/* 
     Copyright (c)  Dipl.-Ing. A. Traeger
     Traeger Industry Components
     WWW.TRAEGER.DE
     Söllnerstr. 9

     D - 92637 Weiden
     Tel 0961/482300
     Fax 0961/48230 20
     info@traeger.de
     www.traeger.de
*/           
/*
  Rfc1006lib.h
*/

#ifndef __RFC1006_INCLUDE_INCLUDED__
#define __RFC1006_INCLUDE_INCLUDED__

#define E_RFC1006_TIMEOUT		-1
#define E_RFC1006_NORES_AVAIL		-2
#define E_RFC1006_REF_NOTOPENED	 	-3
// -4,-5 frei
#define E_RFC1006_GENERAL		-5
#define E_RFC1006_NOPARTNER		-6
#define E_RFC1006_SOCKERR		-7
#define E_RFC1006_SERVER_YET_RUNNING	-10	
#define E_RFC1006_STARTING_SERVER 	-11	
#define E_RFC1006_SERVER_NOT_RUNNING 	-12	
#define E_RFC1006_NOCONNECTION		-13 // Es hat sich noch kein Client mit dem Server verbunden
#define E_RFC1006_BUFSIZE         -14 // 1.16

#define E_RFC1006_BADREF	 	-99


#ifdef __cplusplus
extern "C" {
#endif



#ifdef __linux__
	#ifndef WINTYPES_DEFINED
	#define WINTYPES_DEFINED
	  #define WINAPI
	  #include <sys/types.h>
	  typedef unsigned char BYTE;
	  typedef unsigned char *LPBYTE;
	  typedef unsigned char *PBYTE;
	  typedef char *PSTR;
	  typedef char *LPSTR;
	  typedef const char *LPCSTR;
	  typedef const char *PCSTR;
	  typedef u_int16_t  WORD;
	  typedef u_int16_t  *LPWORD;
	  typedef u_int16_t  *PWORD;
	  typedef int16_t INT;
	  typedef int16_t  *LPINT;
	  typedef u_int32_t  DWORD;
	  typedef u_int32_t *PDWORD;
	  typedef u_int32_t *LPDWORD;
	  typedef void  VOID;
	  typedef void *PVOID;
	  typedef void *LPVOID;
	  typedef int BOOL;
	  typedef int16_t BOOL16;
	  typedef int SOCKET;
	#endif
#endif // __linux__


long WINAPI
Rfc1006Open (LPCSTR IPAdr,BYTE *SSAP, DWORD LenSSAP, BYTE *DSAP, DWORD LenDSAP, DWORD Port, DWORD ConnectTimeout);

long WINAPI
Rfc1006Close (long Ref);

long WINAPI
Rfc1006Rx (long Ref, void *Buf, DWORD MaxCnt, long RxTimeout);

long WINAPI
Rfc1006Tx (long Ref, void *Buf, DWORD Cnt, long Timeout);



long WINAPI
Rfc1006GetSockErr (long Ref);

long WINAPI
Rfc1006Connect (long Ref);

long WINAPI
Rfc1006Disconnect (long Ref);

long WINAPI
Rfc1006GetStatus (long Ref);

long WINAPI
Rfc1006StartServer (int Port, LPCSTR BindIPAdr, int MaxCon);

long WINAPI
Rfc1006OpenServer (LPCSTR DstIPAdr, BYTE *SSAP, DWORD LenSSAP, BYTE *DSAP, DWORD LenDSAP); // 1.02

long WINAPI
Rfc1006StopServer (void);


void WINAPI
Rfc1006CloseAll (void); // 1.14


long WINAPI 
Rfc1006SetKeepAlive (long Ref, DWORD AliveInterval, DWORD AliveTime); // 1.18

long WINAPI
Rfc1006TxUnlocked (long Ref, void *Buf, DWORD Cnt, long Timeout); // 1.19


long WINAPI 
Rfc1006SetFastAck (long Ref, DWORD Mode); // 1.22

long WINAPI 
Rfc1006PacketInQ (long Ref); // 1.26

long WINAPI
Rfc1006OpenExServer (LPCSTR DstIPAdr, BYTE *SSAP, DWORD LenSSAP, BYTE *DSAP, DWORD LenDSAP, DWORD Port); // 1.31

const char * WINAPI
Rfc1006GetSockErrString(long SockErr, LPSTR ErrStr, DWORD MaxLen); // 1.40

const char * WINAPI
Rfc1006GetLibraryVersion(); // 1.42

long WINAPI
Rfc1006GetLibraryVersionMajor(); // 1.42

long WINAPI
Rfc1006GetLibraryVersionMinor(); // 1.42


#ifdef __cplusplus
} //extern "C" 
#endif
#endif //__RFC1006_INCLUDE_INCLUDED__
