lapbSend()

PROTOTYPE

#include <lapb.h>

int lapbSend(uint channel, void *buffer, int length);

DESCRIPTION

lapbSend() sends a frame of data for the channel specified by channel, which must be in the range from 0 to LAPB_MAX_NUM_CHANNELS - 1 and correspond to a registered HDLC channel. buffer points to an application buffer which holds the data to send. length, the number of bytes to send, must be less than or equal to LAPB_MAX_I_FIELD (defined in “lapb.h”).

If a send buffer is free or the channel is nonblocking, lapbSend() returns immediately. Otherwise, it blocks until either a previously sent buffer is acknowledged or the link is reset.

If successful, lapbSend() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

LAPB_INVALID_CHAN channel is not a registered channel in the range from 0 to LAPB_MAX_NUM_CHANNELS - 1.
LAPB_LEN_TOO_BIG length is greater than LAPB_MAX_I_FIELD.
LAPB_NOT_CONNECTED The selected channel is not connected.
LAPB_UNINITIALIZED The initialization routine lapbInit() has not been called.
LAPB_WOULDBLOCK The channel is nonblocking and no send buffers are free.

EXAMPLE

    /*-----------------------------------------------------------------*/
    /* Send status request to modem.                                   */
    /*-----------------------------------------------------------------*/
    rc = lapbSend(chan, SendBuf, 1);
    if (rc) continue;