xref: /aosp_15_r20/external/ot-br-posix/src/openwrt/ubus/otubus.hpp (revision 4a64e381480ef79f0532b2421e44e6ee336b8e0d)
1*4a64e381SAndroid Build Coastguard Worker /*
2*4a64e381SAndroid Build Coastguard Worker  *  Copyright (c) 2019, The OpenThread Authors.
3*4a64e381SAndroid Build Coastguard Worker  *  All rights reserved.
4*4a64e381SAndroid Build Coastguard Worker  *
5*4a64e381SAndroid Build Coastguard Worker  *  Redistribution and use in source and binary forms, with or without
6*4a64e381SAndroid Build Coastguard Worker  *  modification, are permitted provided that the following conditions are met:
7*4a64e381SAndroid Build Coastguard Worker  *  1. Redistributions of source code must retain the above copyright
8*4a64e381SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer.
9*4a64e381SAndroid Build Coastguard Worker  *  2. Redistributions in binary form must reproduce the above copyright
10*4a64e381SAndroid Build Coastguard Worker  *     notice, this list of conditions and the following disclaimer in the
11*4a64e381SAndroid Build Coastguard Worker  *     documentation and/or other materials provided with the distribution.
12*4a64e381SAndroid Build Coastguard Worker  *  3. Neither the name of the copyright holder nor the
13*4a64e381SAndroid Build Coastguard Worker  *     names of its contributors may be used to endorse or promote products
14*4a64e381SAndroid Build Coastguard Worker  *     derived from this software without specific prior written permission.
15*4a64e381SAndroid Build Coastguard Worker  *
16*4a64e381SAndroid Build Coastguard Worker  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17*4a64e381SAndroid Build Coastguard Worker  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*4a64e381SAndroid Build Coastguard Worker  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*4a64e381SAndroid Build Coastguard Worker  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20*4a64e381SAndroid Build Coastguard Worker  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*4a64e381SAndroid Build Coastguard Worker  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*4a64e381SAndroid Build Coastguard Worker  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*4a64e381SAndroid Build Coastguard Worker  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*4a64e381SAndroid Build Coastguard Worker  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*4a64e381SAndroid Build Coastguard Worker  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*4a64e381SAndroid Build Coastguard Worker  *  POSSIBILITY OF SUCH DAMAGE.
27*4a64e381SAndroid Build Coastguard Worker  */
28*4a64e381SAndroid Build Coastguard Worker 
29*4a64e381SAndroid Build Coastguard Worker /**
30*4a64e381SAndroid Build Coastguard Worker  * @file
31*4a64e381SAndroid Build Coastguard Worker  * This file includes definitions for ubus API.
32*4a64e381SAndroid Build Coastguard Worker  */
33*4a64e381SAndroid Build Coastguard Worker 
34*4a64e381SAndroid Build Coastguard Worker #ifndef OTBR_AGENT_OTUBUS_HPP_
35*4a64e381SAndroid Build Coastguard Worker #define OTBR_AGENT_OTUBUS_HPP_
36*4a64e381SAndroid Build Coastguard Worker 
37*4a64e381SAndroid Build Coastguard Worker #include "openthread-br/config.h"
38*4a64e381SAndroid Build Coastguard Worker 
39*4a64e381SAndroid Build Coastguard Worker #include <stdarg.h>
40*4a64e381SAndroid Build Coastguard Worker #include <time.h>
41*4a64e381SAndroid Build Coastguard Worker 
42*4a64e381SAndroid Build Coastguard Worker #include <openthread/ip6.h>
43*4a64e381SAndroid Build Coastguard Worker #include <openthread/link.h>
44*4a64e381SAndroid Build Coastguard Worker #include <openthread/netdiag.h>
45*4a64e381SAndroid Build Coastguard Worker #include <openthread/udp.h>
46*4a64e381SAndroid Build Coastguard Worker 
47*4a64e381SAndroid Build Coastguard Worker #include "common/code_utils.hpp"
48*4a64e381SAndroid Build Coastguard Worker #include "common/mainloop.hpp"
49*4a64e381SAndroid Build Coastguard Worker #include "ncp/rcp_host.hpp"
50*4a64e381SAndroid Build Coastguard Worker 
51*4a64e381SAndroid Build Coastguard Worker extern "C" {
52*4a64e381SAndroid Build Coastguard Worker #include <libubox/blobmsg_json.h>
53*4a64e381SAndroid Build Coastguard Worker #include <libubox/uloop.h>
54*4a64e381SAndroid Build Coastguard Worker #include <libubox/ustream.h>
55*4a64e381SAndroid Build Coastguard Worker #include <libubox/utils.h>
56*4a64e381SAndroid Build Coastguard Worker #include <libubus.h>
57*4a64e381SAndroid Build Coastguard Worker }
58*4a64e381SAndroid Build Coastguard Worker 
59*4a64e381SAndroid Build Coastguard Worker namespace otbr {
60*4a64e381SAndroid Build Coastguard Worker namespace Ncp {
61*4a64e381SAndroid Build Coastguard Worker class RcpHost;
62*4a64e381SAndroid Build Coastguard Worker }
63*4a64e381SAndroid Build Coastguard Worker 
64*4a64e381SAndroid Build Coastguard Worker namespace ubus {
65*4a64e381SAndroid Build Coastguard Worker 
66*4a64e381SAndroid Build Coastguard Worker /**
67*4a64e381SAndroid Build Coastguard Worker  * @namespace otbr::ubus
68*4a64e381SAndroid Build Coastguard Worker  *
69*4a64e381SAndroid Build Coastguard Worker  * @brief
70*4a64e381SAndroid Build Coastguard Worker  *   This namespace contains definitions for ubus related instance.
71*4a64e381SAndroid Build Coastguard Worker  */
72*4a64e381SAndroid Build Coastguard Worker 
73*4a64e381SAndroid Build Coastguard Worker class UbusServer
74*4a64e381SAndroid Build Coastguard Worker {
75*4a64e381SAndroid Build Coastguard Worker public:
76*4a64e381SAndroid Build Coastguard Worker     /**
77*4a64e381SAndroid Build Coastguard Worker      * Constructor
78*4a64e381SAndroid Build Coastguard Worker      *
79*4a64e381SAndroid Build Coastguard Worker      * @param[in] aHost  A pointer to OpenThread Controller structure.
80*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMutex       A pointer to mutex.
81*4a64e381SAndroid Build Coastguard Worker      */
82*4a64e381SAndroid Build Coastguard Worker     static void Initialize(Ncp::RcpHost *aHost, std::mutex *aMutex);
83*4a64e381SAndroid Build Coastguard Worker 
84*4a64e381SAndroid Build Coastguard Worker     /**
85*4a64e381SAndroid Build Coastguard Worker      * This method return the instance of the global UbusServer.
86*4a64e381SAndroid Build Coastguard Worker      *
87*4a64e381SAndroid Build Coastguard Worker      * @retval The reference of the UbusServer Instance.
88*4a64e381SAndroid Build Coastguard Worker      */
89*4a64e381SAndroid Build Coastguard Worker     static UbusServer &GetInstance(void);
90*4a64e381SAndroid Build Coastguard Worker 
91*4a64e381SAndroid Build Coastguard Worker     /**
92*4a64e381SAndroid Build Coastguard Worker      * This method install ubus object onto OpenWRT.
93*4a64e381SAndroid Build Coastguard Worker      */
94*4a64e381SAndroid Build Coastguard Worker     void InstallUbusObject(void);
95*4a64e381SAndroid Build Coastguard Worker 
96*4a64e381SAndroid Build Coastguard Worker     /**
97*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus scan function request.
98*4a64e381SAndroid Build Coastguard Worker      *
99*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
100*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
101*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
102*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
103*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
104*4a64e381SAndroid Build Coastguard Worker      *
105*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
106*4a64e381SAndroid Build Coastguard Worker      */
107*4a64e381SAndroid Build Coastguard Worker     static int UbusScanHandler(struct ubus_context      *aContext,
108*4a64e381SAndroid Build Coastguard Worker                                struct ubus_object       *aObj,
109*4a64e381SAndroid Build Coastguard Worker                                struct ubus_request_data *aRequest,
110*4a64e381SAndroid Build Coastguard Worker                                const char               *aMethod,
111*4a64e381SAndroid Build Coastguard Worker                                struct blob_attr         *aMsg);
112*4a64e381SAndroid Build Coastguard Worker 
113*4a64e381SAndroid Build Coastguard Worker     /**
114*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get channel function request.
115*4a64e381SAndroid Build Coastguard Worker      *
116*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
117*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
118*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
119*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
120*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
121*4a64e381SAndroid Build Coastguard Worker      *
122*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
123*4a64e381SAndroid Build Coastguard Worker      */
124*4a64e381SAndroid Build Coastguard Worker     static int UbusChannelHandler(struct ubus_context      *aContext,
125*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_object       *aObj,
126*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_request_data *aRequest,
127*4a64e381SAndroid Build Coastguard Worker                                   const char               *aMethod,
128*4a64e381SAndroid Build Coastguard Worker                                   struct blob_attr         *aMsg);
129*4a64e381SAndroid Build Coastguard Worker 
130*4a64e381SAndroid Build Coastguard Worker     /**
131*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set channel function request.
132*4a64e381SAndroid Build Coastguard Worker      *
133*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
134*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
135*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
136*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
137*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
138*4a64e381SAndroid Build Coastguard Worker      *
139*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
140*4a64e381SAndroid Build Coastguard Worker      */
141*4a64e381SAndroid Build Coastguard Worker     static int UbusSetChannelHandler(struct ubus_context      *aContext,
142*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_object       *aObj,
143*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_request_data *aRequest,
144*4a64e381SAndroid Build Coastguard Worker                                      const char               *aMethod,
145*4a64e381SAndroid Build Coastguard Worker                                      struct blob_attr         *aMsg);
146*4a64e381SAndroid Build Coastguard Worker 
147*4a64e381SAndroid Build Coastguard Worker     /**
148*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get networkname function request.
149*4a64e381SAndroid Build Coastguard Worker      *
150*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
151*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
152*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
153*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
154*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
155*4a64e381SAndroid Build Coastguard Worker      *
156*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
157*4a64e381SAndroid Build Coastguard Worker      */
158*4a64e381SAndroid Build Coastguard Worker     static int UbusNetworknameHandler(struct ubus_context      *aContext,
159*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_object       *aObj,
160*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_request_data *aRequest,
161*4a64e381SAndroid Build Coastguard Worker                                       const char               *aMethod,
162*4a64e381SAndroid Build Coastguard Worker                                       struct blob_attr         *aMsg);
163*4a64e381SAndroid Build Coastguard Worker 
164*4a64e381SAndroid Build Coastguard Worker     /**
165*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set networkname function request.
166*4a64e381SAndroid Build Coastguard Worker      *
167*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
168*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
169*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
170*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
171*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
172*4a64e381SAndroid Build Coastguard Worker      *
173*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
174*4a64e381SAndroid Build Coastguard Worker      */
175*4a64e381SAndroid Build Coastguard Worker     static int UbusSetNetworknameHandler(struct ubus_context      *aContext,
176*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_object       *aObj,
177*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_request_data *aRequest,
178*4a64e381SAndroid Build Coastguard Worker                                          const char               *aMethod,
179*4a64e381SAndroid Build Coastguard Worker                                          struct blob_attr         *aMsg);
180*4a64e381SAndroid Build Coastguard Worker 
181*4a64e381SAndroid Build Coastguard Worker     /**
182*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get state function request.
183*4a64e381SAndroid Build Coastguard Worker      *
184*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
185*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
186*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
187*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
188*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
189*4a64e381SAndroid Build Coastguard Worker      *
190*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
191*4a64e381SAndroid Build Coastguard Worker      */
192*4a64e381SAndroid Build Coastguard Worker     static int UbusStateHandler(struct ubus_context      *aContext,
193*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_object       *aObj,
194*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_request_data *aRequest,
195*4a64e381SAndroid Build Coastguard Worker                                 const char               *aMethod,
196*4a64e381SAndroid Build Coastguard Worker                                 struct blob_attr         *aMsg);
197*4a64e381SAndroid Build Coastguard Worker 
198*4a64e381SAndroid Build Coastguard Worker     /**
199*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set state function request.
200*4a64e381SAndroid Build Coastguard Worker      *
201*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
202*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
203*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
204*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
205*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
206*4a64e381SAndroid Build Coastguard Worker      *
207*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
208*4a64e381SAndroid Build Coastguard Worker      */
209*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterSetStateHandler(struct ubus_context      *aContext,
210*4a64e381SAndroid Build Coastguard Worker                                             struct ubus_object       *aObj,
211*4a64e381SAndroid Build Coastguard Worker                                             struct ubus_request_data *aRequest,
212*4a64e381SAndroid Build Coastguard Worker                                             const char               *aMethod,
213*4a64e381SAndroid Build Coastguard Worker                                             struct blob_attr         *aMsg);
214*4a64e381SAndroid Build Coastguard Worker 
215*4a64e381SAndroid Build Coastguard Worker     /**
216*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get panid function request.
217*4a64e381SAndroid Build Coastguard Worker      *
218*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
219*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
220*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
221*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
222*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
223*4a64e381SAndroid Build Coastguard Worker      *
224*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
225*4a64e381SAndroid Build Coastguard Worker      */
226*4a64e381SAndroid Build Coastguard Worker     static int UbusPanIdHandler(struct ubus_context      *aContext,
227*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_object       *aObj,
228*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_request_data *aRequest,
229*4a64e381SAndroid Build Coastguard Worker                                 const char               *aMethod,
230*4a64e381SAndroid Build Coastguard Worker                                 struct blob_attr         *aMsg);
231*4a64e381SAndroid Build Coastguard Worker 
232*4a64e381SAndroid Build Coastguard Worker     /**
233*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set panid function request.
234*4a64e381SAndroid Build Coastguard Worker      *
235*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
236*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
237*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
238*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
239*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
240*4a64e381SAndroid Build Coastguard Worker      *
241*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
242*4a64e381SAndroid Build Coastguard Worker      */
243*4a64e381SAndroid Build Coastguard Worker     static int UbusSetPanIdHandler(struct ubus_context      *aContext,
244*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_object       *aObj,
245*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_request_data *aRequest,
246*4a64e381SAndroid Build Coastguard Worker                                    const char               *aMethod,
247*4a64e381SAndroid Build Coastguard Worker                                    struct blob_attr         *aMsg);
248*4a64e381SAndroid Build Coastguard Worker 
249*4a64e381SAndroid Build Coastguard Worker     /**
250*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get pskc function request.
251*4a64e381SAndroid Build Coastguard Worker      *
252*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
253*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
254*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
255*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
256*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
257*4a64e381SAndroid Build Coastguard Worker      *
258*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
259*4a64e381SAndroid Build Coastguard Worker      */
260*4a64e381SAndroid Build Coastguard Worker     static int UbusPskcHandler(struct ubus_context      *aContext,
261*4a64e381SAndroid Build Coastguard Worker                                struct ubus_object       *aObj,
262*4a64e381SAndroid Build Coastguard Worker                                struct ubus_request_data *aRequest,
263*4a64e381SAndroid Build Coastguard Worker                                const char               *aMethod,
264*4a64e381SAndroid Build Coastguard Worker                                struct blob_attr         *aMsg);
265*4a64e381SAndroid Build Coastguard Worker 
266*4a64e381SAndroid Build Coastguard Worker     /**
267*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set pskc function request.
268*4a64e381SAndroid Build Coastguard Worker      *
269*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
270*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
271*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
272*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
273*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
274*4a64e381SAndroid Build Coastguard Worker      *
275*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
276*4a64e381SAndroid Build Coastguard Worker      */
277*4a64e381SAndroid Build Coastguard Worker     static int UbusSetPskcHandler(struct ubus_context      *aContext,
278*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_object       *aObj,
279*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_request_data *aRequest,
280*4a64e381SAndroid Build Coastguard Worker                                   const char               *aMethod,
281*4a64e381SAndroid Build Coastguard Worker                                   struct blob_attr         *aMsg);
282*4a64e381SAndroid Build Coastguard Worker 
283*4a64e381SAndroid Build Coastguard Worker     /**
284*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get networkkey function request.
285*4a64e381SAndroid Build Coastguard Worker      *
286*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
287*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
288*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
289*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
290*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
291*4a64e381SAndroid Build Coastguard Worker      *
292*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
293*4a64e381SAndroid Build Coastguard Worker      */
294*4a64e381SAndroid Build Coastguard Worker     static int UbusNetworkkeyHandler(struct ubus_context      *aContext,
295*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_object       *aObj,
296*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_request_data *aRequest,
297*4a64e381SAndroid Build Coastguard Worker                                      const char               *aMethod,
298*4a64e381SAndroid Build Coastguard Worker                                      struct blob_attr         *aMsg);
299*4a64e381SAndroid Build Coastguard Worker 
300*4a64e381SAndroid Build Coastguard Worker     /**
301*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set networkkey function request.
302*4a64e381SAndroid Build Coastguard Worker      *
303*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
304*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
305*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
306*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
307*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
308*4a64e381SAndroid Build Coastguard Worker      *
309*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
310*4a64e381SAndroid Build Coastguard Worker      */
311*4a64e381SAndroid Build Coastguard Worker     static int UbusSetNetworkkeyHandler(struct ubus_context      *aContext,
312*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_object       *aObj,
313*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_request_data *aRequest,
314*4a64e381SAndroid Build Coastguard Worker                                         const char               *aMethod,
315*4a64e381SAndroid Build Coastguard Worker                                         struct blob_attr         *aMsg);
316*4a64e381SAndroid Build Coastguard Worker 
317*4a64e381SAndroid Build Coastguard Worker     /**
318*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get rloc16 function request.
319*4a64e381SAndroid Build Coastguard Worker      *
320*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
321*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
322*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
323*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
324*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
325*4a64e381SAndroid Build Coastguard Worker      *
326*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
327*4a64e381SAndroid Build Coastguard Worker      */
328*4a64e381SAndroid Build Coastguard Worker     static int UbusRloc16Handler(struct ubus_context      *aContext,
329*4a64e381SAndroid Build Coastguard Worker                                  struct ubus_object       *aObj,
330*4a64e381SAndroid Build Coastguard Worker                                  struct ubus_request_data *aRequest,
331*4a64e381SAndroid Build Coastguard Worker                                  const char               *aMethod,
332*4a64e381SAndroid Build Coastguard Worker                                  struct blob_attr         *aMsg);
333*4a64e381SAndroid Build Coastguard Worker 
334*4a64e381SAndroid Build Coastguard Worker     /**
335*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get extpanid function request.
336*4a64e381SAndroid Build Coastguard Worker      *
337*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
338*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
339*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
340*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
341*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
342*4a64e381SAndroid Build Coastguard Worker      *
343*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
344*4a64e381SAndroid Build Coastguard Worker      */
345*4a64e381SAndroid Build Coastguard Worker     static int UbusExtPanIdHandler(struct ubus_context      *aContext,
346*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_object       *aObj,
347*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_request_data *aRequest,
348*4a64e381SAndroid Build Coastguard Worker                                    const char               *aMethod,
349*4a64e381SAndroid Build Coastguard Worker                                    struct blob_attr         *aMsg);
350*4a64e381SAndroid Build Coastguard Worker 
351*4a64e381SAndroid Build Coastguard Worker     /**
352*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set extpanid function request.
353*4a64e381SAndroid Build Coastguard Worker      *
354*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
355*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
356*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
357*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
358*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
359*4a64e381SAndroid Build Coastguard Worker      *
360*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
361*4a64e381SAndroid Build Coastguard Worker      */
362*4a64e381SAndroid Build Coastguard Worker     static int UbusSetExtPanIdHandler(struct ubus_context      *aContext,
363*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_object       *aObj,
364*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_request_data *aRequest,
365*4a64e381SAndroid Build Coastguard Worker                                       const char               *aMethod,
366*4a64e381SAndroid Build Coastguard Worker                                       struct blob_attr         *aMsg);
367*4a64e381SAndroid Build Coastguard Worker 
368*4a64e381SAndroid Build Coastguard Worker     /**
369*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get mode function request.
370*4a64e381SAndroid Build Coastguard Worker      *
371*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
372*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
373*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
374*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
375*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
376*4a64e381SAndroid Build Coastguard Worker      *
377*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
378*4a64e381SAndroid Build Coastguard Worker      */
379*4a64e381SAndroid Build Coastguard Worker     static int UbusModeHandler(struct ubus_context      *aContext,
380*4a64e381SAndroid Build Coastguard Worker                                struct ubus_object       *aObj,
381*4a64e381SAndroid Build Coastguard Worker                                struct ubus_request_data *aRequest,
382*4a64e381SAndroid Build Coastguard Worker                                const char               *aMethod,
383*4a64e381SAndroid Build Coastguard Worker                                struct blob_attr         *aMsg);
384*4a64e381SAndroid Build Coastguard Worker 
385*4a64e381SAndroid Build Coastguard Worker     /**
386*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus set mode function request.
387*4a64e381SAndroid Build Coastguard Worker      *
388*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
389*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
390*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
391*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
392*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
393*4a64e381SAndroid Build Coastguard Worker      *
394*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
395*4a64e381SAndroid Build Coastguard Worker      */
396*4a64e381SAndroid Build Coastguard Worker     static int UbusSetModeHandler(struct ubus_context      *aContext,
397*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_object       *aObj,
398*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_request_data *aRequest,
399*4a64e381SAndroid Build Coastguard Worker                                   const char               *aMethod,
400*4a64e381SAndroid Build Coastguard Worker                                   struct blob_attr         *aMsg);
401*4a64e381SAndroid Build Coastguard Worker 
402*4a64e381SAndroid Build Coastguard Worker     /**
403*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get partitionid function request.
404*4a64e381SAndroid Build Coastguard Worker      *
405*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
406*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
407*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
408*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
409*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
410*4a64e381SAndroid Build Coastguard Worker      *
411*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
412*4a64e381SAndroid Build Coastguard Worker      */
413*4a64e381SAndroid Build Coastguard Worker     static int UbusPartitionIdHandler(struct ubus_context      *aContext,
414*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_object       *aObj,
415*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_request_data *aRequest,
416*4a64e381SAndroid Build Coastguard Worker                                       const char               *aMethod,
417*4a64e381SAndroid Build Coastguard Worker                                       struct blob_attr         *aMsg);
418*4a64e381SAndroid Build Coastguard Worker 
419*4a64e381SAndroid Build Coastguard Worker     /**
420*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get leaderdata function request.
421*4a64e381SAndroid Build Coastguard Worker      *
422*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
423*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
424*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
425*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
426*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
427*4a64e381SAndroid Build Coastguard Worker      *
428*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
429*4a64e381SAndroid Build Coastguard Worker      */
430*4a64e381SAndroid Build Coastguard Worker     static int UbusLeaderdataHandler(struct ubus_context      *aContext,
431*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_object       *aObj,
432*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_request_data *aRequest,
433*4a64e381SAndroid Build Coastguard Worker                                      const char               *aMethod,
434*4a64e381SAndroid Build Coastguard Worker                                      struct blob_attr         *aMsg);
435*4a64e381SAndroid Build Coastguard Worker 
436*4a64e381SAndroid Build Coastguard Worker     /**
437*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get networkdata function request.
438*4a64e381SAndroid Build Coastguard Worker      *
439*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
440*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
441*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
442*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
443*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
444*4a64e381SAndroid Build Coastguard Worker      *
445*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
446*4a64e381SAndroid Build Coastguard Worker      */
447*4a64e381SAndroid Build Coastguard Worker     static int UbusNetworkdataHandler(struct ubus_context      *aContext,
448*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_object       *aObj,
449*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_request_data *aRequest,
450*4a64e381SAndroid Build Coastguard Worker                                       const char               *aMethod,
451*4a64e381SAndroid Build Coastguard Worker                                       struct blob_attr         *aMsg);
452*4a64e381SAndroid Build Coastguard Worker 
453*4a64e381SAndroid Build Coastguard Worker     /**
454*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get parent function request.
455*4a64e381SAndroid Build Coastguard Worker      *
456*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
457*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
458*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
459*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
460*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
461*4a64e381SAndroid Build Coastguard Worker      *
462*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
463*4a64e381SAndroid Build Coastguard Worker      */
464*4a64e381SAndroid Build Coastguard Worker     static int UbusParentHandler(struct ubus_context      *aContext,
465*4a64e381SAndroid Build Coastguard Worker                                  struct ubus_object       *aObj,
466*4a64e381SAndroid Build Coastguard Worker                                  struct ubus_request_data *aRequest,
467*4a64e381SAndroid Build Coastguard Worker                                  const char               *aMethod,
468*4a64e381SAndroid Build Coastguard Worker                                  struct blob_attr         *aMsg);
469*4a64e381SAndroid Build Coastguard Worker 
470*4a64e381SAndroid Build Coastguard Worker     /**
471*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get neighbor function request.
472*4a64e381SAndroid Build Coastguard Worker      *
473*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
474*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
475*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
476*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
477*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
478*4a64e381SAndroid Build Coastguard Worker      *
479*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
480*4a64e381SAndroid Build Coastguard Worker      */
481*4a64e381SAndroid Build Coastguard Worker     static int UbusNeighborHandler(struct ubus_context      *aContext,
482*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_object       *aObj,
483*4a64e381SAndroid Build Coastguard Worker                                    struct ubus_request_data *aRequest,
484*4a64e381SAndroid Build Coastguard Worker                                    const char               *aMethod,
485*4a64e381SAndroid Build Coastguard Worker                                    struct blob_attr         *aMsg);
486*4a64e381SAndroid Build Coastguard Worker 
487*4a64e381SAndroid Build Coastguard Worker     /**
488*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus start thread function request.
489*4a64e381SAndroid Build Coastguard Worker      *
490*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
491*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
492*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
493*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
494*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
495*4a64e381SAndroid Build Coastguard Worker      *
496*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
497*4a64e381SAndroid Build Coastguard Worker      */
498*4a64e381SAndroid Build Coastguard Worker     static int UbusThreadStartHandler(struct ubus_context      *aContext,
499*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_object       *aObj,
500*4a64e381SAndroid Build Coastguard Worker                                       struct ubus_request_data *aRequest,
501*4a64e381SAndroid Build Coastguard Worker                                       const char               *aMethod,
502*4a64e381SAndroid Build Coastguard Worker                                       struct blob_attr         *aMsg);
503*4a64e381SAndroid Build Coastguard Worker 
504*4a64e381SAndroid Build Coastguard Worker     /**
505*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus stop thread function request.
506*4a64e381SAndroid Build Coastguard Worker      *
507*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
508*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
509*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
510*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
511*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
512*4a64e381SAndroid Build Coastguard Worker      *
513*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
514*4a64e381SAndroid Build Coastguard Worker      */
515*4a64e381SAndroid Build Coastguard Worker     static int UbusThreadStopHandler(struct ubus_context      *aContext,
516*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_object       *aObj,
517*4a64e381SAndroid Build Coastguard Worker                                      struct ubus_request_data *aRequest,
518*4a64e381SAndroid Build Coastguard Worker                                      const char               *aMethod,
519*4a64e381SAndroid Build Coastguard Worker                                      struct blob_attr         *aMsg);
520*4a64e381SAndroid Build Coastguard Worker 
521*4a64e381SAndroid Build Coastguard Worker     /**
522*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus leave function request.
523*4a64e381SAndroid Build Coastguard Worker      *
524*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
525*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
526*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
527*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
528*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
529*4a64e381SAndroid Build Coastguard Worker      *
530*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
531*4a64e381SAndroid Build Coastguard Worker      */
532*4a64e381SAndroid Build Coastguard Worker     static int UbusLeaveHandler(struct ubus_context      *aContext,
533*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_object       *aObj,
534*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_request_data *aRequest,
535*4a64e381SAndroid Build Coastguard Worker                                 const char               *aMethod,
536*4a64e381SAndroid Build Coastguard Worker                                 struct blob_attr         *aMsg);
537*4a64e381SAndroid Build Coastguard Worker 
538*4a64e381SAndroid Build Coastguard Worker     /**
539*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get macfilter address function request.
540*4a64e381SAndroid Build Coastguard Worker      *
541*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
542*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
543*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
544*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
545*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
546*4a64e381SAndroid Build Coastguard Worker      *
547*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
548*4a64e381SAndroid Build Coastguard Worker      */
549*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterAddrHandler(struct ubus_context      *aContext,
550*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_object       *aObj,
551*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_request_data *aRequest,
552*4a64e381SAndroid Build Coastguard Worker                                         const char               *aMethod,
553*4a64e381SAndroid Build Coastguard Worker                                         struct blob_attr         *aMsg);
554*4a64e381SAndroid Build Coastguard Worker 
555*4a64e381SAndroid Build Coastguard Worker     /**
556*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get macfilter state function request.
557*4a64e381SAndroid Build Coastguard Worker      *
558*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
559*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
560*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
561*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
562*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
563*4a64e381SAndroid Build Coastguard Worker      *
564*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
565*4a64e381SAndroid Build Coastguard Worker      */
566*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterStateHandler(struct ubus_context      *aContext,
567*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_object       *aObj,
568*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_request_data *aRequest,
569*4a64e381SAndroid Build Coastguard Worker                                          const char               *aMethod,
570*4a64e381SAndroid Build Coastguard Worker                                          struct blob_attr         *aMsg);
571*4a64e381SAndroid Build Coastguard Worker 
572*4a64e381SAndroid Build Coastguard Worker     /**
573*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus macfilter address add function request.
574*4a64e381SAndroid Build Coastguard Worker      *
575*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
576*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
577*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
578*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
579*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
580*4a64e381SAndroid Build Coastguard Worker      *
581*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
582*4a64e381SAndroid Build Coastguard Worker      */
583*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterAddHandler(struct ubus_context      *aContext,
584*4a64e381SAndroid Build Coastguard Worker                                        struct ubus_object       *aObj,
585*4a64e381SAndroid Build Coastguard Worker                                        struct ubus_request_data *aRequest,
586*4a64e381SAndroid Build Coastguard Worker                                        const char               *aMethod,
587*4a64e381SAndroid Build Coastguard Worker                                        struct blob_attr         *aMsg);
588*4a64e381SAndroid Build Coastguard Worker 
589*4a64e381SAndroid Build Coastguard Worker     /**
590*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus macfilter address clear function request.
591*4a64e381SAndroid Build Coastguard Worker      *
592*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
593*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
594*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
595*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
596*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
597*4a64e381SAndroid Build Coastguard Worker      *
598*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
599*4a64e381SAndroid Build Coastguard Worker      */
600*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterClearHandler(struct ubus_context      *aContext,
601*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_object       *aObj,
602*4a64e381SAndroid Build Coastguard Worker                                          struct ubus_request_data *aRequest,
603*4a64e381SAndroid Build Coastguard Worker                                          const char               *aMethod,
604*4a64e381SAndroid Build Coastguard Worker                                          struct blob_attr         *aMsg);
605*4a64e381SAndroid Build Coastguard Worker 
606*4a64e381SAndroid Build Coastguard Worker     /**
607*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus macfilter address remove function request.
608*4a64e381SAndroid Build Coastguard Worker      *
609*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
610*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
611*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
612*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
613*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
614*4a64e381SAndroid Build Coastguard Worker      *
615*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
616*4a64e381SAndroid Build Coastguard Worker      */
617*4a64e381SAndroid Build Coastguard Worker     static int UbusMacfilterRemoveHandler(struct ubus_context      *aContext,
618*4a64e381SAndroid Build Coastguard Worker                                           struct ubus_object       *aObj,
619*4a64e381SAndroid Build Coastguard Worker                                           struct ubus_request_data *aRequest,
620*4a64e381SAndroid Build Coastguard Worker                                           const char               *aMethod,
621*4a64e381SAndroid Build Coastguard Worker                                           struct blob_attr         *aMsg);
622*4a64e381SAndroid Build Coastguard Worker 
623*4a64e381SAndroid Build Coastguard Worker     /**
624*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus start commissioner function request.
625*4a64e381SAndroid Build Coastguard Worker      *
626*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
627*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
628*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
629*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
630*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
631*4a64e381SAndroid Build Coastguard Worker      *
632*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
633*4a64e381SAndroid Build Coastguard Worker      */
634*4a64e381SAndroid Build Coastguard Worker     static int UbusCommissionerStartHandler(struct ubus_context      *aContext,
635*4a64e381SAndroid Build Coastguard Worker                                             struct ubus_object       *aObj,
636*4a64e381SAndroid Build Coastguard Worker                                             struct ubus_request_data *aRequest,
637*4a64e381SAndroid Build Coastguard Worker                                             const char               *aMethod,
638*4a64e381SAndroid Build Coastguard Worker                                             struct blob_attr         *aMsg);
639*4a64e381SAndroid Build Coastguard Worker 
640*4a64e381SAndroid Build Coastguard Worker     /**
641*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus add joiner function request.
642*4a64e381SAndroid Build Coastguard Worker      *
643*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
644*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
645*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
646*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
647*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
648*4a64e381SAndroid Build Coastguard Worker      *
649*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
650*4a64e381SAndroid Build Coastguard Worker      */
651*4a64e381SAndroid Build Coastguard Worker     static int UbusJoinerAddHandler(struct ubus_context      *aContext,
652*4a64e381SAndroid Build Coastguard Worker                                     struct ubus_object       *aObj,
653*4a64e381SAndroid Build Coastguard Worker                                     struct ubus_request_data *aRequest,
654*4a64e381SAndroid Build Coastguard Worker                                     const char               *aMethod,
655*4a64e381SAndroid Build Coastguard Worker                                     struct blob_attr         *aMsg);
656*4a64e381SAndroid Build Coastguard Worker 
657*4a64e381SAndroid Build Coastguard Worker     /**
658*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus remove joiner function request.
659*4a64e381SAndroid Build Coastguard Worker      *
660*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
661*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
662*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
663*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
664*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
665*4a64e381SAndroid Build Coastguard Worker      *
666*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
667*4a64e381SAndroid Build Coastguard Worker      */
668*4a64e381SAndroid Build Coastguard Worker     static int UbusJoinerRemoveHandler(struct ubus_context      *aContext,
669*4a64e381SAndroid Build Coastguard Worker                                        struct ubus_object       *aObj,
670*4a64e381SAndroid Build Coastguard Worker                                        struct ubus_request_data *aRequest,
671*4a64e381SAndroid Build Coastguard Worker                                        const char               *aMethod,
672*4a64e381SAndroid Build Coastguard Worker                                        struct blob_attr         *aMsg);
673*4a64e381SAndroid Build Coastguard Worker 
674*4a64e381SAndroid Build Coastguard Worker     /**
675*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus get joiner information function request.
676*4a64e381SAndroid Build Coastguard Worker      *
677*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
678*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
679*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
680*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
681*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
682*4a64e381SAndroid Build Coastguard Worker      *
683*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
684*4a64e381SAndroid Build Coastguard Worker      */
685*4a64e381SAndroid Build Coastguard Worker     static int UbusJoinerNumHandler(struct ubus_context      *aContext,
686*4a64e381SAndroid Build Coastguard Worker                                     struct ubus_object       *aObj,
687*4a64e381SAndroid Build Coastguard Worker                                     struct ubus_request_data *aRequest,
688*4a64e381SAndroid Build Coastguard Worker                                     const char               *aMethod,
689*4a64e381SAndroid Build Coastguard Worker                                     struct blob_attr         *aMsg);
690*4a64e381SAndroid Build Coastguard Worker 
691*4a64e381SAndroid Build Coastguard Worker     /**
692*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus mgmtset function request.
693*4a64e381SAndroid Build Coastguard Worker      *
694*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
695*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
696*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
697*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
698*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
699*4a64e381SAndroid Build Coastguard Worker      *
700*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
701*4a64e381SAndroid Build Coastguard Worker      */
702*4a64e381SAndroid Build Coastguard Worker     static int UbusMgmtsetHandler(struct ubus_context      *aContext,
703*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_object       *aObj,
704*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_request_data *aRequest,
705*4a64e381SAndroid Build Coastguard Worker                                   const char               *aMethod,
706*4a64e381SAndroid Build Coastguard Worker                                   struct blob_attr         *aMsg);
707*4a64e381SAndroid Build Coastguard Worker 
708*4a64e381SAndroid Build Coastguard Worker     /**
709*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus interfaceName function request.
710*4a64e381SAndroid Build Coastguard Worker      *
711*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
712*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
713*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
714*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
715*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
716*4a64e381SAndroid Build Coastguard Worker      *
717*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
718*4a64e381SAndroid Build Coastguard Worker      */
719*4a64e381SAndroid Build Coastguard Worker     static int UbusInterfaceNameHandler(struct ubus_context      *aContext,
720*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_object       *aObj,
721*4a64e381SAndroid Build Coastguard Worker                                         struct ubus_request_data *aRequest,
722*4a64e381SAndroid Build Coastguard Worker                                         const char               *aMethod,
723*4a64e381SAndroid Build Coastguard Worker                                         struct blob_attr         *aMsg);
724*4a64e381SAndroid Build Coastguard Worker 
725*4a64e381SAndroid Build Coastguard Worker     /**
726*4a64e381SAndroid Build Coastguard Worker      * This method handle initial diagnostic get response.
727*4a64e381SAndroid Build Coastguard Worker      *
728*4a64e381SAndroid Build Coastguard Worker      * @param[in] aError        A error of receiving the diagnostic response.
729*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMessage      A pointer to the message.
730*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMessageInfo  A pointer to the message information.
731*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext      A pointer to the context.
732*4a64e381SAndroid Build Coastguard Worker      */
733*4a64e381SAndroid Build Coastguard Worker     static void HandleDiagnosticGetResponse(otError              aError,
734*4a64e381SAndroid Build Coastguard Worker                                             otMessage           *aMessage,
735*4a64e381SAndroid Build Coastguard Worker                                             const otMessageInfo *aMessageInfo,
736*4a64e381SAndroid Build Coastguard Worker                                             void                *aContext);
737*4a64e381SAndroid Build Coastguard Worker 
738*4a64e381SAndroid Build Coastguard Worker     /**
739*4a64e381SAndroid Build Coastguard Worker      * This method handle diagnosticget response.
740*4a64e381SAndroid Build Coastguard Worker      *
741*4a64e381SAndroid Build Coastguard Worker      * @param[in] aError       A error of receiving the diagnostic response.
742*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMessage     A pointer to the message.
743*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMessageInfo A pointer to the message information.
744*4a64e381SAndroid Build Coastguard Worker      */
745*4a64e381SAndroid Build Coastguard Worker     void HandleDiagnosticGetResponse(otError aError, otMessage *aMessage, const otMessageInfo *aMessageInfo);
746*4a64e381SAndroid Build Coastguard Worker 
747*4a64e381SAndroid Build Coastguard Worker private:
748*4a64e381SAndroid Build Coastguard Worker     bool                 mIfFinishScan;
749*4a64e381SAndroid Build Coastguard Worker     struct ubus_context *mContext;
750*4a64e381SAndroid Build Coastguard Worker     const char          *mSockPath;
751*4a64e381SAndroid Build Coastguard Worker     struct blob_buf      mBuf;
752*4a64e381SAndroid Build Coastguard Worker     struct blob_buf      mNetworkdataBuf;
753*4a64e381SAndroid Build Coastguard Worker     Ncp::RcpHost        *mHost;
754*4a64e381SAndroid Build Coastguard Worker     std::mutex          *mHostMutex;
755*4a64e381SAndroid Build Coastguard Worker     time_t               mSecond;
756*4a64e381SAndroid Build Coastguard Worker     enum
757*4a64e381SAndroid Build Coastguard Worker     {
758*4a64e381SAndroid Build Coastguard Worker         kDefaultJoinerTimeout = 120,
759*4a64e381SAndroid Build Coastguard Worker     };
760*4a64e381SAndroid Build Coastguard Worker 
761*4a64e381SAndroid Build Coastguard Worker     /**
762*4a64e381SAndroid Build Coastguard Worker      * Constructor
763*4a64e381SAndroid Build Coastguard Worker      *
764*4a64e381SAndroid Build Coastguard Worker      * @param[in] aHost    The pointer to OpenThread Controller structure.
765*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMutex   A pointer to mutex.
766*4a64e381SAndroid Build Coastguard Worker      */
767*4a64e381SAndroid Build Coastguard Worker     UbusServer(Ncp::RcpHost *aHost, std::mutex *aMutex);
768*4a64e381SAndroid Build Coastguard Worker 
769*4a64e381SAndroid Build Coastguard Worker     /**
770*4a64e381SAndroid Build Coastguard Worker      * This method start scan.
771*4a64e381SAndroid Build Coastguard Worker      */
772*4a64e381SAndroid Build Coastguard Worker     void ProcessScan(void);
773*4a64e381SAndroid Build Coastguard Worker 
774*4a64e381SAndroid Build Coastguard Worker     /**
775*4a64e381SAndroid Build Coastguard Worker      * This method detailly start scan.
776*4a64e381SAndroid Build Coastguard Worker      *
777*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
778*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
779*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
780*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
781*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
782*4a64e381SAndroid Build Coastguard Worker      *
783*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
784*4a64e381SAndroid Build Coastguard Worker      */
785*4a64e381SAndroid Build Coastguard Worker     int UbusScanHandlerDetail(struct ubus_context      *aContext,
786*4a64e381SAndroid Build Coastguard Worker                               struct ubus_object       *aObj,
787*4a64e381SAndroid Build Coastguard Worker                               struct ubus_request_data *aRequest,
788*4a64e381SAndroid Build Coastguard Worker                               const char               *aMethod,
789*4a64e381SAndroid Build Coastguard Worker                               struct blob_attr         *aMsg);
790*4a64e381SAndroid Build Coastguard Worker 
791*4a64e381SAndroid Build Coastguard Worker     /**
792*4a64e381SAndroid Build Coastguard Worker      * This method handle scan result (callback function).
793*4a64e381SAndroid Build Coastguard Worker      *
794*4a64e381SAndroid Build Coastguard Worker      * @param[in] aResult   A pointer to result.
795*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to context.
796*4a64e381SAndroid Build Coastguard Worker      */
797*4a64e381SAndroid Build Coastguard Worker     static void HandleActiveScanResult(otActiveScanResult *aResult, void *aContext);
798*4a64e381SAndroid Build Coastguard Worker 
799*4a64e381SAndroid Build Coastguard Worker     /**
800*4a64e381SAndroid Build Coastguard Worker      * This method detailly handler the scan result, called by HandleActiveScanResult.
801*4a64e381SAndroid Build Coastguard Worker      *
802*4a64e381SAndroid Build Coastguard Worker      * @param[in] aResult  A pointer to result.
803*4a64e381SAndroid Build Coastguard Worker      */
804*4a64e381SAndroid Build Coastguard Worker     void HandleActiveScanResultDetail(otActiveScanResult *aResult);
805*4a64e381SAndroid Build Coastguard Worker 
806*4a64e381SAndroid Build Coastguard Worker     /**
807*4a64e381SAndroid Build Coastguard Worker      * This method detailly handler get neighbor information.
808*4a64e381SAndroid Build Coastguard Worker      *
809*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
810*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
811*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
812*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
813*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
814*4a64e381SAndroid Build Coastguard Worker      *
815*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
816*4a64e381SAndroid Build Coastguard Worker      */
817*4a64e381SAndroid Build Coastguard Worker     int UbusNeighborHandlerDetail(struct ubus_context      *aContext,
818*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_object       *aObj,
819*4a64e381SAndroid Build Coastguard Worker                                   struct ubus_request_data *aRequest,
820*4a64e381SAndroid Build Coastguard Worker                                   const char               *aMethod,
821*4a64e381SAndroid Build Coastguard Worker                                   struct blob_attr         *aMsg);
822*4a64e381SAndroid Build Coastguard Worker 
823*4a64e381SAndroid Build Coastguard Worker     /**
824*4a64e381SAndroid Build Coastguard Worker      * This method detailly handler get parent information.
825*4a64e381SAndroid Build Coastguard Worker      *
826*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
827*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
828*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
829*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
830*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
831*4a64e381SAndroid Build Coastguard Worker      *
832*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
833*4a64e381SAndroid Build Coastguard Worker      */
834*4a64e381SAndroid Build Coastguard Worker     int UbusParentHandlerDetail(struct ubus_context      *aContext,
835*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_object       *aObj,
836*4a64e381SAndroid Build Coastguard Worker                                 struct ubus_request_data *aRequest,
837*4a64e381SAndroid Build Coastguard Worker                                 const char               *aMethod,
838*4a64e381SAndroid Build Coastguard Worker                                 struct blob_attr         *aMsg);
839*4a64e381SAndroid Build Coastguard Worker 
840*4a64e381SAndroid Build Coastguard Worker     /**
841*4a64e381SAndroid Build Coastguard Worker      * This method handle mgmtset request.
842*4a64e381SAndroid Build Coastguard Worker      *
843*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
844*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
845*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
846*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
847*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
848*4a64e381SAndroid Build Coastguard Worker      *
849*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
850*4a64e381SAndroid Build Coastguard Worker      */
851*4a64e381SAndroid Build Coastguard Worker     int UbusMgmtset(struct ubus_context      *aContext,
852*4a64e381SAndroid Build Coastguard Worker                     struct ubus_object       *aObj,
853*4a64e381SAndroid Build Coastguard Worker                     struct ubus_request_data *aRequest,
854*4a64e381SAndroid Build Coastguard Worker                     const char               *aMethod,
855*4a64e381SAndroid Build Coastguard Worker                     struct blob_attr         *aMsg);
856*4a64e381SAndroid Build Coastguard Worker 
857*4a64e381SAndroid Build Coastguard Worker     /**
858*4a64e381SAndroid Build Coastguard Worker      * This method handle leave request.
859*4a64e381SAndroid Build Coastguard Worker      *
860*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
861*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
862*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
863*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
864*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
865*4a64e381SAndroid Build Coastguard Worker      *
866*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
867*4a64e381SAndroid Build Coastguard Worker      */
868*4a64e381SAndroid Build Coastguard Worker     int UbusLeaveHandlerDetail(struct ubus_context      *aContext,
869*4a64e381SAndroid Build Coastguard Worker                                struct ubus_object       *aObj,
870*4a64e381SAndroid Build Coastguard Worker                                struct ubus_request_data *aRequest,
871*4a64e381SAndroid Build Coastguard Worker                                const char               *aMethod,
872*4a64e381SAndroid Build Coastguard Worker                                struct blob_attr         *aMsg);
873*4a64e381SAndroid Build Coastguard Worker 
874*4a64e381SAndroid Build Coastguard Worker     /**
875*4a64e381SAndroid Build Coastguard Worker      * This method handle thread related request.
876*4a64e381SAndroid Build Coastguard Worker      *
877*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
878*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
879*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
880*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
881*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
882*4a64e381SAndroid Build Coastguard Worker      * @param[in] aAction   A pointer to the action needed.
883*4a64e381SAndroid Build Coastguard Worker      *
884*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
885*4a64e381SAndroid Build Coastguard Worker      */
886*4a64e381SAndroid Build Coastguard Worker     int UbusThreadHandler(struct ubus_context      *aContext,
887*4a64e381SAndroid Build Coastguard Worker                           struct ubus_object       *aObj,
888*4a64e381SAndroid Build Coastguard Worker                           struct ubus_request_data *aRequest,
889*4a64e381SAndroid Build Coastguard Worker                           const char               *aMethod,
890*4a64e381SAndroid Build Coastguard Worker                           struct blob_attr         *aMsg,
891*4a64e381SAndroid Build Coastguard Worker                           const char               *aAction);
892*4a64e381SAndroid Build Coastguard Worker 
893*4a64e381SAndroid Build Coastguard Worker     /**
894*4a64e381SAndroid Build Coastguard Worker      * This method handle get information request.
895*4a64e381SAndroid Build Coastguard Worker      *
896*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
897*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
898*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
899*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
900*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
901*4a64e381SAndroid Build Coastguard Worker      * @param[in] aAction   A pointer to the action needed.
902*4a64e381SAndroid Build Coastguard Worker      *
903*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
904*4a64e381SAndroid Build Coastguard Worker      */
905*4a64e381SAndroid Build Coastguard Worker     int UbusGetInformation(struct ubus_context      *aContext,
906*4a64e381SAndroid Build Coastguard Worker                            struct ubus_object       *aObj,
907*4a64e381SAndroid Build Coastguard Worker                            struct ubus_request_data *aRequest,
908*4a64e381SAndroid Build Coastguard Worker                            const char               *aMethod,
909*4a64e381SAndroid Build Coastguard Worker                            struct blob_attr         *aMsg,
910*4a64e381SAndroid Build Coastguard Worker                            const char               *action);
911*4a64e381SAndroid Build Coastguard Worker 
912*4a64e381SAndroid Build Coastguard Worker     /**
913*4a64e381SAndroid Build Coastguard Worker      * This method handle set information request.
914*4a64e381SAndroid Build Coastguard Worker      *
915*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
916*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
917*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
918*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
919*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
920*4a64e381SAndroid Build Coastguard Worker      * @param[in] aAction   A pointer to the action needed.
921*4a64e381SAndroid Build Coastguard Worker      *
922*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
923*4a64e381SAndroid Build Coastguard Worker      */
924*4a64e381SAndroid Build Coastguard Worker     int UbusSetInformation(struct ubus_context      *aContext,
925*4a64e381SAndroid Build Coastguard Worker                            struct ubus_object       *aObj,
926*4a64e381SAndroid Build Coastguard Worker                            struct ubus_request_data *aRequest,
927*4a64e381SAndroid Build Coastguard Worker                            const char               *aMethod,
928*4a64e381SAndroid Build Coastguard Worker                            struct blob_attr         *aMsg,
929*4a64e381SAndroid Build Coastguard Worker                            const char               *aAction);
930*4a64e381SAndroid Build Coastguard Worker 
931*4a64e381SAndroid Build Coastguard Worker     /**
932*4a64e381SAndroid Build Coastguard Worker      * This method handle commissioner related request.
933*4a64e381SAndroid Build Coastguard Worker      *
934*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
935*4a64e381SAndroid Build Coastguard Worker      * @param[in] aObj      A pointer to the ubus object.
936*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the ubus request.
937*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMethod   A pointer to the ubus method.
938*4a64e381SAndroid Build Coastguard Worker      * @param[in] aMsg      A pointer to the ubus message.
939*4a64e381SAndroid Build Coastguard Worker      * @param[in] aAction   A pointer to the action needed.
940*4a64e381SAndroid Build Coastguard Worker      *
941*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
942*4a64e381SAndroid Build Coastguard Worker      */
943*4a64e381SAndroid Build Coastguard Worker     int UbusCommissioner(struct ubus_context      *aContext,
944*4a64e381SAndroid Build Coastguard Worker                          struct ubus_object       *aObj,
945*4a64e381SAndroid Build Coastguard Worker                          struct ubus_request_data *aRequest,
946*4a64e381SAndroid Build Coastguard Worker                          const char               *aMethod,
947*4a64e381SAndroid Build Coastguard Worker                          struct blob_attr         *aMsg,
948*4a64e381SAndroid Build Coastguard Worker                          const char               *aAction);
949*4a64e381SAndroid Build Coastguard Worker 
950*4a64e381SAndroid Build Coastguard Worker     /**
951*4a64e381SAndroid Build Coastguard Worker      * This method handle conmmissione state change (callback function).
952*4a64e381SAndroid Build Coastguard Worker      *
953*4a64e381SAndroid Build Coastguard Worker      * @param[in] aState    The state of commissioner.
954*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the ubus context.
955*4a64e381SAndroid Build Coastguard Worker      */
956*4a64e381SAndroid Build Coastguard Worker     static void HandleStateChanged(otCommissionerState aState, void *aContext);
957*4a64e381SAndroid Build Coastguard Worker 
958*4a64e381SAndroid Build Coastguard Worker     /**
959*4a64e381SAndroid Build Coastguard Worker      * This method handle conmmissione state change.
960*4a64e381SAndroid Build Coastguard Worker      *
961*4a64e381SAndroid Build Coastguard Worker      * @param[in] aState  The state of commissioner.
962*4a64e381SAndroid Build Coastguard Worker      */
963*4a64e381SAndroid Build Coastguard Worker     void HandleStateChanged(otCommissionerState aState);
964*4a64e381SAndroid Build Coastguard Worker 
965*4a64e381SAndroid Build Coastguard Worker     /**
966*4a64e381SAndroid Build Coastguard Worker      * This method handle joiner event (callback function).
967*4a64e381SAndroid Build Coastguard Worker      *
968*4a64e381SAndroid Build Coastguard Worker      * @param[in] aEvent       The joiner event type.
969*4a64e381SAndroid Build Coastguard Worker      * @param[in] aJoinerInfo  A pointer to the Joiner Info.
970*4a64e381SAndroid Build Coastguard Worker      * @param[in] aJoinerId    A pointer to the Joiner ID (if not known, it will be NULL).
971*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext     A pointer to application-specific context.
972*4a64e381SAndroid Build Coastguard Worker      */
973*4a64e381SAndroid Build Coastguard Worker     static void HandleJoinerEvent(otCommissionerJoinerEvent aEvent,
974*4a64e381SAndroid Build Coastguard Worker                                   const otJoinerInfo       *aJoinerInfo,
975*4a64e381SAndroid Build Coastguard Worker                                   const otExtAddress       *aJoinerId,
976*4a64e381SAndroid Build Coastguard Worker                                   void                     *aContext);
977*4a64e381SAndroid Build Coastguard Worker 
978*4a64e381SAndroid Build Coastguard Worker     /**
979*4a64e381SAndroid Build Coastguard Worker      * This method handle joiner event.
980*4a64e381SAndroid Build Coastguard Worker      *
981*4a64e381SAndroid Build Coastguard Worker      * @param[in] aEvent       The joiner event type.
982*4a64e381SAndroid Build Coastguard Worker      * @param[in] aJoinerInfo  A pointer to the Joiner Info.
983*4a64e381SAndroid Build Coastguard Worker      * @param[in] aJoinerId    A pointer to the Joiner ID (if not known, it will be NULL).
984*4a64e381SAndroid Build Coastguard Worker      */
985*4a64e381SAndroid Build Coastguard Worker     void HandleJoinerEvent(otCommissionerJoinerEvent aEvent,
986*4a64e381SAndroid Build Coastguard Worker                            const otJoinerInfo       *aJoinerInfo,
987*4a64e381SAndroid Build Coastguard Worker                            const otExtAddress       *aJoinerId);
988*4a64e381SAndroid Build Coastguard Worker 
989*4a64e381SAndroid Build Coastguard Worker     /**
990*4a64e381SAndroid Build Coastguard Worker      * This method convert thread network state to string.
991*4a64e381SAndroid Build Coastguard Worker      *
992*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aInstance  A pointer to the instance.
993*4a64e381SAndroid Build Coastguard Worker      * @param[out] aState     A pointer to the string address.
994*4a64e381SAndroid Build Coastguard Worker      */
995*4a64e381SAndroid Build Coastguard Worker     void GetState(otInstance *aInstance, char *aState);
996*4a64e381SAndroid Build Coastguard Worker 
997*4a64e381SAndroid Build Coastguard Worker     /**
998*4a64e381SAndroid Build Coastguard Worker      * This method add fd of ubus object.
999*4a64e381SAndroid Build Coastguard Worker      */
1000*4a64e381SAndroid Build Coastguard Worker     void UbusAddFd(void);
1001*4a64e381SAndroid Build Coastguard Worker 
1002*4a64e381SAndroid Build Coastguard Worker     /**
1003*4a64e381SAndroid Build Coastguard Worker      * This method set ubus reconnect time.
1004*4a64e381SAndroid Build Coastguard Worker      *
1005*4a64e381SAndroid Build Coastguard Worker      * @param[in] aTimeout  A pointer to the timeout.
1006*4a64e381SAndroid Build Coastguard Worker      */
1007*4a64e381SAndroid Build Coastguard Worker     static void UbusReconnTimer(struct uloop_timeout *aTimeout);
1008*4a64e381SAndroid Build Coastguard Worker 
1009*4a64e381SAndroid Build Coastguard Worker     /**
1010*4a64e381SAndroid Build Coastguard Worker      * This method detailly handle ubus reconnect time.
1011*4a64e381SAndroid Build Coastguard Worker      *
1012*4a64e381SAndroid Build Coastguard Worker      * @param[in] aTimeout  A pointer to the timeout.
1013*4a64e381SAndroid Build Coastguard Worker      */
1014*4a64e381SAndroid Build Coastguard Worker     void UbusReconnTimerDetail(struct uloop_timeout *aTimeout);
1015*4a64e381SAndroid Build Coastguard Worker 
1016*4a64e381SAndroid Build Coastguard Worker     /**
1017*4a64e381SAndroid Build Coastguard Worker      * This method handle ubus connection lost.
1018*4a64e381SAndroid Build Coastguard Worker      *
1019*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the context.
1020*4a64e381SAndroid Build Coastguard Worker      */
1021*4a64e381SAndroid Build Coastguard Worker     static void UbusConnectionLost(struct ubus_context *aContext);
1022*4a64e381SAndroid Build Coastguard Worker 
1023*4a64e381SAndroid Build Coastguard Worker     /**
1024*4a64e381SAndroid Build Coastguard Worker      * This method connect and display ubus.
1025*4a64e381SAndroid Build Coastguard Worker      *
1026*4a64e381SAndroid Build Coastguard Worker      * @param[in] aPath  A pointer to the ubus server path(default is nullptr).
1027*4a64e381SAndroid Build Coastguard Worker      *
1028*4a64e381SAndroid Build Coastguard Worker      * @retval 0  Successfully handler the request.
1029*4a64e381SAndroid Build Coastguard Worker      */
1030*4a64e381SAndroid Build Coastguard Worker     int DisplayUbusInit(const char *aPath);
1031*4a64e381SAndroid Build Coastguard Worker 
1032*4a64e381SAndroid Build Coastguard Worker     /**
1033*4a64e381SAndroid Build Coastguard Worker      * This method disconnect and display ubus.
1034*4a64e381SAndroid Build Coastguard Worker      */
1035*4a64e381SAndroid Build Coastguard Worker     void DisplayUbusDone(void);
1036*4a64e381SAndroid Build Coastguard Worker 
1037*4a64e381SAndroid Build Coastguard Worker     /**
1038*4a64e381SAndroid Build Coastguard Worker      * This method parses an ASCII string as a long.
1039*4a64e381SAndroid Build Coastguard Worker      *
1040*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aString  A pointer to the ASCII string.
1041*4a64e381SAndroid Build Coastguard Worker      * @param[out] aLong    A reference to where the parsed long is placed.
1042*4a64e381SAndroid Build Coastguard Worker      *
1043*4a64e381SAndroid Build Coastguard Worker      * @retval OT_ERROR_NONE   Successfully parsed the ASCII string.
1044*4a64e381SAndroid Build Coastguard Worker      * @retval OT_ERROR_PARSE  Could not parse the ASCII string.
1045*4a64e381SAndroid Build Coastguard Worker      */
1046*4a64e381SAndroid Build Coastguard Worker     otError ParseLong(char *aString, long &aLong);
1047*4a64e381SAndroid Build Coastguard Worker 
1048*4a64e381SAndroid Build Coastguard Worker     /**
1049*4a64e381SAndroid Build Coastguard Worker      * This method converts a hex string to binary.
1050*4a64e381SAndroid Build Coastguard Worker      *
1051*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aHex        A pointer to the hex string.
1052*4a64e381SAndroid Build Coastguard Worker      * @param[out] aBin        A pointer to where the binary representation is placed.
1053*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aBinLength  Maximum length of the binary representation.
1054*4a64e381SAndroid Build Coastguard Worker      *
1055*4a64e381SAndroid Build Coastguard Worker      * @returns The number of bytes in the binary representation.
1056*4a64e381SAndroid Build Coastguard Worker      */
1057*4a64e381SAndroid Build Coastguard Worker     int Hex2Bin(const char *aHex, uint8_t *aBin, uint16_t aBinLength);
1058*4a64e381SAndroid Build Coastguard Worker 
1059*4a64e381SAndroid Build Coastguard Worker     /**
1060*4a64e381SAndroid Build Coastguard Worker      * This method output bytes into char*.
1061*4a64e381SAndroid Build Coastguard Worker      *
1062*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aBytes   A pointer to the bytes need to be convert.
1063*4a64e381SAndroid Build Coastguard Worker      * @param[in]  aLength  The length of the bytes.
1064*4a64e381SAndroid Build Coastguard Worker      * @param[out] aOutput  A pointer to the char* string.
1065*4a64e381SAndroid Build Coastguard Worker      */
1066*4a64e381SAndroid Build Coastguard Worker     void OutputBytes(const uint8_t *aBytes, uint8_t aLength, char *aOutput);
1067*4a64e381SAndroid Build Coastguard Worker 
1068*4a64e381SAndroid Build Coastguard Worker     /**
1069*4a64e381SAndroid Build Coastguard Worker      * This method append result in message passed to ubus.
1070*4a64e381SAndroid Build Coastguard Worker      *
1071*4a64e381SAndroid Build Coastguard Worker      * @param[in] aError    The error type of the message.
1072*4a64e381SAndroid Build Coastguard Worker      * @param[in] aContext  A pointer to the context.
1073*4a64e381SAndroid Build Coastguard Worker      * @param[in] aRequest  A pointer to the request.
1074*4a64e381SAndroid Build Coastguard Worker      */
1075*4a64e381SAndroid Build Coastguard Worker     void AppendResult(otError aError, struct ubus_context *aContext, struct ubus_request_data *aRequest);
1076*4a64e381SAndroid Build Coastguard Worker };
1077*4a64e381SAndroid Build Coastguard Worker 
1078*4a64e381SAndroid Build Coastguard Worker class UBusAgent : public MainloopProcessor
1079*4a64e381SAndroid Build Coastguard Worker {
1080*4a64e381SAndroid Build Coastguard Worker public:
1081*4a64e381SAndroid Build Coastguard Worker     /**
1082*4a64e381SAndroid Build Coastguard Worker      * The constructor to initialize the UBus agent.
1083*4a64e381SAndroid Build Coastguard Worker      *
1084*4a64e381SAndroid Build Coastguard Worker      * @param[in] aHost  A reference to the Thread controller.
1085*4a64e381SAndroid Build Coastguard Worker      */
UBusAgent(otbr::Ncp::RcpHost & aHost)1086*4a64e381SAndroid Build Coastguard Worker     UBusAgent(otbr::Ncp::RcpHost &aHost)
1087*4a64e381SAndroid Build Coastguard Worker         : mHost(aHost)
1088*4a64e381SAndroid Build Coastguard Worker         , mThreadMutex()
1089*4a64e381SAndroid Build Coastguard Worker     {
1090*4a64e381SAndroid Build Coastguard Worker     }
1091*4a64e381SAndroid Build Coastguard Worker 
1092*4a64e381SAndroid Build Coastguard Worker     /**
1093*4a64e381SAndroid Build Coastguard Worker      * This method initializes the UBus agent.
1094*4a64e381SAndroid Build Coastguard Worker      */
1095*4a64e381SAndroid Build Coastguard Worker     void Init(void);
1096*4a64e381SAndroid Build Coastguard Worker 
1097*4a64e381SAndroid Build Coastguard Worker     void Update(MainloopContext &aMainloop) override;
1098*4a64e381SAndroid Build Coastguard Worker     void Process(const MainloopContext &aMainloop) override;
1099*4a64e381SAndroid Build Coastguard Worker 
1100*4a64e381SAndroid Build Coastguard Worker private:
UbusServerRun(void)1101*4a64e381SAndroid Build Coastguard Worker     static void UbusServerRun(void) { otbr::ubus::UbusServer::GetInstance().InstallUbusObject(); }
1102*4a64e381SAndroid Build Coastguard Worker 
1103*4a64e381SAndroid Build Coastguard Worker     otbr::Ncp::RcpHost &mHost;
1104*4a64e381SAndroid Build Coastguard Worker     std::mutex          mThreadMutex;
1105*4a64e381SAndroid Build Coastguard Worker };
1106*4a64e381SAndroid Build Coastguard Worker } // namespace ubus
1107*4a64e381SAndroid Build Coastguard Worker } // namespace otbr
1108*4a64e381SAndroid Build Coastguard Worker 
1109*4a64e381SAndroid Build Coastguard Worker #endif // OTBR_AGENT_OTUBUS_HPP_
1110