ANSC_HANDLE
DslhObjroGetVarRecord
    (
        ANSC_HANDLE                 hThisObject,
        char*                       name
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PDSLH_OBJ_RECORD_OBJECT         pMyObject       = (PDSLH_OBJ_RECORD_OBJECT)hThisObject;
    PDSLH_OBJ_ENTITY_OBJECT         pObjEntity      = (PDSLH_OBJ_ENTITY_OBJECT)pMyObject->hDslhObjEntity;
    PDSLH_VAR_RECORD_OBJECT         pChildVarRecord = (PDSLH_VAR_RECORD_OBJECT)NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry     = (PSINGLE_LINK_ENTRY     )NULL;

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->VarroTable);

    while ( pSLinkEntry )
    {
        pChildVarRecord = ACCESS_DSLH_VAR_RECORD_OBJECT(pSLinkEntry);
        pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString
                (
                    pChildVarRecord->GetLastName((ANSC_HANDLE)pChildVarRecord),
                    name,
                    TRUE
                ) )
        {
            return  (ANSC_HANDLE)pChildVarRecord;
        }
    }

    return  (ANSC_HANDLE)NULL;
}
ANSC_HANDLE
HttpBmoGetHeaderField
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       ulHeaderId
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject    = (PHTTP_BASIC_MESSAGE_OBJECT)hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PHTTP_HEADER_FIELD              pHttpHfo     = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ULONG                           ulHashIndex  = AnscHashUlong(ulHeaderId, HTTP_BMO_HFO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->HfoTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->HfoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pHttpHfo    = ACCESS_HTTP_HEADER_FIELD(pSLinkEntry);
        pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

        if ( pHttpHfo->HeaderId == ulHeaderId )
        {
            AnscReleaseLock(&pMyObject->HfoTableLock);

            return  (ANSC_HANDLE)pHttpHfo;
        }
    }

    AnscReleaseLock(&pMyObject->HfoTableLock);

    return  (ANSC_HANDLE)NULL;
}
ANSC_STATUS
AnscDstoStopEngines
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_DAEMON_SERVER_TCP_OBJECT  pMyObject    = (PANSC_DAEMON_SERVER_TCP_OBJECT)hThisObject;
    PANSC_DAEMON_ENGINE_TCP_OBJECT  pEngine      = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->EngineQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->EngineQueue);

    while ( pSLinkEntry )
    {
        pEngine     = ACCESS_ANSC_DAEMON_ENGINE_TCP_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

        pEngine->Stop((ANSC_HANDLE)pEngine);
    }

    AnscReleaseLock(&pMyObject->EngineQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
HttpFcoGetFormElement
    (
        ANSC_HANDLE                 hThisObject,
        char*                       name
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PHTTP_FORM_CONTENT_OBJECT       pMyObject     = (PHTTP_FORM_CONTENT_OBJECT)hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf        = (PHTTP_HFP_INTERFACE      )pMyObject->hHfpIf;
    PHTTP_FORM_ELEMENT              pFormElement  = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry   = NULL;
    ULONG                           ulHashIndex   = AnscHashString(name, AnscSizeOfString(name), HTTP_FCO_FEO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->FeoTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->FeoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pFormElement = ACCESS_HTTP_FORM_ELEMENT(pSLinkEntry);
        pSLinkEntry  = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString(pFormElement->Name, name, TRUE) )
        {
            AnscReleaseLock(&pMyObject->FeoTableLock);

            return  (ANSC_HANDLE)pFormElement;
        }
    }

    AnscReleaseLock(&pMyObject->FeoTableLock);

    return  (ANSC_HANDLE)NULL;
}
ANSC_HANDLE
AnscLpccoGetPendingCall
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       msg_type,
        ULONG                       seq_number
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_LPC_CONNECTOR_OBJECT      pMyObject    = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject;
    PANSC_LPCCO_PENDING_CALL        pPendingCall = (PANSC_LPCCO_PENDING_CALL  )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = (PSINGLE_LINK_ENTRY        )NULL;

    AnscAcquireLock(&pMyObject->PcallQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->PcallQueue);

    while ( pSLinkEntry )
    {
        pPendingCall = ACCESS_ANSC_LPCCO_PENDING_CALL(pSLinkEntry);
        pSLinkEntry  = AnscQueueGetNextEntry(pSLinkEntry);

        if ( (pPendingCall->ImcpMsgType   == msg_type  ) &&
             (pPendingCall->CallSeqNumber == seq_number) )
        {
            AnscReleaseLock(&pMyObject->PcallQueueLock);

            return  (ANSC_HANDLE)pPendingCall;
        }
    }

    AnscReleaseLock(&pMyObject->PcallQueueLock);

    return  (ANSC_HANDLE)NULL;
}
Beispiel #6
0
ANSC_HANDLE
CcspCrLookforComponent
    (
        ANSC_HANDLE                 hCcspCr,
        const char*                 pCompName
    )
{
    PCCSP_CR_MANAGER_OBJECT         pMyObject         = (PCCSP_CR_MANAGER_OBJECT)hCcspCr;
    PCCSP_COMPONENT_INFO            pCompInfo         = (PCCSP_COMPONENT_INFO)NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY)NULL;

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->CompInfoQueue);

    while ( pSLinkEntry )
    {
        pCompInfo       = ACCESS_CCSP_COMPONENT_INFO(pSLinkEntry);
        pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

        /* Since component in the device profile doesn't have prefix included while registerCapabilities does,
         * we don't need a perfect match here */
        /* if ( pCompName != NULL && AnscEqualString(pCompInfo->pComponentName, (char*)pCompName, TRUE)) */
        if ( pCompName != NULL && ccspStringEndswith(pCompName, pCompInfo->pComponentName))
        {
            return  (ANSC_HANDLE)pCompInfo;
        }
    }

    return NULL;
}
Beispiel #7
0
/**********************************************************************

    prototype:

        char*
        CcspCrLookforRemoteCR
            (
                ANSC_HANDLE                 hCcspCr,
                char*                       pPrefix
            );

    description:

        This function is called to look for remote cr path specified by name.

    argument:   ANSC_HANDLE                                 hCcspCr
                the handle of CCSP CR component;

                char*                       pPrefix
                The specified subsystem prefix;

    return:     The dbus path if found;

**********************************************************************/
char*
CcspCrLookforRemoteCR
    (
        ANSC_HANDLE                 hThisObject,
        char*                       pPrefix
    )
{
    PCCSP_CR_MANAGER_OBJECT         pMyObject         = (PCCSP_CR_MANAGER_OBJECT)hThisObject;
    PCCSP_REMOTE_CRINFO             pCompInfo         = (PCCSP_REMOTE_CRINFO)NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY)NULL;

    if( pPrefix == NULL || AnscSizeOfString(pPrefix) == 0)
    {
        return NULL;
    }

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->RemoteCRQueue);

    while ( pSLinkEntry )
    {
        pCompInfo       = ACCESS_CCSP_REMOTE_CRINFO(pSLinkEntry);
        pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString(pCompInfo->pPrefix, (char*)pPrefix, TRUE))
        {
            return  pCompInfo->pID;
        }
    }

    return NULL;

}
ANSC_STATUS
AnscDetoCancel
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hSocket
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_DAEMON_ENGINE_TCP_OBJECT  pMyObject    = (PANSC_DAEMON_ENGINE_TCP_OBJECT)hThisObject;
    PANSC_DAEMON_SERVER_TCP_OBJECT  pServer      = (PANSC_DAEMON_SERVER_TCP_OBJECT)pMyObject->hDaemonServer;
    PANSC_DSTO_WORKER_OBJECT        pWorker      = (PANSC_DSTO_WORKER_OBJECT      )pServer->hWorker;
    PANSC_DAEMON_SOCKET_TCP_OBJECT  pSocket      = (PANSC_DAEMON_SOCKET_TCP_OBJECT)hSocket;
    PANSC_DETO_PACKET_OBJECT        pPacket      = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    if ( (pMyObject->ControlFlags & ANSC_DETO_FLAG_ASYNC_SEND) == 0 )
    {
        return  ANSC_STATUS_SUCCESS;
    }

    AnscAcquireLock(&pMyObject->PacketQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->PacketQueue);

    while ( pSLinkEntry )
    {
        pPacket     = ACCESS_ANSC_DETO_PACKET_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

        if ( pPacket->hSocket != (ANSC_HANDLE)pSocket )
        {
            continue;
        }

        AnscQueuePopEntryByLink(&pMyObject->PacketQueue, &pPacket->Linkage);

        returnStatus =
            pWorker->SendComplete
                (
                    pWorker->hWorkerContext,
                    (ANSC_HANDLE)pSocket,
                    pPacket->hWorkerReserved,
                    ANSC_STATUS_FAILURE
                );

        AnscFreeMemory(pPacket);
    }

    AnscReleaseLock(&pMyObject->PacketQueueLock);



    return  ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
AnscXmlDomNodeGetHeadChild
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PANSC_XML_DOM_NODE_OBJECT       pXmlNode      = (PANSC_XML_DOM_NODE_OBJECT)hThisObject;
    PANSC_XML_DOM_NODE_OBJECT       pChildNode    = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry   = NULL;

    if( AnscQueueQueryDepth(&pXmlNode->ChildNodeQueue) == 0)
    {
        if( pXmlNode->ChildNodeQueue.Next.Next != NULL)
        {
            PANSC_XML_ATTRIBUTE                     pNameAttr = NULL;

            pNameAttr = (PANSC_XML_ATTRIBUTE)AnscXmlDomNodeGetFirstAttr(pXmlNode);

            if( pNameAttr == NULL || pNameAttr->StringData == NULL)
            {
                AnscXmlWarning("The child node queue of XML node is corrupted.\n");
            }
            else
            {
                AnscXmlWarning
                    (
                        "The child node queue of XML node '%s' is corrupted.\n",
                        (PCHAR)pNameAttr->StringData
                    );
            }
        }

        return NULL;
    }

    AnscAcquireXmlLock(&pXmlNode->ChildNodeQueueLock);
    pSLinkEntry = AnscQueueGetFirstEntry(&pXmlNode->ChildNodeQueue);
    AnscReleaseXmlLock(&pXmlNode->ChildNodeQueueLock);

    if ( pSLinkEntry )
    {
        pChildNode = ACCESS_ANSC_XML_DOM_NODE_OBJECT(pSLinkEntry);
    }

    return  (ANSC_HANDLE)pChildNode;
}
ANSC_HANDLE
AnscXmlDomNodeGetFirstAttr
    (
        ANSC_HANDLE                 hNode
    )
{
    /***********************************************************
                    DEFINITION OF LOCAL VARIABLES
    ***********************************************************/

    /*
     * pointer to the current parent node
     */
    PANSC_XML_DOM_NODE_OBJECT       pCurrentNode = (PANSC_XML_DOM_NODE_OBJECT)hNode;

    /*
     * pointer to the first available son node
     */
    PSINGLE_LINK_ENTRY              pSLinkEntry = NULL;


    /***********************************************************
          GET THE FIRST AVAILABLE CHILD NODE FROM THE LIST
    ***********************************************************/

    /*
     * make sure user didn't pass down invalid handle
     */
    if ( !pCurrentNode )
    {
        return  (ANSC_HANDLE)NULL;
    }

    /*
     * retrieve the pointer to the first son node
     */
    pSLinkEntry = AnscQueueGetFirstEntry(&pCurrentNode->AttributesList);

    if ( !pSLinkEntry )
    {
        return  (ANSC_HANDLE)NULL;
    }

    return  (ANSC_HANDLE)ACCESS_XML_ATTRIBUTE(pSLinkEntry);
}
ANSC_STATUS
TlsSmoDelSession
(
    ANSC_HANDLE                 hThisObject,
    ULONG                       host_id,
    ULONG                       peer_id,
    PUCHAR                      session_id,
    ULONG                       session_id_size
)
{
    PTLS_SESSION_MANAGER_OBJECT     pMyObject     = (PTLS_SESSION_MANAGER_OBJECT  )hThisObject;
    PTLS_SESSION_ENTRY_OBJECT       pSessionEntry = (PTLS_SESSION_ENTRY_OBJECT    )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry   = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           ulHashIndex   = AnscHashUlong(peer_id, TLS_SMO_SEO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->SeoTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->SeoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pSessionEntry = ACCESS_TLS_SESSION_ENTRY_OBJECT(pSLinkEntry);
        pSLinkEntry   = AnscQueueGetNextEntry(pSLinkEntry);

        if ( pSessionEntry->Match2
                (
                    (ANSC_HANDLE)pSessionEntry,
                    host_id,
                    peer_id,
                    session_id,
                    session_id_size
                ) )
        {
            AnscQueuePopEntryByLink(&pMyObject->SeoTable[ulHashIndex], &pSessionEntry->Linkage);

            pSessionEntry->Remove((ANSC_HANDLE)pSessionEntry);

            break;
        }
    }

    AnscReleaseLock(&pMyObject->SeoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
AnscLpccoDelPartyAddr
    (
        ANSC_HANDLE                 hThisObject,
        char*                       party_name
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_LPC_CONNECTOR_OBJECT      pMyObject    = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject;
    PANSC_LPC_PARTY_ADDR            pPartyAddr   = (PANSC_LPC_PARTY_ADDR      )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = (PSINGLE_LINK_ENTRY        )NULL;
    ULONG                           ulHashIndex  = AnscHashString(party_name, AnscSizeOfString(party_name), ANSC_LPCCO_PARTY_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->PartyTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->PartyTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pPartyAddr  = ACCESS_ANSC_LPC_PARTY_ADDR(pSLinkEntry);
        pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString
                (
                    pPartyAddr->PartyName,
                    party_name,
                    FALSE
                ) )
        {
            AnscQueuePopEntryByLink(&pMyObject->PartyTable[ulHashIndex], &pPartyAddr->Linkage);

            AnscFreeMemory(pPartyAddr);

            break;
        }
    }

    AnscReleaseLock(&pMyObject->PartyTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ULONG
DslhObjroGetVarRecordCount
    (
        ANSC_HANDLE                 hThisObject,
        BOOL                        bExcludeHidden
    )
{
    ANSC_STATUS                     returnStatus     = ANSC_STATUS_SUCCESS;
    PDSLH_OBJ_RECORD_OBJECT         pMyObject        = (PDSLH_OBJ_RECORD_OBJECT)hThisObject;
    PDSLH_OBJ_ENTITY_OBJECT         pObjEntity       = (PDSLH_OBJ_ENTITY_OBJECT)pMyObject->hDslhObjEntity;
    PDSLH_VAR_RECORD_OBJECT         pChildVarRecord  = (PDSLH_VAR_RECORD_OBJECT)NULL;
    PDSLH_VAR_ENTITY_OBJECT         pChildVarEntity = (PDSLH_VAR_ENTITY_OBJECT)NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry     = (PSINGLE_LINK_ENTRY     )NULL;
    ULONG                           ulVarRecordCount = 0;

    if( bExcludeHidden )
    {
        pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->VarroTable);

        while ( pSLinkEntry )
        {
            pChildVarRecord = ACCESS_DSLH_VAR_RECORD_OBJECT(pSLinkEntry);
            pChildVarEntity = (PDSLH_VAR_ENTITY_OBJECT)pChildVarRecord->hDslhVarEntity;
            pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

            if( pChildVarEntity->ParamDescr && !pChildVarEntity->ParamDescr->bInvisible)
            {
                ulVarRecordCount ++;
            }
        }

    }
    else
    {
        /* include all the parameters */
        ulVarRecordCount += AnscQueueQueryDepth(&pMyObject->VarroTable);
    }

    return  ulVarRecordCount;
}
ANSC_STATUS
AnscDstoStartEngines
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_DAEMON_SERVER_TCP_OBJECT  pMyObject    = (PANSC_DAEMON_SERVER_TCP_OBJECT)hThisObject;
    PANSC_DAEMON_ENGINE_TCP_OBJECT  pEngine      = NULL;
    ULONG                           ulFlags      = 0;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;

    AnscAcquireLock(&pMyObject->EngineQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->EngineQueue);

    while ( pSLinkEntry )
    {
        pEngine     = ACCESS_ANSC_DAEMON_ENGINE_TCP_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);
        ulFlags     = pEngine->GetControlFlags((ANSC_HANDLE)pEngine);

        if ( pMyObject->Mode & ANSC_DSTO_MODE_ASYNC_SEND )
        {
            ulFlags |= ANSC_DETO_FLAG_ASYNC_SEND;
        }

        if ( pMyObject->Mode & ANSC_DSTO_MODE_NO_TIMEOUT )
        {
            ulFlags |= ANSC_DETO_FLAG_NO_TIMEOUT;
        }

        pEngine->SetControlFlags((ANSC_HANDLE)pEngine, ulFlags);
        pEngine->Start          ((ANSC_HANDLE)pEngine);
    }

    AnscReleaseLock(&pMyObject->EngineQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
Bmc2EnvcoGetComTerminal
    (
        ANSC_HANDLE                 hThisObject,
        char*                       pUserIdentifier
    )
{
    ANSC_STATUS                     returnStatus     = ANSC_STATUS_SUCCESS;
    PBMC2_ENV_CONTROLLER_OBJECT     pMyObject        = (PBMC2_ENV_CONTROLLER_OBJECT  )hThisObject;
    PBMC2_ENV_CONTROLLER_PROPERTY   pProperty        = (PBMC2_ENV_CONTROLLER_PROPERTY)&pMyObject->Property;
    PBMC2_COM_TERMINAL_OBJECT       pBmc2ComTerminal = (PBMC2_COM_TERMINAL_OBJECT    )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry      = (PSINGLE_LINK_ENTRY           )NULL;

    AnscAcquireLock(&pMyObject->ComtoQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->ComtoQueue);

    while ( pSLinkEntry )
    {
        pBmc2ComTerminal = ACCESS_BMC2_COM_TERMINAL_OBJECT(pSLinkEntry);
        pSLinkEntry      = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString
                (
                    pBmc2ComTerminal->GetUserIdentifier((ANSC_HANDLE)pBmc2ComTerminal),
                    pUserIdentifier,
                    TRUE
                ) )
        {
            AnscReleaseLock(&pMyObject->ComtoQueueLock);

            return  (ANSC_HANDLE)pBmc2ComTerminal;
        }
    }

    AnscReleaseLock(&pMyObject->ComtoQueueLock);

    return  (ANSC_HANDLE)NULL;
}
BOOL
BwrmEcoRamIsPageCachedForced
    (
        ANSC_HANDLE                 hThisObject,
        char*                       page_path
    )
{
    ANSC_STATUS                     returnStatus     = ANSC_STATUS_SUCCESS;
    PBWRM_ENV_CONTROLLER_OBJECT     pMyObject        = (PBWRM_ENV_CONTROLLER_OBJECT  )hThisObject;
    PBWRM_ENV_CONTROLLER_PROPERTY   pProperty        = (PBWRM_ENV_CONTROLLER_PROPERTY)&pMyObject->Property;
    PSINGLE_LINK_ENTRY              pSLinkEntry      = (PSINGLE_LINK_ENTRY         )NULL;
    PBWRM_ENV_CACHE_FORCED_PAGE     pCacheForcedPage = (PBWRM_ENV_CACHE_FORCED_PAGE)NULL;
    BOOL                            bForced          = FALSE;
    ULONG                           ulLen            = AnscSizeOfString(page_path);

    AnscAcquireLock(&pMyObject->AccessLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->ForcedCachedPages);

    while ( pSLinkEntry )
    {
        pCacheForcedPage = ACCESS_BWRM_ENV_CACHE_FORCED_PAGE(pSLinkEntry);
        pSLinkEntry      = AnscQueueGetNextEntry(pSLinkEntry);

        if ( ulLen == AnscSizeOfString(pCacheForcedPage->PagePath) &&
             AnscEqualString2(pCacheForcedPage->PagePath, page_path, ulLen, FALSE) )
        {
            bForced = TRUE;
            break;
        }
    }

    AnscReleaseLock(&pMyObject->AccessLock);

    return  bForced;
}
ANSC_STATUS
DslhDmagntCancel
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PDSLH_DATAMODEL_AGENT_OBJECT    pMyObject         = (PDSLH_DATAMODEL_AGENT_OBJECT)hThisObject;
    PSINGLE_LINK_ENTRY              pSListEntry       = NULL;
    PPLUGIN_INFORMATION             pInfo             = NULL;

    if ( !pMyObject->bActive )
    {
        return  ANSC_STATUS_SUCCESS;
    }

    /* remove all the pluginInfo  */

    pSListEntry =   AnscQueueGetFirstEntry(&pMyObject->sPluginInfoList);

    while( pSListEntry != NULL)
    {
        pInfo       = ACCESS_PLUGIN_INFORMATION(pSListEntry);
        pSListEntry = AnscQueueGetNextEntry(pSListEntry);

        if( pInfo != NULL)
        {
            DslhDmagntRemovePluginInfo(pMyObject, pInfo);
        }              
    }

    AnscQueueInitializeHeader(&pMyObject->sPluginInfoList);

    pMyObject->bActive = FALSE;

    return ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpBmoCopyHeadersFrom
    (
        ANSC_HANDLE                 hThisObject,
        PVOID                       buffer,
        PULONG                      pulSize
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject     = (PHTTP_BASIC_MESSAGE_OBJECT)hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf        = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PANSC_BUFFER_DESCRIPTOR         pHeaderBdo    = (PANSC_BUFFER_DESCRIPTOR   )pMyObject->hHeaderBdo;
    PHTTP_HEADER_FIELD              pHttpHfo      = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry   = NULL;
    ULONG                           ulHeadersSize = 0;
    ULONG                           ulCopySize    = 0;
    ULONG                           ulLeftSize    = *pulSize;
    char*                           pHfStream     = (char*)buffer;
    ULONG                           i             = 0;

    if ( *pulSize < pMyObject->GetHeadersSize((ANSC_HANDLE)pMyObject) )
    {
        return  ANSC_STATUS_BAD_SIZE;
    }
    else if ( pHeaderBdo )
    {
        AnscCopyMemory
            (
                buffer,
                AnscBdoGetBlock    (pHeaderBdo),
                AnscBdoGetBlockSize(pHeaderBdo)
            );

        *pulSize = AnscBdoGetBlockSize(pHeaderBdo);

        return  ANSC_STATUS_SUCCESS;
    }

    ulCopySize   = ulLeftSize;
    pHfStream    = (char*)((ULONG)buffer + ulHeadersSize);
    returnStatus =
        pMyObject->CopyStartLineFrom
            (
                (ANSC_HANDLE)pMyObject,
                (PVOID)pHfStream,
                &ulCopySize
            );

    if ( returnStatus != ANSC_STATUS_SUCCESS )
    {
        return  returnStatus;
    }
    else
    {
        pHfStream     += ulCopySize;
        ulHeadersSize += ulCopySize;
        ulLeftSize    -= ulCopySize;

        pHfStream[0] = HTTP_CARRIAGE_RETURN;
        pHfStream[1] = HTTP_LINE_FEED;

        pHfStream     += 2;
        ulHeadersSize += 2;
        ulLeftSize    -= 2;
    }

    AnscAcquireLock(&pMyObject->HfoTableLock);

    for ( i = 0; i < HTTP_BMO_HFO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->HfoTable[i]);

        while ( pSLinkEntry )
        {
            pHttpHfo    = ACCESS_HTTP_HEADER_FIELD(pSLinkEntry);
            pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

            ulCopySize  = pHfpIf->GetHeaderSize(pHfpIf->hOwnerContext, (ANSC_HANDLE)pHttpHfo);

            if ( ulCopySize > 0 )
            {
                returnStatus =
                    pHfpIf->BuildHeader
                        (
                            pHfpIf->hOwnerContext,
                            (ANSC_HANDLE)pHttpHfo,
                            (PVOID)pHfStream,
                            ulCopySize
                        );

                if ( returnStatus != ANSC_STATUS_SUCCESS )
                {
                    return  returnStatus;
                }
                else
                {
                    pHfStream     += ulCopySize;
                    ulHeadersSize += ulCopySize;
                    ulLeftSize    -= ulCopySize;

                    pHfStream[0] = HTTP_CARRIAGE_RETURN;
                    pHfStream[1] = HTTP_LINE_FEED;

                    pHfStream     += 2;
                    ulHeadersSize += 2;
                    ulLeftSize    -= 2;
                }
            }
        }
    }

    AnscReleaseLock(&pMyObject->HfoTableLock);

    pHfStream[0] = HTTP_CARRIAGE_RETURN;
    pHfStream[1] = HTTP_LINE_FEED;

    pHfStream     += 2;
    ulHeadersSize += 2;
    ulLeftSize    -= 2;

    *pulSize = ulHeadersSize;

    return  ANSC_STATUS_SUCCESS;
}
int
CcspTableHelperRefreshCache
	(
        ANSC_HANDLE                 hThisObject
	)
{
	PCCSP_TABLE_HELPER_OBJECT       pThisObject     = (PCCSP_TABLE_HELPER_OBJECT)hThisObject;
	char*							pDMString       = pThisObject->pStrSampleDM;
	char*							pDestComp       = NULL;
	char*							pDestPath       = NULL;
	PCCSP_MIB_MAPPING				pMibMap			= (PCCSP_MIB_MAPPING)NULL;
	PCCSP_INDEX_MAPPING				pIndexMap		= (PCCSP_INDEX_MAPPING)NULL;
	PSINGLE_LINK_ENTRY              pSLinkEntry     = (PSINGLE_LINK_ENTRY)NULL;
	char                            pTemp[256]      = { 0 };
	netsnmp_tdata*					table			= (netsnmp_tdata *)pThisObject->mibMagic.pTableData;
    netsnmp_tdata_row*				row				= NULL;
	PCCSP_TABLE_ENTRY				pEntry          = NULL;
	ULONG							indexes[6]      = { 0 };
	int							    indexCount      = pThisObject->IndexMapQueue.Depth;
	int								i				= 0;
	int								j				= 0;
	int								k				= 0;
	char*							pFind           = NULL;
	unsigned int*				    insArray1       = NULL;
	unsigned int					insCount1       = 32;
	unsigned int*					insArray2       = NULL;
	unsigned int					insCount2       = 32;
	unsigned int*					insArray3       = NULL;
	unsigned int					insCount3       = 32;
	unsigned int					subDMIns[3] = {0,0,0};
    int                             status          = 0;

    if (pThisObject->RefreshCacheCallback != NULL)
    {
        int (*TableRefreshCache)(netsnmp_tdata *);

        TableRefreshCache = pThisObject->RefreshCacheCallback;
        status = TableRefreshCache(table);
    }

    if(pThisObject->bCacheSkip == TRUE)
    {
        return status;
    }

#if 0

	for( i = 0; i < 3; i ++)
	{
		for( j = 0; j < indexCount; j ++)
 		{
			indexes[j] = 5 + i + j; 
		}

        row = CcspUtilCreateMibEntry(table, indexes, indexCount, TRUE);
		
        if (row == NULL)  continue;

		pEntry = (PCCSP_TABLE_ENTRY)row->data;

		/* init the value array */
		CcspUtilInitMibValueArray(&pThisObject->MibObjQueue, &pEntry->MibValueQueue);
    }


#else

	/* first time we need to figure out which component to talk with */
	if( !pThisObject->pCcspComp || !pThisObject->pCcspPath)
	{
		if( pDMString == NULL)
		{
			AnscTraceWarning(("No one DM param name is configured, no way to cache.\n"));

			return -1;
		}
		else
		{
			/* remove the chars after '%d' */
			pFind = _ansc_strstr(pDMString, "%d");

			if( pFind != NULL)
			{
				pDMString[(ULONG)(pFind - pDMString)] = '\0';
			}

			AnscTraceInfo(("Try to find the CCSP component who supports '%s'\n", pDMString));
		}

		if( !Cosa_FindDestComp(pDMString, &pThisObject->pCcspComp, &pThisObject->pCcspPath) )
		{
			AnscTraceWarning(("Failed to find the CCSP component who supports '%s'\n", pDMString));

			return -1;
		}
	}

	if( pThisObject->MibObjQueue.Depth == 0 || pThisObject->IndexMapQueue.Depth == 0)
	{
		AnscTraceError(("No one mib or index is loaded in the mib table, cache failed.\n"));

		return -1;
	}

	if( pThisObject->IndexMapQueue.Depth == 1)
	{
		pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->IndexMapQueue);

		pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

		if( pIndexMap != NULL)
		{
			if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
			{
				AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName);
		
				/* get the ins count */
				if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray1, &insCount1))
				{
					AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                    insArray1 = NULL;
                    insCount1 = 0;
				}

				for( i = 0; i < insCount1; i ++)
				{
					indexCount = 1;
                                        if (pIndexMap->uMapType == CCSP_MIB_MAP_TO_INSNUMBER) {
						indexes[0] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray1[i], FALSE);
						if( indexes[0] == 0 && pIndexMap->IndexQueue.Depth > 0)
						{
							AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray1[i]));
						}
					} else if (pIndexMap->uMapType == CCSP_MIB_MAP_TO_SUBDM) {
						subDMIns[0] = insArray1[i];
						indexes[0] = tableGroupGetSubDMMapping(pThisObject, pIndexMap->Mapping.SubDMMappingInfo.pSubDMName, subDMIns);
						if( indexes[0] == 0 )
						{
							AnscTraceError(("Unable to find the sub DM value to index mapping for '%d'\n", insArray1[i]));
						}
					}

					if( indexes[0] == 0)
						indexes[0] = insArray1[i];

					row = CcspUtilCreateMibEntry(table, indexes, indexCount, TRUE);
		
					if (row == NULL)  continue;

					pEntry = (PCCSP_TABLE_ENTRY)row->data;

					/* don't forget to set back the actual instance number at back-end */
					pEntry->IndexValue[0].Value.iValue = insArray1[i];
					pEntry->IndexCount = 1;

					/* init the value array */
					CcspUtilInitMibValueArray(&pThisObject->MibObjQueue, &pEntry->MibValueQueue);

					/* retrieve values from back-end Component */
					if(!tableGroupGetCosaValues(pThisObject, pEntry))
					{
						AnscTraceError(("Failed to get COSA values.\n"));
					}
				}

                if (insArray1)
                    free(insArray1);
			}
			else
			{
				AnscTraceInfo(("Unsupported MIB index mapping type: %lu\n", pIndexMap->uMapType));
			}
		}
	}
	else if(pThisObject->IndexMapQueue.Depth == 2)
	{
		pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->IndexMapQueue);
		pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

		if( pIndexMap != NULL)
		{
			if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
			{
				AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName);
		
				/* get the ins count */
				if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray1, &insCount1))
				{
					AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                    insArray1 = NULL;
                    insCount1 = 0;
				}

				for( i = 0; i < insCount1; i ++)
				{
					indexes[0] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray1[i], FALSE);
					indexCount = 1;

					if( indexes[0] == 0)
					{
						if( pIndexMap->IndexQueue.Depth > 0)
						{
							AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray1[i]));
						}

						indexes[0] = insArray1[i];
					}

					/* get the second index */
					pSLinkEntry = AnscQueueSearchEntryByIndex(&pThisObject->IndexMapQueue,1);
					pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

					if( pIndexMap != NULL)
					{
						if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
						{
							/* AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName); */
							_ansc_sprintf(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName, insArray1[i]);
		
							/* get the ins count */
							if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray2, &insCount2))
							{
								AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                                insArray2 = NULL;
                                insCount2 = 0;
							}

							for( j = 0; j < insCount2; j ++)
							{
								indexes[1] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray2[j], FALSE);
								indexCount = 2;

								if( indexes[1] == 0)
								{
									if( pIndexMap->IndexQueue.Depth > 0)
									{
										AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray2[j]));
									}

									indexes[1] = insArray2[j];
								}

								/* create the entry */
								row = CcspUtilCreateMibEntry(table, indexes, indexCount, TRUE);
		
								if (row == NULL)  continue;

								pEntry = (PCCSP_TABLE_ENTRY)row->data;

								/* don't forget to set back the actual instance number at back-end */
								pEntry->IndexValue[0].Value.iValue = insArray1[i];
								pEntry->IndexValue[1].Value.iValue = insArray2[j];
								pEntry->IndexCount = 2;

								/* init the value array */
								CcspUtilInitMibValueArray(&pThisObject->MibObjQueue, &pEntry->MibValueQueue);

								/* retrieve values from back-end Component */
								if(!tableGroupGetCosaValues(pThisObject, pEntry))
								{
									AnscTraceError(("Failed to get COSA values.\n"));
								}
							}
                            
                            

                            if (insArray2)
                                free(insArray2);
						}
					}
                    /*Reset mapping to first level index*/
                    pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->IndexMapQueue);
                    pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);
				}

                if (insArray1)
                    free(insArray1);
			}
			else
			{
				AnscTraceInfo(("Unsupported MIB index mapping type: %lu\n", pIndexMap->uMapType));
			}
		}
	}
	else if(pThisObject->IndexMapQueue.Depth == 3)
	{
		pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->IndexMapQueue);
		pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

		if( pIndexMap != NULL)
		{
			if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
			{
				AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName);
		
				/* get the ins count */
				if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray1, &insCount1))
				{
					AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                    insArray1 = NULL;
                    insCount1 = 0;
				}

				for( i = 0; i < insCount1; i ++)
				{
					indexes[0] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray1[i], FALSE);
					indexCount = 1;

					if( indexes[0] == 0)
					{
						if( pIndexMap->IndexQueue.Depth > 0)
						{
							AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray1[i]));
						}

						indexes[0] = insArray1[i];
					}

					/* get the second index */
					pSLinkEntry = AnscQueueSearchEntryByIndex(&pThisObject->IndexMapQueue,1);
					pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

					if( pIndexMap != NULL)
					{
						if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
						{
							/* AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName); */
							_ansc_sprintf(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName, insArray1[i]);
		
							/* get the ins count */
							if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray2, &insCount2))
							{
								AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                                insArray2 = NULL;
                                insCount2 = 0;
							}

							for( j = 0; j < insCount2; j ++)
							{
								indexes[1] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray2[j], FALSE);
								indexCount = 2;

								if( indexes[1] == 0)
								{
									if( pIndexMap->IndexQueue.Depth > 0)
									{
										AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray2[j]));
									}

									indexes[1] = insArray2[j];
								}

								/* get the third index */
								pSLinkEntry = AnscQueueSearchEntryByIndex(&pThisObject->IndexMapQueue,2);
								pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);

								if( pIndexMap != NULL)
								{
									if(pIndexMap->uMapType >= CCSP_MIB_MAP_TO_DM)
									{
										/* AnscCopyString(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName); */
										_ansc_sprintf(pTemp, pIndexMap->Mapping.DMMappingInfo.pDMName, insArray1[i], insArray2[j]);
		
										/* get the ins count */
										if( !Cosa_GetInstanceNums(pThisObject->pCcspComp, pThisObject->pCcspPath, pTemp, &insArray3, &insCount3))
										{
											AnscTraceWarning(("Failed to GetInstanceNums of '%s'\n", pTemp));
                                            insArray3 = NULL;
                                            insCount3 = 0;
										}

										for( k = 0; k < insCount3; k ++)
										{
											indexes[2] = CcspUtilLookforInsNumMapping(&pIndexMap->IndexQueue, insArray3[k], FALSE);
											indexCount = 3;

											if( indexes[2] == 0)
											{
												if( pIndexMap->IndexQueue.Depth > 0)
												{
													AnscTraceError(("Unable to find the insNumber to index mapping for '%d'\n", insArray3[k]));
												}

												indexes[2] = insArray3[k];
											}

											/* create the entry */
											row = CcspUtilCreateMibEntry(table, indexes, indexCount, TRUE);
		
											if (row == NULL)  continue;

											pEntry = (PCCSP_TABLE_ENTRY)row->data;

											/* don't forget to set back the actual instance number at back-end */
											pEntry->IndexValue[0].Value.iValue = insArray1[i];
											pEntry->IndexValue[1].Value.iValue = insArray2[j];
											pEntry->IndexValue[2].Value.iValue = insArray3[k];
											pEntry->IndexCount = 3;

											/* init the value array */
											CcspUtilInitMibValueArray(&pThisObject->MibObjQueue, &pEntry->MibValueQueue);

											/* retrieve values from back-end Component */
											if(!tableGroupGetCosaValues(pThisObject, pEntry))
											{
												AnscTraceError(("Failed to get COSA values.\n"));
											}
										}

                                        if (insArray3)
                                            free(insArray3);
									}
								}
                                pSLinkEntry = AnscQueueSearchEntryByIndex(&pThisObject->IndexMapQueue,1);
                                pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);
							}

                            if (insArray2)
                                free(insArray2);
						}
					}
                    pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->IndexMapQueue);
                    pIndexMap   = ACCESS_CCSP_INDEX_MAPPING(pSLinkEntry);
				}

                if (insArray1)
                    free(insArray1);
			}
			else
			{
				AnscTraceInfo(("Unsupported MIB index mapping type: %ld\n", pIndexMap->uMapType));
			}
		}
	}

#endif

	return 0;
}
ANSC_STATUS
AnscLpccoConnTimerInvoke
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_LPC_CONNECTOR_OBJECT      pMyObject    = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject;
    PANSC_CPC_INTERFACE             pAnscCpcIf   = (PANSC_CPC_INTERFACE       )pMyObject->hAnscCpcIf;
    PANSC_LPC_PARTY_ADDR            pPartyAddr   = (PANSC_LPC_PARTY_ADDR      )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = (PSINGLE_LINK_ENTRY        )NULL;
    ULONG                           i            = 0;

    if ( !pMyObject->bActive )
    {
        return  ANSC_STATUS_SUCCESS;
    }

    AnscAcquireLock(&pMyObject->PartyTableLock);

    for ( i = 0; i < ANSC_LPCCO_PARTY_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->PartyTable[i]);

        while ( pSLinkEntry )
        {
            pPartyAddr  = ACCESS_ANSC_LPC_PARTY_ADDR(pSLinkEntry);
            pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

            if ( pPartyAddr->Timestamp == 0 )
            {
                continue;
            }
            else if ( (pPartyAddr->PartyState & ANSC_LPC_PARTY_STATE_connectedIn ) ||
                      (pPartyAddr->PartyState & ANSC_LPC_PARTY_STATE_connectedOut) )
            {
                continue;
            }
            else if ( pPartyAddr->PartyType == ANSC_LPC_PARTY_TYPE_manager )
            {
                if ( (pMyObject->LpcOpmode  == ANSC_LPC_OPMODE_CLIENT) &&
                     (pMyObject->bConnected == TRUE                  ) )
                {
                    pMyObject->bConnected = FALSE;
                }

                continue;
            }
            else if ( pPartyAddr->PartyType != ANSC_LPC_PARTY_TYPE_client )
            {
                continue;
            }
            else if ( pPartyAddr->RefCount > 0 )
            {
                continue;
            }

            AnscQueuePopEntryByLink(&pMyObject->PartyTable[i], &pPartyAddr->Linkage);

            if ( TRUE )
            {
                returnStatus =
                    pAnscCpcIf->NotifyEvent
                        (
                            pAnscCpcIf->hOwnerContext,
                            ANSC_CPC_EVENT_DISCONNECTED,
                            (ANSC_HANDLE)pPartyAddr
                        );
            }

            AnscFreeMemory(pPartyAddr);
        }
    }

    AnscReleaseLock(&pMyObject->PartyTableLock);

    if ( (pMyObject->LpcOpmode  == ANSC_LPC_OPMODE_CLIENT) &&
         (pMyObject->bConnected == FALSE                 ) )
    {
        returnStatus = pMyObject->ConnectToManager((ANSC_HANDLE)pMyObject);
    }

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
BwrmEcoRamForcePageCache
    (
        ANSC_HANDLE                 hThisObject,
        char*                       page_path,
        BOOL                        bCachedForced
    )
{
    ANSC_STATUS                     returnStatus     = ANSC_STATUS_SUCCESS;
    PBWRM_ENV_CONTROLLER_OBJECT     pMyObject        = (PBWRM_ENV_CONTROLLER_OBJECT  )hThisObject;
    PBWRM_ENV_CONTROLLER_PROPERTY   pProperty        = (PBWRM_ENV_CONTROLLER_PROPERTY)&pMyObject->Property;
    PSINGLE_LINK_ENTRY              pSLinkEntry      = (PSINGLE_LINK_ENTRY         )NULL;
    PBWRM_ENV_CACHE_FORCED_PAGE     pCacheForcedPage = (PBWRM_ENV_CACHE_FORCED_PAGE)NULL;
    BOOL                            bFound           = FALSE;
    ULONG                           ulLen            = AnscSizeOfString(page_path);

    AnscAcquireLock(&pMyObject->AccessLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->ForcedCachedPages);

    while ( pSLinkEntry )
    {
        pCacheForcedPage = ACCESS_BWRM_ENV_CACHE_FORCED_PAGE(pSLinkEntry);
        pSLinkEntry      = AnscQueueGetNextEntry(pSLinkEntry);

        if ( ulLen == AnscSizeOfString(pCacheForcedPage->PagePath) &&
             AnscEqualString2(pCacheForcedPage->PagePath, page_path, ulLen, FALSE) )
        {
            bFound = TRUE;
            break;
        }
    }

    if ( bFound && !bCachedForced )
    {
        /* remove it from the list */
        AnscQueuePopEntryByLink(&pMyObject->ForcedCachedPages, &pCacheForcedPage->Linkage);
    }
    else if ( bCachedForced && !bFound )
    {
        pCacheForcedPage = (PBWRM_ENV_CACHE_FORCED_PAGE)AnscAllocateMemory(sizeof(BWRM_ENV_CACHE_FORCED_PAGE));

        if ( pCacheForcedPage )
        {
            pCacheForcedPage->PagePath = AnscCloneString(page_path);

            if ( pCacheForcedPage->PagePath )
            {
                AnscQueuePushEntry(&pMyObject->ForcedCachedPages, &pCacheForcedPage->Linkage);
            }
            else
            {
                BwrmEnvRemoveCacheForcedPage(pCacheForcedPage);
            }
        }
    }

    AnscReleaseLock(&pMyObject->AccessLock);

    return  returnStatus;
}
ANSC_HANDLE
DslhObjroGetObjRecord2
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hTokenChain
    )
{
    ANSC_STATUS                     returnStatus        = ANSC_STATUS_SUCCESS;
    PDSLH_OBJ_RECORD_OBJECT         pMyObject           = (PDSLH_OBJ_RECORD_OBJECT    )hThisObject;
    PANSC_TOKEN_CHAIN               pObjNameTokens      = (PANSC_TOKEN_CHAIN          )hTokenChain;
    PANSC_STRING_TOKEN              pObjNameToken       = (PANSC_STRING_TOKEN         )NULL;
    PDSLH_OBJ_RECORD_OBJECT         pChildObjRecord     = (PDSLH_OBJ_RECORD_OBJECT    )NULL;
    PDSLH_OBJ_ENTITY_OBJECT         pChildObjEntity     = (PDSLH_OBJ_ENTITY_OBJECT    )NULL;
    PDSLH_OBJ_CONTROLLER_OBJECT     pChildObjController = (PDSLH_OBJ_CONTROLLER_OBJECT)NULL;
    PDSLH_OBJCO_TABLE_OBJECT        pChildObjcoTable    = (PDSLH_OBJCO_TABLE_OBJECT   )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry         = (PSINGLE_LINK_ENTRY         )NULL;
    BOOL                            bObjRecordFound     = FALSE;

    if ( !pObjNameTokens )
    {
        return  (ANSC_HANDLE)NULL;
    }
    else
    {
        pObjNameToken = AnscTcUnlinkToken(pObjNameTokens);
    }

    if ( !pObjNameToken )
    {
        return  (ANSC_HANDLE)NULL;
    }

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->ObjroQueue);

    while ( pObjNameToken->Name && pSLinkEntry )
    {
        pChildObjRecord = ACCESS_DSLH_OBJ_RECORD_OBJECT(pSLinkEntry);
        pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

        if ( pChildObjRecord->LastName && AnscEqualString
                (
                    pChildObjRecord->LastName,
                    pObjNameToken->Name,
                    TRUE
                ) )
        {
            bObjRecordFound = TRUE;

            break;
        }
    }

    AnscFreeMemory(pObjNameToken);

    if ( bObjRecordFound )
    {
        pChildObjEntity     = (PDSLH_OBJ_ENTITY_OBJECT    )pChildObjRecord->hDslhObjEntity;
        pChildObjController = (PDSLH_OBJ_CONTROLLER_OBJECT)pChildObjRecord->hDslhObjController;
        pChildObjcoTable    = (PDSLH_OBJCO_TABLE_OBJECT   )pChildObjController;

        if ( AnscTcGetTokenCount(pObjNameTokens) == 0 )
        {
            if ( pChildObjEntity->ObjDescr->bDynamic && pChildObjEntity->ObjDescr->Type == DSLH_CWMP_OBJECT_TYPE_table)
            {
                if ( pChildObjcoTable->IsUpdated((ANSC_HANDLE)pChildObjcoTable) )
                {
					AnscTrace("Delete and Repopulate the record in '%s'\n", pChildObjEntity->LastName);

                    pChildObjRecord->DelAllObjRecords  ((ANSC_HANDLE)pChildObjRecord);

                    pChildObjcoTable->Lock(pChildObjcoTable);
                    pChildObjRecord->PopulateObjRecords((ANSC_HANDLE)pChildObjRecord);
                    pChildObjRecord->PopulateVarRecords((ANSC_HANDLE)pChildObjRecord);
                    pChildObjcoTable->Unlock(pChildObjcoTable);

   				    AnscTrace("End of the repopulation in '%s'\n", pChildObjEntity->LastName);

                }
            }

            return  (ANSC_HANDLE)pChildObjRecord;
        }
        else
        {
            /*
             * If this obj record is a dynamic table object, we need to check whether the table
             * content has been updated. If it has, we need to remove all child objects and para-
             * meters under this object and re-populate them.
             */
            if ( pChildObjEntity->ObjDescr->bDynamic && pChildObjEntity->ObjDescr->Type == DSLH_CWMP_OBJECT_TYPE_table)
            {
                if ( pChildObjcoTable->IsUpdated((ANSC_HANDLE)pChildObjcoTable) )
                {
					AnscTrace("Delete and Repopulate the record in '%s'\n", pChildObjEntity->LastName);

                    pChildObjRecord->DelAllObjRecords  ((ANSC_HANDLE)pChildObjRecord);

                    pChildObjcoTable->Lock(pChildObjcoTable);
                    pChildObjRecord->PopulateObjRecords((ANSC_HANDLE)pChildObjRecord);
                    pChildObjRecord->PopulateVarRecords((ANSC_HANDLE)pChildObjRecord);
                    pChildObjcoTable->Unlock(pChildObjcoTable);

                    AnscTrace("End of the repopulation in '%s'\n", pChildObjEntity->LastName);

                }
            }

            return  pChildObjRecord->GetObjRecord2
                        (
                            (ANSC_HANDLE)pChildObjRecord,
                            (ANSC_HANDLE)pObjNameTokens
                        );
        }
    }

    return  (ANSC_HANDLE)NULL;
}
ANSC_HANDLE
AnscXmlDomNodeGetAttr
    (
        ANSC_HANDLE                 hThisObject,
        PUCHAR                      pAttrName
    )
{
    /***********************************************************
                    DEFINITION OF LOCAL VARIABLES
    ***********************************************************/

    /*
     * status of operation
     */
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;

    /*
     * pointer to the underneath Attributes and nodes
     */
    PSINGLE_LINK_ENTRY              pSLinkEntry      = NULL;
    PANSC_XML_ATTRIBUTE             pSonAttribute    = NULL;

    /*
     * pointer to the current parent node
     */
    PANSC_XML_DOM_NODE_OBJECT       pXmlNode      = (PANSC_XML_DOM_NODE_OBJECT)hThisObject;
    PANSC_XML_CONTEXT               pXMLContext   = NULL; /*RDKB-6188, CID-24302, initilize*/


    /***********************************************************
               SEARCH THE CHILD Attribute BY MATCHING NAME
    ***********************************************************/

    /*
     * the pointer of the parent node cannot be NULL
     */
    if ( !pXmlNode )
    {
        return  (ANSC_HANDLE)NULL;
    }
	pXMLContext = (PANSC_XML_CONTEXT)pXmlNode->hXMLContext; /*RDKB-6188, CID-24302, assign after null check*/

    AnscAcquireXmlLock(&pXmlNode->AttributesListLock);
    pSLinkEntry = AnscQueueGetFirstEntry(&pXmlNode->AttributesList);
    AnscReleaseXmlLock(&pXmlNode->AttributesListLock);

    while ( pSLinkEntry )
    {
        pSonAttribute    = ACCESS_XML_ATTRIBUTE(pSLinkEntry);

        if ( AnscEqualString(pSonAttribute->Name, pAttrName, TRUE) )
        {
            return  (ANSC_HANDLE)pSonAttribute;
        }

        AnscAcquireXmlLock(&pXmlNode->AttributesListLock);
        pSLinkEntry      = AnscQueueGetNextEntry(pSLinkEntry);
        AnscReleaseXmlLock(&pXmlNode->AttributesListLock);
    }

    return  (ANSC_HANDLE)NULL;
}
ANSC_HANDLE
Bmc2EnvcoGetCommandProperty
    (
        ANSC_HANDLE                 hThisObject,
        char*                       pCommandName,
        char*                       pDomainName
    )
{
    ANSC_STATUS                     returnStatus         = ANSC_STATUS_SUCCESS;
    PBMC2_ENV_CONTROLLER_OBJECT     pMyObject            = (PBMC2_ENV_CONTROLLER_OBJECT  )hThisObject;
    PBMC2_ENV_CONTROLLER_PROPERTY   pProperty            = (PBMC2_ENV_CONTROLLER_PROPERTY)&pMyObject->Property;
    PBMC2_COMMAND_PROPERTY          pBmc2CommandProperty = (PBMC2_COMMAND_PROPERTY       )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry          = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           ulHashIndex          = AnscHashString(pCommandName, AnscSizeOfString(pCommandName), BMC2_ENVCO_COMPO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->CompoTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->CompoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pBmc2CommandProperty = ACCESS_BMC2_COMMAND_PROPERTY(pSLinkEntry);
        pSLinkEntry          = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString
                (
                    pBmc2CommandProperty->CommandName,
                    pCommandName,
                    FALSE
                ) )
        {
            BOOL                    bDomainMatched = FALSE;

            /* check if the specified domain matches pattern defined in command property */
            if ( !pBmc2CommandProperty->DomainNamePattern || 
                 AnscEqualString(pBmc2CommandProperty->DomainNamePattern, "*", TRUE) )
            {
                bDomainMatched = TRUE;
            }
            else
            {
                char*               pStar = _ansc_strstr(pBmc2CommandProperty->DomainNamePattern, "*");

                if ( !pStar )
                {
                    bDomainMatched = 
                        AnscEqualString
                            (
                                pBmc2CommandProperty->DomainNamePattern, 
                                pDomainName, 
                                FALSE
                            );
                }
                else
                {
                    PANSC_TOKEN_CHAIN   pTokenChain  = (PANSC_TOKEN_CHAIN)NULL;
                    PANSC_STRING_TOKEN  pStringToken = (PANSC_STRING_TOKEN)NULL;
                    ULONG               ulCurPos     = 0;
                    char*               pCurDomain   = pDomainName;
                    char*               pSubStr      = NULL;
                    
                    bDomainMatched = TRUE;

                    pTokenChain =
                        AnscTcAllocate3
                            (
                                pBmc2CommandProperty->DomainNamePattern,
                                "*"
                            );

                    if(pTokenChain) /*RDKB-5887 , CID-24415, null check before use*/
                    {

                        while ( pStringToken = AnscTcUnlinkToken(pTokenChain) )
                        {
                            pSubStr = Bmc2EnvcoFindSubStrNoCase(pCurDomain, pStringToken->Name);

                            if ( !pSubStr )
                            {
                                bDomainMatched = FALSE;
                            }
                            else if ( pCurDomain == pDomainName && *pBmc2CommandProperty->DomainNamePattern != '*' )
                            {
                                if ( pSubStr != pCurDomain )
                                {
                                    bDomainMatched = FALSE;
                                }
                            }

                            if ( pSubStr )
                            {
                                pCurDomain = pSubStr + AnscSizeOfString(pStringToken->Name);    /* move to next part */
                            }

                            AnscFreeMemory(pStringToken);

                            if ( !bDomainMatched )
                            {
                                break;
                            }
                        }

                        AnscTcFree((ANSC_HANDLE)pTokenChain);

                    }

                }
            }

            if ( !bDomainMatched )
            {
                continue;
            }

            AnscReleaseLock(&pMyObject->CompoTableLock);

            return  (ANSC_HANDLE)pBmc2CommandProperty;
        }
    }

    AnscReleaseLock(&pMyObject->CompoTableLock);

    return  (ANSC_HANDLE)NULL;
}
ANSC_HANDLE
Bmc2EnvcoDelCommandProperty
    (
        ANSC_HANDLE                 hThisObject,
        char*                       pCommandName,
        char*                       pDomainNamePattern
    )
{
    ANSC_STATUS                     returnStatus         = ANSC_STATUS_SUCCESS;
    PBMC2_ENV_CONTROLLER_OBJECT     pMyObject            = (PBMC2_ENV_CONTROLLER_OBJECT  )hThisObject;
    PBMC2_ENV_CONTROLLER_PROPERTY   pProperty            = (PBMC2_ENV_CONTROLLER_PROPERTY)&pMyObject->Property;
    PBMC2_COMMAND_PROPERTY          pBmc2CommandProperty = (PBMC2_COMMAND_PROPERTY       )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry          = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           ulHashIndex          = AnscHashString(pCommandName, AnscSizeOfString(pCommandName), BMC2_ENVCO_COMPO_TABLE_SIZE);
    PBMC2_COMMAND_PROPERTY          pBmc2CommandRef      = (PBMC2_COMMAND_PROPERTY       )NULL;

    AnscAcquireLock(&pMyObject->CompoTableLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->CompoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pBmc2CommandProperty = ACCESS_BMC2_COMMAND_PROPERTY(pSLinkEntry);
        pSLinkEntry          = AnscQueueGetNextEntry(pSLinkEntry);

        if ( AnscEqualString
                (
                    pBmc2CommandProperty->CommandName,
                    pCommandName,
                    FALSE
                ) )
        {
            BOOL                    bDomainMatched = FALSE;

            /* check if the specified domain matches pattern defined in command property */
            if ( !pDomainNamePattern && !pBmc2CommandProperty->DomainNamePattern )
            {
                bDomainMatched = TRUE;
            }
            else if ( !pDomainNamePattern && pBmc2CommandProperty->DomainNamePattern )
            {
                if ( AnscEqualString(pBmc2CommandProperty->DomainNamePattern, "*", TRUE) )
                {
                    bDomainMatched = TRUE;
                }
            }
            else if ( !pBmc2CommandProperty->DomainNamePattern || 
                 AnscEqualString(pBmc2CommandProperty->DomainNamePattern, "*", TRUE) )
            {
                if ( !pDomainNamePattern || AnscEqualString(pDomainNamePattern, "*", TRUE) )
                {
                    bDomainMatched = TRUE;
                }
            }
            else
            {
                ULONG               ulDNLen      = AnscSizeOfString(pBmc2CommandProperty->DomainNamePattern);
                ULONG               ulCmdDNLen   = AnscSizeOfString(pDomainNamePattern);
                ULONG               ulCmpLen     = (ulDNLen > ulCmdDNLen) ? ulCmdDNLen : ulDNLen;

                if ( !pBmc2CommandRef && AnscEqualString2(pDomainNamePattern, pBmc2CommandProperty->DomainNamePattern, ulCmpLen, FALSE) )
                {
                    pBmc2CommandRef = pBmc2CommandProperty;
                }
                else if ( !pBmc2CommandRef && 
                          (!pBmc2CommandProperty->DomainNamePattern || 
                            AnscEqualString(pBmc2CommandProperty->DomainNamePattern, "*", TRUE)) )
                {
                    pBmc2CommandRef = pBmc2CommandProperty;
                }
                else
                {
                    BOOL                bEndWithStar = (pBmc2CommandProperty->DomainNamePattern[ulDNLen - 1] == '*');

                    if ( bEndWithStar &&
                         AnscEqualString2(pDomainNamePattern, pBmc2CommandProperty->DomainNamePattern, ulDNLen - 1, FALSE) )
                    {
                        pBmc2CommandRef = pBmc2CommandProperty;
                    }
                }

                bDomainMatched = 
                    AnscEqualString
                        (
                            pBmc2CommandProperty->DomainNamePattern, 
                            pDomainNamePattern, 
                            FALSE
                        );
            }

            if ( !bDomainMatched )
            {
                continue;
            }

            AnscQueuePopEntryByLink(&pMyObject->CompoTable[ulHashIndex], &pBmc2CommandProperty->Linkage);

            AnscReleaseLock(&pMyObject->CompoTableLock);

            Bmc2FreeCommandProperty(pBmc2CommandProperty);

            return  (ANSC_HANDLE)NULL;
        }
    }

    AnscReleaseLock(&pMyObject->CompoTableLock);

    return  (ANSC_HANDLE)pBmc2CommandRef;
}
ANSC_STATUS
DslhWmpdoMonitorTimerInvoke
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus       = ANSC_STATUS_SUCCESS;
    PDSLH_WMP_DATABASE_OBJECT       pMyObject          = (PDSLH_WMP_DATABASE_OBJECT  )hThisObject;
    PDSLH_WMP_DATABASE_PROPERTY     pProperty          = (PDSLH_WMP_DATABASE_PROPERTY)&pMyObject->Property;
    PDSLH_CPE_CONTROLLER_OBJECT     pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT)pMyObject->hDslhCpeController;
    PDSLH_WMPDO_MONITOR_PARAM       pMonitorParam      = (PDSLH_WMPDO_MONITOR_PARAM  )NULL;
    PDSLH_VAR_RECORD_OBJECT         pDslhVarRecord     = (PDSLH_VAR_RECORD_OBJECT    )NULL;
    PDSLH_VAR_ENTITY_OBJECT         pDslhVarEntity     = (PDSLH_VAR_ENTITY_OBJECT    )NULL;
    PDSLH_CWMP_PARAM_DESCR          pParamDesp         = (PDSLH_CWMP_PARAM_DESCR     )NULL;
    PSLAP_VARIABLE                  pNewParamValue     = (PSLAP_VARIABLE             )NULL;
    BOOL                            bValueNotUpdated   = (BOOL                       )TRUE;
    char*                           pParamFullName     = (char*                      )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry        = (PSINGLE_LINK_ENTRY         )NULL;
    BOOL                            bActiveNotify      = FALSE;
    int                             oldValue           = 0; /* Only for notification with threshold */
    int                             newValue           = 0; /* Only for notification with threshold */

    AnscAcquireLock(&pMyObject->MpoQueueLock);

    pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->MpoQueue);

    while ( pSLinkEntry )
    {
        pMonitorParam  = ACCESS_DSLH_WMPDO_MONITOR_PARAM(pSLinkEntry);
        pDslhVarRecord = (PDSLH_VAR_RECORD_OBJECT)pMonitorParam->hVarRecord;
        pSLinkEntry    = AnscQueueGetNextEntry(pSLinkEntry);

        /*
         * DO NOT synchronize the value if value-changing is in progress...
         */
        if ( pDslhVarRecord->TempParamValue )
        {
            continue;
        }

        /*
         * DO NOT synchronize the value if the active notification parameter is rate-regulated and
         * the last update was notified less than "NotificationLimit" seconds ago.
         */
        if ( (pDslhVarRecord->Notification      == DSLH_CWMP_NOTIFICATION_active) &&
             (pMonitorParam ->NotificationLimit >  0                            ) )
        {
            if ( (AnscGetTickInSeconds() - pMonitorParam->Timestamp) < pMonitorParam->NotificationLimit )
            {
                continue;
            }
        }

        if ( pMonitorParam->PreviousValue )
        {
            pNewParamValue   = pDslhVarRecord->GetValue((ANSC_HANDLE)pDslhVarRecord);
            bValueNotUpdated = TRUE;

            if ( !pNewParamValue )
            {
                continue;
            }
            else
            {
            	SlapEqualVariables(pMonitorParam->PreviousValue, pNewParamValue, bValueNotUpdated);
            }

            if ( !bValueNotUpdated )
            {
                /* Notificatoin with threshold check */
                pDslhVarEntity = (PDSLH_VAR_ENTITY_OBJECT)pDslhVarRecord->hDslhVarEntity;
                pParamDesp     = (PDSLH_CWMP_PARAM_DESCR )pDslhVarEntity->ParamDescr;
                
                if ( pParamDesp && pParamDesp->bThresholdEnabled == TRUE )
                {
                    oldValue  = pMonitorParam ->PreviousValue->Variant.varInt;
                    newValue  = pNewParamValue->Variant.varInt;
                    
                    if ( 
                           (oldValue < pParamDesp->NotifyThresholdMin && newValue < pParamDesp->NotifyThresholdMin) ||
                           (oldValue > pParamDesp->NotifyThresholdMax && newValue > pParamDesp->NotifyThresholdMax) ||
                           (oldValue >= pParamDesp->NotifyThresholdMin && oldValue <= pParamDesp->NotifyThresholdMax && newValue >= pParamDesp->NotifyThresholdMin && newValue <= pParamDesp->NotifyThresholdMax)
                       )
                    {
                        if ( pMonitorParam->PreviousValue )
                        {
                            SlapFreeVariable(pMonitorParam->PreviousValue);
                        }
                        
                        pMonitorParam->PreviousValue = pNewParamValue;
                        continue;
                    }
                }
                
                /* save the previous value as old */
                if( pDslhVarRecord->OldParamValue != NULL)
                {
                    SlapFreeVariable(pDslhVarRecord->OldParamValue);
                }

                pDslhVarRecord->OldParamValue = pMonitorParam->PreviousValue;
                /* SlapFreeVariable(pMonitorParam->PreviousValue); */

                pMonitorParam->PreviousValue = pNewParamValue;
                pParamFullName               = pDslhVarRecord->GetFullName((ANSC_HANDLE)pDslhVarRecord);

                if ( pParamFullName )
                {
                    bActiveNotify |= (pDslhVarRecord->Notification == DSLH_CWMP_NOTIFICATION_active);					 
                    pMonitorParam->Timestamp = AnscGetTickInSeconds();

                    pDslhVarRecord->NotifyValueChanged(pDslhVarRecord);

                    AnscTraceWarning(("DslhWmpdoMonitorTimerInvoke - value change detected on parameter <%s>.\n", pParamFullName));
					pDslhVarRecord->ReqSenderID = 0;
					pMonitorParam->PreviousValue->ReqSenderID = 0;
                    AnscFreeMemory(pParamFullName);
                }
            }
            else
            {
                SlapFreeVariable(pNewParamValue);
            }
        }
        else
        {
            pMonitorParam->PreviousValue = pDslhVarRecord->GetValue((ANSC_HANDLE)pDslhVarRecord);
        }
    }

    AnscReleaseLock(&pMyObject->MpoQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
BspTemplateListCORemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PBSP_TEMPLATE_LIST_OBJECT       pMyObject    = (PBSP_TEMPLATE_LIST_OBJECT)hThisObject;
    PBSP_TEMPLATE_READER_OBJECT     pReader      = (PBSP_TEMPLATE_READER_OBJECT)pMyObject->hReader;
    PANSC_PTR_ARRAY_OBJECT          pPtrArray;
    ULONG                           ulSize, i;
    PBSP_TEMPLATE_OBJECT            pTemplate;
    char                            *pName;
    PSINGLE_LINK_ENTRY              pSLinkEntry, pSLinkNext;
    PBSP_TEMPLATE_REG_PAGE_INFO     pInfo;

    if ( pMyObject->hList )
    {
        pPtrArray   = (PANSC_PTR_ARRAY_OBJECT)pMyObject->hList;
        ulSize      = pPtrArray->GetSize((ANSC_HANDLE)pPtrArray);
        for (i = 0; i < ulSize; i ++)
        {
            pTemplate   = (PBSP_TEMPLATE_OBJECT)pPtrArray->GetAt((ANSC_HANDLE)pPtrArray, i);
            if (pTemplate)
                pTemplate->Remove((ANSC_HANDLE)pTemplate);
        }
        pPtrArray->Remove((ANSC_HANDLE)pPtrArray);
    }

    /* loaded templates list */
    if ( pMyObject->hLoadedTemplatesList )
    {
        pPtrArray   = (PANSC_PTR_ARRAY_OBJECT)pMyObject->hLoadedTemplatesList;
        ulSize      = pPtrArray->GetSize((ANSC_HANDLE)pPtrArray);
        for (i = 0; i < ulSize; i ++)
        {
            pName   = (char *)pPtrArray->GetAt((ANSC_HANDLE)pPtrArray, i);
            AnscFreeMemory(pName);
        }
        pPtrArray->Remove((ANSC_HANDLE)pPtrArray);
    }

    /* remove registered templates */
    for (i = 0; i < BSP_TEMPLATE_LIST_REG_TABLE_SIZE; i ++)
    {
        pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->RegTemplateTable[i]);

        while (pSLinkEntry)
        {
            pSLinkNext  = AnscQueueGetNextEntry(pSLinkEntry);
            pInfo       = ACCESS_BSP_TEMPLATE_REG_PAGE_INFO(pSLinkEntry);

            AnscFreeMemory(pInfo->pName);
            AnscFreeMemory(pInfo);

            pSLinkEntry = pSLinkNext;
        }
    }

    if (pReader)
        pReader->Close((ANSC_HANDLE)pReader);

    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
/**********************************************************************

    prototype:

		int
		CcspTableHelperRefreshCache
			(
				ANSC_HANDLE                 hThisObject
			);

    description:

        One of the cache handler function to load values for cache.

    argument:   ANSC_HANDLE				hThisObject
	            The handle of the object;

	return:     The result of refresh cache

**********************************************************************/
static
BOOL
tableGroupGetCosaValues
	(
		ANSC_HANDLE					hThisObject, 
		PCCSP_TABLE_ENTRY			pEntry
	)
{
	PCCSP_TABLE_HELPER_OBJECT       pThisObject     = (PCCSP_TABLE_HELPER_OBJECT)hThisObject;
	int								size			= 0;
	parameterValStruct_t**			paramValues	    = NULL;
	parameterValStruct_t*			pValue          = NULL;
	int								i				= 0;
	int								j               = 0;
	char*                           CacheDMName[MAXI_MIB_COUNT_IN_GROUP]  = { 0 };        
	ULONG                           CacheMibOid[MAXI_MIB_COUNT_IN_GROUP]  = { 0 };        
	ULONG							nCacheMibCount  = 0;
	char							pTemp[256]      = { 0 };
	PCCSP_MIB_MAPPING				pMibMap			= (PCCSP_MIB_MAPPING)NULL;
	PSINGLE_LINK_ENTRY              pSLinkEntry     = (PSINGLE_LINK_ENTRY)NULL;
	PCCSP_MIB_VALUE					pMibValue       = (PCCSP_MIB_VALUE)NULL;
	BOOL							bReturn         = FALSE;

	pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->MibObjQueue);

	while ( pSLinkEntry )
	{
		pMibMap         = ACCESS_CCSP_MIB_MAPPING(pSLinkEntry);
		pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

		if( pMibMap != NULL && pMibMap->bHasMapping)
		{
			/* add the DM name to cache array */
			if(nCacheMibCount < MAXI_MIB_COUNT_IN_GROUP)
			{
				if( pEntry->IndexCount == 1)
				{
					_ansc_sprintf(pTemp, pMibMap->Mapping.pDMName, 
                            pEntry->IndexValue[0].Value.iValue);
				}
				else if( pEntry->IndexCount == 2)
				{
					_ansc_sprintf(pTemp, pMibMap->Mapping.pDMName,
                            pEntry->IndexValue[0].Value.iValue,
                            pEntry->IndexValue[1].Value.iValue);
				}
				else if( pEntry->IndexCount == 3)
				{
					_ansc_sprintf(pTemp, pMibMap->Mapping.pDMName,
                            pEntry->IndexValue[0].Value.iValue,
                            pEntry->IndexValue[1].Value.iValue,
                            pEntry->IndexValue[2].Value.iValue);
				}
				else if( pEntry->IndexCount == 4)
				{
					_ansc_sprintf(pTemp, pMibMap->Mapping.pDMName,
                            pEntry->IndexValue[0].Value.iValue,
                            pEntry->IndexValue[1].Value.iValue,
                            pEntry->IndexValue[2].Value.iValue,
                            pEntry->IndexValue[3].Value.iValue);
				}

				CacheDMName[nCacheMibCount] = AnscCloneString(pTemp);
				CacheMibOid[nCacheMibCount] = pMibMap->MibInfo.uLastOid;
				nCacheMibCount ++;

				AnscTraceInfo(("Add cache: %s\n", pTemp));
			}
		}
	}

#if 0
	if( !Cosa_GetParamValues(pThisObject->pCcspComp, pThisObject->pCcspPath, CacheDMName, nCacheMibCount, &size, &paramValues))
	{
		AnscTraceError(("Failed to get value from CCSP components.\n"));
		goto EXIT;
	}

	/* put them in the value array */
	for( i = 0; i< size; i ++)
	{
		pValue = paramValues[i];

        if (pValue->parameterName && pValue->parameterValue)
            CcspTraceDebug(("  %s %s\n", pValue->parameterName, pValue->parameterValue));

		for( j= 0; j < nCacheMibCount; j ++)
		{
			if( pValue->parameterName != NULL && AnscEqualString(pValue->parameterName, CacheDMName[j], TRUE))
			{
				pMibValue = CcspUtilLookforMibValueObjWithOid(&pEntry->MibValueQueue, CacheMibOid[j]);
				pMibMap   = CcspUtilLookforMibMapWithOid(&pThisObject->MibObjQueue, CacheMibOid[j]);

				if( pMibValue != NULL && pMibMap != NULL)
				{
					/* Copy the value */
					CcspUtilDMValueToMIB(pMibMap, pMibValue, (int)pValue->type, (char*)pValue->parameterValue);
				}
			}
		}
	}

	/* free the parameter values */
	Cosa_FreeParamValues(size, paramValues);


#else
	/* put them in the value array */
	for( i = 0; i< nCacheMibCount; i ++)
	{
		size = 0;
		paramValues = NULL;

		/* get value one by one instead all to bypass any parameter with error */
		if( !Cosa_GetParamValues(pThisObject->pCcspComp, pThisObject->pCcspPath, &CacheDMName[i], 1, &size, &paramValues))
		{
			AnscTraceError(("Failed to get value of '%s'\n", CacheDMName[i]));
		}
		else
		{
			pValue = paramValues[0];

			if (pValue->parameterName && pValue->parameterValue)
				CcspTraceDebug(("  %s %s\n", pValue->parameterName, pValue->parameterValue));

			pMibValue = CcspUtilLookforMibValueObjWithOid(&pEntry->MibValueQueue, CacheMibOid[i]);
			pMibMap   = CcspUtilLookforMibMapWithOid(&pThisObject->MibObjQueue, CacheMibOid[i]);

			if( pMibValue != NULL && pMibMap != NULL)
			{
				/* Copy the value */
				CcspUtilDMValueToMIB(pMibMap, pMibValue, (int)pValue->type, (char*)pValue->parameterValue);
			}
		}

		/* free the parameter values */
		Cosa_FreeParamValues(size, paramValues);
	}

#endif

    bReturn = TRUE;

