• 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 WIFI_DIRECT_ERROR_CODE_STRUCT_H
17 #define WIFI_DIRECT_ERROR_CODE_STRUCT_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 enum WifiDirectErrorCode {
24     /* Error code representing OK */
25     OK = 0,
26 
27     /* Error code representing start position of V1 errors. */
28     V1_ERROR_START = -401000,
29 
30     /* Indicating cannot build a p2p link because the device is already connected with a mismatch role. */
31     V1_ERROR_CONNECTED_WITH_MISMATCHED_ROLE = V1_ERROR_START - 1,
32 
33     /* Indicating cannot build a p2p link because this device is already be GC. */
34     V1_ERROR_GC_CONNECTED_TO_ANOTHER_DEVICE = V1_ERROR_START - 2,
35 
36     /* Indicating cannot build a p2p link because this device cannot be connected with the specified role. */
37     V1_ERROR_AVAILABLE_WITH_MISMATCHED_ROLE = V1_ERROR_START - 3,
38 
39     /* Indicating cannot build a p2p link because the remote device is already be GC. */
40     V1_ERROR_PEER_GC_CONNECTED_TO_ANOTHER_DEVICE = V1_ERROR_START - 4,
41 
42     /* Indicating cannot build a p2p link because both the devices are GO. */
43     V1_ERROR_BOTH_GO = V1_ERROR_START - 5,
44 
45     /* Indicating that two devices initiate a connection to peer device at the same time. */
46     V1_ERROR_TWO_WAY_SIMULTANEOUS_CONNECTION = V1_ERROR_START - 6,
47 
48     /* Indicating that this connect request has timed out. */
49     V1_ERROR_CONNECT_TIMEOUT = V1_ERROR_START - 7,
50 
51     /* Indicating that failure occurred when reusing p2p link. */
52     V1_ERROR_REUSE_FAILED = V1_ERROR_START - 8,
53 
54     /* Indicating that p2p link is used by another service. */
55     V1_ERROR_LINK_USED_BY_ANOTHER_SERVICE = V1_ERROR_START - 9,
56 
57     /* Indicating that GOInfo is wrong. */
58     V1_ERROR_WRONG_GO_INFO = V1_ERROR_START - 10,
59 
60     /* Indicating that GCInfo is wrong. */
61     V1_ERROR_WRONG_GC_INFO = V1_ERROR_START - 11,
62 
63     /* Indicating that post message to remote device via AuthConnection has failed. */
64     V1_ERROR_POST_MESSAGE_FAILED = V1_ERROR_START - 12,
65 
66     /* Indicating that cannot build a p2p link because current device is busy. */
67     V1_ERROR_BUSY = V1_ERROR_START - 15,
68 
69     /* Indicating that peer device is not a trusted device. */
70     V1_ERROR_NOT_TRUSTED_DEVICE = V1_ERROR_START - 17,
71 
72     /* Indicating that connect group failed. */
73     V1_ERROR_CONNECT_GROUP_FAILED = V1_ERROR_START - 18,
74 
75     /* Indicating that create group failed. */
76     V1_ERROR_CREATE_GROUP_FAILED = V1_ERROR_START - 19,
77 
78     /* Indicating that connect group timeout. */
79     V1_ERROR_PEER_CONNECT_GROUP_FAILED = V1_ERROR_START - 20,
80 
81     /* Indicating that create group timeout. */
82     V1_ERROR_PEER_CREATE_GROUP_FAILED = V1_ERROR_START - 21,
83 
84     /* Indicating that create group timeout. */
85     V1_ERROR_RPT_ENABLED = V1_ERROR_START - 22,
86 
87     /* Indicating that create group timeout. */
88     V1_ERROR_PEER_RPT_ENABLED = V1_ERROR_START - 23,
89 
90     /* Indicating unknown reason. */
91     V1_ERROR_UNKNOWN = V1_ERROR_START - 24,
92 
93     /* Indicating p2p interface is not available */
94     V1_ERROR_IF_NOT_AVAILABLE = V1_ERROR_START - 25,
95 
96     /* Error code representing end position of v1 errors. */
97     V1_ERROR_END = V1_ERROR_START - 30,
98 
99     /* Base error code */
100     ERROR_BASE = -200000,
101 
102     /* Error code representing invalid input parameters */
103     ERROR_INVALID_INPUT_PARAMETERS = ERROR_BASE - 1,
104 
105     /* Error code representing not context */
106     ERROR_NO_CONTEXT = ERROR_BASE - 2,
107 
108     /* Error code representing entity is busy */
109     ERROR_ENTITY_BUSY = ERROR_BASE - 3,
110 
111     /* Error code representing fail to generate a command */
112     ERROR_GENERATE_COMMAND_FAILED = ERROR_BASE - 4,
113 
114     /* Error code representing fail to post data */
115     ERROR_POST_DATA_FAILED = ERROR_BASE - 5,
116 
117     /* Error code representing wait link state change timeout */
118     ERROR_WAIT_LINK_CHANGE_TIMEOUT = ERROR_BASE - 6,
119 
120     /* Error code representing reuse link fail */
121     ERROR_SINK_REUSE_LINK_FAILED = ERROR_BASE - 7,
122 
123     /* Error code representing remove link fail */
124     ERROR_REMOVE_LINK_FAILED = ERROR_BASE - 8,
125 
126     /* Error code representing fail to config Ip */
127     ERROR_CONFIG_IP_FAIL = ERROR_BASE - 9,
128 
129     /* Error code representing no interface info on sink end */
130     ERROR_SINK_NO_INTERFACE_INFO = ERROR_BASE - 10,
131 
132     /* Error code representing fail to reuse link on source end */
133     ERROR_SOURCE_REUSE_LINK_FAILED = ERROR_BASE - 11,
134 
135     /* Error code representing no interface info on source end */
136     ERROR_SOURCE_NO_INTERFACE_INFO = ERROR_BASE - 12,
137 
138     /* Error code representing no link on source end */
139     ERROR_SOURCE_NO_LINK = ERROR_BASE - 13,
140 
141     /* Error code representing no link on sink end */
142     ERROR_SINK_NO_LINK = ERROR_BASE - 14,
143 
144     /* Error code representing manager is busy */
145     ERROR_MANAGER_BUSY = ERROR_BASE - 15,
146 
147     /* Error code representing information on auth connection is wrong */
148     ERROR_WRONG_AUTH_CONNECTION_INFO = ERROR_BASE - 16,
149 
150     /* Error code representing start position of wifi direct errors */
151     ERROR_WIFI_DIRECT_START = ERROR_BASE - 4000,
152 
153     /* Error code representing no suitable wifi direct processor */
154     ERROR_WIFI_DIRECT_NO_SUITABLE_PROCESSOR = ERROR_BASE - 4001,
155 
156     /* Error code representing failed to process wifi direct command */
157     ERROR_WIFI_DIRECT_PROCESS_FAILED = ERROR_BASE - 4002,
158 
159     /* Error code representing wrong wifi direct negotiation msg */
160     ERROR_WIFI_DIRECT_WRONG_NEGOTIATION_MSG = ERROR_BASE - 4003,
161 
162     /* Error code representing wifi if off */
163     ERROR_WIFI_OFF = ERROR_BASE - 4004,
164 
165     /* Error code representing rpt is enabled */
166     ERROR_RPT_ENABLED = ERROR_BASE - 4005,
167 
168     /* Error code representing no suitable protocol */
169     ERROR_WIFI_DIRECT_NO_SUITABLE_PROTOCOL = ERROR_BASE - 4006,
170 
171     /* Error code representing fail to pack data */
172     ERROR_WIFI_DIRECT_PACK_DATA_FAILED = ERROR_BASE - 4007,
173 
174     /* Error code representing wait negotiation message timeout */
175     ERROR_WIFI_DIRECT_WAIT_NEGOTIATION_MSG_TIMEOUT = ERROR_BASE - 4008,
176 
177     /* Error code representing wait connect request timeout */
178     ERROR_WIFI_DIRECT_WAIT_CONNECT_REQUEST_TIMEOUT = ERROR_BASE - 4009,
179 
180     /* Error code representing wait connect response timeout */
181     ERROR_WIFI_DIRECT_WAIT_CONNECT_RESPONSE_TIMEOUT = ERROR_BASE - 4010,
182 
183     /* Error code representing fail to get LinkInfo on sink end */
184     ERROR_WIFI_DIRECT_SINK_GET_LINK_INFO_FAILED = ERROR_BASE - 4011,
185 
186     /* Error code representing fail to get remote wifi config info */
187     ERROR_WIFI_DIRECT_GET_REMOTE_WIFI_CFG_INFO_FAILED = ERROR_BASE - 4012,
188 
189     /* Error code representing fail to get local wifi config info */
190     ERROR_WIFI_DIRECT_SINK_GET_LOCAL_WIFI_CFG_INFO_FAILED = ERROR_BASE - 4013,
191 
192     /* Error code representing fail to get LinkInfo on source end */
193     ERROR_WIFI_DIRECT_SOURCE_GET_LINK_INFO_FAILED = ERROR_BASE - 4014,
194 
195     /* Error code representing fail to set connect notify */
196     ERROR_WIFI_DIRECT_SET_CONNECT_NOTIFY_FAILED = ERROR_BASE - 4015,
197 
198     /* Error code representing local link is not connected, but remote link is still connected */
199     ERROR_WIFI_DIRECT_LOCAL_DISCONNECTED_REMOTE_CONNECTED = ERROR_BASE - 4016,
200 
201     /* Error code representing local link is connected, but remote link is not connected */
202     ERROR_WIFI_DIRECT_LOCAL_CONNECTED_REMOTE_DISCONNECTED = ERROR_BASE - 4017,
203 
204     /* Error code representing two devices initiate a connection or a disconnection to peer device simultaneously */
205     ERROR_WIFI_DIRECT_BIDIRECTIONAL_SIMULTANEOUS_REQ = ERROR_BASE - 4018,
206 
207     /* Error code representing there exists no available interface */
208     ERROR_WIFI_DIRECT_NO_AVAILABLE_INTERFACE = ERROR_BASE - 4019,
209 
210     /* Error code representing remote device is not trusted */
211     ERROR_WIFI_DIRECT_NOT_TRUSTED_DEVICE = ERROR_BASE - 4020,
212 
213     /* Error code representing remote device is not trusted */
214     ERROR_WIFI_DIRECT_UNPACK_DATA_FAILED = ERROR_BASE - 4021,
215 
216     /* Error code representing command wait timeout */
217     ERROR_WIFI_DIRECT_COMMAND_WAIT_TIMEOUT = ERROR_BASE - 4022,
218 
219     /* Error code representing wait connect reuse response timeout */
220     ERROR_WIFI_DIRECT_WAIT_REUSE_RESPONSE_TIMEOUT = ERROR_BASE - 4023,
221 
222     /* Error code representing p2p link is used by another service */
223     ERROR_P2P_LINK_USED_BY_ANOTHER_SERVICE = ERROR_BASE - 5000,
224 
225     /* Error code representing mismatch role */
226     ERROR_P2P_GC_AVAILABLE_WITH_MISMATCHED_ROLE = ERROR_BASE - 5001,
227 
228     /* Error code representing current GC device has connected to another device */
229     ERROR_P2P_GC_CONNECTED_TO_ANOTHER_DEVICE = ERROR_BASE - 5002,
230 
231     /* Error code representing the GO is not a trusted device */
232     ERROR_P2P_GO_NOT_TRUSTED = ERROR_BASE - 5003,
233 
234     /* Error code representing fail to apply GC ip address */
235     ERROR_P2P_APPLY_GC_IP_FAIL = ERROR_BASE - 5004,
236 
237     /* Error code representing p2p server has already destroyed */
238     ERROR_P2P_SERVER_ALREADY_DESTROYED = ERROR_BASE - 5005,
239 
240     /* Error code representing two devices are both GO */
241     ERROR_P2P_BOTH_GO = ERROR_BASE - 5006,
242 
243     /* Error code representing remote GC device has connected to another GO */
244     ERROR_P2P_PEER_GC_CONNECTED_TO_ANOTHER_DEVICE = ERROR_BASE - 5007,
245 
246     /* Error code representing GO available with mismatched role */
247     ERROR_P2P_GO_AVAILABLE_WITH_MISMATCHED_ROLE = ERROR_BASE - 5008,
248 
249     /* Error code representing fail to remove link */
250     ERROR_P2P_SHARE_LINK_REMOVE_FAILED = ERROR_BASE - 5009,
251 
252     /* Error code representing fail to reuse link */
253     ERROR_P2P_SHARE_LINK_REUSE_FAILED = ERROR_BASE - 5010,
254 
255     /* Error code representing handling an expired request */
256     ERROR_P2P_EXPIRED_REQ = ERROR_BASE - 5011,
257 
258     /* Error code representing handling an expired response */
259     ERROR_P2P_EXPIRED_RESP = ERROR_BASE - 5012,
260 
261     /* Error code representing fail to connect group */
262     ERROR_P2P_CONNECT_GROUP_FAILED = ERROR_BASE - 5200,
263 
264     /* Error code representing p2p client already exists */
265     ERROR_P2P_CLIENT_EXISTS = ERROR_BASE - 5201,
266 
267     /* Error code representing fail to create p2p group */
268     ERROR_P2P_CREATE_GROUP_FAILED = ERROR_BASE - 5600,
269 
270     /* Error code representing p2p server already exists */
271     ERROR_P2P_SERVER_EXISTS = ERROR_BASE - 5601,
272 
273     /* Error code representing fail disconnect hml */
274     ERROR_HML_DISCONNECT_FAIL = ERROR_BASE - 6000,
275 
276     /* Error code representing config ip fail */
277     ERROR_HML_CONFIG_IP_FAIL = ERROR_BASE - 6001,
278 
279     /* Error code representing apply ip fail */
280     ERROR_HML_APPLY_IP_FAIL = ERROR_BASE - 6002,
281 
282     /* Error code representing fail to connect hml group */
283     ERROR_HML_CONNECT_GROUP_FAIL = ERROR_BASE - 6200,
284 
285     /* Error code representing fail to create hml group */
286     ERROR_HML_CREATE_GROUP_FAIL = ERROR_BASE - 6600,
287 
288     /* Error code representing fail to destroy hml group */
289     ERROR_HML_DESTROY_FAIL = ERROR_BASE - 6601,
290 
291     /* Error code representing fail to notify connect */
292     ERROR_HML_CONNECT_NOTIFY_FAIL = ERROR_BASE - 6602,
293 
294     /* Error code representing 3 vap conflict */
295     ERROR_LOCAL_THREE_VAP_CONFLICT = ERROR_BASE - 6603,
296 
297     /* Error code representing Peer device 3 vap conflict */
298     ERROR_PEER_THREE_VAP_CONFLICT = ERROR_BASE - 6604,
299 
300     /* Error code representing Local device 3 vap dbac conflict */
301     ERROR_LOCAL_THREE_VAP_DBAC_CONFLICT = ERROR_BASE - 6605,
302 
303     /* Error code representing Peer device 3 vap dbac conflict */
304     ERROR_PEER_THREE_VAP_DBAC_CONFLICT = ERROR_BASE - 6606,
305 
306     /* Error code representing Entity is unavailable */
307     ERROR_ENTITY_UNAVAILABLE = ERROR_BASE - 6607,
308 
309     /* Error code representing remote client join failed */
310     ERROR_HML_CLIENT_JOIN_FAIL = ERROR_BASE - 6608,
311 
312     /* Error code representing switch notify failed */
313     ERROR_HML_SWITCH_NOTIFY_FAIL = ERROR_BASE - 6609,
314 
315     /* Error code representing switch notify failed */
316     ERROR_HML_RENEGO_TO_P2P = ERROR_BASE - 6610,
317 
318     /* Error code representing waiting hand shake timeout */
319     ERROR_HML_WAITING_HANDSHAKE_TIMEOUT = ERROR_BASE - 6611,
320 
321     /* Error code wait HML_CREATE_GROUP timeout */
322     ERROR_HML_CREATE_GROUP_TIMEOUT = ERROR_BASE - 6612,
323 
324     /* Error code wait HML_DESTROY_GROUP timeout */
325     ERROR_HML_DESTROY_GROUP_TIMEOUT = ERROR_BASE - 6613,
326 
327     /* Error code wait HML_CONN_NOTIFY timeout */
328     ERROR_HML_CONN_NOTIFY_TIMEOUT = ERROR_BASE - 6614,
329 
330     /* Error code wait HML_CONNECT_GROUP timeout */
331     ERROR_HML_CONNECT_GROUP_TIMEOUT = ERROR_BASE - 6615,
332 
333     /* Error code wait HML_DISCONNECT_GROUP timeout */
334     ERROR_HML_DISCONNECT_GROUP_TIMEOUT = ERROR_BASE - 6616,
335 
336     /* Error code auth start listen failed */
337     ERROR_HML_AUTH_START_LISTEN_FAIL = ERROR_BASE - 6617,
338 
339     /* Error code auth open connection failed */
340     ERROR_HML_AUTH_OPEN_CONNECTION_FAIL = ERROR_BASE - 6618,
341 
342     /* Error code switch notify timeout */
343     ERROR_HML_SWITCH_NOTIFY_TIMEOUT = ERROR_BASE - 6619,
344 
345     /* Error code need renegotiate */
346     ERROR_HML_NEED_RENEGOTIATE = ERROR_BASE - 6620,
347 
348     /* Error code need renegotiate */
349     ERROR_HML_PRE_ASSIGN_PORT_FAILED = ERROR_BASE - 6621,
350 
351     /* Error code no negotiate channel */
352     ERROR_NO_NEGO_CHANNEL = ERROR_BASE - 6622,
353 
354     /* Error code parallelism conflict */
355     ERROR_PARALLELISM_CONFLICT = ERROR_BASE - 6623,
356 
357     /* Error code retry for avoid block */
358     ERROR_RETRY_FOR_AVOID_BLOCK = ERROR_BASE - 6624,
359 
360     /* Error code no wifi config info */
361     ERROR_NO_WIFI_CONFIG_INFO = ERROR_BASE - 6625,
362 
363     /* Error code start action listen failed */
364     ERROR_START_ACTION_LISTEN_FAILED = ERROR_BASE - 6626,
365 
366     /* Error code trigger message not handled */
367     ERROR_TRIGGER_MSG_NOT_HANDLED = ERROR_BASE - 6627,
368 
369     /* Error code representing end position of wifi direct errors */
370     ERROR_WIFI_DIRECT_END = ERROR_BASE - 6999,
371 };
372 
373 #ifdef __cplusplus
374 }
375 #endif
376 
377 #endif // WIFI_DIRECT_ERROR_CODE_STRUCT_H