PREV TOC HOME INDEX NEXT


gc_GetFrame( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_GetFrame(linedev, l2_blkp)
Inputs:

LINEDEV linedev

  • line device handle for D channel
 

GC_L2_BLK *l2_blkp

  • pointer to the buffer to store received frame info
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

interface specific

Mode:

synchronous

Platform and Technology:

Springware: ISDN

DM3: ISDN

Description

Note: The gc_GetFrame( ) function is deprecated in this software release. The suggested equivalent is gc_Extension( ).

The gc_GetFrame( ) function retrieves a Layer 2 frame received by the application. This function is used after a GCEV_L2FRAME event is received. Each GCEV_L2FRAME event is associated with one frame. This function is used for the data link layer only.

Note: To enable Layer 2 access, set parameter number 24 to 01 in the firmware parameter file. When Layer 2 access is enabled, only the gc_GetFrame( ) and gc_SndFrame( ) functions can be used (no calls can be made).

Parameter

Description

linedev Global Call line device handle for the D channel
l2_blkp points to the memory location where the received frame information is to be stored

The retrieved frame uses the GC_L2_BLK data structure. Also, see the example code for details.

Termination Events

None

Cautions

The gc_GetFrame( ) function is called only after a GCEV_L2FRAME event is received. See also the appropriate Global Call Technology User's Guide for technology-specific information and to the protocol-specific parameter file.

Errors

If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function to retrieve the reason for the error. See the "Error Handling" section in the Global Call API Programming Guide. All Global Call error codes are defined in the gcerr.h file. If the error returned is technology specific, see the technology-specific error header file(s) for the error definition (for example, ccerr.h or isdnerr.h file for the ISDN call control library).

Example

#include <stdio.h>
#include <srllib.h>
#include <gclib.h>
#include <gcerr.h>
#include <gcisdn.h> 
METAEVENT metaevent;  
int send_frame(GC_L2_BLK *sndfrmptr) 
{
    LINEDEV    ldev;               /* Line device */
    GC_INFO    gc_error_info;      /* GlobalCall error information data */
    char       devname[] = ":N_dtiB1:P_isdn"; 
    /*
     * Do the following:
     *    1. Open the D channel
     *    2. Send the frame
     */ 
    if(gc_OpenEx(&ldev, devname, EV_SYNC, &ldev) < 0) {
        /* Process the error as shown in the Example
         * code of the gc_ErrorInfo() function description */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_OpenEx() on devname: %s, GC ErrorValue: 0x%hx - %s, 
                CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
                devname, gc_error_info.gcValue, gc_error_info.gcMsg, 
                gc_error_info.ccLibId, gc_error_info.ccLibName,
                gc_error_info.ccValue, gc_error_info.ccMsg);
        return (gc_error_info.gcValue);
    } 
    if(gc_SndFrame(ldev, sndfrmptr) != GC_SUCCESS) {
        /* Process the error as shown in the Example
         * code of the gc_ErrorInfo() function description */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_GetFrame() on linedev: 0x%lx, GC ErrorValue: 0x%hx - %s, 
                CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
                ldev, gc_error_info.gcValue, gc_error_info.gcMsg, 
                gc_error_info.ccLibId, gc_error_info.ccLibName,
                gc_error_info.ccValue, gc_error_info.ccMsg);
        return (gc_error_info.gcValue);
    } 
    return 0;
}    
/* Retrieve events from SRL */
int evt_hdlr()
{
    LINEDEV      ldev;           /* Line device */
    GC_L2_BLK    recvfrmptr;     /* Buffer to store received frame */
    int          retcode;        /* Return value */
    GC_INFO      gc_error_info;  /* GlobalCall error information data */ 
    retcode = gc_GetMetaEvent(&metaevent); 
    if (retcode <0 ) {
           /* get and process the error */
    } else {
           /* Continue with normal processing */
    } 
    ldev = metaevent.evtdev; 
    switch(metaevent.evttype) { 
    case GCEV_L2FRAME:
        /* retrieve signaling information from queue */
        if ( gc_GetFrame(ldev, &recvfrmptr) != GC_SUCCESS) {
            /* Process the error as shown in the Example
             * code of the gc_ErrorInfo() function description */
            gc_ErrorInfo( &gc_error_info );
            printf ("Error: gc_GetFrame() on linedev: 0x%lx, GC ErrorValue: 0x%hx - %s, 
                    CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
                    ldev, gc_error_info.gcValue, gc_error_info.gcMsg, 
                    gc_error_info.ccLibId, gc_error_info.ccLibName,
                    gc_error_info.ccValue, gc_error_info.ccMsg);
            return (gc_error_info.gcValue); 
        }
        else {
               /* succeeded, process signaling information */
        }
        break;
    }
    return 0;
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2003, Intel Corporation
All rights reserved
This page generated February, 2003