/* RPCPkt.h*/
/* 28 July 1982 11:52 am PDT */
/* requires #include <Env.h>
requires #include <RPC.h>
requires #include <RPCInternal.h> */
struct PktType { /* "type" word of a Pup --*/
byte transport; /* should be zero before sending --*/
byte fields; /*: Here's what would be in them.
subType bit 3 { rpc(3B), (7B) },
eom bit { end(0), notEnd(1) },
ack bit { dontAck(0), pleaseAck(1) },
class bit 3 { call(0), data(1), ack(2), nak(3), rfa(4), (7) } */
};
#define subtypeField 0340
#define eomField 0020
#define ackField 0010
#define classField 0007
#define rpc 0140
/* constant value for subType*/
#define call 0
/* class values*/
#define xtraData 1
#define ack 2
/* obsolete nak = 3*/
#define rfa 4
struct Socket {
word ms;
byte midS;
byte LS; }; /* a "word", but socket numbers are small in RPC */
#define lenSocket (sizeof (struct Socket)/2)
struct PktConversationID {
/* Same as ConversationID, but abbreviated within a packet --*/
/* Assumes originator is always caller or callee*/
word LS;
word fields; /*: Here's what would be in them
originator bit {caller, callee} // BCPL-style
ms bit 15 */
};
#define lenPktConversationID (sizeof (struct PktConversationID)/2)
#define callerField 0000000
/* swab(0000000) */
#define calleeField 0000200
/* swab(0100000) */
#define originatorField 0000200
/* swab(0100000) */
#define notCalleeMask 0177577
/* swab(0077777) */
struct ConnectionID {
/* Uniquely identifies an independent sequence of calls --*/
struct PktConversationID conv;
union Machine caller;
num activity; }; /* PSB.PsbIndex*/
#define lenConnectionID (sizeof (struct ConnectionID)/2)
struct CallCount {
/* [ConnectionID,CallCount] uniquely identifies call for all hosts and a long time*/
word LS;
word ms; };
#define lenCallCount (sizeof (struct CallCount)/2)
struct PktID {
/* [ConversationID,PktID] uniquely identifies pkt for all hosts and a long time --*/
num activity; /* PSB.PsbIndex*/
struct CallCount callCt;
num pktSeq; };
#define lenPktID (sizeof (struct PktID)/2)
struct Header {
num length; /* here's what it should be:
length bit 15 // BCPL style
oddByte bit { no(0), yes(1) },
[length must be swapped and shifted, viz:
to remove from packet: (swab(hdr->length))>>1
to insert into packet: swab(hdr->length<<1) ] */
struct PktType type;
num destPSB; /* in Mesa, PSB.PsbIndex,-- field has 6 extra bits*/
num srcePSB; /* in Mesa, PSB.PsbIndex,-- field has 6 extra bits*/
union Machine destHost;
struct Socket destSoc; /* PupTypes.PupSocketID,*/
union Machine srceHost;
struct Socket srceSoc; /* PupTypes.PupSocketID,*/
/* end of standard Pup header --*/
struct PktConversationID conv;
/* For secure conversations, the remainder of the packet must be encrypted --*/
struct PktID pktID;
union RPCCall callSpec;
union RPCData callData; };
#define lenHeader (20)
/* 10 Pup + 6 RPC + 4 Dispatcher -- omits callData */
/* ******** MUST TRACK PUP PACKAGE !!! ******* */
#define lenPBIOverhead 4
struct PBI {
struct PBI *next;
struct Queue *queue;
struct ConversationObject *convHandle;
struct Header *pup; };
/* Mapping from Pup pkt types to RPC pkt types:*/
#define typeCall 0140
/* = [end, dontAck, call ]*/
#define typeData 0141
/* = [end, dontAck, data ]*/
#define typeAck 0142
/* = [end, dontAck, ack ]*/
#define typeRFA 0144
/* = [end, dontAck, rfa ]*/
/* 150B = [end, pleaseAck, call ]*/
/* 151B = [end, pleaseAck, data ]*/
#define typePing 0152
/* = [end, pleaseAck, ack ]*/
/* 154B = [, pleaseAck, rfa ] (also 174B)*/
/* 160B = [notEnd, dontAck, call ]*/
/* 161B = [notEnd, dontAck, data ]*/
/* 162B = [notEnd, dontAck, ack ]*/
/* 164B = [notEnd, dontAck, rfa ]*/
/* 170B = [notEnd, pleaseAck, call ]*/
/* 171B = [notEnd, pleaseAck, data ]*/
/* 172B = [notEnd, pleaseAck, ack ]*/
#define pktLengthOverhead (lenHeader+1)
/* include checksum word*/
/* Outcomes in outcome header-variant*/
#define result 0
/* normal --*/
#define unbound 1
/* dispatcher not known --*/
#define signal 2
/* signal propagation --*/
#define unwind 3
/* signal is unwinding --*/
#define protocol 4
/* stub protocol error detected. --*/
/* ******** Single-packet communication: exported by RPCPktIO ******** */
/* Packet Exchange States*/
/* receiving=0*/
/* sending=1*/
#define calling 2
#define endCall 3
#define authReq 4
#define rpcSocket 036
#define rpcBcstSocket 045