The TRequest Structure
You use theTRequeststructure to specify the data being sent with theOTSndRequestfunction (page 3-137) and the data being read with theOTRcvRequestfunction (page 3-139). You pass a pointer to this structure as a parameter to each of these functions.The
TRequeststructure is defined by theTRequestdata type.
struct TRequest { TNetbuf data; TNetbuf opt; OTSequence sequence; }; typedef struct TRequest TRequest;
Field Description
data- A
TNetbufstructure specifying the location and size of the request data buffer.- In the
reqparameter to theOTSndRequestfunction, this field specifies the location and size of a buffer containing the request. You must allocate a buffer for the request data, set thedata.buffield to point to it, and set thedata.lenfield to the size of the request data. The size of the request cannot exceed the value specified for theetsdufield of theTEndpointInfostructure for the endpoint.- If you are sending data that is not stored contiguously, the
data.buffield is a pointer to anOTDatastructure that describes the first data fragment. In this case, you must set theudata.lenfield tokNetbufDataIsOTData.- In the
reqparameter to theOTRcvRequestfunction, on return, this field specifies the location and size of a buffer containing the incoming request. You must allocate a buffer into which the request data is placed when the function returns and set thedata.buffield to point to it. You must set thedata.maxlenfield to the maximum size of the request data; this value cannot exceed theetsduvalue specified for the endpoint. On return, thedata.lenfield contains the actual length of the data sent.- If you are doing a no-copy receive, the
data.buffield is a pointer to anOTBufferpointer. In this case, you must set thedata.maxlenfield to the constantkNetbufDataIsOTBufferStar.opt- A
TNetbufstructure specifying the location and size of the options buffer.- In the
reqparameter to theOTSndRequestfunction, this field specifies the location and size of a buffer containing the options you want to negotiate for this request. You must allocate a buffer that contains the option data, set theopt.buffield to point to it, and set theopt.lenfield to the size of the option data. Set theopt.lenfield to 0 if there are no options.- In the
reqparameter to theOTRcvRequestfunction, on return, this field specifies the location and size of a buffer containing the association-related options specified by the requester. You must allocate a buffer into which the endpoint provider can place the option data when the function returns, and set theopt.buffield to point to it. Set theopt.maxlenfield to the maximum size of this buffer.sequence- A long that specifies the transaction ID of the current transaction.
- You set this field to any desired value when you send
the request.- When you read the request, this value is generated by the endpoint provider. You need to save this value and use it for the
sequencefield when sending a reply.