1 /* 2 * Copyright (C) 2021 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 EXPAND_SUB_SESSION_H 17 #define EXPAND_SUB_SESSION_H 18 19 #include "base_cmd.h" 20 21 typedef enum { 22 EXPAND_STATE_INIT = 0, 23 EXPAND_STATE_RUNNING = 1, 24 EXPAND_STATE_FINISH = 2, 25 } ExpandStatus; 26 27 typedef struct ExpandSubSession ExpandSubSession; 28 struct ExpandSubSession { 29 int32_t state; 30 int32_t (*addCmd)(ExpandSubSession *self, int32_t cmdType, 31 void *params, bool isClient, int32_t strategy); 32 int32_t (*start)(ExpandSubSession *self, CJson **returnSendMsg); 33 int32_t (*process)(ExpandSubSession *self, const CJson *receviedMsg, CJson **returnSendMsg); 34 void (*destroy)(ExpandSubSession *self); 35 }; 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 bool IsCmdSupport(int32_t cmdId); 42 int32_t CreateExpandSubSession(const Uint8Buff *nonce, const Uint8Buff *encKey, ExpandSubSession **returnObj); 43 44 #ifdef __cplusplus 45 } 46 #endif 47 #endif 48