The TUnitReply Structure
You use theTUnitReplystructure to specify the data being sent with theOTSndUReplyfunction (page 3-112) and the data being read with theOTRcvUReplyfunction (page 3-115). You pass a pointer to theTUnitReplystructure as a parameter to each of these functions.The
TUnitReplystructure is defined by theTUnitReplydata type.
struct TUnitReply { TNetbuf addr; TNetbuf opt; TNetbuf udata; OTSequence sequence; }; typedef struct TUnitReplyTUnitReply;
Field Description
addr- A
TNetbufstructure that contains information about
an address.- In the
replyparameter to theOTSndUReplyfunction, this field specifies the location and size of a buffer containing the address of the requester. You are not required to provide this information. If you do not want to provide address information, set theaddr.lenfield to 0. To specify an address, you must allocate a buffer for the address and initialize it to the destination address. Then you set theaddr.buffield to point to the buffer and set theaddr.lenfield to the length of the address.- In the
replyparameter to theOTRcvUReplyfunction, this field specifies the location and size of a buffer containing the address of the endpoint sending the reply. You must allocate a buffer into which the address is placed when the function returns, and you must set theaddr.buffield to point to this buffer. You must also set theaddr.maxlenfield to the maximum size of the buffer.opt- A
TNetbufstructure that contains information about the options associated with this reply.- In the
replyparameter to theOTSndUReplyfunction, this field specifies the location and size of a buffer containing the options that you set for this reply. You must set theopt.lenfield to the length of the options or to 0 if you don't want to specify any options.- In the
replyparameter to theOTRcvUReplyfunction, this field specifies the location and size of a buffer containing the association-related options that the responder has sent using theOTSndUReplyfunction. You must allocate a buffer to hold option information and set thereply.optfield to point to it. When theOTRcvUReplyfunction returns, it fills this buffer with option information. You must set thereply.maxlenfield to the maximum size necessary to hold option information.udata- A
TNetbufstructure that contains information about the reply data.- In the
replyparameter to theOTSndUReplyfunction, this field specifies the location and size of a buffer containing the reply data sent to the requester. You allocate a buffer that contains the reply data, set theudata.buffield to point to that buffer, and set theudata.lenfield to specify the size of the reply. The size cannot exceed the value specified for thetsdufield 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 tokNetbufDataIsOTData.- In the
replyparameter to theOTRcvUReplyfunction, this field specifies the location and size of a buffer into which the function places the reply data on return. You must allocate a buffer to hold the data, set theudata.buffield to point to it, and set theudata.maxlenfield to the maximum size of this buffer. The size must not exceed the value specified for thetsdufield of theTEndpointInfostructure for this endpoint.- 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.
- When sending a reply, you set this field to the value for this field that you read with the
OTRcvURequestfunction.- When receiving a reply, if you have sent out multiple requests, you use this field to match incoming replies to outgoing requests.