ANSC_STATUS
BbhmDiageoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBBHM_DIAG_EXEC_OBJECT          pMyObject    = (PBBHM_DIAG_EXEC_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                          = BBHM_DIAG_EXEC_OID;
    pMyObject->Create                       = BbhmDiageoCreate;
    pMyObject->Remove                       = BbhmDiageoRemove;
    pMyObject->EnrollObjects                = BbhmDiageoEnrollObjects;
    pMyObject->Initialize                   = BbhmDiageoInitialize;

    pMyObject->bActive                      = FALSE;
    //pMyObject->hDslhDiagInfo                = (ANSC_HANDLE)NULL;
    pMyObject->bResultQueryRunning          = FALSE;

    AnscInitializeLock (&pMyObject->AccessLock);
    AnscInitializeEvent(&pMyObject->ResultQueryEvent);
    AnscInitializeEvent(&pMyObject->ResultQueryExitEvent);

    pMyObject->Reset                        = BbhmDiageoReset;

    pMyObject->Engage                       = BbhmDiageoEngage;
    pMyObject->Cancel                       = BbhmDiageoCancel;

    pMyObject->GetResult                    = BbhmDiageoGetResult;
    pMyObject->GetResultTimeStamp           = BbhmDiageoGetResultTimeStamp;
    pMyObject->SetDiagParams                = BbhmDiageoSetDiagParams;
    pMyObject->SetDiagState                 = BbhmDiageoSetDiagState;

    pMyObject->CopyDiagParams               = BbhmDiageoCopyDiagParams;
    pMyObject->CheckCanStart                = BbhmDiageoCheckCanStart;
    pMyObject->StartDiag                    = BbhmDiageoStartDiag;
    pMyObject->StopDiag                     = BbhmDiageoStopDiag;
    pMyObject->RetrieveResult               = BbhmDiageoRetrieveResult;

    pMyObject->ResultQueryTask              = BbhmDiageoResultQueryTask;

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 2
0
ANSC_STATUS
AnscSstoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PANSC_SIMPLE_SYS_TIME_OBJECT    pMyObject     = (PANSC_SIMPLE_SYS_TIME_OBJECT)hThisObject;


    /*
     * While in C++ you don't have to initialize all the member fields inherited from the base
     * class since the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    pMyObject->Oid                      = ANSC_SIMPLE_SYS_TIME_OID;
    pMyObject->Create                   = AnscSstoCreate;
    pMyObject->Remove                   = AnscSstoRemove;
    pMyObject->EnrollObjects            = AnscSstoEnrollObjects;
    pMyObject->Initialize               = AnscSstoInitialize;

    pMyObject->LastSecond               = ANSC_SSTO_SECONDS_FROM_1900_TO_1970;
    pMyObject->LastTick                 = AnscGetTickInSeconds();
    pMyObject->iTimeOffset              = 0;

    AnscInitializeLock       (&pMyObject->AccessLock       );



    pMyObject->GetStsIf                 = AnscSstoGetStsIf;
    pMyObject->Reset                    = AnscSstoReset;
    pMyObject->GetLastSecond            = AnscSstoGetLastSecond;
    pMyObject->GetLastTick              = AnscSstoGetLastTick;
    pMyObject->GetiTimeOffset           = AnscSstoGetiTimeOffset;
    pMyObject->SetiTimeOffset           = AnscSstoSetiTimeOffset;
    pMyObject->AcquireAccess            = AnscSstoAcquireAccess;
    pMyObject->ReleaseAccess            = AnscSstoReleaseAccess;
    pMyObject->GetCurrSecond            = AnscSstoGetCurrSecond;

    pMyObject->SecondToCalendar         = AnscSstoSecondToCalendar;
    pMyObject->SecondToLocalCalendar    = AnscSstoSecondToLocalCalendar;
    pMyObject->CalendarToSecond         = AnscSstoCalendarToSecond;
    pMyObject->GetWeekDay               = AnscSstoGetWeekDay;
    pMyObject->LocalCalendarToSecond    = AnscSstoLocalCalendarToSecond;

    pMyObject->StsGetLocalTime          = AnscSstoStsGetLocalTime;
    pMyObject->StsGetCurSeconds         = AnscSstoStsGetCurSeconds;
    pMyObject->StsAdjustClock1          = AnscSstoStsAdjustClock1;
    pMyObject->StsAdjustClock2          = AnscSstoStsAdjustClock2;

    pMyObject->StsSecondsToCalendar     = AnscSstoStsSecondsToCalendar;
    pMyObject->StsCalendarToSeconds     = AnscSstoStsCalendarToSeconds;
    pMyObject->StsSysTickToCalendar     = AnscSstoStsSysTickToCalendar;


    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 3
0
ANSC_STATUS
WebUpoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PWEB_URI_PATH_OBJECT            pMyObject    = (PWEB_URI_PATH_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid              = WEB_URI_PATH_OID;
    pMyObject->Create           = WebUpoCreate;
    pMyObject->Remove           = WebUpoRemove;
    pMyObject->EnrollObjects    = WebUpoEnrollObjects;
    pMyObject->Initialize       = WebUpoInitialize;

    pMyObject->hResourceOwner   = (ANSC_HANDLE)NULL;
    pMyObject->HashIndex        = 0;

    pMyObject->IsRemoveable     = WebUpoIsRemoveable;
    pMyObject->GetPathName      = WebUpoGetPathName;
    pMyObject->SetPathName      = WebUpoSetPathName;
    pMyObject->GetResourceOwner = WebUpoGetResourceOwner;
    pMyObject->SetResourceOwner = WebUpoSetResourceOwner;
    pMyObject->Reset            = WebUpoReset;

    pMyObject->GetUriPath       = WebUpoGetUriPath;
    pMyObject->AddUriPath       = WebUpoAddUriPath;
    pMyObject->DelUriPath       = WebUpoDelUriPath;
    pMyObject->DelAllUriPaths   = WebUpoDelAllUriPaths;

    for ( i = 0; i < WEB_UPO_UPO_TABLE_SIZE; i++ )
    {
        AnscQueueInitializeHeader(&pMyObject->UpoTable[i]);
    }
    AnscInitializeLock(&pMyObject->UpoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
AnscOmoCreate
    (
        ANSC_HANDLE                 hOwnerContext
    )
{
    ANSC_STATUS                     returnStatus  = ANSC_STATUS_SUCCESS;
    PANSC_OBJECT_MAPPER_OBJECT      pObjectMapper = NULL;
    ULONG                           i             = 0;

    pObjectMapper = (PANSC_OBJECT_MAPPER_OBJECT)AnscAllocateMemory(sizeof(ANSC_OBJECT_MAPPER_OBJECT));

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

    pObjectMapper->hContainerContext   = (ANSC_HANDLE)NULL;
    pObjectMapper->hOwnerContext       = hOwnerContext;

    pObjectMapper->Create              = AnscOmoCreate;
    pObjectMapper->Remove              = AnscOmoRemove;
    pObjectMapper->Reset               = AnscOmoReset;

    pObjectMapper->GetContainerContext = AnscOmoGetContainerContext;
    pObjectMapper->SetContainerContext = AnscOmoSetContainerContext;

    pObjectMapper->RegisterObject      = AnscOmoRegisterObject;
    pObjectMapper->CreateObjectByName  = AnscOmoCreateObjectByName;
    pObjectMapper->CreateObjectByOid   = AnscOmoCreateObjectByOid;
    pObjectMapper->CreateObjectByType  = AnscOmoCreateObjectByType;
    pObjectMapper->GetObjectByRid      = AnscOmoGetObjectByRid;

    pObjectMapper->GetObjectsCount     = AnscOmoGetObjectsCount;
    pObjectMapper->Serialize           = AnscOmoSerialize;
    pObjectMapper->Interpret           = AnscOmoInterpret;

    pObjectMapper->AddDescriptor       = AnscOmoAddDescriptor;
    pObjectMapper->DelDescriptor       = AnscOmoDelDescriptor;
    pObjectMapper->DelAllDescriptors   = AnscOmoDelAllDescriptors;

    pObjectMapper->GetDescriptorByName = AnscOmoGetDescriptorByName;
    pObjectMapper->GetDescriptorByOid  = AnscOmoGetDescriptorByOid;
    pObjectMapper->GetDescriptorByType = AnscOmoGetDescriptorByType;

    for ( i = 0; i < DEFAULT_OD_TABLE_SIZE; i++ )
    {
        AnscSListInitializeHeader(&pObjectMapper->DescriptorTable[i]);
    }
    AnscInitializeLock(&pObjectMapper->DescriptorTableLock);

    return  (ANSC_HANDLE)pObjectMapper;
}
Exemplo n.º 5
0
ANSC_STATUS
SlapOcoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PSLAP_OBJ_CONTAINER_OBJECT      pMyObject    = (PSLAP_OBJ_CONTAINER_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                 = SLAP_OBJ_CONTAINER_OID;
    pMyObject->Create              = SlapOcoCreate;
    pMyObject->Remove              = SlapOcoRemove;
    pMyObject->EnrollObjects       = SlapOcoEnrollObjects;
    pMyObject->Initialize          = SlapOcoInitialize;

    pMyObject->hSlapUoaIf          = (ANSC_HANDLE)NULL;
    pMyObject->hSlapBssIf          = (ANSC_HANDLE)NULL;
    pMyObject->hSlapObjMapper      = (ANSC_HANDLE)NULL;
    pMyObject->ContainerName       = NULL;
    pMyObject->GlobalInsId         = 0;
    pMyObject->HashIndex           = 0;

    pMyObject->GetSlapUoaIf        = SlapOcoGetSlapUoaIf;
    pMyObject->SetSlapUoaIf        = SlapOcoSetSlapUoaIf;
    pMyObject->GetSlapBssIf        = SlapOcoGetSlapBssIf;
    pMyObject->SetSlapBssIf        = SlapOcoSetSlapBssIf;
    pMyObject->GetSlapObjMapper    = SlapOcoGetSlapObjMapper;
    pMyObject->SetSlapObjMapper    = SlapOcoSetSlapObjMapper;
    pMyObject->GetContainerName    = SlapOcoGetContainerName;
    pMyObject->SetContainerName    = SlapOcoSetContainerName;
    pMyObject->GetContainerType    = SlapOcoGetContainerType;
    pMyObject->SetContainerType    = SlapOcoSetContainerType;
    pMyObject->Reset               = SlapOcoReset;

    pMyObject->AssignInstanceId    = SlapOcoAssignInstanceId;
    pMyObject->GetSrvComponent     = SlapOcoGetSrvComponent;
    pMyObject->AddSrvComponent     = SlapOcoAddSrvComponent;
    pMyObject->DelSrvComponent     = SlapOcoDelSrvComponent;
    pMyObject->DelAllSrvComponents = SlapOcoDelAllSrvComponents;

    for ( i = 0; i < SLAP_OCO_SCO_TABLE_SIZE; i++ )
    {
        AnscQueueInitializeHeader(&pMyObject->ScoTable[i]);
    }
    AnscInitializeLock(&pMyObject->ScoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 6
0
ANSC_STATUS
WebRooInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PWEB_RESOURCE_OWNER_OBJECT      pMyObject    = (PWEB_RESOURCE_OWNER_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                  = WEB_RESOURCE_OWNER_OID;
    pMyObject->Create               = WebRooCreate;
    pMyObject->Remove               = WebRooRemove;
    pMyObject->EnrollObjects        = WebRooEnrollObjects;
    pMyObject->Initialize           = WebRooInitialize;

    pMyObject->hAuthServer          = NULL;
    pMyObject->hHfpIf               = (ANSC_HANDLE)NULL;
    pMyObject->bActive              = FALSE;

    pMyObject->GetAuthServer        = WebRooGetAuthServer;
    pMyObject->GetHfpIf             = WebRooGetHfpIf;
    pMyObject->SetHfpIf             = WebRooSetHfpIf;
    pMyObject->GetRcpIf             = WebRooGetRcpIf;
    pMyObject->GetPathName          = WebRooGetPathName;
    pMyObject->SetPathName          = WebRooSetPathName;
    pMyObject->IsDefaultOwner       = WebRooIsDefaultOwner;
    pMyObject->GetProperty          = WebRooGetProperty;
    pMyObject->SetProperty          = WebRooSetProperty;
    pMyObject->ResetProperty        = WebRooResetProperty;
    pMyObject->Reset                = WebRooReset;

    pMyObject->AcquireAccess        = WebRooAcquireAccess;
    pMyObject->ReleaseAccess        = WebRooReleaseAccess;
    pMyObject->Engage               = WebRooEngage;
    pMyObject->Cancel               = WebRooCancel;

    pMyObject->Query                = WebRooQuery;
    pMyObject->Process              = WebRooProcess;

    pMyObject->DoOptions            = WebRooDoOptions;
    pMyObject->DoGet                = WebRooDoGet;
    pMyObject->DoHead               = WebRooDoHead;
    pMyObject->DoPost               = WebRooDoPost;
    pMyObject->DoPut                = WebRooDoPut;
    pMyObject->DoDelete             = WebRooDoDelete;
    pMyObject->DoTrace              = WebRooDoTrace;
    pMyObject->DoConnect            = WebRooDoConnect;

    pMyObject->DoNotify             = WebRooDoNotify;
    pMyObject->DoSearch             = WebRooDoSearch;
    pMyObject->DoMSearch            = WebRooDoMSearch;
    pMyObject->DoMPost              = WebRooDoMPost;
    pMyObject->DoSubscribe          = WebRooDoSubscribe;
    pMyObject->DoUnsubscribe        = WebRooDoUnsubscribe;

    pMyObject->ReplyReq             = WebRooReplyReq;
    pMyObject->Reply300             = WebRooReply300;
    pMyObject->Reply301             = WebRooReply301;
    pMyObject->Reply302             = WebRooReply302;
    pMyObject->Reply303             = WebRooReply303;
    pMyObject->Reply304             = WebRooReply304;
    pMyObject->Reply305             = WebRooReply305;
    pMyObject->Reply307             = WebRooReply307;
    pMyObject->Reply400             = WebRooReply400;
    pMyObject->Reply403             = WebRooReply403;
    pMyObject->Reply404             = WebRooReply404;
    pMyObject->Reply405             = WebRooReply405;
    pMyObject->Reply409             = WebRooReply409;
    pMyObject->Reply410             = WebRooReply410;
    pMyObject->Reply415             = WebRooReply415;
    pMyObject->Reply417             = WebRooReply417;
    pMyObject->Reply500             = WebRooReply500;
    pMyObject->Reply501             = WebRooReply501;
    pMyObject->Reply503             = WebRooReply503;
    pMyObject->Reply505             = WebRooReply505;

    pMyObject->RcpGetDocumentRoot   = WebRooRcpGetDocumentRoot;
    pMyObject->RcpGetPathInfo       = WebRooRcpGetPathInfo;
    pMyObject->RcpGetPathTranslated = WebRooRcpGetPathTranslated;
    pMyObject->RcpGetRemoteUser     = WebRooRcpGetRemoteUser;
    pMyObject->RcpGetScriptName     = WebRooRcpGetScriptName;
    pMyObject->RcpGetServerName     = WebRooRcpGetServerName;
    pMyObject->RcpGetServerPort     = WebRooRcpGetServerPort;
    pMyObject->RcpGetServerProtocol = WebRooRcpGetServerProtocol;
    pMyObject->RcpGetServerSoftware = WebRooRcpGetServerSoftware;

    AnscInitializeLock(&pMyObject->SyncLock);

    /*
     * We shall initialize the configuration properties to the default values, which may be changed
     * later via the set_property() member function. Note that this call may not guarantee a valid
     * and legtimate configuration.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
Bmc2ComdoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBMC2_COM_DOMAIN_OBJECT         pMyObject    = (PBMC2_COM_DOMAIN_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                     = BMC2_COM_DOMAIN_OID;
    pMyObject->Create                  = Bmc2ComdoCreate;
    pMyObject->Remove                  = Bmc2ComdoRemove;
    pMyObject->EnrollObjects           = Bmc2ComdoEnrollObjects;
    pMyObject->Initialize              = Bmc2ComdoInitialize;

    pMyObject->hBmc2ComTerminal        = (ANSC_HANDLE)NULL;
    pMyObject->hBmc2EnvController      = (ANSC_HANDLE)NULL;
    pMyObject->hBmc2ReqController      = (ANSC_HANDLE)NULL;
    pMyObject->DomainTitle             = NULL;
    pMyObject->bActive                 = FALSE;

    pMyObject->hSlapContainerDomain    = (ANSC_HANDLE)NULL;
    pMyObject->hSlapBmc2Domain         = (ANSC_HANDLE)NULL;

    pMyObject->GetBmc2ComTerminal      = Bmc2ComdoGetBmc2ComTerminal;
    pMyObject->SetBmc2ComTerminal      = Bmc2ComdoSetBmc2ComTerminal;
    pMyObject->GetBmc2EnvController    = Bmc2ComdoGetBmc2EnvController;
    pMyObject->SetBmc2EnvController    = Bmc2ComdoSetBmc2EnvController;
    pMyObject->GetBmc2ReqController    = Bmc2ComdoGetBmc2ReqController;
    pMyObject->SetBmc2ReqController    = Bmc2ComdoSetBmc2ReqController;
    pMyObject->GetDomainTitle          = Bmc2ComdoGetDomainTitle;
    pMyObject->SetDomainTitle          = Bmc2ComdoSetDomainTitle;
    pMyObject->Reset                   = Bmc2ComdoReset;

    pMyObject->Engage                  = Bmc2ComdoEngage;
    pMyObject->Cancel                  = Bmc2ComdoCancel;
    pMyObject->SetupEnv                = Bmc2ComdoSetupEnv;
    pMyObject->CloseEnv                = Bmc2ComdoCloseEnv;

    pMyObject->GetCommandsByPrefix     = Bmc2ComdoGetCommandsByPrefix;
    pMyObject->GetCommandProperty      = Bmc2ComdoGetCommandProperty;
    pMyObject->AddCommandProperty      = Bmc2ComdoAddCommandProperty;
    pMyObject->DelCommandProperty      = Bmc2ComdoDelCommandProperty;
    pMyObject->DelAllCommandProperties = Bmc2ComdoDelAllCommandProperties;
    pMyObject->SetCommandHelpSyntax    = Bmc2ComdoSetCommandHelpSyntax;

    AnscQueueInitializeHeader(&pMyObject->CompoQueue    );
    AnscInitializeLock       (&pMyObject->CompoQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 8
0
ANSC_STATUS
AnscDsuoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_DAEMON_SERVER_UDP_OBJECT  pMyObject    = (PANSC_DAEMON_SERVER_UDP_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                   = ANSC_DAEMON_SERVER_UDP_OID;
    pMyObject->Create                = AnscDsuoCreate;
    pMyObject->Remove                = AnscDsuoRemove;
    pMyObject->EnrollObjects         = AnscDsuoEnrollObjects;
    pMyObject->Initialize            = AnscDsuoInitialize;

    pMyObject->Socket                = ANSC_SOCKET_INVALID_SOCKET;
    pMyObject->hWorker               = (ANSC_HANDLE)NULL;
    pMyObject->MaxMessageSize        = ANSC_DSUO_MAX_MESSAGE_SIZE;
    pMyObject->EngineCount           = ANSC_DSUO_DEF_ENGINE_COUNT;
    pMyObject->hNextEngineToUse      = (ANSC_HANDLE)NULL;
    pMyObject->CurSocketCount        = 0;
    pMyObject->MinSocketCount        = ANSC_DSUO_MIN_SOCKET_COUNT;
    pMyObject->MaxSocketCount        = ANSC_DSUO_MAX_SOCKET_COUNT;
    pMyObject->CurPacketCount        = 0;
    pMyObject->MinPacketCount        = ANSC_DSUO_MIN_PACKET_COUNT;
    pMyObject->MaxPacketCount        = ANSC_DSUO_MAX_PACKET_COUNT;
    pMyObject->SocketTimeOut         = ANSC_DSUO_SOCKET_TIMEOUT;
    pMyObject->PacketTimeOut         = ANSC_DSUO_PACKET_TIMEOUT;
    pMyObject->Mode                  = 0;
    pMyObject->bActive               = FALSE;

    pMyObject->GetHostAddress        = AnscDsuoGetHostAddress;
    pMyObject->SetHostAddress        = AnscDsuoSetHostAddress;
    pMyObject->GetHostPort           = AnscDsuoGetHostPort;
    pMyObject->SetHostPort           = AnscDsuoSetHostPort;

    pMyObject->GetWorker             = AnscDsuoGetWorker;
    pMyObject->SetWorker             = AnscDsuoSetWorker;
    pMyObject->GetMaxMessageSize     = AnscDsuoGetMaxMessageSize;
    pMyObject->SetMaxMessageSize     = AnscDsuoSetMaxMessageSize;
    pMyObject->GetEngineCount        = AnscDsuoGetEngineCount;
    pMyObject->SetEngineCount        = AnscDsuoSetEngineCount;
    pMyObject->GetMinSocketCount     = AnscDsuoGetMinSocketCount;
    pMyObject->SetMinSocketCount     = AnscDsuoSetMinSocketCount;
    pMyObject->GetMaxSocketCount     = AnscDsuoGetMaxSocketCount;
    pMyObject->SetMaxSocketCount     = AnscDsuoSetMaxSocketCount;
    pMyObject->GetMinPacketCount     = AnscDsuoGetMinPacketCount;
    pMyObject->SetMinPacketCount     = AnscDsuoSetMinPacketCount;
    pMyObject->GetMaxPacketCount     = AnscDsuoGetMaxPacketCount;
    pMyObject->SetMaxPacketCount     = AnscDsuoSetMaxPacketCount;
    pMyObject->GetSocketTimeOut      = AnscDsuoGetSocketTimeOut;
    pMyObject->SetSocketTimeOut      = AnscDsuoSetSocketTimeOut;
    pMyObject->GetPacketTimeOut      = AnscDsuoGetPacketTimeOut;
    pMyObject->SetPacketTimeOut      = AnscDsuoSetPacketTimeOut;
    pMyObject->GetMode               = AnscDsuoGetMode;
    pMyObject->SetMode               = AnscDsuoSetMode;
    pMyObject->Reset                 = AnscDsuoReset;

    pMyObject->AcceptTask            = AnscDsuoAcceptTask;
    pMyObject->WorkerTask            = AnscDsuoWorkerTask;

    pMyObject->Engage                = AnscDsuoEngage;
    pMyObject->Cancel                = AnscDsuoCancel;

    pMyObject->StartEngines          = AnscDsuoStartEngines;
    pMyObject->StopEngines           = AnscDsuoStopEngines;

    pMyObject->AcquireSocket         = AnscDsuoAcquireSocket;
    pMyObject->ReleaseSocket         = AnscDsuoReleaseSocket;
    pMyObject->ManufactureSocketPool = AnscDsuoManufactureSocketPool;
    pMyObject->DestroySocketPool     = AnscDsuoDestroySocketPool;

    pMyObject->AcquirePacket         = AnscDsuoAcquirePacket;
    pMyObject->ReleasePacket         = AnscDsuoReleasePacket;
    pMyObject->ManufacturePacketPool = AnscDsuoManufacturePacketPool;
    pMyObject->DestroyPacketPool     = AnscDsuoDestroyPacketPool;

    pMyObject->AssignEngine          = AnscDsuoAssignEngine;
    pMyObject->ManufactureEnginePool = AnscDsuoManufactureEnginePool;
    pMyObject->DestroyEnginePool     = AnscDsuoDestroyEnginePool;

    pMyObject->Query                 = AnscDsuoQuery;
    pMyObject->ProcessSync           = AnscDsuoProcessSync;
    pMyObject->ProcessAsync          = AnscDsuoProcessAsync;

    AnscInitializeLock       (&pMyObject->OpLock     );
    AnscInitializeEvent      (&pMyObject->AcceptEvent);
    AnscSetEvent             (&pMyObject->AcceptEvent);

    AnscInitializeLock       (&pMyObject->EngineArrayLock);
    AnscSListInitializeHeader(&pMyObject->SocketSList    );
    AnscInitializeLock       (&pMyObject->SocketSListLock);
    AnscSListInitializeHeader(&pMyObject->PacketSList    );
    AnscInitializeLock       (&pMyObject->PacketSListLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 9
0
ANSC_STATUS
AnscScuoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_SIMPLE_CLIENT_UDP_OBJECT  pMyObject    = (PANSC_SIMPLE_CLIENT_UDP_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoVer3Initialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid               = ANSC_SIMPLE_CLIENT_UDP_OID;
    pMyObject->Create            = AnscScuoCreate;
    pMyObject->Remove            = AnscScuoRemove;
    pMyObject->EnrollObjects     = AnscScuoEnrollObjects;
    pMyObject->Initialize        = AnscScuoInitialize;
    pMyObject->Shutdown          = AnscScuoShutdown;

    pMyObject->Socket            = ANSC_SOCKET_INVALID_SOCKET;
    pMyObject->hWorker           = (ANSC_HANDLE)NULL;
    pMyObject->MaxMessageSize    = ANSC_SCUO_MAX_MESSAGE_SIZE;
    pMyObject->Mode              = 0;
    pMyObject->bActive           = FALSE;
    pMyObject->bClosed           = TRUE;

    pMyObject->hClientContext    = (ANSC_HANDLE)NULL;
    pMyObject->RecvBytesCount    = 0;
    pMyObject->SendBytesCount    = 0;
    pMyObject->LastRecvAt        = 0;
    pMyObject->LastSendAt        = 0;

    pMyObject->RecvBuffer        = NULL;
    pMyObject->RecvBufferSize    = ANSC_SCUO_MAX_MESSAGE_SIZE;
    pMyObject->RecvPacketSize    = 0;
    pMyObject->RecvOffset        = 0;

    pMyObject->GetHostAddress    = AnscScuoGetHostAddress;
    pMyObject->SetHostAddress    = AnscScuoSetHostAddress;
    pMyObject->GetHostPort       = AnscScuoGetHostPort;
    pMyObject->SetHostPort       = AnscScuoSetHostPort;
    pMyObject->GetPeerAddress    = AnscScuoGetPeerAddress;
    pMyObject->SetPeerAddress    = AnscScuoSetPeerAddress;
    pMyObject->GetPeerPort       = AnscScuoGetPeerPort;
    pMyObject->SetPeerPort       = AnscScuoSetPeerPort;

    pMyObject->GetWorker         = AnscScuoGetWorker;
    pMyObject->SetWorker         = AnscScuoSetWorker;
    pMyObject->GetMaxMessageSize = AnscScuoGetMaxMessageSize;
    pMyObject->SetMaxMessageSize = AnscScuoSetMaxMessageSize;
    pMyObject->GetMode           = AnscScuoGetMode;
    pMyObject->SetMode           = AnscScuoSetMode;
    pMyObject->Reset             = AnscScuoReset;

    pMyObject->RecvTask          = AnscScuoRecvTask;

    pMyObject->Engage            = AnscScuoEngage;
    pMyObject->Cancel            = AnscScuoCancel;

    pMyObject->GetRecvBuffer     = AnscScuoGetRecvBuffer;
    pMyObject->Recv              = AnscScuoRecv;
    pMyObject->Send              = AnscScuoSend;
    pMyObject->Send2             = AnscScuoSend2;

    AnscInitializeLock(&pMyObject->OpLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 10
0
ANSC_STATUS
AnscLpccoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_LPC_CONNECTOR_OBJECT      pMyObject    = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                 = ANSC_LPC_CONNECTOR_OID;
    pMyObject->Create              = AnscLpccoCreate;
    pMyObject->Remove              = AnscLpccoRemove;
    pMyObject->EnrollObjects       = AnscLpccoEnrollObjects;
    pMyObject->Initialize          = AnscLpccoInitialize;

    pMyObject->LpcOpmode           = ANSC_LPC_OPMODE_CLIENT;
    pMyObject->PartyName           = NULL;
    pMyObject->SeqNumber           = 0;
    pMyObject->CallTimeout         = ANSC_LPC_DEF_CALL_TIMEOUT;
    pMyObject->bConnected          = FALSE;
    pMyObject->bActive             = FALSE;

    pMyObject->GetAnscImcIf        = AnscLpccoGetAnscImcIf;
    pMyObject->GetAnscCpcIf        = AnscLpccoGetAnscCpcIf;
    pMyObject->SetAnscCpcIf        = AnscLpccoSetAnscCpcIf;
    pMyObject->GetPartyAddrSize    = AnscLpccoGetPartyAddrSize;
    pMyObject->GetCallTimeout      = AnscLpccoGetCallTimeout;
    pMyObject->SetCallTimeout      = AnscLpccoSetCallTimeout;
    pMyObject->Reset               = AnscLpccoReset;

    pMyObject->GetPartyCount       = AnscLpccoGetPartyCount;
    pMyObject->GetPartyArray       = AnscLpccoGetPartyArray;
    pMyObject->GetPartyAddr        = AnscLpccoGetPartyAddr;
    pMyObject->GetPartyAddr2       = AnscLpccoGetPartyAddr2;
    pMyObject->AddPartyAddr        = AnscLpccoAddPartyAddr;
    pMyObject->DelPartyAddr        = AnscLpccoDelPartyAddr;
    pMyObject->DelAllPartyAddrs    = AnscLpccoDelAllPartyAddrs;

    pMyObject->GetPendingCall      = AnscLpccoGetPendingCall;
    pMyObject->PopPendingCall      = AnscLpccoPopPendingCall;
    pMyObject->AddPendingCall      = AnscLpccoAddPendingCall;
    pMyObject->DelPendingCall      = AnscLpccoDelPendingCall;
    pMyObject->PopAllPendingCalls  = AnscLpccoPopAllPendingCalls;
    pMyObject->DelAllPendingCalls  = AnscLpccoDelAllPendingCalls;

    pMyObject->AcqAccess           = AnscLpccoAcqAccess;
    pMyObject->RelAccess           = AnscLpccoRelAccess;
    pMyObject->Engage              = AnscLpccoEngage;
    pMyObject->Cancel              = AnscLpccoCancel;
    pMyObject->Enroll              = AnscLpccoEnroll;
    pMyObject->Unbind              = AnscLpccoUnbind;
    pMyObject->ConnectToManager    = AnscLpccoConnectToManager;
    pMyObject->ConnTimerInvoke     = AnscLpccoConnTimerInvoke;

    pMyObject->ImcGenPartyAddr     = AnscLpccoImcGenPartyAddr;
    pMyObject->ImcGetLpcOpmode     = AnscLpccoImcGetLpcOpmode;
    pMyObject->ImcSetLpcOpmode     = AnscLpccoImcSetLpcOpmode;
    pMyObject->ImcGetPartyName     = AnscLpccoImcGetPartyName;
    pMyObject->ImcSetPartyName     = AnscLpccoImcSetPartyName;
    pMyObject->ImcIsPartyConnected = AnscLpccoImcIsPartyConnected;

    pMyObject->ImcEngage           = AnscLpccoImcEngage;
    pMyObject->ImcCancel           = AnscLpccoImcCancel;
    pMyObject->ImcCallRequest      = AnscLpccoImcCallRequest;
    pMyObject->ImcCallRequest2     = AnscLpccoImcCallRequest2;

    pMyObject->CpcCallDispatch     = AnscLpccoCpcCallDispatch;
    pMyObject->CpcFreeOutputBuffer = AnscLpccoCpcFreeOutputBuffer;
    pMyObject->CpcNotifyEvent      = AnscLpccoCpcNotifyEvent;

    AnscInitializeLock(&pMyObject->AccessLock);

    for ( i = 0; i < ANSC_LPCCO_PARTY_TABLE_SIZE; i++ )
    {
        AnscQueueInitializeHeader(&pMyObject->PartyTable[i]);
    }
    AnscInitializeLock(&pMyObject->PartyTableLock);

    AnscQueueInitializeHeader(&pMyObject->PcallQueue    );
    AnscInitializeLock       (&pMyObject->PcallQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 11
0
ANSC_STATUS
SysIroV2Initialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PSYS_IROV2_OBJECT               pMyObject    = (PSYS_IROV2_OBJECT          )hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                      = SYS_INFO_REPOSITORY_OID;
    pMyObject->Create                   = SysIroV2Create;
    pMyObject->Remove                   = SysIroV2Remove;
    pMyObject->EnrollObjects            = SysIroV2EnrollObjects;
    pMyObject->Initialize               = SysIroV2Initialize;

    pMyObject->hSysRamIf                = NULL;
    pMyObject->bActive                  = FALSE;

    AnscInitializeLock       (&pMyObject->AccessLock);

    pMyObject->GetIraIf                 = SysIroV2GetIraIf;
    pMyObject->GetProperty              = SysIroV2GetProperty;
    pMyObject->SetProperty              = SysIroV2SetProperty;
    pMyObject->ResetProperty            = SysIroV2ResetProperty;
    pMyObject->Reset                    = SysIroV2Reset;

    pMyObject->Engage                   = SysIroV2Engage;
    pMyObject->Cancel                   = SysIroV2Cancel;
    pMyObject->AcqAccess                = SysIroV2AcqAccess;
    pMyObject->RelAccess                = SysIroV2RelAccess;

    pMyObject->AddFolder                = SysIroV2AddFolder;
    pMyObject->AddFolder2               = SysIroV2AddFolder2;
    pMyObject->DelFolder                = SysIroV2DelFolder;
	pMyObject->DelFolder2				= SysIroV2DelFolder2;
    pMyObject->ResetFolder              = SysIroV2ResetFolder;
    pMyObject->GetFolderByName          = SysIroV2GetFolderByName;
    pMyObject->GetFolderByName2         = SysIroV2GetFolderByName2;
    pMyObject->GetFolderByIndex         = SysIroV2GetFolderByIndex;
    pMyObject->AddRecord                = SysIroV2AddRecord;
    pMyObject->DelRecord                = SysIroV2DelRecord;
    pMyObject->SetRecord                = SysIroV2SetRecord;
    pMyObject->GetRecordByName          = SysIroV2GetRecordByName;
    pMyObject->GetRecordByIndex         = SysIroV2GetRecordByIndex;

    pMyObject->IraAcqWriteAccess        = SysIroV2IraAcqWriteAccess;
    pMyObject->IraRelWriteAccess        = SysIroV2IraRelWriteAccess;

    pMyObject->IraAddSysFolder          = SysIroV2IraAddSysFolder;
    pMyObject->IraAddFolder             = SysIroV2IraAddFolder;
    pMyObject->IraAddFolder2            = SysIroV2IraAddFolder2;
    pMyObject->IraDelFolder             = SysIroV2IraDelFolder;
    pMyObject->IraDelFolder2            = SysIroV2IraDelFolder2;

    pMyObject->IraOpenFolder            = SysIroV2IraOpenFolder;
    pMyObject->IraOpenFolder2           = SysIroV2IraOpenFolder2;
    pMyObject->IraCloseFolder           = SysIroV2IraCloseFolder;
    pMyObject->IraClearFolder           = SysIroV2IraClearFolder;

    pMyObject->IraGenerateFolder        = SysIroV2IraGenerateFolder;
    pMyObject->IraPopulateFolder        = SysIroV2IraPopulateFolder;

    pMyObject->IraQueryFolder           = SysIroV2IraQueryFolder;
    pMyObject->IraGetSubFolderCount     = SysIroV2IraGetSubFolderCount;
    pMyObject->IraEnumSubFolder         = SysIroV2IraEnumSubFolder;
    pMyObject->IraTestSubFolder         = SysIroV2IraTestSubFolder;

    pMyObject->IraAddRecord             = SysIroV2IraAddRecord;
    pMyObject->IraAddRecord2            = SysIroV2IraAddRecord2;
    pMyObject->IraDelRecord             = SysIroV2IraDelRecord;
    pMyObject->IraGetRecord             = SysIroV2IraGetRecord;
    pMyObject->IraSetRecord             = SysIroV2IraSetRecord;

    pMyObject->IraQueryRecord           = SysIroV2IraQueryRecord;
    pMyObject->IraGetRecordCount        = SysIroV2IraGetRecordCount;
    pMyObject->IraEnumRecord            = SysIroV2IraEnumRecord;
    pMyObject->IraTestRecord            = SysIroV2IraTestRecord;

    pMyObject->IraGetRfoUserContext     = SysIroV2IraGetRfoUserContext;
    pMyObject->IraSetRfoUserContext     = SysIroV2IraSetRfoUserContext;
    pMyObject->IraGetRfoUserReserved    = SysIroV2IraGetRfoUserReserved;
    pMyObject->IraSetRfoUserReserved    = SysIroV2IraSetRfoUserReserved;
    pMyObject->IraGetRfoFolderType      = SysIroV2IraGetRfoFolderType;
    pMyObject->IraSetRfoFolderType      = SysIroV2IraSetRfoFolderType;
    pMyObject->IraGetRfoPermission      = SysIroV2IraGetRfoPermission;
    pMyObject->IraSetRfoPermission      = SysIroV2IraSetRfoPermission;
    pMyObject->IraGetRfoRenderAttr      = SysIroV2IraGetRfoRenderAttr;
    pMyObject->IraSetRfoRenderAttr      = SysIroV2IraSetRfoRenderAttr;

    pMyObject->IraGetRroUserContext     = SysIroV2IraGetRroUserContext;
    pMyObject->IraSetRroUserContext     = SysIroV2IraSetRroUserContext;
    pMyObject->IraGetRroUserReserved    = SysIroV2IraGetRroUserReserved;
    pMyObject->IraSetRroUserReserved    = SysIroV2IraSetRroUserReserved;
    pMyObject->IraGetRroPermission      = SysIroV2IraGetRroPermission;
    pMyObject->IraSetRroPermission      = SysIroV2IraSetRroPermission;
    pMyObject->IraGetRroRenderAttr      = SysIroV2IraGetRroRenderAttr;
    pMyObject->IraSetRroRenderAttr      = SysIroV2IraSetRroRenderAttr;

    pMyObject->IraGetCurRecycleBin      = SysIroV2IraGetCurRecycleBin;
    pMyObject->IraAttachRecycleBin      = SysIroV2IraAttachRecycleBin;
    pMyObject->IraDetachRecycleBin      = SysIroV2IraDetachRecycleBin;

    pMyObject->IraSortSubFolders        = SysIroV2IraSortSubFolders;
    pMyObject->IraSortRecords           = SysIroV2IraSortRecords;

    pMyObject->IraGetSysRamIf           = SysIroV2IraGetSysRamIf;
    pMyObject->IraSetSysRamIf           = SysIroV2IraSetSysRamIf;

    /*
     * We shall initialize the configuration properties to the default values, which may be changed
     * later via the set_property() member function. Note that this call may not guarantee a valid
     * and legtimate configuration.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
HttpPsoVer2Initialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_PSO_VER2_OBJECT           pMyObject    = (PHTTP_PSO_VER2_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                = HTTP_PSO_VER2_OID;
    pMyObject->Create             = HttpPsoVer2Create;
    pMyObject->Remove             = HttpPsoVer2Remove;
    pMyObject->EnrollObjects      = HttpPsoVer2EnrollObjects;
    pMyObject->Initialize         = HttpPsoVer2Initialize;

    pMyObject->hWamIf             = (ANSC_HANDLE)NULL;
    pMyObject->hSbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hCbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hPbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hHfpIf             = (ANSC_HANDLE)NULL;
    pMyObject->hClientSocket      = (ANSC_HANDLE)NULL;
    pMyObject->hSbcContext        = (ANSC_HANDLE)NULL;
    pMyObject->hCbcContext        = (ANSC_HANDLE)NULL;
    pMyObject->HashIndex          = 0;
    pMyObject->SbcPmode           = HTTP_SBC_PMODE_RELAY1;
    pMyObject->CbcPmode           = HTTP_CBC_PMODE_RELAY1;
    pMyObject->SessionState       = HTTP_PSOVER2_STATE_INITIALIZED;

    pMyObject->GetWamIf           = HttpPsoVer2GetWamIf;
    pMyObject->SetWamIf           = HttpPsoVer2SetWamIf;
    pMyObject->GetSbcIf           = HttpPsoVer2GetSbcIf;
    pMyObject->SetSbcIf           = HttpPsoVer2SetSbcIf;
    pMyObject->GetCbcIf           = HttpPsoVer2GetCbcIf;
    pMyObject->SetCbcIf           = HttpPsoVer2SetCbcIf;
    pMyObject->GetPbcIf           = HttpPsoVer2GetPbcIf;
    pMyObject->SetPbcIf           = HttpPsoVer2SetPbcIf;
    pMyObject->GetHfpIf           = HttpPsoVer2GetHfpIf;
    pMyObject->SetHfpIf           = HttpPsoVer2SetHfpIf;

    pMyObject->GetClientSocket    = HttpPsoVer2GetClientSocket;
    pMyObject->SetClientSocket    = HttpPsoVer2SetClientSocket;
    pMyObject->GetSbcContext      = HttpPsoVer2GetSbcContext;
    pMyObject->SetSbcContext      = HttpPsoVer2SetSbcContext;
    pMyObject->GetCbcContext      = HttpPsoVer2GetCbcContext;
    pMyObject->SetCbcContext      = HttpPsoVer2SetCbcContext;

    pMyObject->GetSbcPmode        = HttpPsoVer2GetSbcPmode;
    pMyObject->SetSbcPmode        = HttpPsoVer2SetSbcPmode;
    pMyObject->GetCbcPmode        = HttpPsoVer2GetCbcPmode;
    pMyObject->SetCbcPmode        = HttpPsoVer2SetCbcPmode;
    pMyObject->GetSessionState    = HttpPsoVer2GetSessionState;
    pMyObject->SetSessionState    = HttpPsoVer2SetSessionState;

    pMyObject->Return             = HttpPsoVer2Return;
    pMyObject->Reset              = HttpPsoVer2Reset;

    pMyObject->Open               = HttpPsoVer2Open;
    pMyObject->Close              = HttpPsoVer2Close;

    pMyObject->AcquireAccess      = HttpPsoVer2AcquireAccess;
    pMyObject->ReleaseAccess      = HttpPsoVer2ReleaseAccess;

    pMyObject->AskTroBySocket     = HttpPsoVer2AskTroBySocket;
    pMyObject->PopTroBySocket     = HttpPsoVer2PopTroBySocket;
    pMyObject->GetLastTro         = HttpPsoVer2GetLastTro;
    pMyObject->GetCurTro          = HttpPsoVer2GetCurTro;
    pMyObject->AddNewTro          = HttpPsoVer2AddNewTro;
    pMyObject->DelAllTros         = HttpPsoVer2DelAllTros;

    pMyObject->QueryForClient     = HttpPsoVer2QueryForClient;
    pMyObject->RecvFromClient     = HttpPsoVer2RecvFromClient;
    pMyObject->FinishedByClient   = HttpPsoVer2FinishedByClient;
    pMyObject->AcceptClient       = HttpPsoVer2AcceptClient;
    pMyObject->Authenticate       = HttpPsoVer2Authenticate;

    AnscInitializeLock       (&pMyObject->AccessLock  );
    AnscSListInitializeHeader(&pMyObject->TroSList    );
    AnscInitializeLock       (&pMyObject->TroSListLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 13
0
ANSC_STATUS
HttpWssoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_WEBS_SESSION_OBJECT       pMyObject    = (PHTTP_WEBS_SESSION_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid             = HTTP_WEBS_SESSION_OID;
    pMyObject->Create          = HttpWssoCreate;
    pMyObject->Remove          = HttpWssoRemove;
    pMyObject->EnrollObjects   = HttpWssoEnrollObjects;
    pMyObject->Initialize      = HttpWssoInitialize;

    pMyObject->hWspIf          = (ANSC_HANDLE)NULL;
    pMyObject->hHfpIf          = (ANSC_HANDLE)NULL;
    pMyObject->hWebSocket      = (ANSC_HANDLE)NULL;
    pMyObject->SessionState    = HTTP_WSSO_STATE_INITIALIZED;
    pMyObject->ServeCount      = 0;

    pMyObject->GetWspIf        = HttpWssoGetWspIf;
    pMyObject->SetWspIf        = HttpWssoSetWspIf;
    pMyObject->GetHfpIf        = HttpWssoGetHfpIf;
    pMyObject->SetHfpIf        = HttpWssoSetHfpIf;

    pMyObject->GetWebSocket    = HttpWssoGetWebSocket;
    pMyObject->SetWebSocket    = HttpWssoSetWebSocket;
    pMyObject->GetSessionState = HttpWssoGetSessionState;
    pMyObject->SetSessionState = HttpWssoSetSessionState;

    pMyObject->Return          = HttpWssoReturn;
    pMyObject->Reset           = HttpWssoReset;

    pMyObject->Open            = HttpWssoOpen;
    pMyObject->Close           = HttpWssoClose;

    pMyObject->AcquireAccess   = HttpWssoAcquireAccess;
    pMyObject->ReleaseAccess   = HttpWssoReleaseAccess;
    pMyObject->EnterWspServe   = HttpWssoEnterWspServe;
    pMyObject->LeaveWspServe   = HttpWssoLeaveWspServe;
    pMyObject->ClearWspServe   = HttpWssoClearWspServe;
    pMyObject->CloseConnection = HttpWssoCloseConnection;

    pMyObject->GetEndWsto      = HttpWssoGetEndWsto;
    pMyObject->GetCurWsto      = HttpWssoGetCurWsto;
    pMyObject->AddNewWsto      = HttpWssoAddNewWsto;
    pMyObject->DelAllWstos     = HttpWssoDelAllWstos;

    pMyObject->Query           = HttpWssoQuery;
    pMyObject->Recv            = HttpWssoRecv;
    pMyObject->Finish          = HttpWssoFinish;
    pMyObject->Accept          = HttpWssoAccept;

    AnscInitializeEvent      (&pMyObject->ServeEvent   );
    AnscResetEvent           (&pMyObject->ServeEvent   );

    AnscInitializeLock       (&pMyObject->AccessLock   );
    AnscSListInitializeHeader(&pMyObject->WstoSList    );
    AnscInitializeLock       (&pMyObject->WstoSListLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 14
0
ANSC_STATUS
CcspCwmpsoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PCCSP_CWMP_SESSION_OBJECT        pMyObject    = (PCCSP_CWMP_SESSION_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                       = CCSP_CWMP_SESSION_OID;
    pMyObject->Create                    = CcspCwmpsoCreate;
    pMyObject->Remove                    = CcspCwmpsoRemove;
    pMyObject->EnrollObjects             = CcspCwmpsoEnrollObjects;
    pMyObject->Initialize                = CcspCwmpsoInitialize;

    pMyObject->hCcspCwmpCpeController        = (ANSC_HANDLE)NULL;
    pMyObject->hCcspCwmpProcessor         = (ANSC_HANDLE)NULL;
    pMyObject->AsyncTaskCount            = 0;
    pMyObject->bActive                   = FALSE;

    pMyObject->bInformWhenActive         = FALSE;

    pMyObject->GlobalRequestID           = 1;
    pMyObject->SessionState              = CCSP_CWMPSO_SESSION_STATE_idle;
    pMyObject->CpeMaxEnvelopes           = CCSP_CWMP_CPE_MAX_ENVELOPES;
    pMyObject->AcsMaxEnvelopes           = 1;
    pMyObject->ActiveResponses           = 0;
    pMyObject->bHoldRequests             = FALSE;
    pMyObject->bNoMoreRequests           = FALSE;
    pMyObject->bLastEmptyRequestSent     = FALSE;
    pMyObject->EventCount                = 0;
    pMyObject->RetryCount                = 0;
    pMyObject->ModifiedParamCount        = 0;

    pMyObject->GetCcspCwmpAcsConnection  = CcspCwmpsoGetCcspCwmpAcsConnection;
    pMyObject->GetCcspCwmpMcoIf          = CcspCwmpsoGetCcspCwmpMcoIf;
    pMyObject->GetCcspCwmpCpeController  = CcspCwmpsoGetCcspCwmpCpeController;
    pMyObject->SetCcspCwmpCpeController  = CcspCwmpsoSetCcspCwmpCpeController;
    pMyObject->GetCcspCwmpProcessor      = CcspCwmpsoGetCcspCwmpProcessor;
    pMyObject->SetCcspCwmpProcessor      = CcspCwmpsoSetCcspCwmpProcessor;
    pMyObject->Reset                     = CcspCwmpsoReset;

    pMyObject->AcqAccess                 = CcspCwmpsoAcqAccess;
    pMyObject->RelAccess                 = CcspCwmpsoRelAccess;
    pMyObject->SessionTimerInvoke        = CcspCwmpsoSessionTimerInvoke;
    pMyObject->SessionRetryTimerInvoke   = CcspCwmpsoSessionRetryTimerInvoke;
    pMyObject->DelayedActiveNotifTimerInvoke   
										 = CcspCwmpsoDelayedActiveNotifTimerInvoke;
    pMyObject->StartRetryTimer           = CcspCwmpsoStartRetryTimer;
    pMyObject->StopRetryTimer            = CcspCwmpsoStopRetryTimer;
    pMyObject->StopDelayedActiveNotifTimer 
							             = CcspCwmpsoStopDelayedActiveNotifTimer;

    pMyObject->IsAcsConnected            = CcspCwmpsoIsAcsConnected;
    pMyObject->ConnectToAcs              = CcspCwmpsoConnectToAcs;
    pMyObject->CloseConnection           = CcspCwmpsoCloseConnection;

    pMyObject->AddCwmpEvent              = CcspCwmpsoAddCwmpEvent;
    pMyObject->DiscardCwmpEvent          = CcspCwmpsoDiscardCwmpEvent;
    pMyObject->DelAllEvents              = CcspCwmpsoDelAllEvents;
    pMyObject->AddModifiedParameter      = CcspCwmpsoAddModifiedParameter;
    pMyObject->DelAllParameters          = CcspCwmpsoDelAllParameters;
    pMyObject->SaveCwmpEvent             = CcspCwmpsoSaveCwmpEvent;

    pMyObject->GetRpcMethods             = CcspCwmpsoGetRpcMethods;
    pMyObject->Inform                    = CcspCwmpsoInform;
    pMyObject->TransferComplete          = CcspCwmpsoTransferComplete;
    pMyObject->AutonomousTransferComplete= CcspCwmpsoAutonomousTransferComplete;
    pMyObject->Kicked                    = CcspCwmpsoKicked;
    pMyObject->RequestDownload           = CcspCwmpsoRequestDownload;
    pMyObject->DUStateChangeComplete     = CcspCwmpsoDUStateChangeComplete;
    pMyObject->AutonomousDUStateChangeComplete
                                         = CcspCwmpsoAutonomousDUStateChangeComplete;

    pMyObject->RecvSoapMessage           = CcspCwmpsoRecvSoapMessage;
    pMyObject->NotifySessionClosed       = CcspCwmpsoNotifySessionClosed;
    pMyObject->AsyncProcessTask          = CcspCwmpsoAsyncProcessTask;

    pMyObject->CancelRetryDelay          = CcspCwmpsoCancelRetryDelay;

    pMyObject->InformPending             = CcspCwmpsoInformPending;

    AnscInitializeLock       (&pMyObject->AccessLock       );
    AnscQueueInitializeHeader(&pMyObject->AsyncReqQueue    );
    AnscInitializeLock       (&pMyObject->AsyncReqQueueLock);
    AnscQueueInitializeHeader(&pMyObject->SavedReqQueue    );
    AnscInitializeLock       (&pMyObject->SavedReqQueueLock);
    AnscQueueInitializeHeader(&pMyObject->AsyncRepQueue    );
    AnscInitializeLock       (&pMyObject->AsyncRepQueueLock);
    AnscInitializeEvent      (&pMyObject->AsyncProcessEvent);
    AnscResetEvent           (&pMyObject->AsyncProcessEvent);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 15
0
ANSC_STATUS
HttpTroInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_TRANS_RECORD_OBJECT       pMyObject    = (PHTTP_TRANS_RECORD_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                = HTTP_TRANS_RECORD_OID;
    pMyObject->Create             = HttpTroCreate;
    pMyObject->Remove             = HttpTroRemove;
    pMyObject->EnrollObjects      = HttpTroEnrollObjects;
    pMyObject->Initialize         = HttpTroInitialize;

    pMyObject->ServerAddr.Value   = 0;
    pMyObject->ServerPort         = HTTP_SERVER_PORT;

    pMyObject->hWamIf             = (ANSC_HANDLE)NULL;
    pMyObject->hSbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hCbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hPbcIf             = (ANSC_HANDLE)NULL;
    pMyObject->hHfpIf             = (ANSC_HANDLE)NULL;
    pMyObject->hBmoReq            = (ANSC_HANDLE)NULL;
    pMyObject->hBmoRep            = (ANSC_HANDLE)NULL;
    pMyObject->hClientSocket      = (ANSC_HANDLE)NULL;
    pMyObject->hServerSocket      = (ANSC_HANDLE)NULL;
    pMyObject->hSbcContext        = (ANSC_HANDLE)NULL;
    pMyObject->hCbcContext        = (ANSC_HANDLE)NULL;
    pMyObject->HashIndex          = 0;
    pMyObject->SbcPmode           = HTTP_SBC_PMODE_RELAY1;
    pMyObject->CbcPmode           = HTTP_CBC_PMODE_RELAY1;
    pMyObject->TransState         = HTTP_TRO_STATE_INITIALIZED;
    pMyObject->bCloseConnection   = TRUE;

    pMyObject->GetWamIf           = HttpTroGetWamIf;
    pMyObject->SetWamIf           = HttpTroSetWamIf;
    pMyObject->GetSbcIf           = HttpTroGetSbcIf;
    pMyObject->SetSbcIf           = HttpTroSetSbcIf;
    pMyObject->GetCbcIf           = HttpTroGetCbcIf;
    pMyObject->SetCbcIf           = HttpTroSetCbcIf;
    pMyObject->GetPbcIf           = HttpTroGetPbcIf;
    pMyObject->SetPbcIf           = HttpTroSetPbcIf;
    pMyObject->GetHfpIf           = HttpTroGetHfpIf;
    pMyObject->SetHfpIf           = HttpTroSetHfpIf;

    pMyObject->GetBmoReq          = HttpTroGetBmoReq;
    pMyObject->SetBmoReq          = HttpTroSetBmoReq;
    pMyObject->GetBmoRep          = HttpTroGetBmoRep;
    pMyObject->SetBmoRep          = HttpTroSetBmoRep;
    pMyObject->GetClientSocket    = HttpTroGetClientSocket;
    pMyObject->SetClientSocket    = HttpTroSetClientSocket;
    pMyObject->GetServerSocket    = HttpTroGetServerSocket;
    pMyObject->SetServerSocket    = HttpTroSetServerSocket;
    pMyObject->GetSbcContext      = HttpTroGetSbcContext;
    pMyObject->SetSbcContext      = HttpTroSetSbcContext;
    pMyObject->GetCbcContext      = HttpTroGetCbcContext;
    pMyObject->SetCbcContext      = HttpTroSetCbcContext;

    pMyObject->GetServerName      = HttpTroGetServerName;
    pMyObject->SetServerName      = HttpTroSetServerName;
    pMyObject->GetClientAddr      = HttpTroGetClientAddr;
    pMyObject->GetServerAddr      = HttpTroGetServerAddr;
    pMyObject->GetClientPort      = HttpTroGetClientPort;
    pMyObject->GetServerPort      = HttpTroGetServerPort;

    pMyObject->GetSbcPmode        = HttpTroGetSbcPmode;
    pMyObject->SetSbcPmode        = HttpTroSetSbcPmode;
    pMyObject->GetCbcPmode        = HttpTroGetCbcPmode;
    pMyObject->SetCbcPmode        = HttpTroSetCbcPmode;
    pMyObject->GetTransState      = HttpTroGetTransState;
    pMyObject->SetTransState      = HttpTroSetTransState;

    pMyObject->Return             = HttpTroReturn;
    pMyObject->Reset              = HttpTroReset;

    pMyObject->Terminate          = HttpTroTerminate;
    pMyObject->Open               = HttpTroOpen;
    pMyObject->Close              = HttpTroClose;

    pMyObject->AcquireAccess      = HttpTroAcquireAccess;
    pMyObject->ReleaseAccess      = HttpTroReleaseAccess;

    pMyObject->QueryForClient     = HttpTroQueryForClient;
    pMyObject->RecvFromClient     = HttpTroRecvFromClient;
    pMyObject->FinishedByClient   = HttpTroFinishedByClient;
    pMyObject->SendToClient       = HttpTroSendToClient;
    pMyObject->ResumeTransaction  = HttpTroResumeTransaction;

    pMyObject->QueryForServer     = HttpTroQueryForServer;
    pMyObject->RecvFromServer     = HttpTroRecvFromServer;
    pMyObject->FinishedByServer   = HttpTroFinishedByServer;
    pMyObject->SendToServer       = HttpTroSendToServer;
    pMyObject->ConnectToServer    = HttpTroConnectToServer;
    pMyObject->SetUpConnection    = HttpTroSetUpConnection;

    pMyObject->TmhClientNotify    = HttpTroTmhClientNotify;
    pMyObject->TmhClientSerialize = HttpTroTmhClientSerialize;
    pMyObject->TmhServerNotify    = HttpTroTmhServerNotify;
    pMyObject->TmhServerSerialize = HttpTroTmhServerSerialize;

    AnscInitializeLock(&pMyObject->AccessLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 16
0
ANSC_STATUS
BwrmPmoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBWRM_PAGE_MANAGER_OBJECT       pMyObject    = (PBWRM_PAGE_MANAGER_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                = BWRM_PAGE_MANAGER_OID;
    pMyObject->Create             = BwrmPmoCreate;
    pMyObject->Remove             = BwrmPmoRemove;
    pMyObject->EnrollObjects      = BwrmPmoEnrollObjects;
    pMyObject->Initialize         = BwrmPmoInitialize;

    pMyObject->Timestamp          = AnscGetTickInSeconds();
    pMyObject->bActive            = FALSE;

    pMyObject->GetCacheEnabled    = BwrmPmoGetCacheEnabled;
    pMyObject->SetCacheEnabled    = BwrmPmoSetCacheEnabled;
    pMyObject->GetCacheEntryCount = BwrmPmoGetCacheEntryCount;
    pMyObject->SetCacheEntryCount = BwrmPmoSetCacheEntryCount;
    pMyObject->GetCacheMemorySize = BwrmPmoGetCacheMemorySize;
    pMyObject->SetCacheMemorySize = BwrmPmoSetCacheMemorySize;
    pMyObject->GetCacheTimeout    = BwrmPmoGetCacheTimeout;
    pMyObject->SetCacheTimeout    = BwrmPmoSetCacheTimeout;

    pMyObject->GetProperty        = BwrmPmoGetProperty;
    pMyObject->SetProperty        = BwrmPmoSetProperty;
    pMyObject->ResetProperty      = BwrmPmoResetProperty;
    pMyObject->Reset              = BwrmPmoReset;

    pMyObject->Engage             = BwrmPmoEngage;
    pMyObject->Cancel             = BwrmPmoCancel;
    pMyObject->CacheTimerInvoke   = BwrmPmoCacheTimerInvoke;

    pMyObject->GetPageCount       = BwrmPmoGetPageCount;
    pMyObject->GetOldestPage      = BwrmPmoGetOldestPage;
    pMyObject->GetPage            = BwrmPmoGetPage;
    pMyObject->AddPage            = BwrmPmoAddPage;
    pMyObject->DelPage            = BwrmPmoDelPage;
    pMyObject->DelAllPages        = BwrmPmoDelAllPages;

    for ( i = 0; i < BWRM_PMO_CPO_TABLE_SIZE; i++ )
    {
        AnscSListInitializeHeader(&pMyObject->CpoTable[i]);
    }
    AnscInitializeLock(&pMyObject->CpoTableLock);

    /*
     * We shall initialize the configuration properties to the default values, which may be changed
     * later via the set_property() member function. Note that this call may not guarantee a valid
     * and legtimate configuration.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 17
0
ANSC_STATUS
TlsSmoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PTLS_SESSION_MANAGER_OBJECT     pMyObject    = (PTLS_SESSION_MANAGER_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented progtlsming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java progtlsmer perspective, it's the best we can get for universal embedded network
     * progtlsming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                        = TLS_SESSION_MANAGER_OID;
    pMyObject->Create                     = TlsSmoCreate;
    pMyObject->Remove                     = TlsSmoRemove;
    pMyObject->EnrollObjects              = TlsSmoEnrollObjects;
    pMyObject->Initialize                 = TlsSmoInitialize;

    pMyObject->hTlsMecIf                  = (ANSC_HANDLE)NULL;
    pMyObject->bActive                    = FALSE;

    pMyObject->GetProperty                = TlsSmoGetProperty;
    pMyObject->SetProperty                = TlsSmoSetProperty;
    pMyObject->ResetProperty              = TlsSmoResetProperty;
    pMyObject->Reset                      = TlsSmoReset;

    pMyObject->Engage                     = TlsSmoEngage;
    pMyObject->Cancel                     = TlsSmoCancel;
    pMyObject->PatrolTimerInvoke          = TlsSmoPatrolTimerInvoke;

    pMyObject->GetSession                 = TlsSmoGetSession;
    pMyObject->AddSession                 = TlsSmoAddSession;
    pMyObject->DelSession                 = TlsSmoDelSession;
    pMyObject->DelAllSessions             = TlsSmoDelAllSessions;

#if 0
    pMyObject->HsmSelHandshakeSession     = TlsSmoHsmSelHandshakeSession;
    pMyObject->HsmGetHandshakeSession     = TlsSmoHsmGetHandshakeSession;
    pMyObject->HsmAddHandshakeSession     = TlsSmoHsmAddHandshakeSession;
    pMyObject->HsmDelHandshakeSession     = TlsSmoHsmDelHandshakeSession;
    pMyObject->HsmDelAllHandshakeSessions = TlsSmoHsmDelAllHandshakeSessions;
#endif

    for ( i = 0; i < TLS_SMO_SEO_TABLE_SIZE; i++ )
    {
        AnscQueueInitializeHeader(&pMyObject->SeoTable[i]);
    }
    AnscInitializeLock(&pMyObject->SeoTableLock);

    /*
     * We shall initialize the object properties to the default values, which may be changed later
     * via the exposed member functions. If any of the future extensions needs to change the object
     * property, the following code also needs to be changed.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 18
0
ANSC_STATUS
HttpMboChkInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_MBO_CHUNKED_OBJECT        pMyObject    = (PHTTP_MBO_CHUNKED_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    HttpMboInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                = HTTP_MBO_CHUNKED_OID;
    pMyObject->Create             = HttpMboChkCreate;
    pMyObject->Remove             = HttpMboChkRemove;
    pMyObject->EnrollObjects      = HttpMboChkEnrollObjects;
    pMyObject->Initialize         = HttpMboChkInitialize;

    pMyObject->Reset              = HttpMboChkReset;

    pMyObject->GetEntitySize      = HttpMboChkGetEntitySize;
    pMyObject->GetArrivedSize     = HttpMboChkGetArrivedSize;
    pMyObject->AppendBodyBdo      = HttpMboChkAppendBodyBdo;
    pMyObject->CopyBodyFrom       = HttpMboChkCopyBodyFrom;

    pMyObject->Examine            = HttpMboChkExamine;
    pMyObject->Process            = HttpMboChkProcess;
    pMyObject->CloseUp            = HttpMboChkCloseUp;
    pMyObject->RemoveCoding       = HttpMboChkRemoveCoding;

    pMyObject->ChunkTransferState = HTTP_MBOCHK_CTSTATE_EMPTY;
    pMyObject->SkipSize           = 0;
    pMyObject->PadSize1           = HTTP_MBOCHK_SCRATCH_PAD1_SIZE;
    pMyObject->PadSize2           = HTTP_MBOCHK_SCRATCH_PAD2_SIZE;
    pMyObject->PadSize3           = HTTP_MBOCHK_SCRATCH_PAD3_SIZE;
    pMyObject->UseSize1           = 0;
    pMyObject->UseSize2           = 0;
    pMyObject->UseSize3           = 0;

    pMyObject->GetExpectedSize    = HttpMboChkGetExpectedSize;
    pMyObject->AppendChunkData    = HttpMboChkAppendChunkData;

    pMyObject->ClearChunkInfos    = HttpMboChkClearChunkInfos;
    pMyObject->GetCurChunkInfo    = HttpMboChkGetCurChunkInfo;
    pMyObject->AddChunkInfo       = HttpMboChkAddChunkInfo;

    pMyObject->ProcessChunkData   = HttpMboChkProcessChunkData;
    pMyObject->ProcessTrailer     = HttpMboChkProcessTrailer;

    pMyObject->AppendTrailer      = HttpMboChkAppendTrailer;
    pMyObject->ParseTrailer       = HttpMboChkParseTrailer;

    AnscSListInitializeHeader(&pMyObject->ChunkInfoSList    );
    AnscInitializeLock       (&pMyObject->ChunkInfoSListLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 19
0
ANSC_STATUS
TlsHsoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PTLS_HAND_SHAKER_OBJECT         pMyObject    = (PTLS_HAND_SHAKER_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented progtlsming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    TlsRcoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java progtlsmer perspective, it's the best we can get for universal embedded network
     * progtlsming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                  = TLS_HAND_SHAKER_OID;
    pMyObject->Create               = TlsHsoCreate;
    pMyObject->Remove               = TlsHsoRemove;
    pMyObject->EnrollObjects        = TlsHsoEnrollObjects;
    pMyObject->Initialize           = TlsHsoInitialize;

    pMyObject->RecordType           = TLS_RECORD_TYPE_handshake;
    pMyObject->ProgressBits         = 0;
    pMyObject->MsgBuffer            = NULL;
    pMyObject->MsgBufferSize        = TLS_HSO_DEF_MSG_BUFFER_SIZE;
    pMyObject->MsgOffset            = 0;
    pMyObject->FragMsgBuffer        = NULL;
    pMyObject->FragMsgBufferSize    = TLS_HSO_DEF_MSG_BUFFER_SIZE;
    pMyObject->FragMsgOffset        = 0;

    pMyObject->Reset                = TlsHsoReset;

    pMyObject->Start                = TlsHsoStart;
    pMyObject->Abort                = TlsHsoAbort;
    pMyObject->Establish            = TlsHsoEstablish;
    pMyObject->Agree                = TlsHsoAgree;

    pMyObject->CalKeys30            = TlsHsoCalKeys30;
    pMyObject->CalKeys31            = TlsHsoCalKeys31;
    pMyObject->CalMasterSecret30    = TlsHsoCalMasterSecret30;
    pMyObject->CalMasterSecret31    = TlsHsoCalMasterSecret31;
    pMyObject->ChangeCipherW        = TlsHsoChangeCipherW;
    pMyObject->ChangeCipherR        = TlsHsoChangeCipherR;

    pMyObject->Engage               = TlsHsoEngage;
    pMyObject->Cancel               = TlsHsoCancel;
    pMyObject->SaveHandshakeMsg     = TlsHsoSaveHandshakeMsg;
    pMyObject->SaveFragHandshakeMsg = TlsHsoSaveFragHandshakeMsg;
    pMyObject->StateTimerInvoke     = TlsHsoStateTimerInvoke;

    AnscInitializeLock(&pMyObject->SyncLock  );

    TlsInitSessionState((&pMyObject->SessionState));
    TlsInitRecordState ((&pMyObject->RecordStateW));
    TlsInitRecordState ((&pMyObject->RecordStateR));

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 20
0
ANSC_STATUS
Bmc2ComtoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PBMC2_COM_TERMINAL_OBJECT       pMyObject    = (PBMC2_COM_TERMINAL_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                    = BMC2_COM_TERMINAL_OID;
    pMyObject->Create                 = Bmc2ComtoCreate;
    pMyObject->Remove                 = Bmc2ComtoRemove;
    pMyObject->EnrollObjects          = Bmc2ComtoEnrollObjects;
    pMyObject->Initialize             = Bmc2ComtoInitialize;

    pMyObject->hBmc2IceIf             = (ANSC_HANDLE)NULL;
    pMyObject->hBmc2EnvController     = (ANSC_HANDLE)NULL;
    pMyObject->bActive                = FALSE;

    pMyObject->hSlapContainerTerminal = (ANSC_HANDLE)NULL;
    pMyObject->hSlapBmc2Terminal      = (ANSC_HANDLE)NULL;

    pMyObject->GetBmc2IceIf           = Bmc2ComtoGetBmc2IceIf;
    pMyObject->SetBmc2IceIf           = Bmc2ComtoSetBmc2IceIf;
    pMyObject->GetBmc2EnvController   = Bmc2ComtoGetBmc2EnvController;
    pMyObject->SetBmc2EnvController   = Bmc2ComtoSetBmc2EnvController;
    pMyObject->GetUserIdentifier      = Bmc2ComtoGetUserIdentifier;
    pMyObject->SetUserIdentifier      = Bmc2ComtoSetUserIdentifier;
    pMyObject->GetUserPermission      = Bmc2ComtoGetUserPermission;
    pMyObject->SetUserPermission      = Bmc2ComtoSetUserPermission;
    pMyObject->GetMaxLineNumber       = Bmc2ComtoGetMaxLineNumber;
    pMyObject->SetMaxLineNumber       = Bmc2ComtoSetMaxLineNumber;
    pMyObject->GetMaxColumnNumber     = Bmc2ComtoGetMaxColumnNumber;
    pMyObject->SetMaxColumnNumber     = Bmc2ComtoSetMaxColumnNumber;
    pMyObject->GetReadOnly            = Bmc2ComtoGetReadOnly;
    pMyObject->SetReadOnly            = Bmc2ComtoSetReadOnly;

    pMyObject->SetPseudoTermDevName   = Bmc2ComtoSetPseudoTermDevName;

    pMyObject->GetProperty            = Bmc2ComtoGetProperty;
    pMyObject->SetProperty            = Bmc2ComtoSetProperty;
    pMyObject->ResetProperty          = Bmc2ComtoResetProperty;
    pMyObject->Reset                  = Bmc2ComtoReset;

    pMyObject->AcqAccess              = Bmc2ComtoAcqAccess;
    pMyObject->RelAccess              = Bmc2ComtoRelAccess;
    pMyObject->Engage                 = Bmc2ComtoEngage;
    pMyObject->Cancel                 = Bmc2ComtoCancel;
    pMyObject->SetupEnv               = Bmc2ComtoSetupEnv;
    pMyObject->CloseEnv               = Bmc2ComtoCloseEnv;

    pMyObject->GetDomainCount         = Bmc2ComtoGetDomainCount;
    pMyObject->GetCurComDomain        = Bmc2ComtoGetCurComDomain;
    pMyObject->AddComDomain           = Bmc2ComtoAddComDomain;
    pMyObject->DelCurComDomain        = Bmc2ComtoDelCurComDomain;
    pMyObject->DelComDomain           = Bmc2ComtoDelComDomain;
    pMyObject->DelAllComDomains       = Bmc2ComtoDelAllComDomains;

    AnscInitializeLock       (&pMyObject->AccessLock    );
    AnscSListInitializeHeader(&pMyObject->ComdoSList    );
    AnscInitializeLock       (&pMyObject->ComdoSListLock);

    /*
     * We shall initialize the configuration properties to the default values, which may be changed
     * later via the set_property() member function. Note that this call may not guarantee a valid
     * and legtimate configuration.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 21
0
ANSC_STATUS
BbhmDiagnsInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PBBHM_DIAG_NS_LOOKUP_OBJECT       pMyObject    = (PBBHM_DIAG_NS_LOOKUP_OBJECT)hThisObject;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
     BbhmDiageoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                  = BBHM_DIAG_NS_LOOKUP_OID;
    pMyObject->QueryId              = 0; 
    pMyObject->bActive              = FALSE;

    pMyObject->Reset                = BbhmDiagnsReset;
    pMyObject->CopyDiagParams       = BbhmDiagnsCopyDiagParams;

    /* overwrite the virtual functions */
    pMyObject->StartDiag            = BbhmDiagnsStartDiag;
    pMyObject->StopDiag             = BbhmDiagnsStopDiag;
    pMyObject->RetrieveResult       = BbhmDiagnsRetrieveResult;


    pMyObject->ResetProperty        = BbhmDiagnsResetProperty;
    pMyObject->ResetPropertyCounter = BbhmDiagnsResetPropertyCounter;
    pMyObject->Reset                = BbhmDiagnsReset;
                                    
    pMyObject->Start                = BbhmDiagnsStart;
    pMyObject->Stop                 = BbhmDiagnsStop;
    pMyObject->Open                 = BbhmDiagnsOpen;
    pMyObject->Close                = BbhmDiagnsClose;
    pMyObject->Expire1              = BbhmDiagnsExpire1;
    pMyObject->Expire2              = BbhmDiagnsExpire2;
                                    
    pMyObject->SetStopTime          = BbhmDiagnsSetStopTime;
    pMyObject->AddEchoEntry         = BbhmDiagnsAddEchoEntry;
    pMyObject->PopEchoEntry         = BbhmDiagnsPopEchoEntry;

    pMyObject->Recv                 = BbhmDiagnsRecv;
    pMyObject->Send                 = BbhmDiagnsSend;
                                    
    pMyObject->GetSrcIp             = BbhmDiagnsGetSrcIp;       
    pMyObject->SetSrcIp             = BbhmDiagnsSetSrcIp;   
    pMyObject->GetDstIp             = BbhmDiagnsGetDstIp;       
    pMyObject->SetDstIp             = BbhmDiagnsSetDstIp;       
    pMyObject->GetNumPkts           = BbhmDiagnsGetNumPkts;     
    pMyObject->SetNumPkts           = BbhmDiagnsSetNumPkts;         
    pMyObject->GetTimeOut           = BbhmDiagnsGetTimeOut;     
    pMyObject->SetTimeOut           = BbhmDiagnsSetTimeOut;         
    pMyObject->SetControl           = BbhmDiagnsSetControl;             
    pMyObject->SetStatus            = BbhmDiagnsSetStatus;  
    
    pMyObject->AddPquery            = BbhmDiagnsAddPquery;
    pMyObject->GetPqueryById        = BbhmDiagnsGetPqueryById;
    pMyObject->DelPquery            = BbhmDiagnsDelPquery;
    pMyObject->DelAllPqueries       = BbhmDiagnsDelAllPqueries;
    pMyObject->SetDiagParams        = BbhmDiagnsSetDiagParams;
    pMyObject->CalculateResult      = BbhmDiagnsCalculateResult;
    pMyObject->GetStatus            = BbhmDiagnsGetStatus;

    /*
     * We shall initialize the session properties to the default values, which may be changed later
     * via the "configure" member function. If any of the future extensions needs to change the
     * session property, the following code also needs to be changed.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    AnscSListInitializeHeader(&pMyObject->EchoTable);
    AnscSListInitializeHeader(&pMyObject->PqueryTable);

    AnscInitializeLock       (&pMyObject->EchoTableLock);
    AnscInitializeLock       (&pMyObject->PqueryTableLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 22
0
ANSC_STATUS
AnscDetoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PANSC_DAEMON_ENGINE_TCP_OBJECT  pMyObject    = (PANSC_DAEMON_ENGINE_TCP_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                 = ANSC_DAEMON_ENGINE_TCP_OID;
    pMyObject->Create              = AnscDetoCreate;
    pMyObject->Remove              = AnscDetoRemove;
    pMyObject->EnrollObjects       = AnscDetoEnrollObjects;
    pMyObject->Initialize          = AnscDetoInitialize;

    pMyObject->hDaemonServer       = (ANSC_HANDLE)NULL;
    pMyObject->CurSocketCount      = 0;
    pMyObject->MaxSocketCount      = ANSC_DETO_MAX_SOCKET_COUNT;
    pMyObject->ControlFlags        = 0;
    pMyObject->StartTime           = 0;
    pMyObject->AvgServingTime      = 0;
    pMyObject->SocketTimeOut       = ANSC_DETO_SOCKET_TIMEOUT;
    pMyObject->bStarted            = FALSE;
    pMyObject->bCleaningDemanded   = FALSE;
    pMyObject->bBusy               = FALSE;

    pMyObject->TtcCount            = 0;
    pMyObject->MtcCount            = 0;
    pMyObject->TrcCount            = 0;
    pMyObject->MrcCount            = 0;
    pMyObject->TscCount            = 0;
    pMyObject->MscCount            = 0;

    pMyObject->GetDaemonServer     = AnscDetoGetDaemonServer;
    pMyObject->SetDaemonServer     = AnscDetoSetDaemonServer;
    pMyObject->GetMaxSocketCount   = AnscDetoGetMaxSocketCount;
    pMyObject->SetMaxSocketCount   = AnscDetoSetMaxSocketCount;
    pMyObject->GetControlFlags     = AnscDetoGetControlFlags;
    pMyObject->SetControlFlags     = AnscDetoSetControlFlags;
    pMyObject->Reset               = AnscDetoReset;

    pMyObject->GetSocketByAddress  = AnscDetoGetSocketByAddress;
    pMyObject->GetSocketByAddress2 = AnscDetoGetSocketByAddress2;
    pMyObject->GetSocketByOsocket  = AnscDetoGetSocketByOsocket;
    pMyObject->GetSocketByOsocket2 = AnscDetoGetSocketByOsocket2;
    pMyObject->AddSocket           = AnscDetoAddSocket;
    pMyObject->DelSocket           = AnscDetoDelSocket;
    pMyObject->DelAllSockets       = AnscDetoDelAllSockets;
    pMyObject->ExpAllSockets       = AnscDetoExpAllSockets;
    pMyObject->EnableRecv          = AnscDetoEnableRecv;
    pMyObject->EnableSend          = AnscDetoEnableSend;

    pMyObject->RecvTask            = AnscDetoRecvTask;
    pMyObject->SendTask            = AnscDetoSendTask;

    pMyObject->Start               = AnscDetoStart;
    pMyObject->Stop                = AnscDetoStop;
    pMyObject->Cancel              = AnscDetoCancel;
    pMyObject->Clean               = AnscDetoClean;
    pMyObject->Snapshot            = AnscDetoSnapshot;
    pMyObject->CloseUp             = AnscDetoCloseUp;

    pMyObject->Recv                = AnscDetoRecv;
    pMyObject->Recv2               = AnscDetoRecv2;
    pMyObject->Send                = AnscDetoSend;
    pMyObject->Send2               = AnscDetoSend2;

    AnscInitializeEvent(&pMyObject->RecvEvent     );
    AnscSetEvent       (&pMyObject->RecvEvent     );
    AnscInitializeEvent(&pMyObject->SendEvent     );
    AnscSetEvent       (&pMyObject->SendEvent     );
    AnscInitializeEvent(&pMyObject->NewSocketEvent);
    AnscResetEvent     (&pMyObject->NewSocketEvent);

    AnscInitializeLock(&pMyObject->RecvSocketSetLock);
    AnscInitializeLock(&pMyObject->SendSocketSetLock);

    for ( i = 0; i < ANSC_DETO_SOCKET_TABLE_SIZE; i++ )
    {
        AnscSListInitializeHeader(&pMyObject->SocketTable[i]);
    }
    AnscInitializeLock(&pMyObject->SocketTableLock);

    AnscQueueInitializeHeader(&pMyObject->PacketQueue    );
    AnscInitializeLock       (&pMyObject->PacketQueueLock);

    return  ANSC_STATUS_SUCCESS;
}
Exemplo n.º 23
0
ANSC_STATUS
HttpScoInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_SIMPLE_CLIENT_OBJECT      pMyObject    = (PHTTP_SIMPLE_CLIENT_OBJECT)hThisObject;
    ULONG                           i            = 0;

    /*
     * Until you have to simulate C++ object-oriented programming style with standard C, you don't
     * appreciate all the nice little things come with C++ language and all the dirty works that
     * have been done by the C++ compilers. Member initialization is one of these things. While in
     * C++ you don't have to initialize all the member fields inherited from the base class since
     * the compiler will do it for you, such is not the case with C.
     */
    AnscCoInitialize((ANSC_HANDLE)pMyObject);

    /*
     * Although we have initialized some of the member fields in the "create" member function, we
     * repeat the work here for completeness. While this simulation approach is pretty stupid from
     * a C++/Java programmer perspective, it's the best we can get for universal embedded network
     * programming. Before we develop our own operating system (don't expect that to happen any
     * time soon), this is the way things gonna be.
     */
    pMyObject->Oid                   = HTTP_SIMPLE_CLIENT_OID;
    pMyObject->Create                = HttpScoCreate;
    pMyObject->Remove                = HttpScoRemove;
    pMyObject->EnrollObjects         = HttpScoEnrollObjects;
    pMyObject->Initialize            = HttpScoInitialize;

    pMyObject->ClientMode            = HTTP_SCO_MODE_COMPACT;
    pMyObject->bActive               = FALSE;
    pMyObject->hWebClientSession     = NULL;
	pMyObject->SessionIdleTimeout	 = 0;

    pMyObject->GetBspIf              = HttpScoGetBspIf;
    pMyObject->SetBspIf              = HttpScoSetBspIf;
    pMyObject->GetHfpIf              = HttpScoGetHfpIf;
    pMyObject->SetHfpIf              = HttpScoSetHfpIf;
    pMyObject->GetCasIf              = HttpScoGetCasIf;
    pMyObject->GetClientAuthObj      = HttpScoGetClientAuthObj;
    pMyObject->GetClientMode         = HttpScoGetClientMode;
    pMyObject->SetClientMode         = HttpScoSetClientMode;
    pMyObject->GetProductName        = HttpScoGetProductName;
    pMyObject->SetProductName        = HttpScoSetProductName;
	pMyObject->SetSessionIdleTimeout = HttpScoSetSessionIdleTimeout;

    pMyObject->GetProperty           = HttpScoGetProperty;
    pMyObject->SetProperty           = HttpScoSetProperty;
    pMyObject->ResetProperty         = HttpScoResetProperty;
    pMyObject->Reset                 = HttpScoReset;

    pMyObject->GetCredential         = HttpScoGetCredential;

    pMyObject->Engage                = HttpScoEngage;
    pMyObject->Cancel                = HttpScoCancel;
    pMyObject->SessionTdoInvoke      = HttpScoSessionTdoInvoke;

    pMyObject->AcquireWcso           = HttpScoAcquireWcso;
    pMyObject->ReleaseWcso           = HttpScoReleaseWcso;
    pMyObject->ManufactureWcsoPool   = HttpScoManufactureWcsoPool;
    pMyObject->DestroyWcsoPool       = HttpScoDestroyWcsoPool;

    pMyObject->AcquireWcto           = HttpScoAcquireWcto;
    pMyObject->ReleaseWcto           = HttpScoReleaseWcto;
    pMyObject->ManufactureWctoPool   = HttpScoManufactureWctoPool;
    pMyObject->DestroyWctoPool       = HttpScoDestroyWctoPool;

    pMyObject->AcquireBmoReq         = HttpScoAcquireBmoReq;
    pMyObject->ReleaseBmoReq         = HttpScoReleaseBmoReq;
    pMyObject->ManufactureBmoReqPool = HttpScoManufactureBmoReqPool;
    pMyObject->DestroyBmoReqPool     = HttpScoDestroyBmoReqPool;

    pMyObject->AcquireBmoRep         = HttpScoAcquireBmoRep;
    pMyObject->ReleaseBmoRep         = HttpScoReleaseBmoRep;
    pMyObject->ManufactureBmoRepPool = HttpScoManufactureBmoRepPool;
    pMyObject->DestroyBmoRepPool     = HttpScoDestroyBmoRepPool;

    pMyObject->Request               = HttpScoRequest;
    pMyObject->Request2              = HttpScoRequest2;
    pMyObject->Request3              = HttpScoRequest3;
    pMyObject->DoOptions             = HttpScoDoOptions;
    pMyObject->DoGet                 = HttpScoDoGet;
    pMyObject->DoHead                = HttpScoDoHead;
    pMyObject->DoPost                = HttpScoDoPost;
    pMyObject->DoPut                 = HttpScoDoPut;
    pMyObject->DoDelete              = HttpScoDoDelete;
    pMyObject->DoTrace               = HttpScoDoTrace;
    pMyObject->DoConnect             = HttpScoDoConnect;

    pMyObject->MapWcso               = HttpScoMapWcso;
    pMyObject->GetWcso               = HttpScoGetWcso;
    pMyObject->AddWcso               = HttpScoAddWcso;
    pMyObject->DelAllWcsos           = HttpScoDelAllWcsos;

    pMyObject->BspPolish             = HttpScoBspPolish;
    pMyObject->BspBrowse             = HttpScoBspBrowse;
    pMyObject->BspNotify             = HttpScoBspNotify;

    pMyObject->SetPeerAddresses      = HttpScoSetPeerAddresses;
    pMyObject->GetNextPeerAddr       = HttpScoGetNextPeerAddr;
    pMyObject->GetCurPeerAddr        = HttpScoGetCurPeerAddr;
    pMyObject->ResetPeerAddrPick     = HttpScoResetPeerAddrPick;


    for ( i = 0; i < HTTP_SCO_WCSO_TABLE_SIZE; i++ )
    {
        AnscSListInitializeHeader(&pMyObject->WcsoTable[i]);
    }
    AnscInitializeLock(&pMyObject->WcsoTableLock);

    AnscSListInitializeHeader(&pMyObject->WcsoSList      );
    AnscInitializeLock       (&pMyObject->WcsoSListLock  );
    AnscSListInitializeHeader(&pMyObject->WctoSList      );
    AnscInitializeLock       (&pMyObject->WctoSListLock  );

    AnscSListInitializeHeader(&pMyObject->BmoReqSList    );
    AnscInitializeLock       (&pMyObject->BmoReqSListLock);
    AnscSListInitializeHeader(&pMyObject->BmoRepSList    );
    AnscInitializeLock       (&pMyObject->BmoRepSListLock);

    /*
     * We shall initialize the configuration properties to the default values, which may be changed
     * later via the set_property() member function. Note that this call may not guarantee a valid
     * and legtimate configuration.
     */
    pMyObject->ResetProperty((ANSC_HANDLE)pMyObject);

    return  ANSC_STATUS_SUCCESS;
}