|
|
|
|
The information contained in this chapter will help you write LU0 application programs. The following topics are covered:
Synchronous and asynchronous function calls
Scheduling asynchronous events
SNA information
Configuration information
Solaris Environment considerations
The LU0 interface can operate in two ways:
Synchronous operation is straightforward. The application makes a function call to LU0; this function call blocks until LU0 has completed all processing for the function. Any significant events on the session are reported to the application using function return codes.
Asynchronous operation returns control to the application immediately, so the application is free to continue with further processing (including issuing other LU0 functions). The function return code is used only to indicate whether the function call was valid, and does not report completion of the function. LU0 notifies the application of subsequent events using a callback routine supplied by the application. See Asynchronous Session Operation for more details.
Each LU0 function includes a pointer to a callback routine as one of its supplied parameters. This is used to control whether synchronous or asynchronous operation is used:
To issue the function synchronously, the application supplies a null pointer for the callback routine.
To issue the function asynchronously, the application supplies a pointer to a callback routine within the application, which LU0 can use to notify the application of subsequent events. The callback routine is defined in Callback Routine.
The lu0_init function, which is used to initialize a session, determines how the session operates and how session events are reported to the application:
If the application uses the synchronous version of lu0_init, all function calls on that session must be synchronous. Session events are reported using function return codes.
If the application uses the asynchronous version of lu0_init (by providing a callback routine), session events are reported asynchronously using this callback routine. The application can issue either synchronous or asynchronous function calls for that session. Asynchronous Session Operation provides more information about how asynchronous LU0 sessions operate.
To start an asynchronous session, the application issues lu0_init with a pointer to a callback routine. If this function returns successfully, LU0 returns a handle, which the application uses on all future calls for this session.
The callback routine supplied to lu0_init is a special case because it is called multiple times, to update the application on the status of the session.
During a normal session startup, the lu0_init callback routine is called three times:
When ACTLU is received
When BIND is received
When the session is active (SDT is received)
The lu0_init is considered to be pending
until the active
callback (with an event
value of LU0_EVENT_ACTIVE) is made.
You cannot issue lu0_read or lu0_write
functions for the session until this callback has been made.
The lu0_init callback routine also receives notifications of session failure or session events:
A callback with an event value of
LU0_EVENT_INIT_FAILED, which can only occur while the
lu0_init is pending
, indicates that the initialization
has failed. The handle returned on the original lu0_init
is no longer valid, and no further calls can be made for the session.
After the session has become active, a callback with an event value of LU0_EVENT_INIT_SESS_FAIL indicates that the underlying session has failed. Any unread data already received from the host is still available, so the application can still use lu0_read calls to read it. The application must then terminate the session using lu0_term (or restart it by using lu0_init with the same handle). When it issues either of these calls, all outstanding function calls for the session are terminated.
Other callbacks can report changes in the session status, and affect which other LU0 function calls can be made. See the description of the event parameter in lu0_init for details.
The other LU0 functions also include callback routines. However, each
of these routines is only called once, to indicate whether or not LU0 has
successfully completed processing for the function: the event
value either indicates completed OK
or reports an error condition
along with the completion status. Each callback routine always receives one
callback; for example, if an lu0_read function is outstanding
when a session is terminated, the callback routine supplied on the
lu0_read call will be called to indicate the session termination.
The application is free to choose whether to use the same callback routine for all functions or a different callback routine for each function.
|
|
|
|
|