PupSocketBackdoor.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Hal Murray, June 3, 1986 2:23:18 pm PDT
DIRECTORY
PupBuffer USING [Buffer],
PupSocket USING [Socket],
PupType USING [ErrorCode],
Rope USING [ROPE];
Sending
PutFirst: PROC [socket: Socket, b: Buffer];
PutAgain:
PROC [socket: Socket, b: Buffer];
PutFirst caches the encapsulation and driver in the Socket data structures. PutAgain bypasses all the cycles needed to recompute that info. Beware: There are complicated interactions with gateways going down, learning better routes, translation caches getting confused... In general you should call PutFirst before calling PutAgain, and occasionally thereafter. For example, once a minute and on every clump of retransmissions. PutFirst may do a NEW.
Warning: The buffer is NOT freed.
Errors: None.
Resend:
PROC [b: Buffer, checksum:
BOOL ←
TRUE];
Resend sends a buffer to the same place it went last time, using the same driver, the same encapsulation, and hence the same route. Put, Send, or PutFirst must have been called previously to setup the internal data structures in the buffer.
Warning: The buffer is NOT freed.
Errors: None.
Receiving
ReceiveProc:
TYPE =
PROC [Socket, Buffer,
REF
ANY]
RETURNS [Buffer];
SetDirectReceive:
PROC [socket: Socket, proc: ReceiveProc, user:
REF
ANY];
This avoids the process switch associated with PupSocket.Get. The client is expected to process the packet promptly. (Hanging on an ML will probably be fatal.) Returning NIL means that the client is keeping the buffer, otherwise, the buffer will be reused by the driver. It's ok to return a different buffer as long as it was received via this socket.
Errors: None.
UseNormalPath:
PROC [Buffer];
Put the buffer on the normal socket input queue where PupSocket.Get will find it. Use this if the buffer requires more complicated processing, for example, printing an error message. UseNormalPath should only be called from a clients direct input proc, and that should then return NIL.
Errors: None.
AllocRecvBuffer:
PROC [Socket]
RETURNS [Buffer];
AllocBuffer gets send buffers. AllocRecvBuffer can be used to initialize data structures so that a ReceiveProc can swap buffers and not have to check for NIL.
Errors: None. (May wait forever.)
ReturnToSenderNoFree:
PROC [b: Buffer];
Like PupSocket.ReturnToSender but doesn't free the buffer.
Errors: None.
ReturnErrorNoFree:
PROC [b: Buffer, code: PupType.ErrorCode, rope: Rope.
ROPE];
Like PupSocket.ReturnError but doesn't free the buffer.
Errors: None.