ANSC_STATUS
AnscLpccoImcEngage
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_LPC_CONNECTOR_OBJECT      pMyObject    = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject;

    returnStatus = pMyObject->Engage((ANSC_HANDLE)pMyObject);

    return  returnStatus;
}
ANSC_STATUS
SlapAmoEngage
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus       = ANSC_STATUS_SUCCESS;
    PSLAP_ACCESS_MANAGER_OBJECT     pMyObject          = (PSLAP_ACCESS_MANAGER_OBJECT  )hThisObject;
    PSLAP_ACCESS_MANAGER_PROPERTY   pProperty          = (PSLAP_ACCESS_MANAGER_PROPERTY)&pMyObject->Property;
    PSLAP_GOA_INTERFACE             pSlapGoaIf         = (PSLAP_GOA_INTERFACE          )pMyObject->hSlapGoaIf;
    PSLAP_ENV_CONTROLLER_OBJECT     pSlapEnvController = (PSLAP_ENV_CONTROLLER_OBJECT  )pMyObject->hSlapEnvController;
    PSLAP_LOAM_CLIENT_OBJECT        pSlapLoamClient    = (PSLAP_LOAM_CLIENT_OBJECT     )pMyObject->hSlapLoamClient;
    PSLAP_LOAM_SERVER_OBJECT        pSlapLoamServer    = (PSLAP_LOAM_SERVER_OBJECT     )pMyObject->hSlapLoamServer;
    PANSC_LPC_CONNECTOR_OBJECT      pAnscLpcConnector  = (PANSC_LPC_CONNECTOR_OBJECT   )pMyObject->hAnscLpcConnector;
#ifdef   _SLAP_IPC_USE_TCP_SOCKET
    PANSC_LPCCO_TCP_OBJECT          pAnscLpccoTcp      = (PANSC_LPCCO_TCP_OBJECT       )pAnscLpcConnector;
#else
    PANSC_LPCCO_UDP_OBJECT          pAnscLpccoUdp      = (PANSC_LPCCO_UDP_OBJECT       )pAnscLpcConnector;
