Previous Page Contents Page Next Page

3.5 lu0_term

The lu0_term function terminates the LU0 application's session and releases the LU for use by other applications.

3.5.1 Function Call

     int lu0_write (
                    AP_UINT32    *handle,
                    int           options,
                    LU0_CALLBACK  callback,
                    void         *user
                   );

3.5.2 Supplied Parameters

The application supplies the following parameters:

handle

The identifier that was returned on the original lu0_init function call for the LU0 session.

options

Specifies how to terminate the session.

To terminate the session by sending UNBIND to the host (hard termination), set this parameter to zero.

To request UNBIND from the host (soft termination), specify the following value:

LU0_OPTION_SOFT_TERM

If SHUTD has already been received from the host, LU0 sends SHUTC; otherwise it sends RSHUTD. The host then responds by sending UNBIND to terminate the session.

callback

To use the synchronous version of lu0_term, specify a NULL pointer.

To use the asynchronous version of lu0_term, specify a pointer to a callback routine within the application. See Synchronous and Asynchronous LU0 Operation for more details.

user

This parameter is used only for asynchronous calls.

A pointer to an optional user data string supplied by the application; typically used for the application's session identifier. The format of this data is defined by the application; SNAP-IX does not use this data, but returns it unchanged as a parameter to the callback routine when returning information related to this function call. This allows the application to correlate the callback with the original request.

3.5.3 Returned Parameters: Asynchronous Operation

If a callback routine was specified, the function does not block, and returns a value to indicate whether the function was issued successfully. The result of the termination request is then reported using the application's callback routine.

Return Value

The function returns one of the following values:

LU0_EVENT_IN_PROGRESS

The function was issued successfully. The result of the session termination will be reported to the application using the supplied callback routine.

LU0_EVENT_TERM_BAD

LU0 could not process the function, either because the application supplied parameters that were not valid or because an error occurred within SNAP-IX. The SNAP-IX error log file contains more details of the error. The supplied callback routine will not be called for this function, and the session remains active.

Returned Parameters

The lu0_term function does not return any parameters.

Parameters Supplied to Callback Routine

If the return value from the lu0_term function is LU0_EVENT_IN_PROGRESS, LU0 calls the application's callback routine when the session has been terminated. The parameters supplied to the callback routine are as follows.

handle

The session handle that was returned on the lu0_init function.

user

The user data that was supplied on the lu0_term function. This allows the application to correlate the callback with the original request.

event

The event being reported. This is set to LU0_EVENT_TERM_OK .

qualifier, data_length , data

These parameters are not used in the callback routine for lu0_term.

3.5.4 Returned Parameters: Synchronous Operation

If a callback routine was not specified, the function blocks until the session has been terminated (or until LU0 detects an error). It then returns with a value indicating whether the session was terminated successfully.

Return Value

The function returns one of the following values:

LU0_EVENT_TERM_OK

The session has been sucessfully terminated. The application cannot issue any further LU0 functions for this session.

LU0_EVENT_TERM_BAD

LU0 could not process the function, either because the application supplied parameters that were not valid or because an error occurred within SNAP-IX. The SNAP-IX error log file contains more details of the error. The session remains active.

Returned Parameters

The lu0_term function does not return any parameters.

3.5.5 Usage and Restrictions

The application can issue lu0_term while an asynchronous lu0_init is in progress, to cancel the session activation. In particular, it can do this from within the callback routine that reports a BIND received from the host, in order to reject the BIND. See lu0_init for more details.

If an lu0_read or lu0_write is in progress when the application issues lu0_term, it is canceled. The session failure is reported with an event parameter of LU0_EVENT_READ_SESS_FAIL or LU0_EVENT_WRITE_SESS_FAIL.

Previous Page Contents Page Top of Page Next page