• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DEF_H
17 #define DEV_AUTH_DEV_SESSION_DEF_H
18 
19 #include "auth_sub_session.h"
20 #include "compatible_sub_session.h"
21 #include "expand_sub_session.h"
22 #include "identity_defines.h"
23 #include "dev_session_fwk.h"
24 #include "hc_vector.h"
25 
26 #define FIELD_DATA "data"
27 #define FIELD_VR "vr"
28 #define FIELD_INDEX "index"
29 #define FIELD_TOTAL "total"
30 #define FIELD_CRED_URL "credUrl"
31 #define FIELD_PROTOCOL "protocol"
32 #define FIELD_CMDS "cmds"
33 #define FIELD_AUTH_MSG "authMsg"
34 #define FIELD_AUTH_DATA "authData"
35 #define FIELD_ABILITY "ability"
36 #define FIELD_TYPE "type"
37 #define FIELD_MSG "msg"
38 
39 #define FIELD_HAND_SHAKE "handshake"
40 #define FIELD_AUTH_EVENT "authEvent"
41 #define FIELD_ID "id"
42 #define FIELD_TD_CMDS "tdCmds"
43 #define FIELD_SP_CMDS "spCmds"
44 #define FIELD_CMD_EVENT "cmdEvent"
45 #define FIELD_SESSION_FAIL_EVENT "failEvent"
46 
47 #define DEV_SESSION_SALT_LEN 32
48 
49 typedef struct {
50     int32_t type;
51     const CJson *data;
52 } SessionEvent;
53 
54 DECLARE_HC_VECTOR(EventList, SessionEvent)
55 DECLARE_HC_VECTOR(AuthSubSessionList, AuthSubSession *)
56 
57 typedef struct {
58     DevSession base;
59     bool isClient;
60     int32_t opCode;
61     int32_t channelType;
62     int64_t channelId;
63     CJson *context;
64     int32_t curState;
65     int32_t restartState;
66     uint32_t credCurIndex;
67     uint32_t credTotalNum;
68     Uint8Buff salt;
69     Uint8Buff sessionKey;
70     EventList eventList;
71     IdentityInfoVec credList;
72     ProtocolEntity protocolEntity;
73     AuthSubSessionList authSubSessionList;
74     ExpandSubSession *expandSubSession;
75     CompatibleBaseSubSession *compatibleSubSession;
76     bool isCredAuth;
77 } SessionImpl;
78 
79 #endif
80