OTRcvURequest
Reads a request sent by a client using a connectionless transaction-based protocol.C INTERFACE
OSStatus OTRcvURequest (EndpointRef ref, TUnitRequest* req, OTFlags* flags);C++ INTERFACE
OSStatus TEndpoint::RcvURequest(TUnitRequest* req, OTFlags* flags);PARAMETERS
ref- The endpoint reference of the endpoint accepting the request.
req- A pointer to a
TUnitRequeststructure (page 3-58) that contains information about the request being received. See the description of theTUnitRequeststructure for how to set this parameter when doing a no-copy receive.flags- A long bitmapped field set by the endpoint provider that specifies whether the request is acknowledged (
T_ACKNOWLEDGED) and whether there is more request data coming (T_MORE) or(T_PARTIALDATA). A value ofT_MOREindicates that the buffer you have allocatedis too small to contain the reply. A value ofT_PARTIALDATAindicates that the data unit being read does not contain the complete reply. It is possible that all flags are set.DESCRIPTION
You use theOTRcvURequestfunction to read an incoming request. When the function returns, it fills in theTUnitRequeststructure (referenced by thereqparameter) with the address of the sender, the request data, and any association-related options pertaining to this request.If the endpoint is in synchronous mode and is blocking, the
OTRcvURequestfunction waits for a request to arrive. If the endpoint is in asynchronous mode or is not blocking, theOTRcvURequestfunction retrieves the next pending unread request or returns thekOTNoDataErrresult if there are no pending requests.If the endpoint is in asynchronous mode, the endpoint provider generates a
T_REQUESTevent when a request arrives. You can poll the endpoint using theOTLookfunction or use a notifier function to retrieve this event.If the
T_MOREbit is set in theflagsparameter, this means your buffer is not large enough to hold the entire request. You must call theOTRcvURequestfunction again to retrieve more request data. Open Transport ignores theaddrandoptfields of thereqparameter for subsequent calls to theOTRcvURequestfunction. TheT_MOREflag is not set for the last request packet to let you know that this is the last packet.If the
T_PARTIALDATAbit is set in theflagsparameter, this means that the data you are about to read with theOTRcvURequestfunction does not constitute the entire request and that you must call the function again to read more of or the rest of the request.If the
T_MOREand theT_PARTIALDATAbits are both set, this means that the data you are about to read constitutes only part of the request and that your buffer is too small to contain even this chunk. In this case, you must call the function again until theT_MOREflag is clear. TheT_PARTIALDATAbit is set only on the first call to the function.If you are communicating with multiple requesters and the
OTRcvURequestfunction returns with theT_PARTIALDATAflag set, it is possible that your next call to theOTRcvURequestfunction might not read the rest of the request because the next data unit coming in belongs to a different request. One way to handle this situation is to use the next call to theOTRcvURequestfunction to determine the sequence number of the incoming request (by settingreq->udata.lento 0) and then, having determined which request data is coming in, read the data into the appropriate buffer.The provider sets the
T_ACKNOWLEDGEDflag if the requester has set this flag when calling theOTSndURequestfunction. When this flag is set and you call theOTSndUReplyfunction, Open Transport guarantees that your reply is acknowledged by the requester. This flag is set only on the first call to theOTRcvURequestfunction for any given transaction.VALID STATES
T_IDLESEE ALSO
To determine the maximum size of the request data, you must call theOTGetEndpointInfofunction (page 3-82) and examine theetsdufield of theTEndpointInfostructure (page 3-48) that it returns.You use the
TUnitRequeststructure (page 3-58) to store information about the request being received.You can poll for the
T_REQUESTevent by calling theOTLookfunction (page 3-85).For information on how to use this function with the AppleTalk ATP protocol, see page 14-10 in the ATP chapter.
To respond to a request, you use the
OTSndUReplyfunction (described next).
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help