gc_GetUsrAttr( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_GetUsrAttr(linedev, usr_attrp) Inputs: Returns: Includes: Category: Mode: Platform and Technology: Description
The gc_GetUsrAttr( ) function retrieves the user-defined attribute established previously for the line device by the gc_SetUsrAttr( ) or gc_OpenEx( ) function.
linedev Global Call line device handle usr_attrp address of the location where the returned attribute information will be stored. This parameter will be set to NULL if the user attribute was not previously set using the gc_SetUsrAttr( ) or gc_OpenEx( ) function. Termination Events
Cautions
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]; /* * Retrieves port_num that was set for this device * in set_usrattr (gc_SetUsrAttr()) */ int get_usrattr(LINEDEV ldev, int *port_num) { GC_INFO gc_error_info; /* GlobalCall error information data */ void *vattrp; /* to retrieve the attribute */ /* * Assuming that a line device is opened already and * that its ID is ldev, let us retrieve the attribute set * for this ldev, previously set by the user using gc_SetUsrAttr() */ if ( gc_GetUsrAttr( ldev, &vattrp) != GC_SUCCESS ) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_GetUsrAttr() 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); } *port_num = (int) vattrp; /* * Processing may continue using this retrieved attribute */ return (0); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation