ANSC_STATUS TlsRkoResetProperty ( ANSC_HANDLE hThisObject ) { PTLS_RECORD_KEEPER_OBJECT pMyObject = (PTLS_RECORD_KEEPER_OBJECT )hThisObject; PTLS_RECORD_KEEPER_PROPERTY pProperty = (PTLS_RECORD_KEEPER_PROPERTY)&pMyObject->Property; PTLS_RECORD_STATE pRecordStateW = (PTLS_RECORD_STATE )&pMyObject->RecordStateW; PTLS_RECORD_STATE pRecordStateR = (PTLS_RECORD_STATE )&pMyObject->RecordStateR; TlsInitRecordState(pRecordStateW); TlsInitRecordState(pRecordStateR); return ANSC_STATUS_SUCCESS; }
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; }