
#ifndef COMM_H

#define COMM_H

#define TNC_NONE    0
#define TNC         1
#define TNC_TFPC    2

#define NOT_CONNECTED  0
#define CONNECTED      1
#define OUTGOING_CON   2


struct ch_des
{
   char mycall[10];
   char state;
   char *rx_buf;
   unsigned rx_first, rx_last;
   unsigned rx_view;
   char *tx_buf;
   unsigned tx_first, tx_last;
   unsigned tx_view;
};

extern unsigned int comm_lines;
extern char **comm_buf;
extern unsigned int comm_out;
extern unsigned int comm_write;
extern char tnc_port[20];
extern char tnc_baudrate[10];
extern char tncport;
extern char tnc_type;

extern char tnc_channels;
extern unsigned tnc_channel_buf;
extern unsigned tnc_tx_buf;
extern char tnc_mycall[10];


void comm_init(unsigned int);
void comm_output(void);
void comm_printf(char *, ...);
void comm_end(void);

void tnc_send_cmd(struct port_des *, char, char *);
void tnc_send_data(struct port_des *, char, char *);
void tnc_rx(struct port_des *, char *, char *, char *, char *);
void tnc2hostmode(struct port_des *);
void tnc_init(void);
void tnc_deinit(void);
void tnc_poll(void);
void tnc_resync(struct port_des *);

#endif

