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 RPC_FUNC_H 17 #define RPC_FUNC_H 18 19 #include <pthread.h> 20 21 #include "handle_cmd.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef struct { 28 char *funcId; 29 int (*hfunc)(CmdData *cmdData); 30 } RpcFunList; 31 32 /** 33 * @brief Obtain the list of registered functions. 34 */ 35 RpcFunList* GetRpcFuncList(void); 36 37 /** 38 * @brief Obtain the number of registered functions. 39 */ 40 int GetRpcFuncNum(void); 41 42 /** 43 * @brief Invoke the RPC to create CTX resources. 44 */ 45 int RpcTlsNewCtx(CmdData*); 46 47 /** 48 * @brief Invoke the RPC to create CTX resources with provider. 49 */ 50 int RpcProviderTlsNewCtx(CmdData *cmdData); 51 52 /** 53 * @brief Invoke the RPC to set the CTX information. 54 */ 55 int RpcTlsSetCtx(CmdData*); 56 57 /** 58 * @brief Invoke the RPC to create an SSL resource. 59 */ 60 int RpcTlsNewSsl(CmdData*); 61 62 /** 63 * @brief Invoke the RPC to set the SSL information. 64 */ 65 int RpcTlsSetSsl(CmdData*); 66 67 /** 68 * @brief The RPC invokes the TLS connection to be listened on. 69 */ 70 int RpcTlsListen(CmdData *cmdData); 71 72 /** 73 * @brief Invoke the RPC to wait for the TLS connection. 74 */ 75 int RpcTlsAccept(CmdData*); 76 77 /** 78 * @brief Invoke the RPC interface for TLS connection. 79 */ 80 int RpcTlsConnect(CmdData*); 81 82 /** 83 * @brief Invoke the RPC to read data through TLS. 84 */ 85 int RpcTlsRead(CmdData *cmdData); 86 87 /** 88 * @brief Invoke the RPC to write data through TLS. 89 */ 90 int RpcTlsWrite(CmdData *cmdData); 91 92 /** 93 * @brief Invoke the RPC interface to enable renegotiation. 94 */ 95 int RpcTlsRenegotiate(CmdData *cmdData); 96 97 /** 98 * @brief The RPC call is used to enable the pha. 99 */ 100 int RpcTlsVerifyClientPostHandshake(CmdData *cmdData); 101 102 /** 103 * @brief The RPC exits the process 104 */ 105 int RpcProcessExit(CmdData*); 106 107 /** 108 * @brief RPC bound port 109 */ 110 int RunDataChannelBind(void *param); 111 112 /** 113 * @brief RPC listening data connection 114 */ 115 int RpcDataChannelAccept(CmdData*); 116 117 /** 118 * @brief The RPC data initiates a connection. 119 */ 120 int RpcDataChannelConnect(CmdData *cmdData); 121 122 /** 123 * @brief RPC listens on a certain type of data connection. 124 */ 125 int RunDataChannelAccept(void *param); 126 127 /** 128 * @brief RPC bound port 129 */ 130 int RpcDataChannelBind(CmdData *cmdData); 131 132 /** 133 * @brief RPC registration hook 134 */ 135 int RpcTlsRegCallback(CmdData *cmdData); 136 137 /** 138 * @brief RPC Obtain the SSL connection status. 139 */ 140 int RpcTlsGetStatus(CmdData *cmdData); 141 142 /** 143 * @brief RPC Obtain the flag of the alert message. 144 */ 145 int RpcTlsGetAlertFlag(CmdData *cmdData); 146 147 /** 148 * @brief RPC Obtain the level of the alert message. 149 */ 150 int RpcTlsGetAlertLevel(CmdData *cmdData); 151 152 /** 153 * @brief RPC Obtain the description of the alert message. 154 */ 155 int RpcTlsGetAlertDescription(CmdData *cmdData); 156 157 /** 158 * @brief RPC Disable the TLS connection. 159 */ 160 int RpcTlsClose(CmdData *cmdData); 161 162 /** 163 * @brief RPC Release the CTX and SSL contexts. 164 */ 165 int RpcFreeResFormSsl(CmdData *cmdData); 166 167 168 int RpcCloseFd(CmdData *cmdData); 169 170 int RpcTlsSetMtu(CmdData *cmdData); 171 172 int RpcTlsGetErrorCode(CmdData *cmdData); 173 174 #ifdef __cplusplus 175 } 176 #endif 177 178 #endif // RPC_FUNC_H 179