(* 
  Author : 
  Dipl.-Ing. A. Traeger
  Traeger Industry Components
  WWW.TRAEGER.DE
  Söllnerstr. 9
  D - 92637 Weiden
  Tel 0961/482300
  Fax 0961/48230 20
*)           
unit rfc1006lib;

{$mode objfpc}{$H+}

interface

TYPE PWORD =  ^WORD;
TYPE PBYTE =  ^BYTE;
TYPE PDWORD =  ^LongWord;
TYPE PDOUBLE = ^Double;



function
Rfc1006Open (IPAdr: PAnsiChar; SSAP: Pointer; LenSSAP: LongWord; DSAP: Pointer; LenDSAP: LongWord; Port: LongWord; ConnectTimeout: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006OpenServer (DstIPAdr: PAnsiChar; SSAP: Pointer; LenSSAP: LongWord; DSAP: Pointer; LenDSAP: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006OpenExServer (DstIPAdr: PAnsiChar; SSAP: Pointer; LenSSAP: LongWord; DSAP: Pointer; LenDSAP: LongWord; Port: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';


function
Rfc1006StartServer (Port: LongWord; BindIPAdr: PAnsiChar; MaxCon: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006StopServer () : LongInt; stdcall; external 'rfc1006lib.dll';


function
Rfc1006Close (Ref: LongInt) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006Rx (Ref: LongInt; Buf: Pointer; MaxCnt: LongWord; RxTimeout: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006Tx (Ref: LongInt; Buf: Pointer; Cnt: LongWord; Timeout: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006GetSockErr (Ref: LongInt) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006Connect (Ref: LongInt) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006Disconnect (Ref: LongInt) : LongInt; stdcall; external 'rfc1006lib.dll';

function
Rfc1006GetStatus (Ref: LongInt) : LongInt; stdcall; external 'rfc1006lib.dll';


procedure
Rfc1006CloseAll (); stdcall; external 'rfc1006lib.dll';

function
Rfc1006SetKeepAlive (Ref: LongInt; AliveInterval: LongWord; AliveTime: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function 
Rfc1006TxUnlocked (Ref: LongInt; Buf: PChar; Cnt: LongWord; Timeout: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function 
Rfc1006SetFastAck(Ref: LongInt; Mode: LongWord) : LongInt; stdcall; external 'rfc1006lib.dll';

function 
Rfc1006GetSockErrString (SockErr : LongInt; ErrStr : PAnsiChar; MaxLen LongWord) : PAnsiStr; stdcall; external 'Rfc1006Lib.dll';

function 
Rfc1006GetLibraryVersion () : PAnsiStr; stdcall; external 'Rfc1006Lib.dll';

function 
Rfc1006GetLibraryVersionMajor () : LongInt; stdcall; external 'Rfc1006Lib.dll';

function 
Rfc1006GetLibraryVersionMinor () : LongInt; stdcall; external 'Rfc1006Lib.dll';

const
  E_NOERR = LongInt(0);
  E_TIMEOUT = LongInt(-1);
  E_NORES_AVAIL = LongInt(-2);
  E_REF_NOTOPENED = LongInt(-3);
  E_GENERAL = LongInt(-5);
  E_NOPARTNER = LongInt(-6);
  E_SOCKERR = LongInt(-7);
  E_SERVER_YET_RUNNING = LongInt(-10);
  E_STARTING_SERVER = LongInt(-11);
  E_SERVER_NOT_RUNNING = LongInt(-12);
  E_NOCONNECTION = LongInt(-13);
  E_BUFSIZE = LongInt(-14);
  E_BADREF = LongInt(-99);
  E_PC_BUFSIZE = LongInt(-20);
  E_ALREADY_OPENED = LongInt(-21);
  E_DEMOOVER = LongInt($1234);

implementation

end.

