Event Codes
Your application can include a notifier function that the provider calls to inform you that an asynchronous function has completed or that an asynchronous event has occurred. The provider passes an event code for the function'scodeparameter. The event code specifies the name of the asynchronous function that has completed or the name of an asynchronous event that has occurred. The provider can also pass information using theresultandcookieparameters to the notifier function. Normally, if the provider calls your notifier because an asynchronous function has completed, theresultparameter contains the result code for the function and thecookieparameter contains additional information whose meaning varies with the function called. For example, if you call theOTAsyncOpenEndpointfunction, thecookieparameter would contain the endpoint reference for the endpoint provider you just opened.Most of the codes specified by the event codes enumeration are used by endpoint providers and relate to the use of endpoint functions. You might need to read the "Endpoints" chapter in this book to make sense of the following constant name descriptions.
The constant names that the provider can use for the event code are given by the following enumeration:
enum { T_LISTEN = (OTEventCode)0x0001, T_CONNECT = (OTEventCode)0x0002, T_DATA = (OTEventCode)0x0004, T_EXDATA = (OTEventCode)0x0008, T_DISCONNECT = (OTEventCode)0x0010, T_ERROR = (OTEventCode)0x0020, T_UDERR = (OTEventCode)0x0040, T_ORDREL = (OTEventCode)0x0080, T_GODATA = (OTEventCode)0x0100, T_GOEXDATA = (OTEventCode)0x0200, T_REQUEST = (OTEventCode)0x0400, T_REPLY = (OTEventCode)0x0800, T_PASSCON = (OTEventCode)0x1000, T_RESET = (OTEventCode)0x2000, T_BINDCOMPLETE = (OTEventCode)0x20000001, T_UNBINDCOMPLETE = (OTEventCode)0x20000002, T_ACCEPTCOMPLETE = (OTEventCode)0x20000003, T_REPLYCOMPLETE = (OTEventCode)0x20000004, T_DISCONNECTCOMPLETE = (OTEventCode)0x20000005, T_OPTMGMTCOMPLETE = (OTEventCode)0x20000006, T_OPENCOMPLETE = (OTEventCode)0x20000007, T_GETPROTADDRCOMPLETE = (OTEventCode)0x20000008, T_RESOLVEADDRCOMPLETE = (OTEventCode)0x20000009, T_GETINFOCOMPLETE = (OTEventCode)0x2000000A, T_SYNCCOMPLETE = (OTEventCode)0x2000000B, T_MEMORYRELEASED = (OTEventCode)0x2000000C, T_REGNAMECOMPLETE = (OTEventCode)0x2000000D, T_DELNAMECOMPLETE = (OTEventCode)0x2000000E, T_LKUPNAMECOMPLETE = (OTEventCode)0x2000000F, T_LKUPNAMERESULT = (OTEventCode)0x20000010, kOTProviderIsDisconnected= (OTEventCode)0x23000001, kOTProviderIsReconnected= (OTEventCode)0x23000002. kOTProviderWillClose = (OTEventCode)0x24000001, kOTProviderIsClosed = (OTEventCode)0x24000002, kOTConfigurationChanged = (OTEventCode)0x26000001, };Constant descriptions
T_LISTEN- A connection request has arrived. Call the
OTListenfunction to read the request.T_CONNECT- The passive peer has accepted a connection that you requested using the
OTConnectfunction. Call theOTRcvConnectfunction to retrieve any data or option information that the passive peer has specified when accepting the function or to retrieve the address to which you are actually connected. Thecookieparameter to the notifier function is thesndCallparameter that you specified when calling theOTConnectfunction.T_DATA- Normal data has arrived. Depending on the mode of service you are using, you can call the
OTRcvUDatafunction or theOTRcvfunction to read it. Continue reading data until the function returns with thekOTNoDataErrresult; you do not get another indication that data has arrived until you have read the entire unit.T_EXDATA- Expedited data has arrived. Use the
OTRcvfunction to read it. Continue reading data by calling theOTRcvfunction until the function returns with thekOTNoDataErrresult; you do not get another indication that data has arrived until you have read the entire unit.T_DISCONNECT- A connection has been torn down or rejected. Use the
OTRcvDisconnectfunction to clear the event.- If the event is used to signify that a connection has been terminated, the
cookieparameter to the notifier isNULL.- If the event indicates a rejected connection request, the
cookieparameter to the notification routine is the same as thesndCallparameter that you passed to theOTConnectfunction.T_UDERR- The provider was not able to send the data you specified using the
OTSndUDatafunction even though the function returned successfully. You must call theOTRcvUDErrfunction to clear this event and determine why the function failed.T_ORDREL- The remote client has called the
OTSndOrderlyDisconnectfunction to initiate an orderly disconnect. You must call theOTRcvOrderlyDisconnectfunction to acknowledge receiving the event and to retrieve any data that might have been sent with the disconnection request.T_GODATA- Flow-control restrictions have been lifted. You can now send normal data.
T_GOEXDATA- Flow-control restrictions have been lifted. You can now send expedited data
.T_REQUEST- A request has arrived. Depending on the mode of service you are using, you can call the OTRcvRequest function or the OTRcvURequest function to receive it. You must continue to call the function until it returns with the kOTNoDataErr result.
T_REPLY- A response to a request has arrived. Depending on the mode of service you are using, you can call the
OTRcvReplyfunction orOTRcvUReplyfunction to receive it. You must continue to call the function until it returns with thekOTNoDataErrresult.T_PASSCON- When the
OTAcceptfunction completes, the endpoint provider passes this event to the endpoint receiving the connection (whether that endpoint is the same as or different from the endpoint that calls theOTAcceptfunction.) Thecookieparameter contains the endpoint reference of the endpoint that called theOTAcceptfunction.T_RESET- A connection-oriented endpoint has received a reset from the remote end and has flushed all unread and unsent data. This only occurs for some types of endpoints, and generally leaves the endpoint in an unknown state.
T_BINDCOMPLETE- The
OTBindfunction has completed. Thecookieparameter contains theretAddrparameter of the bind call.T_UNBINDCOMPLETE- The
OTUnbindfunction has completed. Thecookieparameter is meaningless.T_ACCEPTCOMPLETE- The
OTAcceptfunction has completed. Thecookieparameter contains the endpoint reference of the endpoint to which you passed off the connection.T_REPLYCOMPLETE- The
OTSndUReplyorOTSndReplyfunctions have completed. Thecookieparameter contains the sequence number of the request retrieved with theOTRcvURequestorOTRcvRequestfunction.T_DISCONNECTCOMPLETE
TheOTSndDisconnectfunction has completed. Thecookieparameter contains the call parameter of theOTSndDisconnectfunction.T_OPTMGMTCOMPLETE- The
OTOptionManagementfunction has completed. Thecookieparameter contains theretparameter that you have passed to the function.T_OPENCOMPLETE- An asynchronous call to open a provider has completed. The
cookieparameter contains the provider reference.T_GETPROTADDRCOMPLETE
TheOTGetProtAddressfunction has completed. Thecookieparameter contains thepeerAddrparameter that you passed to theOTGetProtocolAddressfunction. If you passedNULLfor that parameter, the cookie parameter contains the address passed in theboundAddrparameter.T_RESOLVEADDRCOMPLETE
TheOTResolveAddressfunction has completed. The cookie parameter contains theretAddrparameter of theOTResolveAddressfunction.T_GETINFOCOMPLETE- The
OTGetEndpointInfofunction has completed. Thecookieparameter contains theinfoparameter of theOTGetEndpointInfofunction.T_SYNCCOMPLETE- The
OTSyncfunction has completed. Thecookieparameter is meaningless.T_MEMORYRELEASED- You are using an asynchronous endpoint that acknowledges sends and an
OTSndorOTSndUDatafunction has completed and is done using the buffers containing the data you are sending. If you have called theOTSndfunction, thecookieparameter contains thebufparameter. If you have called theOTSndUDatafunction, thecookieparameter contains theudataparameter. Theresultparameter contains the number of bytes that were sent. This might be less than the number you meant to send due to flow-control or memory restrictions.T_REGNAMECOMPLETE- The
OTRegisterNamefunction has completed. Thecookieparameter contains the name parameter of theOTRegisterNamefunction.T_DELNAMECOMPLETE- The
OTDeleteNamefunction or theOTDeleteNameByIDfunction has completed. Thecookieparameter contains thenameparameter or theidparameter of the function, respectively.T_LKUPNAMECOMPLETE
TheOTLookupNamefunction has completed. Thecookieparameter contains thereplyparameter of theOTLookUpNamefunction.T_LKUPNAMERESULT- An
OTLookupNamefunction has found a name and is returning it, but the lookup is not yet complete. Thecookieparameter contains thereplyparameter passed to theOTLookupNamefunction.kOTProviderIsDisconnected
Your provider was bound withqlenparameter value greater than 0 and it has been disconnected (is no longer listening). You receive this event after a port has accepted a request to temporarily yield ownership of a port to another provider, which causes this provider to be disconnected from the port in question. This currently only happens with serial ports, but could also happen with other connection-oriented drivers that have characteristics similar to serial ports. You get akOTProviderIsReconnectedmessage when the port reverts back to this provider's ownership again.kOTProviderIsReconnected
Your provider has been reconnected, that is, the cause for its disconnection has been relieved.kOTProviderWillClose
When you return from the notifier function, Open Transport will close the provider whose reference is contained in thecookieparameter. Theresultparameter contains a code specifying the reason why the provider had to close. For example, the user decided to switch links using the control panel.- You can only get this event at system task time. Consequently, you are allowed to set the endpoint to synchronous mode (from within the notifier function) and call functions synchronously before you return from the notifier, at which point, the provider is closed. At this point, any calls other than
OTCloseProviderwill fail with akOTOutStateErr.kOTProviderIsClosed- The provider has closed. The reason for being closed can be found in the
OTResultvalue passed to your notifier. The reasons typically arekOTPortHasDiedErr,kOTPortWasEjectedErr, orkOTPortLostConnectionErr. At this point, any calls other thanOTCloseProviderwill fail with akOTOutStateErr.