#ifndef _ComLib_Header
#define _ComLib_Header
/* #define ISFREEBSD on freebsd systems */

struct comport;
typedef struct comport Comport;

Comport *com_new();
void com_free(Comport **com);

void com_dump(Comport *com, char *file);
void com_debug(Comport *com, char *file, int crlf);

int com_open(Comport *com, char *port, int baud);
int com_close(Comport *com);

/*int com_setup(Comport *com, int baud);*/

int com_wait(Comport *com);
int com_read(Comport *com, char *bf, int bfsz);

int com_write(Comport *com, char *bf, int bytes);

#ifdef WIN32
#	include <windows.h>
#	define CB_110		CBR_110
#	define CB_300		CBR_300   
#	define CB_600		CBR_600   
#	define CB_1200		CBR_1200  
#	define CB_2400		CBR_2400  
#	define CB_4800		CBR_4800  
#	define CB_9600		CBR_9600  
#	define CB_19200		CBR_19200 
#	define CB_38400		CBR_38400
#	define CB_57600		CBR_57600
#	define CB_115200	CBR_115200
#else
#	include <limits.h>
#	include <termios.h>
#	include <unistd.h>
#	define INFINITE ULONG_MAX
#	define CB_110		B110
#	define CB_300		B300
#	define CB_600		B600
#	define CB_1200		B1200
#	define CB_2400		B2400
#	define CB_4800		B4800
#	define CB_9600		B9600
#	define CB_19200		B19200
#	define CB_38400		B38400
#	define CB_57600		B57600
#	define CB_115200	B115200
#endif
#endif
