• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "openthread-br/config.h"
38 
39 #include <string>
40 
41 #include <dbus/dbus.h>
42 
43 namespace otbr {
44 
45 /**
46  * @namespace otbr::DBus
47  *
48  * @brief This namespace contains OpenThread Border Router DBus API.
49  *
50  */
51 namespace DBus {
52 
53 enum class ClientError
54 {
55     ERROR_NONE = 0, ///< No error.
56 
57     ERROR_ERRNO = -1, ///< Error defined by errno.
58     ERROR_DBUS  = -3, ///< DBus error.
59 
60     /**
61      * Operational failed.
62      */
63     OT_ERROR_FAILED = 1,
64 
65     /**
66      * Message was dropped.
67      */
68     OT_ERROR_DROP = 2,
69 
70     /**
71      * Insufficient buffers.
72      */
73     OT_ERROR_NO_BUFS = 3,
74 
75     /**
76      * No route available.
77      */
78     OT_ERROR_NO_ROUTE = 4,
79 
80     /**
81      * Service is busy and could not service the operation.
82      */
83     OT_ERROR_BUSY = 5,
84 
85     /**
86      * Failed to parse message or arguments.
87      */
88     OT_ERROR_PARSE = 6,
89 
90     /**
91      * Input arguments are invalid.
92      */
93     OT_ERROR_INVALID_ARGS = 7,
94 
95     /**
96      * Security checks failed.
97      */
98     OT_ERROR_SECURITY = 8,
99 
100     /**
101      * Address resolution requires an address query operation.
102      */
103     OT_ERROR_ADDRESS_QUERY = 9,
104 
105     /**
106      * Address is not in the source match table.
107      */
108     OT_ERROR_NO_ADDRESS = 10,
109 
110     /**
111      * Operation was aborted.
112      */
113     OT_ERROR_ABORT = 11,
114 
115     /**
116      * Function or method is not implemented.
117      */
118     OT_ERROR_NOT_IMPLEMENTED = 12,
119 
120     /**
121      * Cannot complete due to invalid state.
122      */
123     OT_ERROR_INVALID_STATE = 13,
124 
125     /**
126      * No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006).
127      */
128     OT_ERROR_NO_ACK = 14,
129 
130     /**
131      * A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed
132      * (IEEE 802.15.4-2006).
133      */
134     OT_ERROR_CHANNEL_ACCESS_FAILURE = 15,
135 
136     /**
137      * Not currently attached to a Thread Partition.
138      */
139     OT_ERROR_DETACHED = 16,
140 
141     /**
142      * FCS check failure while receiving.
143      */
144     OT_ERROR_FCS = 17,
145 
146     /**
147      * No frame received.
148      */
149     OT_ERROR_NO_FRAME_RECEIVED = 18,
150 
151     /**
152      * Received a frame from an unknown neighbor.
153      */
154     OT_ERROR_UNKNOWN_NEIGHBOR = 19,
155 
156     /**
157      * Received a frame from an invalid source address.
158      */
159     OT_ERROR_INVALID_SOURCE_ADDRESS = 20,
160 
161     /**
162      * Received a frame filtered by the address filter (allowlisted or denylisted).
163      */
164     OT_ERROR_ADDRESS_FILTERED = 21,
165 
166     /**
167      * Received a frame filtered by the destination address check.
168      */
169     OT_ERROR_DESTINATION_ADDRESS_FILTERED = 22,
170 
171     /**
172      * The requested item could not be found.
173      */
174     OT_ERROR_NOT_FOUND = 23,
175 
176     /**
177      * The operation is already in progress.
178      */
179     OT_ERROR_ALREADY = 24,
180 
181     /**
182      * The creation of IPv6 address failed.
183      */
184     OT_ERROR_IP6_ADDRESS_CREATION_FAILURE = 26,
185 
186     /**
187      * Operation prevented by mode flags
188      */
189     OT_ERROR_NOT_CAPABLE = 27,
190 
191     /**
192      * Coap response or acknowledgment or DNS, SNTP response not received.
193      */
194     OT_ERROR_RESPONSE_TIMEOUT = 28,
195 
196     /**
197      * Received a duplicated frame.
198      */
199     OT_ERROR_DUPLICATED = 29,
200 
201     /**
202      * Message is being dropped from reassembly list due to timeout.
203      */
204     OT_ERROR_REASSEMBLY_TIMEOUT = 30,
205 
206     /**
207      * Message is not a TMF Message.
208      */
209     OT_ERROR_NOT_TMF = 31,
210 
211     /**
212      * Received a non-lowpan data frame.
213      */
214     OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32,
215 
216     /**
217      * The link margin was too low.
218      */
219     OT_ERROR_LINK_MARGIN_LOW = 34,
220 
221     /**
222      * Request rejected.
223      */
224     OT_ERROR_REJECTED = 37,
225 
226     /**
227      * Generic error (should not use).
228      */
229     OT_ERROR_GENERIC = 255,
230 };
231 
232 bool operator==(ClientError aError, int aValue);
233 bool operator!=(ClientError aError, int aValue);
234 
235 } // namespace DBus
236 } // namespace otbr
237 
238 #endif // OTBR_DBUS_COMMON_ERROR_HPP_
239