Next: Utility Operations Up: Uniform Protocol Interface Previous: Protocol-Protocol Operations

Graph Manipulation Operations

Unlike the previous set of operations-which protocols invoke on each other to open/close connections and to send/receive messages-the operations defined in this section actually manipulate the protocol and session graphs; i.e, create nodes and edges. These operations are either called by the x-kernel at start-up time to create and link together protocol objects, or by protocols at runtime to create and link together session objects.

xCreateSessn

Called by protocol llp to create a session that will handle data associated with a common source/destination pair. Usually called in response to an xOpen call, or because data has arrived with participants that match a previous xOpenEnable call. By convention, a protocol will only create one session at a time for a source/destination pair, even if there have been multiple xOpenEnable's that would match incoming data.

The session is initialized using information found in protocols hlpRcv, hlpType and llp. The new session's up pointer is set to hlpRcv (this is where upward-bound messages through this session will be delivered.) The count downc indicates how many lower level sessions this session will use. An array of lower sessions themselves is passed as downv. Sessions which use no lower sessions may pass zero for both downc and downv. The initialization function pointer f may be null; otherwise this function should fill in the interface function pointers in the XObj structure. These pointers are initialized to default (usually null) functions by the system initialization code.

XObj xCreateSessn(Pfv f, XObj hlpRcv, XObj hlpType, XObj llp, int downc, XObj * downv)

Example Init Function: void udp_sessn_init (XObj self)

xCreateProtl

Called during system start-up for each protocol in the graph. The function f is called to initialize a protocol object. It must have a well-known name derived from the concatenation of the protocol name and the string ``_init'' (e.g., tcp_init). The initialization generally allocates and initializes protocol state and fills in the interface function pointers. Because function pointers are initialized to null functions before f is called, only those functions actually used by the protocol need be defined.

Use of xCreateProtl outside of initialization, e.g., to dynamically load new protocols, is not supported at this time.

3.1 compatibility note: Replaces x_instantiateprotland x_createprotl(the user routine) and eliminates the need for x_getproc.

Example Init Function: void udp_init (XObj self)

xDestroy

Destroys protocol and session objects. It is the inverse of xCreateSessn and xCreateProtl. Storage for the XObj is freed, and if the state pointer of the XObj is non-null, it is also freed.

xkern_return_t xDestroy(XObj object)

xGetProtlByName

Returns a capability for a protocol object given its mnemonic name. (See the discussion of graph.comp in section 12.)

XObj xGetProtlByName (char * name )

xSetDown

Sets the indexth member of self's down vector to be object. It sets or increments the XObj field numdown as a side effect.

xkern_return_t xSetDown (XObj self, int index, XObj object)

xGetDown

Returns the indexth member of self's down vector. Returns ERR_XOBJ if the index is larger than the down vector.

XObj xGetDown (XObj self, int index)

xSetUp

Resets the up pointer of session s to hlp. The up pointer of a session is initialized in xCreateSessn, so xSetUp is only used for extraordinary manipulation of the session graph.

void xSetUp (XObj s, XObj hlp)

xGetUp

Returns the up pointer of session s.

XObj xGetUp (XObj s)

xHlpType

Returns the hlpType argument that was used to create session s.

XObj xHlpType (XObj s)



Next: Utility Operations Up: Uniform Protocol Interface Previous: Protocol-Protocol Operations


Tue Nov 29 16:28:56 MST 1994