The TUnitRequest Structure
You use theTUnitRequeststructure to specify information about the data being sent with theOTSndURequestfunction (page 3-107) and the data being read with theOTRcvURequestfunction (page 3-110); you pass a pointer to this structure as a parameter to each of these functions.The
TUnitRequeststructure is defined by theTUnitRequestdata type.
struct TUnitRequest { TNetbuf addr; TNetbuf opt; TNetbuf udata; OTSequence sequence; }; typedef struct TUnitRequest TUnitRequest;
Field Description
addr- A
TNetbufstructure that contains information about an address.- In the
reqparameter to theOTSndURequestfunction, this field specifies the location and size of a buffer containing the address of the responder. You must allocate a buffer for the address and specify the address. You must set theaddr.buffield to point to this buffer and set theaddr.lenfield to the length of the address.- In the
reqparameter to theOTRcvURequestfunction, this field specifies the location and size of a buffer containing the address of the endpoint that made the request; the field is filled in by theOTRcvURequestfunction when it returns. You must allocate a buffer to hold address information and set theaddr.buf field to point to it. You must also set theaddr.maxlenfield to the maximum size of the address.opt- A
TNetbufstructure that contains information about the options associated with this request.- In the
reqparameter to theOTSndURequestfunction, this field specifies the location and size of a buffer containing the options you want to negotiate. You must allocate a buffer that contains the option information and set theopt.buffield to point to it. You must set theopt.lenfield to the length of the option data or to 0 if you don't want to specify any options.- In the
reqparameter to theOTRcvURequestfunction, this field specifies the location and size of a buffer containing the association-related options specified by the requester. Otherwise, this buffer is empty. When theOTRcvURequestfunction returns, it places option information in this buffer. You must allocate a buffer to contain the option information and set theopt.buffield to point to this buffer. You must set theopt.maxlenfield to the maximum size necessary to hold option information for the endpoint.udata- A
TNetbufstructure that contains information about the request data.- In the
reqparameter to theOTSndURequestfunction, this field specifies the location and size of a buffer containing the request data. You must allocate a buffer for the request data, initialize theudata.buffield to point to it, and set theudata.lenfield to the size of the request. The request size must not exceed the value for theetsdufield of theTEndpointInfostructure for the endpoint.- If you are sending data that is not stored contiguously, the
udata.buffield is a pointer to anOTDatastructure that describes the first data fragment. In this case, you must set theudata.lenfield to thekNetbufDataIsOTDataconstant.- In the
reqparameter to theOTRcvURequestfunction, this field specifies the location and size of a buffer containing the request. You must allocate a buffer into which theOTRcvURequestfunction can place the request and set theudata.buffield to point to it. You must set theudata.maxlenfield to the maximum size of the request data.- If you are doing a no-copy receive, the
udata.buffield is a pointer to anOTBufferpointer. In this case, you must set theudata.maxlenfield to the constantkNetbufDataIsOTBufferStar.sequence- A long that specifies the transaction ID for this 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.