sl_register subroutine

Purpose

Register a signaling process to receive signaling interface primitives.

Library

The signaling interface library (libsl.a).

C syntax

#include <slsigpr.h>
...
SL_RET_CODE 	        sl_register(
    SL_HANDLE       	sl_handle,    int *            piMsgQueueId
);

Description

This subroutine is used to create a queue for primitives sent to this process. The subroutine returns a queue identifier that can be used by the poll() system call or the select() system call if multiple input sources are needed. The queue should not be accessed directly by the signaling process, as this has unpredictable results.

Blueworx Voice Response interacts with signaling processes by sending them signaling interface primitives to control signaling.

The second argument to the sl_register() subroutine is a pointer to an int. If not NULL, then the int to which it points will be initialized to the message queue identifier for the message queue created specifically for this process. Any messages detected on the queue are primitives intended for this signaling process. The sl_receive_request() subroutine can then be called at any time, with a timeout of 0 to receive primitives without blocking. Alternatively, a signaling process could fork() and service its own device from a subprocess.

When a message is detected, or when the process wishes to block waiting for a primitive or to poll for a primitive, call the sl_receive_request() subroutine with an applicable timeout. Use 0 for poll, -1 for infinite wait, or positive for seconds. If the return is SLRC_OK then the returned primitive will be that as passed by the channel process to sl_send_request(). The signaling process should then process this primitive.

Parameters

sl_handle
The signaling handle returned from the sl_open() subroutine.
piMsgQueueId
A pointer to the identifier of the message queue created.

Return values

SLRC_OK
Successful.
SLRC_INVALID_HANDLE
Invalid sl_handle.
SLRC_INVALID_SL_TYPE
Invalid sl_handle. (The internal data structures associated with the handle have become corrupted.)
SLRC_INVALID_ARGS
piMsgQueueId is NULL.
SLRC_NOT_REGISTERED
The signaling process is not registered because an error has occurred. The most likely reason is that another signaling process with the same signaling process type is already registered.
SLRC_ERRNO
An AIX error has occurred. Check the value of errno for more information.

Related information