next up previous contents index
Next: Utility Operations Up: Uniform Protocol Interface Previous: Protocol and Session

Graph Manipulation Operations

 

Unlike the previous set of operations, which protocols and sessions 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.

xCreateProtl

 

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

The use of xCreateProtl outside of initialization---for example, to dynamically load new protocols---is not supported at this time.

 
Protl xCreateProtl(ProtlInitFunc func, char *name, char *instName, int *traceVar,

int downc, Protl *downv)

typedef void (*ProtlInitFunc)(Protl self)

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 hlp, hlpType and llp. The new session's up pointer is set to hlp (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 downc and NULL for downv. The initialization function pointer func may be null; otherwise this function should fill in the interface function pointers in the Sessn structure. These pointers are initialized to default (usually null) functions by the system initialization code.

 
Sessn xCreateSessn(SessnInitFunc func, Protl hlp, Protl hlpType, Protl llp,

int downc, Sessn *downv)

typedef void (*SessnInitFunc)(Sessn self)

xDestroySessn

 

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

XkReturn xDestroySessn(Sessn session)

xGetProtlByName

 

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

Protl xGetProtlByName(char *name)

xSetSessnDown

 

Sets the indexth member of self's down vector to be session. It increments the Sessn field numdown as a side effect.

XkReturn xSetSessnDown(Sessn self, int index, Sessn session)

xGetProtlDown

 

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

Protl xGetProtlDown(Protl self, int index)

xGetSessnDown

 

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

Sessn xGetSessnDown(Sessn self, int index)

xMyProtl

 

Returns the myprotl pointer of self.

Protl xMyProtl(Sessn self)

xSetUp

 

Resets the up pointer of session 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(Sessn session, Protl hlp)

xGetUp

 

Returns the up pointer of session.

Protl xGetUp(Sessn session)

xHlpType

 

Returns the hlpType argument that was used to create session.

Protl xHlpType(Sessn session)



next up previous contents index
Next: Utility Operations Up: Uniform Protocol Interface Previous: Protocol and Session



Larry Peterson
Tue Jul 1 14:50:34 MST 1997