
Description | Cautions | Example | Errors | See Also
Name: |
int cc_GetDChanState(boarddev, dchstate_buf) | |
Reference: |
LINEDEV boarddev |
|
int *dchstate_buf |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
System tools | |
Mode: |
synchronous | |
Technology: |
PRI (excluding DPNSS and Q.SIG) | |
The cc_GetDChanState( ) function retrieves the status of the D channel of a specified board at any time.
Parameter |
Description | |
boarddev: |
The line device handle for the D channel board. | |
dchstate_buf: |
Points to the buffer containing the requested D channel state value. The definitions of the possible channel states are: | |
DATA_LINK_UP |
D channel layer 2 is operable | |
DATA_LINK_DOWN |
D channel layer 2 is inoperable | |
The cc_GetDChanState( ) function applies only to ISDN PRI technology. For ISDN BRI technology, use the cc_GetDLinkState( ) function.
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
void main()
{
short devhdl; /* device handle for D channel */
int dchanstate; /* the space for cc_GetDChanState output */
.
.
.
if ( cc_Open(devhdl,"dtiB1T1", 0 ) < 0 )
exit(1);
*/
* Using cc_GetDChanState() to get the
* layer 2 status.
*/
if ( cc_GetDChanState(devhdl,&dchanstate) < 0 )
procdevfail(devhdl);
else if ( dchanstate != DATA_LINK_UP )
{
printf("D Channel link is inoperable...\n");
exit(1);
}
/* The layer 2 is OK, continue the program. */
.
.
.
.
.
if ( cc_Close(devhdl) < 0 )
printf("Error closing device, errno = %d\n", errno);
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle,reason,&msg);
printf("reason = %x - %s\n",reason,msg);
}
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_GetDChanState( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation