示例#1
0
/**********************************************************************

    prototype:

        BOOL
        CcspCrLoadRemoteCRInfo
            (
                ANSC_HANDLE                                 hCcspCr,
                ANSC_HANDLE                                 hXmlHandle
            );

    description:

        This function is called to load single remote cr information

    argument:   ANSC_HANDLE                                 hCcspCr
                the handle of CCSP CR component;

                ANSC_HANDLE                                 hXmlHandle
                the XML handle of remote CR in profile;

    return:     Succeeded or not;

**********************************************************************/
BOOL
CcspCrLoadRemoteCRInfo
    (
        ANSC_HANDLE                                 hCcspCr,
        ANSC_HANDLE                                 hXmlHandle
    )
{
    PCCSP_CR_MANAGER_OBJECT         pMyObject         = (PCCSP_CR_MANAGER_OBJECT)hCcspCr;
    PANSC_XML_DOM_NODE_OBJECT       pObjectNode       = (PANSC_XML_DOM_NODE_OBJECT)hXmlHandle;
    PANSC_XML_DOM_NODE_OBJECT       pChildNode        = (PANSC_XML_DOM_NODE_OBJECT)NULL;
    PCCSP_REMOTE_CRINFO             pCRInfo           = (PCCSP_REMOTE_CRINFO)NULL;
    char                            buffer1[512]       = { 0 };
    char                            buffer2[512]       = { 0 };
    ULONG                           uLength           = 512;

    /* get the prefix */
    pChildNode = (PANSC_XML_DOM_NODE_OBJECT)
        pObjectNode->GetChildByName(pObjectNode, CCSP_CR_XML_NODE_cr_prefix);
     
    if( pChildNode == NULL || pChildNode->GetDataString(pChildNode, NULL, buffer1, &uLength) != ANSC_STATUS_SUCCESS || uLength == 0)
    {
        AnscTraceWarning(("Empty or invalid 'prefix' name.\n"));
        
        return FALSE;
    }

    uLength = 512;
    /* get the id */
    pChildNode = (PANSC_XML_DOM_NODE_OBJECT)
        pObjectNode->GetChildByName(pObjectNode, CCSP_CR_XML_NODE_cr_id);
     
    if( pChildNode == NULL || pChildNode->GetDataString(pChildNode, NULL, buffer2, &uLength) != ANSC_STATUS_SUCCESS || uLength == 0)
    {
        AnscTraceWarning(("Empty or invalid 'id' name.\n"));
        
        return FALSE;
    }

    /* create a remote CR info */
    pCRInfo = (PCCSP_REMOTE_CRINFO)CcspCrAllocateMemory(sizeof(CCSP_REMOTE_CRINFO));

    if( pCRInfo != NULL)
    {
        pCRInfo->pPrefix        = CcspCrCloneString(buffer1);
        pCRInfo->pID            = CcspCrCloneString(buffer2);

        AnscQueuePushEntry(&pMyObject->RemoteCRQueue, &pCRInfo->Linkage);
    }

    return TRUE;
}
示例#2
0
/**********************************************************************

    prototype:

        BOOL
        CcspCrLoadComponentProfile
            (
                ANSC_HANDLE                                 hCcspCr,
                ANSC_HANDLE                                 hXmlHandle
            );

    description:

        This function is called to load single component profile.

    argument:   ANSC_HANDLE                                 hCcspCr
                the handle of CCSP CR component;

                ANSC_HANDLE                                 hXmlHandle
                the handle of component XML handle in profile;

    return:     Succeeded or not;

**********************************************************************/
BOOL
CcspCrLoadComponentProfile
    (
        ANSC_HANDLE                                 hCcspCr,
        ANSC_HANDLE                                 hXmlHandle
    )
{
    PCCSP_CR_MANAGER_OBJECT         pMyObject         = (PCCSP_CR_MANAGER_OBJECT)hCcspCr;
    PANSC_XML_DOM_NODE_OBJECT       pObjectNode       = (PANSC_XML_DOM_NODE_OBJECT)hXmlHandle;
    PANSC_XML_DOM_NODE_OBJECT       pChildNode        = (PANSC_XML_DOM_NODE_OBJECT)NULL;
    PCCSP_COMPONENT_INFO            pCompInfo         = (PCCSP_COMPONENT_INFO)NULL;
    char                            buffer[512]       = { 0 };
    ULONG                           uLength           = 512;
    ULONG                           uVersion          = 0;

    /* get the name */
    pChildNode = (PANSC_XML_DOM_NODE_OBJECT)
        pObjectNode->GetChildByName(pObjectNode, CCSP_CR_XML_NODE_component_name);
     
    if( pChildNode == NULL || pChildNode->GetDataString(pChildNode, NULL, buffer, &uLength) != ANSC_STATUS_SUCCESS || uLength == 0)
    {
        AnscTraceWarning(("Failed to load component name.\n"));
        
        return FALSE;
    }

    /* get the version */
    pChildNode = (PANSC_XML_DOM_NODE_OBJECT)
        pObjectNode->GetChildByName(pObjectNode, CCSP_CR_XML_NODE_component_version);

    if( pChildNode == NULL || pChildNode->GetDataUlong(pChildNode, NULL, &uVersion) != ANSC_STATUS_SUCCESS)
    {
        AnscTraceWarning(("Failed to load component version.\n"));
        
        return FALSE;
    }

    /* create a Component Info and add it */
    pCompInfo = (PCCSP_COMPONENT_INFO)CcspCrAllocateMemory(sizeof(CCSP_COMPONENT_INFO));

    if( pCompInfo != NULL)
    {
        pCompInfo->pComponentName = CcspCrCloneString(buffer);
        pCompInfo->uVersion       = uVersion;
        pCompInfo->uStatus        = CCSP_Component_NotRegistered;

        AnscQueuePushEntry(&pMyObject->CompInfoQueue, &pCompInfo->Linkage);
    }

    return TRUE;
}