PREV TOC HOME INDEX NEXT


4.12.4. Registration Code Example

The following code example shows how to populate a GC_PARM_DATA structure that can be used to register an endpoint with a gatekeeper (H.323) or registrar (SIP). The GC_PARM_DATA structure contains the following registration information:

int boardRegistration(IN LINEDEV boarddev)
{
    GC_PARM_BLKP pParmBlock = NULL;
    int frc = GC_SUCCESS;
    
    /****** Two (mandatory) elements that are not related directly to 
    the server-client negotiation ********/
    frc = gc_util_insert_parm_val(&pParmBlock,
                                  GCSET_SERVREQ,
                                  PARM_REQTYPE,
                                  sizeof(char),
                                  IP_REQTYPE_REGISTRATION);
    
    frc = gc_util_insert_parm_val(&pParmBlock,
                                  GCSET_SERVREQ,
                                  PARM_ACK,
                                  sizeof(char),
                                  1);
    
    /******Setting the protocol target***********/
    frc = gc_util_insert_parm_val(&pParmBlock,
                                  IPSET_PROTOCOL,
                                  IPPARM_PROTOCOL_BITMASK,
                                  sizeof(char),
                                  IP_PROTOCOL_H323); /*can be H323, SIP or Both*/ 
    
    /****** Setting the operation to perform ***********/
    frc = gc_util_insert_parm_val(&pParmBlock,
                                  IPSET_REG_INFO,
                                  IPPARM_OPERATION_REGISTER, /* can be Register
                                                                or Deregister */
                                  sizeof(char),
                                  IP_REG_SET_INFO);  /* can be other relevant
                                                        "sub" operations */
    
    /****** Setting address information ***********/
    IP_REGISTER_ADDRESS registerAddress;
    strcpy(registerAddress.reg_server,"101.102.103.104"); /* set server address*/
    strcpy(registerAddress.reg_client,"10.20.30.40");     /* set client (self)
                                                             address */
    registerAddress.max_hops = regMulticastHops;
    registerAddress.time_to_live = regUnicastTTL;
    
    frc = gc_util_insert_parm_ref(&pParmBlock,
                                  IPSET_REG_INFO,
                                  IPPARM_REG_ADDRESS,
                                  (UINT8)sizeof(IP_REGISTER_ADDRESS),
                                  &registerAddress);
    
    /**** Setting terminalAlias information ****/
    /**** With H.323 - may repeat this line with different aliases and
             alias types ****/
    /**** SIP does not allow setting of this parm block ****/
    frc = gc_util_insert_parm_ref(&pParmBlock,
                                  IPSET_LOCAL_ALIAS,
                                  (unsigned short)IPPARM_ADDRESS_EMAIL,
                                  (UINT8)(strlen("someone@someplace.com")+1),
                                  "someone@someplace.com");
    
    /****** Setting supportedPrefixes information ***********/
    /**** With H.323 - may repeat this line with different supported prefixes and
            supported prefix types ****/
    /**** SIP does not allow setting of this parm block ****/
    frc = gc_util_insert_parm_ref(&pParmBlock,
                                  IPSET_SUPPORTED_PREFIXES,
                                  (unsigned short)IPPARM_ADDRESS_PHONE,
                                  (UINT8)(strlen("011972")+1),
                                  "011972");
    
    /****** Send the request  ***********/
    unsigned long   serviceID ;
    int rc = gc_ReqService(GCTGT_CCLIB_NETIF,
                           boarddev,
                           &serviceID,
                           pParmBlock,
                           NULL,
                           EV_ASYNC);

    if (rc != GC_SUCCESS)
    {
        printf("failed in gc_ReqService\n");
        return GC_ERROR;
    }
    
    gc_util_delete_parm_blk(pParmBlock);
    return GC_SUCCESS;
} 

PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

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