#include "kb_server.h"
#include <errno.h>
#define NET_LINES 6500
#define PBM_LINES 1000
#define MAX_SPOT_AGE 1800
static int sockfd = -1;
static gint net_num = -1;
static gchar net_array[NET_LINES][NET_LENGTH];
static gint packet_num = -1;
static gchar packet_array[12][77] = {"", "", "", "", "", "",
                                     "", "", "", "", "", ""};
static gint ded_num = 0;
static gchar ded_array[6500][NET_LENGTH];
struct send_msg_box_vars
{
  gint row1;
  gint cursor_col;
  gint col1;
  gint field_length;
  gchar field_line[58];
  guint key_handler_id;
  gint done;
};
typedef struct send_msg_box_vars SMBVars;
struct packet_bm_vars
{
  gint spot_num;
  gint spot_filter;
  gchar frequency[PBM_LINES][8];
  gchar call[PBM_LINES][14];
  gchar date[PBM_LINES][7];
  gchar time[PBM_LINES][7];
};
static struct packet_bm_vars pbm = {.spot_num = -1, .spot_filter = FALSE};
static void start_client(GtkWidget *widget);
static gint connect_delay(gpointer widget);
static void alarm_handler(gint sig);
static gint run_client(gpointer da);
static void process_network_command(gpointer da);
static void work_from_network(const gchar *msg_line, gpointer da);
static gint delete_from_network(const gchar *msg_line, gpointer da);
static gint edit_from_network(gpointer da);
static void send_to_server(const gchar *contest_line, const gchar *cmd_type);
static void sort_cr_array(gpointer da);
static void network_message_box(GtkWidget *widget, const gchar *message_line,
                                gint iclear);
static void send_msg_box(void);
static gint smb_key_handler(GtkWidget *widget, GdkEventKey *event,
                            gpointer data);
static gint smb_cursor(gpointer data);
static void send_packet_box(const gchar *spb_line, gint spb_spot);
static gint spb_key_handler(GtkWidget *widget, GdkEventKey *event,
                            gpointer data);
static gint spb_cursor(gpointer data);
static gint filter_spot(void);
