MODULA - M2PROT.ZIP - QCKPACK.DEF

 
Output of file : QCKPACK.DEF contained in archive : M2PROT.ZIP

(*# call(o_a_copy => off) *)
(*%F _fdata *)
(*# call(seg_name => null) *)
(*%E *)
(*# module(implementation=>on) *)
(*# data(seg_name => null) *)
DEFINITION MODULE QCkpack;

(* This JPI Modula-2 module is part of *)

(* QC -- a communications program *)
(* by Carl Neiburger *)
(* 169 N. 25th St.*)
(* San Jose, Calif. 95116 *)

(* CompuServe No. 72336,2257 *)

FROM Str IMPORT CHARSET;

CONST
MaxPacketSize = 1024;
PacketBufLen = 128; (* extra space to avoid overruns *)
CtlChar = SHORTCARD('#');

TYPE
Packet = ARRAY[1..MaxPacketSize+PacketBufLen] OF SHORTCARD;
PackPtr = POINTER TO Packet;
Capabilities = (NotLast, LongOK, SendAhead, AttrOK, XLongOK, CtlSet);
CapasType = SET OF Capabilities;

DefType = RECORD
MaxLength, (* 1: 20H offset; Buffsize *)
TimeOut, (* 2: 20H offset; Time Out sec *)
NumPad: SHORTCARD; (* 3: 20H offset; Num padchars *)
PadChar, (* 4: 20H offset; Pad char *)
EolChar, (* 5: 20H offset; EOL char *)
CntrlQuote, (* 6: No offset; Quote character *)
(* optional parameters follows *)
Bit8Quote, (* 7: No offset; Quote character *)
CheckType, (* 8: No offset; Check type *)
RepChar: CHAR; (* 9: No offset; Repeat Character *)
Capas: CapasType; (* 10: 20H offset; Capability field *)
Windo, (* 11: 20H offset; Window Size *)
HiMaxLen, (* 12: 20H offset; MaxLen DIV 95 *)
LoMaxLen: SHORTCARD; (* 13: 20H offset; MaxLen MOD 95 *)
END;

VAR

(* Packet variables *) (* format *)
TheirDefs : DefType;
(* Receive Send *)
RecvCount, SendCount : CARDINAL; (* COUNT *)
RecvSeq, SendSeq : SHORTCARD; (* SEQNUM *)
RecvType, SendType : CHAR; (* TYPE *)
LENX1, (* extend lenght1 *)
LENX2, (* extend Length2 *)
HCHECK : SHORTCARD; (* Checksum *)
Checksum : CARDINAL; (* Checksum *)
CRCchk : CARDINAL; (* CRC *)
RecvBuf, SendBuf : PackPtr; (* DATA... *)

(* Initialization packet parameters *)
PacketSize : CARDINAL ; (* longer than MaxLen if extended packets used *)
Maxlx1,
Maxlx2 : SHORTCARD;

MyExtControls : CHARSET; (* MyDef.CntrlQuote, TheirDef.Bit8Quote,
TheirDef.RepChar *)
(* Set by GetDefinitions *)

PROCEDURE SendPacket( Count : CARDINAL; (* data characters *)
Seq : SHORTCARD; (* sequence number *)
PType : CHAR;
Data : PackPtr);

(* Sends Data packet . *)
(* 1. Count sent includes Seq, PacketType and Checksum, e.g. *)
(* OutCount + 2 + Checktype *)
(* 2. Count, Seq and Checksum are offset by 20H *)
(* 3. Checksum is calculated on ASCII value printable chars. *)

PROCEDURE RecvPacket(): CHAR;
(* RecvType if received successfully;
'Q' if error;
'T' if timed out;
'@' if abort *)

PROCEDURE SendPacketType (PacketType : BYTE);
(* Send packet of PacketType: *)
(* SendPacketType('Y') an ACK packet *)
(* SendPacketType('N') a NAK packet *)

PROCEDURE SendDefaults( typ : CHAR );
(* Send init parameters *)

PROCEDURE GetDefinitions;
(* Get init parameters *)

PROCEDURE InitDefinitions;
(* Default Packet settings *)

END QCkpack.