PREV TOC HOME INDEX NEXT


gc_SetUsrAttr( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_SetUsrAttr(linedev, usrattr)
Inputs:

LINEDEV linedev

  • Global Call line device handle

void *usrattr

  • user attribute
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

system controls and tools

Mode:

synchronous

Platform and Technology:

All

Description

The gc_SetUsrAttr( ) function sets an attribute defined by the user. For example, the usrattr parameter can be used as a pointer to a data structure associated with a line device or an index to an array. The data structure may contain user information such as the current call state or line device identification. The attribute number is retrieved using the gc_GetUsrAttr( ) function.

Parameter

Description

linedev Global Call line device handle
usrattr user defined attribute. Applications can recall this value by calling gc_GetUsrAttr( ).

Termination Events

None

Cautions

None

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> 
#define MAXCHAN   30                 /* max. number of channels in system */
/*
 * Data structure which stores all information for each line
 */
struct linebag {
    LINEDEV  ldev;                    /* GlobalCall line device handle */
    CRN      crn;                     /* GlobalCall API call handle */
    int      state;                   /* state of first layer state machine */
} port[MAXCHAN+1]; 
/*
 * Associates port_num with ldev for later use
 * by other procedures - will save table searches
 * for the port_num corresponding to ldev
 */
int set_usrattr(LINEDEV ldev, int port_num)
{
    GC_INFO  gc_error_info;   /* GlobalCall error information data */ 
    /*
     * Assuming that a line device is opened already and
     * that its ID is ldev, let us store a meaningful number
     * for this ldev as an attribute for this ldev set by user
     */
    if (gc_SetUsrAttr(ldev, (void *) port_num) != GC_SUCCESS) {
        /* process error return as shown */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_SetUsrAttr() on device handle: 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);
} 

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