This chapter is not intended for the average user. Rather, it is meant for a system programmer who intends to add support for a new kind of side effect. To do this, the system programmer must do the following:
SE_Init( )
None.
CC1=`RPC2_SUCCESS,CCD1=`, CC2=`RPC2_SEFAIL1, CCD2=`, CC3=`RPC2_SEFAIL2, CCD3=`,
Called just prior to return from RPC2_Init
SE_Bind1( in RPC2_Handle ConnHandle, in RPC2_CountedBS *ClientIdent )
P1=`ConnHandle, PD1=`, P2=`ClientIdent, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called on RPC2_Bind on client side. The call is made just prior to sending the first connection-establishment packet to the server. The connection establishment is continued only if RPC2_SUCCESS) is returned.
SE_Bind2( in RPC2_Handle) ConnHandle, in struct timeval *BindTime )
P1=`ConnHandle, PD1=`, P2=`BindTime, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called on RPC2_Bind on client side. The call is made just after the connection is successfully established, before control is returned to the caller. BindTime is the amount of time the bind took because of the network. If SE_Bind2) returns RPC2_SEFAIL1) or RPC2_SEFAIL2, that code is returned as the result of the RPC2_Bind). Otherwise the usual code is returned.
SE_Unbind( in RPC2_Handle ConnHandle )
P1=`ConnHandle, PD1=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called when RPC2_Unbind) is executed on the client or server side. You are expected to free any side effect storage you associated with this connection, and to do whatever cleanup is necessary. Note that the connection state is available to you and is not destroyed until you return RPC2_SUCCESS).
SE_NewConnection( in RPC2_Handle ConnHandle, in RPC2_CountedBS *ClientIdent )
P1=`ConnHandle, PD1=`, P2=`ClientIdent, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called after a request has been completely filled, just prior to network ordering of header fields, encryption and transmission. You may use the Prefix information to determine the actual size of the buffer corresponding to *RequestPtr. If you add data, remember to update the BodyLength field of the header in *RequestPtr. You also probably wish to update the SideEffectFlags and SideEffectDataOffset fields of the header. SDesc points to the side effect descriptor passed in by the client.
If you need more space than available in the buffer passed to you, you may allocate a larger packet, copy the current contents and add additional data. Return a pointer to the packet you allocated in RequestPtr: this is the packet that will actually get sent over the wire. DO NOT free the buffer pointed to by RequestPtr initially. If you allocate a packet, it will be freed immediately after successful transmission.
SE_MakeRPC2( )
.
.
.
CC1=`RPC2_SUCCESS/. CC2=`RPC2_SEFAIL1/. CC3=`RPC2_SEFAIL2/.
Called just after Reply has been received, after decryption and host ordering of header fields. Examine the SideEffectFlags and SideEffectDataOffset fields to determine if there is piggy-backed side effect data for you in Reply. If you remove data, remember to update the BodyLength field of the header in Reply. SDesc points to the side effect descriptor. You will probably wish to fill in the status fields of this descriptor. If the MakeRPC call fails for some reason, this routine will be called with a Reply of NULL. This allows you to take suitable cleanup action.
SE_GetRequest( in RPC2_Handle ConnHandle, inout RPC2_PacketBuffer *Request )
P1=`ConnHandle, PD1=`, P2=`Request, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called just prior to successful return of Request to the server. You should look at Request, extract side effect data if any, modify the header fields appropriately.
SE_InitSideEffect( in RPC2_Handle ConnHandle, inout SE_Descriptor *SDesc )
P1=`ConnHandle, PD1=`, P2=`SDesc, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Called when the server does an RPC2_InitSideEffect) call. You will probably want to examine some fields of SDesc and fill in some status-related fields. Note that there is no requirement that you should actually initiate any side effect action. You may choose to piggy back the side effect with the reply later.
SE_CheckSideEffect( in RPC2_Handle ConnHandle, inout SE_Descriptor *SDesc, in long Flags )
P1=`ConnHandle, PD1=`, P2=`SDesc/. P3=`Flags/.
CC1=`RPC2_SUCCESS/. CC2=`RPC2_SEFAIL1/. CC3=`RPC2_SEFAIL2/.
Called when the server does an RPC2_CheckSideEffect) call. The Flags parameter will specify what status is desired. You may have to actually initiate the side effect, depending on the circumstances.
SE_SendResponse( in RPC2_Handle ConnHandle, in RPC2_PacketBuffer **ReplyPtr )
P1=`ConnHandle, PD1=`, P2=`ReplyPtr, PD2=`,
CC1=`RPC2_SUCCESS, CC2=`RPC2_SEFAIL1, CC3=`RPC2_SEFAIL2,
Text=`Called just before the reply packet is network-ordered, encrypted and transmitted. You may wish to add piggy-back data to the reply; modify the BodyLength field in that case. If you are not piggybacking data, make sure that the side effect is complete before returning from this call.
If you need more space than available in the buffer passed to you, you may allocate a larger packet, copy the current contents and add additional data. Return a pointer to the packet you allocated in ReplyPtr: this is the packet that will actually get sent over the wire. DO NOT free the buffer pointed to by ReplyPtr initially. If you allocate a packet, it will be freed immediately after successful transmission.,
SE_PrintSEDescriptor( in SE_Descriptor *SDesc, in FILE *outFile )
P1=`SDesc, PD1=`Guaranteed to refer to your type of side effect. P2=`outFile, PD2=`Already open and ready to receive bytes.
.
Called when printing debugging information. You should print out SDesc, suitably formatted, on outFile.
SE_SetDefaults( out XXX()Initializer *SInit )
P1=`SInit, PD1=`An initializer for this side effect, XXX.,
.
Called to set SInit to appropriate default values.
SE_Activate( in XXX()Initializer *SInit )
Initialization values to be used for this side effect, XXX.
.
Called to activate this side effect type. The body of this procedure should allocate and fill in a routine vector in the side effect table in file se.c. It should also obtain its initialization parameters from SInit.
<