
Description | Cautions | Example | Errors | See Also
Name: |
int cc_GetDLinkState(bdev, dlinkptr, state_buf) | |
Inputs: |
LINEDEV bdev |
|
DLINK *dlinkptr |
| |
int *state_buf |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System tools | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_GetDLinkState( ) function retrieves the logical data link state (operable, inoperable or disabled) of the specified board device for PRI or station device for BRI.
Parameter |
Description | |
bdev: |
Board device handle for PRI, station device handle for BRI. | |
dlinkptr: |
Pointer to the data link information block (DLINK). See Section 6.4. DLINK for a definition of the data link information block data structure. See the Example code for details. | |
state_buf: |
Pointer to the buffer containing the requested data link state value. Possible data link states are: | |
DATA_LINK_UP |
channel layer 2 is operable | |
DATA_LINK_DOWN |
channel layer 2 is inoperable | |
DATA_LINK_DISABLED |
channel layer 2 was disabled and cannot be reestablished | |
None
/* BRI code example */
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/* Global variables */
LINEDEV lbuf;
main ()
{
DLINK dlink;
char ces;
.
.
.
/* open BRI station device bris1 */
dlink.sapi = 0;
/* check state of each data link */
for(ces = 1; ces <= 8; ces++)
{
/* initialize connection endpoint suffix */
dlink.ces = ces;
/* get current data link state */
if ( cc_GetDLinkState(l_buf, &dlink, &state_buf) == 0)
{
/* if data link is up */
if (state_buf == DATA_LINK_UP)
printf("ces%02x) is up \n", ces);
/* if data link is not up */
else if (state_buf == DATA_LINK_DOWN)
printf("ces(%02x) is down\n", ces);
}
else
printf("error");
}
}
If the function returns a value < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Error codes from the cc_GetDLinkState( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB|E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB|E_ISNOMEM |
Cannot map or allocate memory |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation