DIRECTORY CStrings USING [CString], UnixTypes USING [CHARPtr, FileFlags]; TLI: CEDAR DEFINITIONS ~ BEGIN ConnectionData: TYPE ~ REF ConnectionDataRep; ConnectionDataRep: TYPE ~ MACHINE DEPENDENT RECORD [ flags: CARD32, -- flags rcvSize: INT32, -- recieve buffer size rcvBuf: UnixTypes.CHARPtr, -- the bits ctlSize: INT32, -- the size of the control buffer ctlBuf: UnixTypes.CHARPtr, -- the bits lookDBuf: UnixTypes.CHARPtr, -- look data buffer lookCBuf: UnixTypes.CHARPtr, -- look control buffer lookDSize: INT32, -- the size of the data buffer lookCSize: INT32, -- the size of the control buffer maxPsz: INT32, -- the TIDU servType: INT32, -- the kind of service (COTS, CTSORD, CLTS) lookFlag: INT32, -- buffered look flag fd: INT32, -- the file descriptor of the underlying data stream errno: TErrno, -- the TLI global errno info: TInfo -- filled in on the call to open ]; TErrno: TYPE ~ MACHINE DEPENDENT { TBADADDR(1), -- incorrect addr format TBADOPT(2), -- incorrect option format TACCES(3), -- incorrect permissions TBADF(4), -- illegal transport fd TNOADDR(5), -- couldn't allocate addr TOUTSTATE(6), -- out of state TBADSEQ(7), -- bad call sequnce number TSYSERR(8), -- system error TLOOK(9), -- event requires attention TBADDATA(10), -- illegal amount of data TBUFOVFLW(11), -- buffer not large enough TFLOW(12), -- flow control TNODATA(13), -- no data TNODIS(14), -- discon¬ind not found on q TNOUDERR(15), -- unitdata error not found TBADFLAG(16), -- bad flags TNOREL(17), -- no ord rel found on q TNOTSUPPORT(18), -- primitive not supported TSTATECHNG(19), -- state is in process of changing (LAST[CARD32]) }; LISTEN: INT ~ 00001h; -- connection indication received CONNECT: INT ~ 00002h; -- connect confirmation received DATA: INT ~ 00004h; -- normal data received EXDATA: INT ~ 00008h; -- expedited data received DISCONNECT: INT ~ 00010h; -- disconnect received TERROR: INT ~ 00020h; -- fatal error occurred UDERR: INT ~ 00040h; -- data gram error indication ORDREL: INT ~ 00080h; -- orderly release indication EVENTS: INT ~ 000FFh; -- event mask MORE: INT ~ 0001h; -- more data EXPEDITED: INT ~ 0002h; -- expedited data NEGOTIATE: INT ~ 0004h; -- set opts CHECK: INT ~ 0008h; -- check opts DEFAULT: INT ~ 0010h; -- get default opts SUCCESS: INT ~ 0020h; -- successful FAILURE: INT ~ 0040h; -- failure TInfo: TYPE ~ MACHINE DEPENDENT RECORD [ addr: INT32, -- size of protocol address options: INT32, -- size of protocol options tsdu: INT32, -- size of max transport service data unit etsdu: INT32, -- size of max expedited tsdu connect: INT32, -- max data for connection primitives discon: INT32, -- max data for disconnect primitives servtype: INT32 -- provider service type ]; COTS: INT ~ 01; -- connection oriented transport service COTSORD: INT ~ 02; -- connection oriented w/ orderly release CLTS: INT ~ 03; -- connectionless transport service NetBuf: TYPE ~ MACHINE DEPENDENT RECORD [ maxlen: CARD, len: CARD, char: UnixTypes.CHARPtr ]; TBindCall: TYPE ~ MACHINE DEPENDENT RECORD [ addr: NetBuf, qlen: CARD ]; TOptMgmt: TYPE ~ MACHINE DEPENDENT RECORD [ opt: NetBuf, flags: INT ]; TDisCon: TYPE ~ MACHINE DEPENDENT RECORD [ udata: NetBuf, reason: INT, sequence: INT ]; TCall: TYPE ~ MACHINE DEPENDENT RECORD [ addr: NetBuf, opt: NetBuf, udata: NetBuf, sequence: INT ]; TUnitData: TYPE ~ MACHINE DEPENDENT RECORD [ addr: NetBuf, -- address opt: NetBuf, -- options udata: NetBuf -- user data ]; TUDErr: TYPE ~ MACHINE DEPENDENT RECORD [ addr: NetBuf, -- address opt: NetBuf, -- options error: INT -- error code ]; StructureType: TYPE ~ MACHINE DEPENDENT { (0), tbind (1), -- struct t¬bind toptmgmt (2), -- struct t¬optmgmt tcall (3), -- struct t¬call tdis (4), -- struct t¬discon tunitdata (5), -- struct t¬unitdata tuderror (6), -- struct t¬uderr tinfo (7), -- struct t¬info (LAST[CARD32]) }; StructureBits: TYPE ~ MACHINE DEPENDENT { (0), addr (01h), -- address opt (02h), -- options udata (04h), -- user data all (07h), -- all the above (LAST[CARD32]) }; States: TYPE ~ MACHINE DEPENDENT { uninit (0), -- uninitialized unbnd (1), -- unbound idle (2), -- idle outcon (3), -- outgoing connection pending incon (4), -- incoming connection pending dataxfer (5), -- data transfer outrel (6), -- outgoing release pending inrel (7), -- incoming release pending nostates (8), (LAST[CARD32]) }; TOpen: PROC [cd: ConnectionData, path: CStrings.CString, flags: UnixTypes.FileFlags, info: REF TInfo ¬ NIL] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_Open" }; TBind: PROC [cd: ConnectionData, request: REF TBindCall ¬ NIL, return: REF TBindCall ¬ NIL] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_Bind" }; TUnBind: PROC [cd: ConnectionData] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_UnBind" }; TConnect: PROC [cd: ConnectionData, sndCall: REF TCall, rcvCall: REF TCall ¬ NIL] RETURNS[INT32] = TRUSTED MACHINE CODE { "XR_T_Connect" }; TSnd: PROC [cd: ConnectionData, buf: UnixTypes.CHARPtr, nbytes: CARD32, flags: INT32] RETURNS[bytesSent: INT] = TRUSTED MACHINE CODE { "XR_T_Snd" }; TSndRel: PROC [cd: ConnectionData] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_SndRel" }; TSndDis: PROC [cd: ConnectionData, call: REF TCall] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_SndDis" }; TRcv: PROC [cd: ConnectionData, buf: UnixTypes.CHARPtr, nbytes: CARD32, flags: REF INT32] RETURNS[bytesRcv: INT] = TRUSTED MACHINE CODE { "XR_T_Rcv" }; TRcvRel: PROC [cd: ConnectionData] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_RcvRel" }; TRcvUData: PROC [cd: ConnectionData, unitdata: REF TUnitData, flags: REF INT32] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_RcvUData" }; TSndUData: PROC [cd: ConnectionData, unitdata: REF TUnitData] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_SndUData" }; TLook: PROC [cd: ConnectionData] RETURNS [events: INT32] = TRUSTED MACHINE CODE { "XR_T_Look" }; TRcvUDErr: PROC [cd: ConnectionData, uderr: REF TUDErr] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_RcvUDErr" }; TGetState: PROC [cd: ConnectionData] RETURNS [state: States] = TRUSTED MACHINE CODE { "XR_T_GetState" }; TClose: PROC [cd: ConnectionData] RETURNS [INT32] = TRUSTED MACHINE CODE { "XR_T_Close" }; END.  TLI.mesa Copyright Σ 1989, 1991 by Xerox Corporation. All rights reserved. Tim Diebert: November 21, 1989 4:02:59 pm PST Willie-s, December 9, 1991 6:35 pm PST This interface describes the various procedure calls related to the AT&T TLI (Transport Level Interface) from PCedar. In general all calls require a data structure that gets allocated by a mesa procedure. This is in an attempt to avoid having the C programs allocate and free storage using malloc. The ConnectionDataRep is defined in ThreadsTLI.h. The following are the error codes needed by both the kernel level transport providers and the user level library. The following are the events returned by TLook The following are the flag definitions needed by the user level library routines. Protocol specific service limits Service type defines Netbuf structure TBindCall - format of the addres and options arguments of bind Options management Disconnect structure Call structure Data gram structure Unitdata error The following are structure types used when dynamically allocating the above structures via TStructAlloc(). The following bits specify which fields of the above structures should be allocated by TStructAlloc(). The following are the states for the user Procedures This procedure opens the device indicated by path, using flags. If info is supplied, details about the transport are returned. For the Mentat xns code, path should be /dev/xr and flags should be RDWR. It is assumed that cd has been allocated prior to the call. The lower level code will allocate the various buffers using malloc after the sizes are determined by a get info call. -1 is returned on error with more detail available via cd.errno. A nonzero return value indicates success. This underlying device is closed prior to return on error. This procedure connects a local endpoint (socked) to the connection TOpen-ed above. If request is non-NIL and attempt is made to assign that endpoint to the connection. If return is non-NIL, it contains the true endpoint of the call. Since it's possible that the requested endpoint is already in use, the actual endpoint may be different. The request field is generallay associated with a server. For normal client operation, both request and return should be left NIL. This procedure destroys the binding to a socket by a previous call to TBind This proc makes a connection request to the address specified in the addr field of the sndCall. If rcvCall is supplied, the address of the remote socket is returned. It is assumed that the needed fields of both sndCall and rcvCall have memory allocated to them. If the call is successful 0 is returned, -1 is returned on error. This proc sends data to the socket on the remote machine. If this is not the last call in a logical message, flags must have the MORE bit set. To send expedited data the EXPEDITED flag must be set. -1 is returned to indicate an error has occured. This proc initiates and orderly release of the connection. Upon return, the initiator should perform and TRcvRel to determine that the release is complete. -1 is returned on error. This call initiates an abortive release on the connection. See the documentation on its use. -1 is returned on error. 0 is returned on completion. This proc reads bytes from the input stream and returns the number of bytes recieved from the other end. The call returns when the buffer is full, when EOM is present in the stream or when expedited data was recieved. If this is an attention packet, flags has EXPEDITED and MORE set. Since attention packet are recieved twice, the second time the packed is delivered the EXPEDITED bit will be set but the MORE won't be. If the buffer ran out of space, the MORE flag will be set. If EOM was sent with the message, the MORE will not be set. This proc retrieves the end of an orderly release indication. It is used to determine that the connection is released. This should only be called after TSndRel. 0 is return upon completion, -1 on error. This procedure provides a connectionless mode request to receice data from another. This procedure sends a connectionless chunk of data to a cooperating host. TLook provides additional information when cd.errno = TLOOK. events is a collection of flags as defined above. -1 is returned on serious errors. This proc is called when cd.errno = TLOOK for connectionless data call Returns the current state of the underlying connection This proc closes the fd associated with the TOpen. This call really just blasts the connection away and does'n really care how it does it. This is not an orderly release. Κ ‡–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ7™BKšœ-™-K™&—K˜šΟk ˜ Kšœ žœ ˜Kšœ žœ˜%—K˜KšΠlnœžœž ˜šœž˜K˜K™ͺK˜Kšœ1™1Kšœžœžœ˜-š œžœžœž œžœ˜4KšœžœΟc˜Kšœ žœ ˜'Kšœ  ˜'Kšœ žœ !˜2Kšœ  ˜'Kšœ ˜1Kšœ ˜4Kšœ žœ ˜2Kšœ žœ !˜5Kšœžœ  ˜Kšœ žœ +˜>Kšœ žœ ˜(Kšœžœ 4˜BKšœ ˜(Kšœ  ˜/Kšœ˜—K˜K™qšœžœžœž œ˜"Kšžœ ˜%Kšžœ ˜&Kšžœ ˜$Kšžœ ˜"Kšžœ ˜%Kšž œ ˜Kšžœ ˜&Kšžœ ˜Kšžœ ˜&Kšžœ ˜'Kšž œ ˜)Kšžœ ˜Kšžœ  ˜Kšžœ  œ ˜)Kšžœ ˜)Kšžœ  ˜Kšžœ ˜$Kšž œ ˜+Kšž œ "˜2Kšœžœžœ˜K˜—K˜™.Kšžœžœ  !˜8Kšžœžœ   ˜8Kšžœžœ  ˜,Kšžœžœ  ˜1Kšž œžœ  ˜0Kšžœžœ  ˜.Kšžœžœ  ˜3Kšžœžœ  ˜4Kšžœžœ  ˜.—K˜K™Q˜Kšžœžœ   ˜Kšž œžœ  ˜)Kšž œžœ   ˜#Kšžœžœ   ˜!Kšžœžœ  ˜)Kšžœžœ   ˜#Kšžœžœ   ˜!—K˜™ K˜š œžœžœž œžœ˜(Kšœžœ ˜)Kšœ žœ ˜+Kšœžœ *˜8Kšœžœ ˜+Kšœ žœ %˜5Kšœžœ %˜4Kšœ žœ ˜(K˜——K˜™Kšžœžœ (˜8Kšžœžœ )˜