/*
 * Declarations for the Mcx Win32 Library
 */

extern int GetOpt(int argc, char **argv, char *opts);
extern int optind;
extern int optopt;
extern char *optarg;

/*
 * Overlapped operations helpers
 */
extern OVERLAPPED AcksysWriteOverlap;
extern int AcksysWriteDebug;
HANDLE AcksysInitAsyncWrite(void);
int AcksysAsyncWrite(HANDLE hfd, char *str, DWORD len);
int AcksysWaitWrite(HANDLE hfd);

extern OVERLAPPED AcksysReadOverlap;
extern int AcksysReadDebug;
HANDLE AcksysInitAsyncRead(void);
int AcksysAsyncRead(HANDLE hfd,char *str, DWORD len);
int AcksysWaitRead(HANDLE hfd);

/*
 * System operations helpers
 */
HANDLE AcksysCreateThread(LPTHREAD_START_ROUTINE task, LPVOID arg);
void AcksysExitThread(DWORD retval);
HANDLE AcksysOpen(char *numvoie, int flags);
int AcksysWrite(HANDLE chan, char *str_or_buf, int zero_or_len);
int AcksysRead(HANDLE chan, char *buf, int len);
void AcksysPrintCommError(HANDLE hfd);

/*
 * Specific card operations helpers
 */
#define ACK_NOCLOCK	0
#define ACK_NULLMODEM	1
#define ACK_ETCD	2
#define ACK_ETTD	3
BOOL AcksysHdlc(HANDLE chan, BOOL fullDuplex, int clock, int packetSize);
BOOL AcksysAsync(HANDLE chan, BOOL fullDuplex, int clock, int packetSize);
DWORD AcksysChannelOptionOne(HANDLE hfd, DWORD optionCode, DWORD value);

/*
 * Debugging helpers
 */
extern BOOL AcksysDbgIoPrint;
extern BOOL AcksysReadDebug;
extern BOOL AcksysWriteDebug;
extern char AcksysFile[];
extern char *AcksysStringError(void);
extern char *AcksysOemError(void);

/*
 * Registry access helpers
 */
void AcksysOpenReg(HKEY hive,char *path);
void AcksysOpenMcxParams(char *card /*i.e. "1" or "000A"*/);
DWORD AcksysGetRegDword(char *nom);
PCHAR AcksysGetRegExpandedString(char *nom);
PCHAR AcksysGetRegString(char *nom);
BOOL AcksysSetRegDword(char *nom,DWORD value);
