• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 NET_WEBSOCKET_FFI_STRUCTS_H
17 #define NET_WEBSOCKET_FFI_STRUCTS_H
18 
19 #include <cstdint>
20 
21 #include "cj_ffi/cj_common_ffi.h"
22 
23 #ifdef __cplusplus
24 #define EXTERN_C_START extern "C" {
25 #define EXTERN_C_END }
26 #else
27 #define EXTERN_C_START
28 #define EXTERN_C_END
29 #endif
30 
31 EXTERN_C_START
32     struct CHttpProxy {
33         char* host;
34         uint16_t port;
35         char** exclusionList;
36         int64_t exclusionListSize;
37     };
38 
39     struct CClientCert {
40         char* certPath;
41         char* keyPath;
42         char* keyPassword;
43     };
44 
45     struct CWebSocketRequestOptions {
46         CArrString header;
47         char* caPath;
48         CClientCert* clientCert;
49         char* protocol;
50         bool usingSystemProxy;
51         CHttpProxy* httpProxy;
52     };
53 
54     struct CWebSocketCloseOptions {
55         uint32_t code;
56         char* reason;
57     };
58 
59     struct CWebSocketCallbackData {
60         int32_t code;
61         int32_t typeId;
62         uint8_t* data;
63         int32_t dataLen;
64     };
65 
66     struct COpenResponse {
67         uint32_t status;
68         char* message;
69     };
70 
71     struct CMessageResponse {
72         CArrUI8 result;
73         int32_t resultType;
74     };
75 
76     struct CErrorResponse {
77         int32_t code;
78         uint32_t httpResponse;
79     };
80 
81     struct CCloseResponse {
82         uint32_t code;
83         char* reason;
84     };
85 
86     struct CReceiveResponse {
87         CArrString header;
88         int32_t headerType;
89     };
90 EXTERN_C_END
91 
92 #endif