#endif
    PSLAP_UOA_INTERFACE             pSlapUoaIf         = (PSLAP_UOA_INTERFACE          )pSlapEnvController->GetSlapUoaIf((ANSC_HANDLE)pSlapEnvController);
    char                            lpcPartyName[64];

    if ( pMyObject->bActive )
    {
        return  ANSC_STATUS_SUCCESS;
    }
    else if (  (pProperty->AggregationMode & SLAP_GOA_MODE_imcpServer ) &&
              !(pProperty->AggregationMode & SLAP_GOA_MODE_thisProcess) )
    {
        return  ANSC_STATUS_BAD_PARAMETER;
    }

    if ( TRUE )
    {
        if ( pProperty->AggregationMode & SLAP_GOA_MODE_enablePooling )
        {
            pSlapEnvController->BssSetPoolingFlag((ANSC_HANDLE)pSlapEnvController, TRUE);
        }
        else
        {
            pSlapEnvController->BssSetPoolingFlag((ANSC_HANDLE)pSlapEnvController, FALSE);
        }

        pSlapEnvController->Engage((ANSC_HANDLE)pSlapEnvController);
    }


    #ifdef  _ANSC_SLAP_LPC_

    if ( (pProperty->AggregationMode & SLAP_GOA_MODE_imcpClient) ||
         (pProperty->AggregationMode & SLAP_GOA_MODE_imcpServer) )
    {
        if ( !pAnscLpcConnector )
        {
#ifdef   _SLAP_IPC_USE_TCP_SOCKET
            pAnscLpcConnector =
                (PANSC_LPC_CONNECTOR_OBJECT)AnscCreateLpccoTcp
                    (
                        pMyObject->hContainerContext,
                        (ANSC_HANDLE)pMyObject,
                        (ANSC_HANDLE)NULL
                    );
#else
            pAnscLpcConnector =
                (PANSC_LPC_CONNECTOR_OBJECT)AnscCreateLpccoUdp
                    (
                        pMyObject->hContainerContext,
                        (ANSC_HANDLE)pMyObject,
                        (ANSC_HANDLE)NULL
                    );
#endif

            if ( !pAnscLpcConnector )
            {
                return  ANSC_STATUS_RESOURCES;
            }
            else
            {
                pMyObject->hAnscLpcConnector = (ANSC_HANDLE           )pAnscLpcConnector;
#ifdef   _SLAP_IPC_USE_TCP_SOCKET
                pAnscLpccoTcp                = (PANSC_LPCCO_TCP_OBJECT)pAnscLpcConnector;
#else
                pAnscLpccoUdp                = (PANSC_LPCCO_UDP_OBJECT)pAnscLpcConnector;
#endif
            }
        }

        if ( TRUE )
        {
            AnscZeroMemory(lpcPartyName, 64);

            _ansc_sprintf
                (
                    lpcPartyName,
                    "slapAccessManager-0x%x-0x%x@%d.%d.%d.%d",
                    (ULONG)AnscGetProcessId    (),
                    (ULONG)AnscGetCurTaskHandle(),
                    pProperty->MyAddress.Dot[0],
                    pProperty->MyAddress.Dot[1],
                    pProperty->MyAddress.Dot[2],
                    pProperty->MyAddress.Dot[3]
                );
        }

        pAnscLpcConnector->ImcSetLpcOpmode  ((ANSC_HANDLE)pAnscLpcConnector, ANSC_LPC_OPMODE_CLIENT       );
        pAnscLpcConnector->ImcSetPartyName  ((ANSC_HANDLE)pAnscLpcConnector, lpcPartyName                 );
#ifdef   _SLAP_IPC_USE_TCP_SOCKET
        pAnscLpccoTcp    ->SetMyPort        ((ANSC_HANDLE)pAnscLpccoTcp,     pProperty->LpcPartyPort      );
        pAnscLpccoTcp    ->SetMyAddress     ((ANSC_HANDLE)pAnscLpccoTcp,     pProperty->MyAddress.Dot     );
        pAnscLpccoTcp    ->SetManagerAddress((ANSC_HANDLE)pAnscLpccoTcp,     pProperty->ManagerAddress.Dot);
#else
        pAnscLpccoUdp    ->SetMyPort        ((ANSC_HANDLE)pAnscLpccoUdp,     pProperty->LpcPartyPort      );
        pAnscLpccoUdp    ->SetMyAddress     ((ANSC_HANDLE)pAnscLpccoUdp,     pProperty->MyAddress.Dot     );
        pAnscLpccoUdp    ->SetManagerAddress((ANSC_HANDLE)pAnscLpccoUdp,     pProperty->ManagerAddress.Dot);
#endif
        pAnscLpcConnector->Engage           ((ANSC_HANDLE)pAnscLpcConnector);
    }

    if ( pProperty->AggregationMode & SLAP_GOA_MODE_imcpClient )
    {
        if ( !pSlapLoamClient )
        {
            pSlapLoamClient =
                (PSLAP_LOAM_CLIENT_OBJECT)SlapCreateLoamClient
                    (
                        pMyObject->hContainerContext,
                        (ANSC_HANDLE)pMyObject,
                        (ANSC_HANDLE)NULL
                    );

            if ( !pSlapLoamClient )
            {
                return  ANSC_STATUS_RESOURCES;
            }
            else
            {
                pMyObject->hSlapLoamClient = (ANSC_HANDLE)pSlapLoamClient;
            }
        }

        if ( pProperty->AggregationMode & SLAP_GOA_MODE_mobilitySupport )
        {
            pSlapLoamClient->SetMobilityOn((ANSC_HANDLE)pSlapLoamClient, TRUE);
        }
        else
        {
            pSlapLoamClient->SetMobilityOn((ANSC_HANDLE)pSlapLoamClient, FALSE);
        }

        pSlapLoamClient->SetAnscLpcConnector((ANSC_HANDLE)pSlapLoamClient, (ANSC_HANDLE)pAnscLpcConnector);
        pSlapLoamClient->Engage             ((ANSC_HANDLE)pSlapLoamClient);
    }

    if ( pProperty->AggregationMode & SLAP_GOA_MODE_imcpServer )
    {
        if ( !pSlapLoamServer )
        {
            pSlapLoamServer =
                (PSLAP_LOAM_SERVER_OBJECT)SlapCreateLoamServer
                    (
                        pMyObject->hContainerContext,
                        (ANSC_HANDLE)pMyObject,
                        (ANSC_HANDLE)NULL
                    );

            if ( !pSlapLoamServer )
            {
                return  ANSC_STATUS_RESOURCES;
            }
            else
            {
                pMyObject->hSlapLoamServer = (ANSC_HANDLE)pSlapLoamServer;
            }
        }

        if ( pProperty->AggregationMode & SLAP_GOA_MODE_autoExport )
        {
            pSlapLoamServer->SetMobilityOn((ANSC_HANDLE)pSlapLoamServer, TRUE);
        }
        else
        {
            pSlapLoamServer->SetMobilityOn((ANSC_HANDLE)pSlapLoamServer, FALSE);
        }

        pSlapLoamServer->SetAnscLpcConnector((ANSC_HANDLE)pSlapLoamServer, (ANSC_HANDLE)pAnscLpcConnector);
        pSlapLoamServer->SetSlapUoaIf       ((ANSC_HANDLE)pSlapLoamServer, (ANSC_HANDLE)pSlapUoaIf       );
        pSlapLoamServer->Engage             ((ANSC_HANDLE)pSlapLoamServer);
    }

    #endif


    pMyObject->bActive = TRUE;

    return  ANSC_STATUS_SUCCESS;
}