1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DEV_AUTH_DEV_SESSION_V2_H 17 #define DEV_AUTH_DEV_SESSION_V2_H 18 19 #include "dev_session_def.h" 20 21 typedef enum { 22 JUMP_TO_NEXT_STATE, 23 STAY_STATE, 24 RESTART_STATE, 25 JUMP_TO_FINISH_STATE 26 } JumpPolicy; 27 28 typedef enum { 29 INIT_CLIENT_STATE = 0, 30 INIT_SERVER_STATE, 31 HAND_SHAKE_REQ_STATE, 32 HAND_SHAKE_RSP_STATE, 33 AUTH_STATE, 34 EXPAND_STATE, 35 SESSION_FINISH_STATE, 36 SESSION_FAIL_STATE, 37 } SessionStateEnum; 38 39 typedef enum { 40 START_EVENT, 41 HAND_SHAKE_EVENT, 42 HAND_SHAKE_RSP_EVENT, 43 AUTH_EVENT, 44 EXPAND_EVENT, 45 SESSION_FAIL_EVENT, 46 SESSION_UNKNOWN_EVENT, 47 } SessionEventType; 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 bool IsSupportSessionV2(void); 54 AuthSubSessionList CreateAuthSubSessionList(void); 55 void DestroyAuthSubSessionList(AuthSubSessionList *list); 56 EventList CreateEventList(void); 57 void DestroyEventList(EventList *list); 58 int32_t SessionSwitchState(SessionImpl *impl, SessionEvent *event, CJson *sessionMsg); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 #endif 64