Important: The information in this document is obsolete and should not be used for new development.
Event Codes
Your application can include a notifier function that the provider calls to inform you that some provider event has occurred. The provider passes an event code for the function'scode
parameter. The event code specifies which provider event has occurred. The provider can also pass information using theresult
andcookie
parameters to the notifier function. Normally, if the provider calls your notifier because an asynchronous function has completed, theresult
parameter contains the result code for the function and thecookie
parameter contains additional information whose meaning varies with the function called. For example, if you call theOTAsyncOpenEndpoint
function, thecookie
parameter 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. See "Handling Events for Endpoints" for more information.
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, kOTSyncIdleEvent kOTProviderIsReconnected = (OTEventCode)0x23000002. kOTProviderWillClose = (OTEventCode)0x24000001, kOTProviderIsClosed = (OTEventCode)0x24000002, };Constant descriptions
T_LISTEN
- A connection request has arrived. Call the
OTListen
function to read the request.T_CONNECT
- The passive peer has accepted a connection that you requested using the
OTConnect
function. Call theOTRcvConnect
function to retrieve any data or option information that the passive peer has specified when accepting the connection or to retrieve the address to which you are actually connected. Thecookie
parameter to the notifier function is thesndCall
parameter that you specified when calling theOTConnect
function.T_DATA
- Normal data has arrived. Depending on the type of service of the endpoint you are using, you can call the
OTRcvUData
function or theOTRcv
function to read it. Continue reading data until the function returns with thekOTNoDataErr
result; you will not get another indication that data has arrived until you have read all the data and got this error.T_ERROR
- Obsolete.
T_EXDATA
- Expedited data has arrived. Use the
OTRcv
function to read it. Continue reading data by calling theOTRcv
function until the function returns with thekOTNoDataErr
result; you will not get another indication that data has arrived until you have read all the data and got this error.T_DISCONNECT
- A connection has been torn down or rejected. Use the
OTRcvDisconnect
function to clear the event.- If the event is used to signify that a connection has been terminated, the
cookie
parameter to the notifier isNULL
.- If the event indicates a rejected connection request, the
cookie
parameter to the notification routine is the same as thesndCall
parameter that you passed to theOTConnect
function.
T_UDERR
- The provider was not able to send the data you specified using the
OTSndUData
function even though the function returned successfully. You must call theOTRcvUDErr
function to clear this event and determine why the function failed.T_ORDREL
- The remote client has called the
OTSndOrderlyDisconnect
function to initiate an orderly disconnect. You must call theOTRcvOrderlyDisconnect
function to acknowledge receiving the event.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 type of service for the endpoint you are using, you can call the
OTRcvRequest
function or theOTRcvURequest
function to receive it. You must continue to call the function until it returns with thekOTNoDataErr
result.
T_REPLY
- A response to a request has arrived. Depending on the type of service of the endpoint you are using, you can call the
OTRcvReply
function orOTRcvUReply
function to receive it. You must continue to call the function until it returns with thekOTNoDataErr
result.
T_PASSCON
- When the
OTAccept
function 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 theOTAccept
function). Thecookie
parameter contains theresRef
parameter to theOTAccept
function.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 it generally leaves the endpoint in an unknown state.
T_BINDCOMPLETE
- The
OTBind
function has completed. Thecookie
parameter contains theretAddr
parameter of the bind call.T_UNBINDCOMPLETE
- The
OTUnbind
function has completed. Thecookie
parameter is meaningless.T_ACCEPTCOMPLETE
- The
OTAccept
function has completed. Thecookie
parameter contains theresRef
parameter to theOTAccept
function.T_REPLYCOMPLETE
- The
OTSndUReply
orOTSndReply
functions have completed. Thecookie
parameter contains the sequence number used in theOTSndUReply
orOTSndReply
call.T_DISCONNECTCOMPLETE
- The
OTSndDisconnect
function has completed. Thecookie
parameter contains the call parameter of theOTSndDisconnect
function.T_OPTMGMTCOMPLETE
- The
OTOptionManagement
function has completed. Thecookie
parameter contains theret
parameter that you passed to the function.T_OPENCOMPLETE
- An asynchronous call to open a provider has completed. The
cookie
parameter contains the provider reference.T_GETPROTADDRCOMPLETE
- The
OTGetProtAddress
function has completed. Thecookie
parameter contains thepeerAddr
parameter that you passed to theOTGetProtocolAddress
function. If you passedNULL
for that parameter, the cookie parameter contains the address passed in theboundAddr
parameter.T_RESOLVEADDRCOMPLETE
- The
OTResolveAddress
function has completed. The cookie parameter contains theretAddr
parameter of theOTResolveAddress
function.T_GETINFOCOMPLETE
- The
OTGetEndpointInfo
function has completed. Thecookie
parameter contains theinfo
parameter of theOTGetEndpointInfo
function.T_SYNCCOMPLETE
- The
OTSync
function has completed. Thecookie
parameter is meaningless.T_MEMORYRELEASED
- You are using an asynchronous endpoint that acknowledges sends and Open Transport is done using the buffers containing the data you are sending. If you called the
OTSnd
function, thecookie
parameter contains thebuf
parameter. If you called theOTSndUData
function, thecookie
parameter contains theudata
parameter. Theresult
parameter 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.- You should not wait for the
T_MEMORYRELEASED
event from a previous send operation to trigger more sends. The exact time this event occurs depends on how the underlying provider is implemented. It might hold on to memory until the next send occurs, or behave in some other way which causes it to delay releasing memory.- Note that
T_MEMORYRELEASED
events can reenter your notifier. See "OTAckSends" for more information.T_REGNAMECOMPLETE
- The
OTRegisterName
function has completed. Thecookie
parameter is thereply
parameter, unless it wasNULL
. In this case, it is thereq
parameter.T_DELNAMECOMPLETE
- The
OTDeleteName
function or theOTDeleteNameByID
function has completed. Thecookie
parameter contains thename
parameter or thenameId
parameter of the function, respectively.T_LKUPNAMECOMPLETE
- The
OTLookupName
function has completed. Thecookie
parameter contains thereply
parameter of theOTLookUpName
function.T_LKUPNAMERESULT
- An
OTLookupName
function has found a name and is returning it, but the lookup is not yet complete. Thecookie
parameter contains thereply
parameter passed to theOTLookupName
function.kOTSyncIdleEvent
- A synchronous call is waiting to complete. Call the function
YieldToAnyThread
from your notifier to allow other concurrent processes to obtain processing time. See "Using Synchronous Processing With Threads" for more information.kOTProviderIsDisconnected
- Your provider was bound with a
qlen
parameter 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 akOTProviderIsReconnected
message 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 the
cookie
parameter. Theresult
parameter contains a result code specifying the reason why the provider had to close. For example, the user decided to switch links using the TCP/IP or AppleTalk control panel. The result codes that can be returned are in the range -3280 through -3285; these are documented in "Result Codes".- 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. After this, any calls other than
OTCloseProvider
will fail with akOTOutStateErr
.kOTProviderIsClosed
- The provider has closed. The reason for being closed can be found in the
OTResult
value passed to your notifier. The reasons typically arekOTPortHasDiedErr
,kOTPortWasEjectedErr
, orkOTPortLostConnectionErr
. At this point, any calls other thanOTCloseProvider
will fail with akOTOutStateErr
.