Copyright (C) 1985 by Xerox Corporation. All rights reserved. The following program was created in 1985 but has not been published within the meaning of the copyright law, is furnished under license, and may not be used, copied and/or disclosed except in accordance with the terms of said license.
UDP.mesa
Hal Murray June 26, 1985 10:36:35 pm PDT
John Larson, April 14, 1986 9:26:10 pm PST
DIRECTORY
IPDefs USING [Byte, Datagram, DByte, Address];
UDP: CEDAR DEFINITIONS =
BEGIN
Port: TYPE = IPDefs.DByte;
default: Port = Port.LAST;
echo: Port = 7;
discard: Port = 9;
date: Port = 13; -- text
time: Port = 37; -- 32 bit binary, seconds since Midnight, Jan 1, 1900
domain: Port = 53;
minLength: INT = 8;
maxLength: INT = minLength+512;
PseudoHeader: TYPE = MACHINE DEPENDENT RECORD [
source (0): IPDefs.Address,
dest (2): IPDefs.Address,
zero (4: 0..7): IPDefs.Byte,
protocol (4: 8..15): IPDefs.Byte,
udpTotalBytes (5): IPDefs.DByte ];
Body: TYPE = REF BodyRec;
BodyRec: TYPE = MACHINE DEPENDENT RECORD [
source (0): Port,
dest (1): Port,
length (2): IPDefs.DByte,
checksum (3): IPDefs.DByte,
data (4): DataBuffer ];
DataBuffer: TYPE = PACKED ARRAY INT [minLength..maxLength) OF IPDefs.Byte;
Handle: TYPE = REF HandleRec;
HandleRec: TYPE = RECORD [
local, remote: Port,
him: IPDefs.Address ];
Create: PROC [him: IPDefs.Address, remote: Port, local: Port ← default] RETURNS [Handle];
Destroy: PROC [Handle];
Receive: PROC [handle: Handle, timeout: INT] RETURNS [data: IPDefs.Datagram];
NIL if timeout (ms), 0 => Forever
Send: PROC [handle: Handle, data: IPDefs.Datagram, length: INT];
SendReply: PROC [data: IPDefs.Datagram];
END.