lapbConfig()
PROTOTYPE
#include <lapb.h>
int lapbConfig(uint channel, LapbSpec *lapb_spec);
DESCRIPTION
lapbConfig() assigns the LAPB characteristics 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. Channel numbers are assigned by hdlcAdd(), which registers the underlying HDLC channel with TargetLAPB. hdlcAdd() is documented in the HDLC driver interface documentation.
lapb_spec points to a LapbSpec structure, defined in “lapb.h” and reproduced below, that defines the channel’s LAPB specifications. For more information on a channel’s LAPB specifications, see the section on using TargetLAPB.
typedef struct
{
uint T1; /* resend timeout (in tenths of seconds) */
uint T2; /* acknowledgment delay (in tenths of seconds) */
uint T4; /* idle channel timeout (tenths of seconds) */
uint N2; /* max retry value */
uint window_size; /* max window size (less than 8/128) */
ui8 flags; /* settings */
} LapbSpec;
If successful, lapbConfig() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| LAPB_BAD_WIN_SIZE | window_size is either 0, > 7 in normal sequence number mode, > 127 in extend sequence number mode, or >= LAPB_NUM_CHAN_RECV_BUFS if LAPB_USE_SREJ is true. |
| LAPB_INVALID_CHAN | channel is not in the range from 0 to LAPB_MAX_NUM_CHANNELS -1. |
| LAPB_T1_ZERO | The T1 value is zero. |
| LAPB_T2_GE_T1 | The T2 value is greater than or equal to the value for T1. |
| LAPB_T4_LE_T1 | The T4 value is less than or equal to the value for T1. |
| LAPB_UNINITIALIZED | The initialization routine lapbInit() has not been called. |
EXAMPLE
/*-------------------------------------------------------------------*/
/* Specify the LAPB parameters. */
/*-------------------------------------------------------------------*/
lapb_spec.T1 = 30; /* 3 seconds */
lapb_spec.T2 = 5; /* 0.5 seconds */
lapb_spec.N2 = 10; /* 10 retries */
lapb_spec.T4 = 300; /* 30 seconds */
lapb_spec.window_size = 20;
lapb_spec.flags = LAPB_USE_SREJ | LAPB_DTE_ADDR | LAPB_SEQ_MOD_128 |
LAPB_OMIT_FRMR;
rc = lapbConfig(channel, &lapb_spec);