EXIT:

	for( i = 0; i < nCacheMibCount; i ++)
	{
		if( CacheDMName[i] != NULL)
		{
			AnscFreeMemory(CacheDMName[i]);
		}
	}

	return bReturn;
}
char*
HttpBmoGetHeaderValueByName2
    (
        ANSC_HANDLE                 hThisObject,
        char*                       name,
        ULONG                       ulIndex
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject    = (PHTTP_BASIC_MESSAGE_OBJECT   )hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE          )pMyObject->hHfpIf;
#ifndef _CCSP_CWMP_TCP_CONNREQ_HANDLER
    PHTTP_HELPER_CONTAINER_OBJECT   pHttpHco     = (PHTTP_HELPER_CONTAINER_OBJECT)pMyObject->hContainerContext;
#endif
    PHTTP_HEADER_FIELD              pHttpHfo     = NULL;
    char*                           pHttpHfValue = NULL;
    char*                           pHttpHfColon = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ULONG                           ulHeaderId   = HTTP_HEADER_ID_RESERVED;
    ULONG                           i            = 0;
    ULONG                           ulCount      = 0;

    ulHeaderId =
#ifdef _CCSP_CWMP_TCP_CONNREQ_HANDLER
        AnscHttpGetHeaderCode(name);
#else
        pHttpHco->GetHeaderId
            (
                (ANSC_HANDLE)pHttpHco,
                name
            );
