DIRECTORY Arpa USING [Address], ArpaICMPBuf USING [Buffer] ; ArpaICMP: CEDAR DEFINITIONS ~ { Address: TYPE ~ Arpa.Address; Buffer: TYPE ~ ArpaICMPBuf.Buffer; Handle: TYPE ~ REF Object; Object: TYPE; nullID: CARD16 ~ CARD16.LAST; CreateHandle: PROC [id: CARD16 _ nullID] RETURNS [h: Handle]; Kick: PROC [h: Handle]; DestroyHandle: PROC [h: Handle]; AllocBuffer: PROC [h: Handle] RETURNS [b: Buffer]; SetBodyBytes: PROC [b: Buffer, bodyBytes: CARDINAL, optionsBytes: CARDINAL _ 0]; Send: PROC [h: Handle, b: Buffer, address: Address]; waitForever: CARD ~ CARD.LAST; dontWait: CARD ~ 0; Receive: PROC [h: Handle, timeoutMsec: CARD _ waitForever] RETURNS [b: Buffer]; GetBodyBytes: PROC [b: Buffer] RETURNS [bodyBytes: CARDINAL, optionsBytes: CARDINAL]; GetSource: PROC [b: Buffer] RETURNS [Address]; FreeBuffer: PROC [h: Handle, b: Buffer]; Error: ERROR [code: ATOM]; }... 4ArpaICMP.mesa Demers, August 27, 1987 6:21:26 pm PDT Introduction This interface can be used to send arbitrary ICMP datagrams (with IP options) and to receive replies of types echoReply, timestampReply, infoReply. ArpaICMPImpl is a server for echo, timestamp, inforequest and redirect requests. ICMP destUnreachable, sourceQuench, timeExceeded and parameterProblem messages are passed to the protocol module that generated the original datagram. Types Handle Create / Destroy Create a handle that can be used to send / receive ICMP messages with a given ID to / from a given address. Wake up processes waiting in Receive[h]. Destroy a handle. Don't drop it on the floor. Sending Allocate a buffer associated with this handle. The Handle may be NIL, in which case we use a default handle that allows sending but not receiving. Set number of bytes in body and options of ICMP message in buffer. Example: for a TimeStamp message, call SetBodyBytes[b, BYTES[ArpaICMPBuf.Body.timestamp]]. Send an ICMP message to the specified address. The Handle may be NIL, as in AllocBuffer. The (ICMP and IP) Hdr of b will be "fixed" for sending, but the data will not be changed. Call FreeBuffer after Send if you don't want to keep the buffer around (e.g. for retransmission). Receiving Receive and ICMP message. The ICMP type is echoReply, timestampReply or infoReply; ID is the one specified when the handle was created. Return number of bytes in body of ICMP message in buffer. Example: if b contains a well-formed TimestampReply message, then GetBodyBytes[b] = BYTES[ArpaICMPBuf.Body.timestampReply]. Return source address of datagram in buffer. Release a buffer obtained by Receive or AllocBuffer. The Handle may be NIL, as in AllocBuffer / Send. Errors Error Codes: $HandleDestroyed : can't send or receive after destroy others as necessary ... Κ1˜code™ K™&K™—šΟk ˜ Kšœœ ˜Kšœ œ ˜K˜K˜—šΟnœœ ˜K˜K˜head™ K™“K™PK™–—™Kšœ œ˜Kšœœ˜"K˜Kšœœœ˜Kšœœ˜ —K˜™Kšœœœœ˜K˜šž œœœ œ ˜=K™kK˜—šžœœ ˜K™(K˜—šž œœ ˜ K™K™——K˜™šž œœ œ ˜2K™.K™c—K˜šž œœœœ˜PK™BKšœZ™Z—K˜šžœœ*˜4K™.K™)K™YK™a—K˜—™ Kšœ œœœ˜Kšœ œ˜K˜šžœœœœ ˜OK™ˆK˜—š ž œœ œ œœ˜UKšœ9™9Kšœ{™{K˜—šž œœ œ ˜.K™,K™—šž œœ˜(K™4K™0——™šžœœœ˜K˜—™ K™6K™——K˜——…—v Ϋ