The TUnitData Structure
You use theTUnitDatastructure to describe the data being sent with theOTSndUDatafunction (page 3-101) and the data being read with theOTRcvUDatafunction (page 3-105); you pass this structure as a parameter to each of these functions.The
TUnitDatastructure is defined by theTUnitDatatype.
struct TUnitData { TNetbuf addr; TNetbuf opt; TNetbuf udata; }; typedef struct TUnitData TUnitData;
Field Description
addr- A
TNetbufstructure that contains information about an address.- In the
udataparameter to theOTSndUDatafunction, this field specifies the location and size of the destination address. You must allocate a buffer to hold the address and initialize theaddr.buffield to point to that buffer. You must set theaddr.lenfield to the length of the address.- In the
udataparameter to theOTRcvUDatafunction, on return, this field specifies the location and size of the address of the endpoint that has sent the data. You must allocate a buffer to contain the address, initialize theaddr.buffield to point to it, and set theaddr.maxlenfield to specify its maximum size.opt- A
TNetbufstructure that contains information about options.- In the
udataparameter to theOTSndUDatafunction, this field specifies the location and size of options. You must allocate a buffer to hold the options and initialize theopt.buffield to point to that buffer. You must set theopt.lenfield to the length of the options buffer. If you do not want to specify any options, set theopt.lenfield to 0.- In the
udataparameter to theOTRcvUDatafunction, on return, this field contains any association-related options specified by the endpoint sending data. To read these options, you must allocate a buffer into which the provider can place the options; you must set theopt.buffield to point to the buffer; and you must set theopt.maxlenfield to the maximum size of the buffer.udata- A
TNetbufstructure that contains information about the data being transferred.- In the
udataparameter to theOTSndUDatafunction, this field specifies the location and size of the buffer containing the data to be sent. You must allocate a buffer for the data and initialize theudata.buffield to point to that buffer. You must set theudata.lenfield to the size of the data being sent.- 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 the constantkNetbufDataIsOTData.- In the
udataparameter to theOTRcvUDatafunction, this field specifies the location and size of the buffer into which the data being received is going to be placed when the function returns. You must allocate a buffer for the data, set theudata.buffield to point to it, and set theudata.maxlenfield to the maximum length of this buffer.- 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.