<* IF __GEN_C__ THEN *>
  <*+COMMENT*>
  <*+GENCTYPES*>
<* END *>
(* (C)OE5DXL 1993-2015, GPL3 *)

DEFINITION MODULE frameio;

FROM l2 IMPORT pDATA, PORTS;
FROM aprsstr IMPORT IPNUM, UDPPORT;
FROM osi IMPORT SOCKET;


CONST UDPSOCKS=PORTS;

TYPE UDPSOCK=RECORD
               fd                     : SOCKET;
               ipnum                  : IPNUM;
               fromport, toport       : UDPPORT;
               dcdretry, txbufretry   : CARDINAL;
               checkip, dcd, hastxdata: BOOLEAN;

               dupcnt                 : CARDINAL;                  (* circular write pointer *)
               dupcrcs                : ARRAY[0..31] OF CARDINAL;  (* circular crc of frames buffer*)
             END;


VAR crcok:BOOLEAN;
    udpsocks:ARRAY[0..UDPSOCKS-1] OF UDPSOCK;

PROCEDURE GetFrame(port:CARDINAL):BOOLEAN;
PROCEDURE SendFrame(tport,Baud:CARDINAL;VAR Adress:ARRAY OF CHAR;
                    AdrLen:CARDINAL; dp:pDATA);
PROCEDURE Sending(uport:CARDINAL):BOOLEAN;
PROCEDURE DCD(port:CARDINAL):BOOLEAN;
PROCEDURE Modempoll(port:CARDINAL);
PROCEDURE Init;

END frameio.
