
Description | Cautions | Example | Errors | See Also
Name: |
int cc_SndFrame(linedev, sndfrmptr) | |
Inputs: |
LINEDEV linedev |
|
L2_BLK *sndfrmptr |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Data link layer handling | |
Mode: |
synchronous | |
Technology: |
BRI/SC; PRI (excluding Q.SIG) | |
The cc_SndFrame( ) function sends a frame to the data link layer. When the data link layer is successfully established, the application will receive a CCEV_D_CHAN_STATUS event. If the data link layer is not established before the function is called, the function will be returned with a value < 0 indicating function failure.
Parameter |
Description |
linedev: |
The line device handle for the D channel board. |
sndfrmptr: |
Pointer to the buffer containing the requested transmit frame. The transmit frame is stored in the L2_BLK data structure. For a description of the structure, see Section 6.7. L2_BLK. See the Example code for details. |
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/* Global variables */
typedef long int (*EVTHDLRTYP)( );
.
.
.
void InitSndFrameBlk (L2_BLK *l2_blk_ptr)
{
l2_blk_ptr -> length = 13; /* 13 bytes of data */
l2_blk_ptr -> data [0] = 0x08; /* Protocol discriminator */
l2_blk_ptr -> data [1] = 0x02; /* CRN length - 2 bytes */
l2_blk_ptr -> data [2] = 0x03; /* CRN = 8003 */
l2_blk_ptr -> data [3] = 0x80;
l2_blk_ptr -> data [4] = 0x6e; /* msg type = NOTIFY */
/* The first IE */
l2_blk_ptr -> data [5] = 0x27; /* IE type = 27 (NOTIFY) */
l2_blk_ptr -> data [6] = 0x01; /* The length of NOTIFY */
l2_blk_ptr -> data [7] = 0xF1; /* Notify indication */
/* The second IE */
l2_blk_ptr -> data [8] = 0x76; /* IE type = 76 (REDIRECTION) */
l2_blk_ptr -> data [9] = 0x03; /* length of redirection */
l2_blk_ptr -> data [10] = 0x01; /* unknown type and E164 plan */
l2_blk_ptr -> data [11] = 0x03; /* network provides presentation */
l2_blk_ptr -> data [12] = 0x8D; /* reason = transfer */
}
int evt_hdlr( )
{
int ldev = sr_getevtdev( );
unsigned long *ev_datap = (unsigned long *)sr_getevtdatap( );
int len = sr_getevtlen( );
int rc = 0;
L2_BLK l2_blk;
InitSndFrameBlk (&l2_blk); /* prepare for the message */
if ((rc = cc_SndFrame(ldev, &l2_blk) ) ! = 0)
{
printf("Error in cc_SndFrame, rc = %x\n", rc);
}
else
.
.
.
.
.
}
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_SndFrame( ) 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