#endif

    if ( ulHeaderId != HTTP_HEADER_ID_RESERVED )
    {
        return  pMyObject->GetHeaderValueById2((ANSC_HANDLE)pMyObject, ulHeaderId, ulIndex);
    }

    AnscAcquireLock(&pMyObject->HfoTableLock);

    for ( i = 0; i < HTTP_BMO_HFO_TABLE_SIZE; i++ )
    {
        pSLinkEntry = AnscQueueGetFirstEntry(&pMyObject->HfoTable[i]);

        while ( pSLinkEntry )
        {
            pHttpHfo    = ACCESS_HTTP_HEADER_FIELD(pSLinkEntry);
            pSLinkEntry = AnscQueueGetNextEntry(pSLinkEntry);

            if ( !(pHttpHfo->Flags & HTTP_FIELD_FLAG_LINE_PRESENT) )
            {
                continue;
            }
            else if ( AnscSizeOfString(pHttpHfo->HeaderLine) < AnscSizeOfString(name) )
            {
                continue;
            }
            else
            {
                pHttpHfColon = _ansc_strchr(pHttpHfo->HeaderLine, ':');
            }

            if ( !pHttpHfColon )
            {
                continue;
            }
            else if ( ((ULONG)pHttpHfColon - (ULONG)pHttpHfo->HeaderLine) != AnscSizeOfString(name) )
            {
                continue;
            }
            else if ( AnscEqualString2
                        (
                            pHttpHfo->HeaderLine,
                            name,
                            AnscSizeOfString(name),
                            FALSE
                        ) )
            {
                if ( ulCount != ulIndex )
                {
                    ulCount ++;
                    continue;
                }

                AnscReleaseLock(&pMyObject->HfoTableLock);

                AnscHttpGetHfValue(pHttpHfo->HeaderLine, AnscSizeOfString(pHttpHfo->HeaderLine), pHttpHfValue);

                return  pHttpHfValue;
            }
        }
    }

    AnscReleaseLock(&pMyObject->HfoTableLock);

    return  NULL;
}
/**********************************************************************

    prototype:

		int
		CcspScalarHelperRefreshCache
			(
				ANSC_HANDLE                 hThisObject
			);

    description:

        One of the cache handler function to load values for cache.

    argument:   ANSC_HANDLE				hThisObject
	            The handle of the object;

	return:     The result of refresh cache

**********************************************************************/
int
CcspScalarHelperRefreshCache
	(
        ANSC_HANDLE                 hThisObject
	)
{
	PCCSP_SCALAR_HELPER_OBJECT      pThisObject     = (PCCSP_SCALAR_HELPER_OBJECT)hThisObject;
	char*							pDMString       = pThisObject->pMibFilter;
	char*							pDestComp       = NULL;
	char*							pDestPath       = NULL;
	PCCSP_MIB_MAPPING				pMibMap			= (PCCSP_MIB_MAPPING)NULL;
	PSINGLE_LINK_ENTRY              pSLinkEntry     = (PSINGLE_LINK_ENTRY)NULL;
	char                            pTemp[256]      = { 0 };
	ULONG							uInsNumber      = 0;

	if( pDMString == NULL)
	{
		AnscTraceWarning(("No one DM param name is configured, no way to cache.\n"));

		return -1;
	}

	/* first time we need to figure out which component to talk with */
	if( !pThisObject->pCcspComp || !pThisObject->pCcspPath)
	{
		pThisObject->nCacheMibCount = 0;

		/* This is the first time, we need to get the corresponding CCSP component Info */
		if( _ansc_strstr(pDMString, "%d") != NULL || _ansc_strstr(pDMString, "=") != NULL)
		{
			/* filter mapping, will take care later */
			uInsNumber = CcspUtilDMFilterToNamespace(pDMString, &pThisObject->pCcspComp, &pThisObject->pCcspPath);
			
			if( uInsNumber == 0)
			{
				AnscTraceWarning(("Failed to find the entry who has '%s'\n", pDMString));

				return -1;
			}

			/* then add all the DM names in the CacheName array */
			pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->MibObjQueue);

			while ( pSLinkEntry )
			{
				pMibMap         = ACCESS_CCSP_MIB_MAPPING(pSLinkEntry);
				pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

				if( pMibMap != NULL && pMibMap->bHasMapping)
				{
					/* add the DM name to cache array */
					if(pThisObject->nCacheMibCount < MAXI_MIB_COUNT_IN_GROUP)
					{
						if( _ansc_strstr(pMibMap->Mapping.pDMName, "%d") != NULL)
						{
							AnscCopyString(pTemp, pMibMap->Mapping.pDMName);
							_ansc_sprintf(pMibMap->Mapping.pDMName, pTemp, uInsNumber);
						}

						pThisObject->CacheMibOid[pThisObject->nCacheMibCount]  = pMibMap->MibInfo.uLastOid;
						pThisObject->CacheDMName[pThisObject->nCacheMibCount]  = pMibMap->Mapping.pDMName;
						pThisObject->nCacheMibCount ++;

						CcspTraceDebug(("Adding to cache: lastOid %lu, DMName %s\n", pMibMap->MibInfo.uLastOid, pMibMap->Mapping.pDMName));
					}
				}
			}
		}
		else
		{
			if( !Cosa_FindDestComp(pDMString, &pThisObject->pCcspComp, &pThisObject->pCcspPath) )
			{
				AnscTraceWarning(("Failed to find the CCSP component who supports '%s'\n", pDMString));

				return -1;
			}

			/* verify the other MIB mappings to be in the same Component */
			pSLinkEntry = AnscQueueGetFirstEntry(&pThisObject->MibObjQueue);

			while ( pSLinkEntry )
			{
				pMibMap         = ACCESS_CCSP_MIB_MAPPING(pSLinkEntry);
				pSLinkEntry     = AnscQueueGetNextEntry(pSLinkEntry);

				pDestComp       = NULL;
				pDestPath       = NULL;

				if(Cosa_FindDestComp(pMibMap->Mapping.pDMName, &pDestComp, &pDestPath))
				{
					if(!AnscEqualString(pDestComp, pThisObject->pCcspComp, TRUE) || !AnscEqualString(pDestPath, pThisObject->pCcspPath, TRUE))
					{
						AnscTraceError(("Different Ccsp Component '%s' for DM namespace '%s', Error!\n", pDestComp, pMibMap->Mapping.pDMName));
					}
					else
					{
						/* add the DM name to cache array */
						if(pThisObject->nCacheMibCount < MAXI_MIB_COUNT_IN_GROUP)
						{
							pThisObject->CacheMibOid[pThisObject->nCacheMibCount]  = pMibMap->MibInfo.uLastOid;
							pThisObject->CacheDMName[pThisObject->nCacheMibCount]  = pMibMap->Mapping.pDMName;
							pThisObject->nCacheMibCount ++;

							CcspTraceDebug(("Adding to cache: lastOid %lu, DMName %s\n", pMibMap->MibInfo.uLastOid, pMibMap->Mapping.pDMName));
						}
					}
				}
				else
				{
					AnscTraceError(("Unable to find the component to support DM namespace '%s', Error!\n", pMibMap->Mapping.pDMName));
				}

				if( pDestComp){   AnscFreeMemory(pDestComp); pDestComp = NULL;}
				if( pDestPath){   AnscFreeMemory(pDestPath); pDestPath = NULL;}
			}
		}
	}

	if( pThisObject->nCacheMibCount == 0)
	{
		AnscTraceError(("No one mib is register in the cache, just exit.\n"));

		return -1;
	}

	/* Get all the values in the cache */
	if( TRUE )
	{
		int                       size			= 0;
		parameterValStruct_t**    paramValues	= NULL;
		parameterValStruct_t*	  pValue        = NULL;
		int						  i				= 0;
		int						  j             = 0;
		PCCSP_MIB_VALUE			  pMibValue     = (PCCSP_MIB_VALUE)NULL;
		PCCSP_MIB_MAPPING	      pMapping      = (PCCSP_MIB_MAPPING)NULL;

		if( !Cosa_GetParamValues(pThisObject->pCcspComp, pThisObject->pCcspPath, pThisObject->CacheDMName, pThisObject->nCacheMibCount, &size, &paramValues))
		{
			return -1;
		}

        CcspTraceDebug(("Cosa_GetParamValues:\n"));

		/* put them in the value array */
		for( i = 0; i< size; i ++)
		{
			pValue = paramValues[i];

            if (pValue->parameterName && pValue->parameterValue)
                CcspTraceDebug(("  %s %s\n", pValue->parameterName, pValue->parameterValue));

			for( j= 0; j < pThisObject->nCacheMibCount; j ++)
			{
				if( pValue->parameterName != NULL && AnscEqualString(pValue->parameterName, pThisObject->CacheDMName[j], TRUE))
				{
					pMibValue = CcspUtilLookforMibValueObjWithOid(&pThisObject->MibValueQueue, pThisObject->CacheMibOid[j]);
					pMapping  = CcspUtilLookforMibMapWithOid(&pThisObject->MibObjQueue, pThisObject->CacheMibOid[j]);

					if( pMibValue != NULL && pMapping != NULL)
					{
						/* Copy the value */
						CcspUtilDMValueToMIB(pMapping, pMibValue, (int)pValue->type, (char*)pValue->parameterValue);
					}
				}
			}
		}

		/* free the parameter values */
		Cosa_FreeParamValues(size, paramValues);

	}

	return 0;
}