Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / ot-br-posix / repo / src / dbus / common / error.hpp
1 /*
2  *    Copyright (c) 2020, The OpenThread Authors.
3  *    All rights reserved.
4  *
5  *    Redistribution and use in source and binary forms, with or without
6  *    modification, are permitted provided that the following conditions are met:
7  *    1. Redistributions of source code must retain the above copyright
8  *       notice, this list of conditions and the following disclaimer.
9  *    2. Redistributions in binary form must reproduce the above copyright
10  *       notice, this list of conditions and the following disclaimer in the
11  *       documentation and/or other materials provided with the distribution.
12  *    3. Neither the name of the copyright holder nor the
13  *       names of its contributors may be used to endorse or promote products
14  *       derived from this software without specific prior written permission.
15  *
16  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *    POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 /**
30  * @file
31  * This file includes definitions for d-bus client errors.
32  */
33
34 #ifndef OTBR_DBUS_COMMON_ERROR_HPP_
35 #define OTBR_DBUS_COMMON_ERROR_HPP_
36
37 #include <string>
38
39 #include <dbus/dbus.h>
40
41 namespace otbr {
42
43 /**
44  * @namespace otbr::DBus
45  *
46  * @brief This namespace contains OpenThread Border Router DBus API.
47  *
48  */
49 namespace DBus {
50
51 enum class ClientError
52 {
53     ERROR_NONE = 0, ///< No error.
54
55     ERROR_ERRNO = -1, ///< Error defined by errno.
56     ERROR_DBUS  = -3, ///< DBus error.
57
58     /**
59      * Operational failed.
60      */
61     OT_ERROR_FAILED = 1,
62
63     /**
64      * Message was dropped.
65      */
66     OT_ERROR_DROP = 2,
67
68     /**
69      * Insufficient buffers.
70      */
71     OT_ERROR_NO_BUFS = 3,
72
73     /**
74      * No route available.
75      */
76     OT_ERROR_NO_ROUTE = 4,
77
78     /**
79      * Service is busy and could not service the operation.
80      */
81     OT_ERROR_BUSY = 5,
82
83     /**
84      * Failed to parse message or arguments.
85      */
86     OT_ERROR_PARSE = 6,
87
88     /**
89      * Input arguments are invalid.
90      */
91     OT_ERROR_INVALID_ARGS = 7,
92
93     /**
94      * Security checks failed.
95      */
96     OT_ERROR_SECURITY = 8,
97
98     /**
99      * Address resolution requires an address query operation.
100      */
101     OT_ERROR_ADDRESS_QUERY = 9,
102
103     /**
104      * Address is not in the source match table.
105      */
106     OT_ERROR_NO_ADDRESS = 10,
107
108     /**
109      * Operation was aborted.
110      */
111     OT_ERROR_ABORT = 11,
112
113     /**
114      * Function or method is not implemented.
115      */
116     OT_ERROR_NOT_IMPLEMENTED = 12,
117
118     /**
119      * Cannot complete due to invalid state.
120      */
121     OT_ERROR_INVALID_STATE = 13,
122
123     /**
124      * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006).
125      */
126     OT_ERROR_NO_ACK = 14,
127
128     /**
129      * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed
130      * (IEEE 802.15.4-2006).
131      */
132     OT_ERROR_CHANNEL_ACCESS_FAILURE = 15,
133
134     /**
135      * Not currently attached to a Thread Partition.
136      */
137     OT_ERROR_DETACHED = 16,
138
139     /**
140      * FCS check failure while receiving.
141      */
142     OT_ERROR_FCS = 17,
143
144     /**
145      * No frame received.
146      */
147     OT_ERROR_NO_FRAME_RECEIVED = 18,
148
149     /**
150      * Received a frame from an unknown neighbor.
151      */
152     OT_ERROR_UNKNOWN_NEIGHBOR = 19,
153
154     /**
155      * Received a frame from an invalid source address.
156      */
157     OT_ERROR_INVALID_SOURCE_ADDRESS = 20,
158
159     /**
160      * Received a frame filtered by the address filter (allowlisted or denylisted).
161      */
162     OT_ERROR_ADDRESS_FILTERED = 21,
163
164     /**
165      * Received a frame filtered by the destination address check.
166      */
167     OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22,
168
169     /**
170      * The requested item could not be found.
171      */
172     OT_ERROR_NOT_FOUND = 23,
173
174     /**
175      * The operation is already in progress.
176      */
177     OT_ERROR_ALREADY = 24,
178
179     /**
180      * The creation of IPv6 address failed.
181      */
182     OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26,
183
184     /**
185      * Operation prevented by mode flags
186      */
187     OT_ERROR_NOT_CAPABLE = 27,
188
189     /**
190      * Coap response or acknowledgment or DNS, SNTP response not received.
191      */
192     OT_ERROR_RESPONSE_TIMEOUT = 28,
193
194     /**
195      * Received a duplicated frame.
196      */
197     OT_ERROR_DUPLICATED = 29,
198
199     /**
200      * Message is being dropped from reassembly list due to timeout.
201      */
202     OT_ERROR_REASSEMBLY_TIMEOUT = 30,
203
204     /**
205      * Message is not a TMF Message.
206      */
207     OT_ERROR_NOT_TMF = 31,
208
209     /**
210      * Received a non-lowpan data frame.
211      */
212     OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32,
213
214     /**
215      * The link margin was too low.
216      */
217     OT_ERROR_LINK_MARGIN_LOW = 34,
218
219     /**
220      * Generic error (should not use).
221      */
222     OT_ERROR_GENERIC = 255,
223 };
224
225 bool operator==(ClientError aError, int aValue);
226 bool operator!=(ClientError aError, int aValue);
227
228 } // namespace DBus
229 } // namespace otbr
230
231 #endif // OTBR_DBUS_COMMON_ERROR_HPP_