• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef HANDLE_CMD_H
17 #define HANDLE_CMD_H
18 
19 #include <stdint.h>
20 #include "hlt_type.h"
21 #include "channel_res.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define MAX_CMD_ID_LEN (15)
28 #define MAX_CMD_FUNCID_LEN (64)
29 #define MAX_CMD_PARAS_NUM (100)
30 
31 typedef struct {
32     uint8_t parasNum;
33     char id[MAX_CMD_ID_LEN];
34     char funcId[MAX_CMD_FUNCID_LEN];
35     char paras[MAX_CMD_PARAS_NUM][CONTROL_CHANNEL_MAX_MSG_LEN];
36     char result[CONTROL_CHANNEL_MAX_MSG_LEN];
37 } CmdData;
38 
39 /**
40 * @brief  Expected result value
41 */
42 int ExpectResult(CmdData *expectCmdData);
43 
44 /**
45 * @brief  Waiting for the result of the peer end
46 */
47 int WaitResultFromPeer(CmdData *expectCmdData);
48 
49 /**
50 * @brief  Resolve instructions from a string
51 */
52 int ParseCmdFromStr(char *str, CmdData *cmdData);
53 
54 /**
55 * @brief  Parse the instruction from the buffer.
56 */
57 int ParseCmdFromBuf(ControlChannelBuf *dataBuf, CmdData *cmdData);
58 
59 /**
60 * @brief  Execute the corresponding command.
61 */
62 int ExecuteCmd(CmdData *cmdData);
63 
64 /**
65 * @brief  Obtain the CTX configuration content from the character string parsing.
66 */
67 int ParseCtxConfigFromString(char (*string)[CONTROL_CHANNEL_MAX_MSG_LEN], HLT_Ctx_Config *ctxConfig);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif // HANDLE_CMD_H