Fix SAM tool violations (GlobalVariable)
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-mesh.c
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
5  *
6  * @author: Anupam Roy <anupam.r@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <dlog.h>
22 #include <bluetooth.h>
23 #include "bt_mesh.h"
24
25 #include "oal-event.h"
26 #include "oal-internal.h"
27 #include "oal-manager.h"
28 #include "oal-adapter-mgr.h"
29 #include "oal-utils.h"
30 #include "oal-mesh.h"
31 #include "oal-common.h"
32
33
34 static const bt_interface_t *blued_api;
35 static const btmesh_interface_t *mesh_api;
36
37 #define CHECK_OAL_MESH_ENABLED() \
38         do { \
39                 if (mesh_api == NULL) { \
40                         BT_ERR("Mesh Not Enabled"); \
41                         return OAL_STATUS_NOT_READY; \
42                 } \
43         } while (0)
44
45 /* Forward declaration: Callbacks from HAL */
46 static void mesh_network_attached_callback(bt_status_t status,
47                 bt_mesh_token_t *token, bt_uuid_t *uuid);
48 static void mesh_network_destroyed_callback(bt_status_t status,
49                 bt_mesh_token_t *token, bt_uuid_t *uuid);
50 static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
51                 bt_status_t status, bt_uuid_t *net_uuid);
52 static void mesh_network_scan_result_callback(bt_status_t status,
53                 bt_uuid_t *net_uuid, bt_mesh_scan_result_t *result);
54 static void mesh_network_provisioning_status_callback(bt_status_t status,
55                 bt_uuid_t *net_uuid, bt_uuid_t *dev_uuid);
56 static void mesh_network_provisioning_finished_callback(bt_status_t status,
57                 int reason, bt_uuid_t *net_uuid,
58                         bt_uuid_t *dev_uuid, uint16_t unicast, uint8_t count);
59 static void mesh_network_provisioning_data_requested_callback(
60                 bt_uuid_t *net_uuid, uint8_t count);
61 static void mesh_network_authentication_requested_callback(bt_uuid_t *net_uuid,
62                 bt_hal_mesh_auth_variant_e auth_type, char auth_value[]);
63 static void mesh_network_netkey_execute_callback(bt_status_t status,
64                 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx);
65 static void mesh_network_appkey_execute_callback(bt_status_t status,
66                 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx, uint16_t appkey_idx);
67 static void mesh_network_appkey_execute_callback(bt_status_t status,
68                 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx, uint16_t appkey_idx);
69 static void mesh_devkey_message_received_callback(bt_uuid_t *net_uuid,
70                 uint16_t source_addr, bool is_remote_devkey,
71                         uint16_t netkey_idx, uint16_t ata_len, uint8_t *data);
72 static void mesh_message_received_callback(bt_uuid_t *net_uuid,
73                 uint16_t source_addr, uint16_t dest_addr,
74                 uint16_t key_idx, uint16_t data_len, uint8_t *data);
75
76
77 static btmesh_callbacks_t sBluetoothMeshCallbacks = {
78         .size = sizeof(sBluetoothMeshCallbacks),
79         .network_attached_cb = mesh_network_attached_callback,
80         .network_destroyed_cb = mesh_network_destroyed_callback,
81         .scan_status_cb = mesh_network_scan_status_callback,
82         .scan_result_cb = mesh_network_scan_result_callback,
83         .provisioning_status_cb = mesh_network_provisioning_status_callback,
84         .provisioning_finished_cb = mesh_network_provisioning_finished_callback,
85         .provisioning_data_requested_cb = mesh_network_provisioning_data_requested_callback,
86         .authentication_requested_cb = mesh_network_authentication_requested_callback,
87         .netkey_execute_cb = mesh_network_netkey_execute_callback,
88         .appkey_execute_cb = mesh_network_appkey_execute_callback,
89         .devkey_msg_cb = mesh_devkey_message_received_callback,
90         .msg_cb = mesh_message_received_callback,
91 };
92
93 /* Mesh HAL event handlers */
94 static void mesh_network_attached_callback(bt_status_t status,
95                 bt_mesh_token_t *token, bt_uuid_t *uuid)
96 {
97         event_mesh_network_attached_t *event = g_new0(event_mesh_network_attached_t, 1);
98
99         event->status = convert_to_oal_status(status);
100         BT_INFO("Mesh Event: Network Attached, status: [%s]",
101                 status2string(status));
102
103         memcpy(event->token, token->token, sizeof(bt_mesh_token_t));
104         memcpy(event->uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
105
106         send_event_bda_trace(OAL_EVENT_MESH_NETWORK_ATTACHED,
107                 event, sizeof(event_mesh_network_attached_t), NULL);
108 }
109
110 static void mesh_network_destroyed_callback(bt_status_t status,
111                 bt_mesh_token_t *token, bt_uuid_t *uuid)
112 {
113         event_mesh_network_attached_t *event = g_new0(event_mesh_network_attached_t, 1);
114
115         event->status = convert_to_oal_status(status);
116         BT_INFO("Mesh Event: Network Destroyed, status: [%s]",
117                         status2string(status));
118
119         memcpy(event->token, token->token, sizeof(bt_mesh_token_t));
120         memcpy(event->uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
121
122         send_event_bda_trace(OAL_EVENT_MESH_NETWORK_DESTROYED,
123                         event, sizeof(event_mesh_network_destroyed_t), NULL);
124 }
125
126 static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
127                 bt_status_t status, bt_uuid_t *net_uuid)
128 {
129         event_mesh_scan_status_t *event_data = g_new0(event_mesh_scan_status_t, 1);
130         oal_event_t event;
131
132         event_data->status = convert_to_oal_status(status);
133         BT_INFO("Mesh Event: Scan status: [%s] state [%d]",
134                 status2string(status), scan_state);
135
136         memcpy(event_data->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
137
138         event = (BT_MESH_SCAN_STARTED == scan_state) ? \
139                 OAL_EVENT_MESH_SCAN_STARTED : OAL_EVENT_MESH_SCAN_FINISHED;
140         send_event_bda_trace(event, event_data,
141                 sizeof(event_mesh_scan_status_t), NULL);
142 }
143
144 static void mesh_network_provisioning_status_callback(bt_status_t status,
145                 bt_uuid_t *net_uuid, bt_uuid_t *dev_uuid)
146 {
147         event_mesh_provisioning_status_t *event = g_new0(event_mesh_provisioning_status_t, 1);
148
149         event->status = convert_to_oal_status(status);
150         BT_INFO("Mesh Event: Provisioning status: [%s]",
151                 status2string(status));
152
153         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
154         memcpy(event->dev_uuid.uuid, dev_uuid->uu, sizeof(bt_uuid_t));
155
156         if (event->status == OAL_STATUS_SUCCESS)
157                 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_STARTED,
158                         event, sizeof(event_mesh_provisioning_status_t), NULL);
159         else
160                 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_FAILED,
161                         event, sizeof(event_mesh_provisioning_status_t), NULL);
162 }
163
164 static void mesh_network_provisioning_finished_callback(bt_status_t status,
165                 int reason, bt_uuid_t *net_uuid,
166                         bt_uuid_t *dev_uuid, uint16_t unicast, uint8_t count)
167 {
168         event_mesh_provisioning_finished_t *event = \
169                 g_new0(event_mesh_provisioning_finished_t, 1);
170
171         event->status = convert_to_oal_status(status);
172         event->reason = reason;
173         BT_INFO("Mesh Event: Provisioning Completed Result: [%s]",
174                 status2string(status));
175
176         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
177         memcpy(event->dev_uuid.uuid, dev_uuid->uu, sizeof(bt_uuid_t));
178         event->unicast = unicast;
179         event->count = count;
180
181         send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_FINISHED,
182                 event, sizeof(event_mesh_provisioning_finished_t), NULL);
183 }
184
185 static void mesh_network_provisioning_data_requested_callback(
186                 bt_uuid_t *net_uuid, uint8_t count)
187 {
188         event_mesh_provisioning_data_requested_t *event = \
189                 g_new0(event_mesh_provisioning_data_requested_t, 1);
190
191         BT_INFO("Mesh Event: Provisioning Data requested");
192
193         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
194         event->count = count;
195
196         send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_DATA_REQUESTED,
197                 event, sizeof(event_mesh_provisioning_data_requested_t), NULL);
198 }
199
200 static void mesh_network_authentication_requested_callback(bt_uuid_t *net_uuid,
201                 bt_hal_mesh_auth_variant_e auth_type,
202                         char auth_value[])
203 {
204         event_mesh_authentication_requested_t *event = \
205                 g_new0(event_mesh_authentication_requested_t, 1);
206
207         BT_INFO("Mesh Event: Authentication requested");
208
209         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
210         event->auth_type = auth_type;
211         g_strlcpy(event->auth_value, auth_value, sizeof(event->auth_value));
212
213         send_event_bda_trace(OAL_EVENT_MESH_AUTHENTICATION_REQUESTED,
214                 event, sizeof(event_mesh_provisioning_data_requested_t), NULL);
215 }
216
217 static void mesh_network_netkey_execute_callback(bt_status_t status,
218                 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t index)
219 {
220         event_mesh_netkey_operation_t *event = \
221                 g_new0(event_mesh_netkey_operation_t, 1);
222
223         event->status = convert_to_oal_status(status);
224         BT_INFO("Mesh Event: NetKey Execute Event");
225
226         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
227         event->op = (oal_mesh_key_op_e)key_event;
228         event->key_idx = index;
229
230         send_event_bda_trace(OAL_EVENT_MESH_NETKEY_EXECUTE_EVENT,
231                 event, sizeof(event_mesh_netkey_operation_t), NULL);
232 }
233
234 static void mesh_network_appkey_execute_callback(bt_status_t status,
235                 bt_uuid_t *net_uuid, uint8_t key_event,
236                         uint16_t net_idx, uint16_t app_idx)
237 {
238         event_mesh_appkey_operation_t *event = \
239                 g_new0(event_mesh_appkey_operation_t, 1);
240
241         event->status = convert_to_oal_status(status);
242         BT_INFO("Mesh Event: AppKey Execute Event");
243
244         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
245         event->op = (oal_mesh_key_op_e)key_event;
246         event->net_idx = net_idx;
247         event->app_idx = app_idx;
248
249         send_event_bda_trace(OAL_EVENT_MESH_APPKEY_EXECUTE_EVENT,
250                 event, sizeof(event_mesh_appkey_operation_t), NULL);
251 }
252
253 static void mesh_network_scan_result_callback(bt_status_t status,
254                 bt_uuid_t *net_uuid, bt_mesh_scan_result_t *result)
255 {
256         event_mesh_scan_result_t *event = g_new0(event_mesh_scan_result_t, 1);
257
258         event->status = convert_to_oal_status(status);
259         BT_INFO("Mesh Event: Scan Result status: [%s]",
260                 status2string(status));
261
262         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
263         memcpy(&event->result, result, sizeof(bt_mesh_scan_result_t));
264
265         send_event_bda_trace(OAL_EVENT_MESH_SCAN_RESULT,
266                 event, sizeof(event_mesh_scan_result_t), NULL);
267 }
268
269 static void mesh_devkey_message_received_callback(bt_uuid_t *net_uuid,
270                 uint16_t source_addr,
271                         bool is_remote_devkey, uint16_t netkey_idx,
272                                 uint16_t data_len, uint8_t *data)
273 {
274         event_mesh_devkey_message_t *event = g_new0(event_mesh_devkey_message_t, 1);
275
276         BT_INFO("Mesh Event: Dev Key Message Received");
277         event->source = source_addr;
278         event->remote = is_remote_devkey;
279         event->subnet = netkey_idx;
280         event->data_len = data_len;
281         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
282         memcpy(event->data, data, data_len);
283
284         send_event_bda_trace(OAL_EVENT_MESH_DEVKEY_MESSAGE_RECEIVED, event,
285                 sizeof(event_mesh_devkey_message_t), NULL);
286 }
287
288 static void mesh_message_received_callback(bt_uuid_t *net_uuid,
289                 uint16_t source_addr, uint16_t dest_addr, uint16_t key_idx,
290                                 uint16_t data_len, uint8_t *data)
291 {
292         event_mesh_message_t *event = g_new0(event_mesh_message_t, 1);
293
294         BT_INFO("Mesh Event: Model Message Received");
295         event->source = source_addr;
296         event->dest = dest_addr;
297         event->key_idx = key_idx;
298         event->data_len = data_len;
299         memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
300         memcpy(event->data, data, data_len);
301
302         send_event_bda_trace(OAL_EVENT_MESH_MODEL_MESSAGE_RECEIVED, event,
303                 sizeof(event_mesh_message_t), NULL);
304 }
305
306 oal_status_t mesh_enable(void)
307 {
308         int ret;
309         API_TRACE();
310
311         /* Get stack interface */
312         blued_api = (const bt_interface_t *) adapter_get_stack_interface();
313
314         if (blued_api == NULL) {
315                 BT_ERR("Stack is not initialized");
316                 return OAL_STATUS_NOT_READY;
317         }
318
319         if (mesh_api) {
320                 BT_WARN("MESH Interface is already initialized...");
321                 return OAL_STATUS_ALREADY_DONE;
322         }
323
324         mesh_api = (const btmesh_interface_t *)blued_api->get_profile_interface(BT_PROFILE_MESH_ID);
325         if (mesh_api == NULL) {
326                 BT_ERR("MESH interface failed");
327                 return OAL_STATUS_INTERNAL_ERROR;
328         }
329
330         if ((ret = mesh_api->init(&sBluetoothMeshCallbacks)) != BT_STATUS_SUCCESS) {
331                 BT_ERR("Error: Unable to initialise MESH :%s", status2string(ret));
332                 mesh_api->cleanup();
333                 mesh_api = NULL;
334                 return convert_to_oal_status(ret);
335         }
336
337         BT_INFO("MESH successfully initialized");
338         return OAL_STATUS_SUCCESS;
339 }
340
341 oal_status_t mesh_disable(void)
342 {
343         API_TRACE();
344         CHECK_OAL_MESH_ENABLED();
345
346         mesh_api->cleanup();
347
348         mesh_api = NULL;
349         return OAL_STATUS_SUCCESS;
350 }
351
352 oal_status_t mesh_register_node(oal_mesh_node_t *node,
353                 GSList *model_list, bool is_provisioner)
354 {
355         int ret = BT_STATUS_SUCCESS;
356         API_TRACE();
357         CHECK_OAL_MESH_ENABLED();
358
359         BT_INFO("Mesh: Send create network request to stack");
360         ret = mesh_api->create((bt_hal_mesh_node_t*)node, model_list, is_provisioner);
361         if (ret != BT_STATUS_SUCCESS) {
362                 BT_ERR("MESH: Create Network failed :failed: %s", status2string(ret));
363                 return convert_to_oal_status(ret);
364         }
365
366         BT_INFO("Mesh: Request sent to stack");
367         return OAL_STATUS_SUCCESS;
368 }
369
370 oal_status_t mesh_network_destroy(oal_uuid_t* network_uuid)
371 {
372         int ret = BT_STATUS_SUCCESS;
373         API_TRACE();
374         CHECK_OAL_MESH_ENABLED();
375
376         ret = mesh_api->destroy((bt_uuid_t*)network_uuid);
377         if (ret != BT_STATUS_SUCCESS) {
378                 BT_ERR("MESH: Network Leave failed: %s", status2string(ret));
379                 return convert_to_oal_status(ret);
380         }
381
382         return OAL_STATUS_SUCCESS;
383 }
384
385 oal_status_t mesh_network_start_scan(oal_uuid_t* network_uuid,
386                 oal_mesh_scan_params_t *params)
387 {
388         int ret = BT_STATUS_SUCCESS;
389         API_TRACE();
390         CHECK_OAL_MESH_ENABLED();
391
392         ret = mesh_api->scan((bt_uuid_t*)network_uuid,
393                 (bt_hal_mesh_scan_param_t*)params);
394         if (ret != BT_STATUS_SUCCESS) {
395                 BT_ERR("MESH: Start Scan failed: %s", status2string(ret));
396                 return convert_to_oal_status(ret);
397         }
398
399         return OAL_STATUS_SUCCESS;
400 }
401
402 oal_status_t mesh_network_scan_cancel(oal_uuid_t* network_uuid)
403 {
404         int ret = BT_STATUS_SUCCESS;
405         API_TRACE();
406         CHECK_OAL_MESH_ENABLED();
407
408         ret = mesh_api->scan_cancel((bt_uuid_t*)network_uuid);
409         if (ret != BT_STATUS_SUCCESS) {
410                 BT_ERR("MESH: Scan Cancel failed: %s", status2string(ret));
411                 return convert_to_oal_status(ret);
412         }
413
414         return OAL_STATUS_SUCCESS;
415 }
416
417 oal_status_t mesh_network_set_provisioning_capabilities(
418                 oal_uuid_t *network_uuid,
419                          oal_mesh_capabilities_t *caps)
420 {
421         int ret = BT_STATUS_SUCCESS;
422         API_TRACE();
423         CHECK_OAL_MESH_ENABLED();
424
425         ret = mesh_api->capability((bt_uuid_t*)network_uuid,
426                 (bt_hal_mesh_prov_caps_t*)caps);
427         if (ret != BT_STATUS_SUCCESS) {
428                 BT_ERR("MESH: Set Provisioning capabilities :failed: %s",
429                         status2string(ret));
430                 return convert_to_oal_status(ret);
431         }
432
433         return OAL_STATUS_SUCCESS;
434 }
435
436 oal_status_t mesh_conf_send_message(oal_uuid_t *network_uuid,
437                 uint16_t dest, bool is_devkey_remote,
438                         uint16_t netkey_idx, uint8_t *buf, int len)
439 {
440         int ret = BT_STATUS_SUCCESS;
441         API_TRACE();
442         CHECK_OAL_MESH_ENABLED();
443
444         ret = mesh_api->config_send((bt_uuid_t*)network_uuid,
445                         dest, is_devkey_remote, netkey_idx, buf, len);
446         if (ret != BT_STATUS_SUCCESS) {
447                 BT_ERR("MESH: Configuration Message sending failed: %s",
448                         status2string(ret));
449                 return convert_to_oal_status(ret);
450         }
451
452         return OAL_STATUS_SUCCESS;
453 }
454
455 oal_status_t mesh_conf_send_key_message(oal_uuid_t *network_uuid,
456                 uint16_t dest, bool is_netkey,
457                         bool is_update, int key_idx, int netkey_idx)
458 {
459         int ret = BT_STATUS_SUCCESS;
460         API_TRACE();
461         CHECK_OAL_MESH_ENABLED();
462
463         ret = mesh_api->key_send((bt_uuid_t*)network_uuid, dest,
464                         is_netkey, is_update, key_idx, netkey_idx);
465         if (ret != BT_STATUS_SUCCESS) {
466                 BT_ERR("MESH: Key Configuration Message sending failed: %s",
467                         status2string(ret));
468                 return convert_to_oal_status(ret);
469         }
470
471         return OAL_STATUS_SUCCESS;
472 }
473
474 oal_status_t mesh_model_send_message(oal_uuid_t *network_uuid,
475                 uint16_t dest, uint16_t appkey_idx,
476                 uint8_t *buf, int len)
477 {
478         int ret = BT_STATUS_SUCCESS;
479         API_TRACE();
480         CHECK_OAL_MESH_ENABLED();
481
482         ret = mesh_api->msg_execute((bt_uuid_t*)network_uuid,
483                         dest, appkey_idx, buf, len);
484         if (ret != BT_STATUS_SUCCESS) {
485                 BT_ERR("MESH: Model Message sending failed: %s",
486                         status2string(ret));
487                 return convert_to_oal_status(ret);
488         }
489
490         return OAL_STATUS_SUCCESS;
491 }
492
493 oal_status_t mesh_network_provision_device(oal_uuid_t* network_uuid,
494                 oal_uuid_t *dev_uuid)
495 {
496         int ret = BT_STATUS_SUCCESS;
497         API_TRACE();
498         CHECK_OAL_MESH_ENABLED();
499
500         ret = mesh_api->provision((bt_uuid_t*)network_uuid, (bt_uuid_t *)dev_uuid);
501         if (ret != BT_STATUS_SUCCESS) {
502                 BT_ERR("MESH: Device Provisioning :failed: %s",
503                         status2string(ret));
504                 return convert_to_oal_status(ret);
505         }
506
507         return OAL_STATUS_SUCCESS;
508 }
509
510 oal_status_t mesh_network_send_provisioning_data(oal_uuid_t* network_uuid,
511                 uint16_t netkey_idx, uint16_t unicast)
512 {
513         int ret = BT_STATUS_SUCCESS;
514         API_TRACE();
515         CHECK_OAL_MESH_ENABLED();
516
517         ret = mesh_api->provision_data((bt_uuid_t*)network_uuid, netkey_idx, unicast);
518         if (ret != BT_STATUS_SUCCESS) {
519                 BT_ERR("MESH: Device Provisioning :failed: %s",
520                         status2string(ret));
521                 return convert_to_oal_status(ret);
522         }
523
524         return OAL_STATUS_SUCCESS;
525 }
526
527 oal_status_t mesh_network_subnet_execute(oal_uuid_t* network_uuid,
528                 oal_mesh_key_op_e operation, uint16_t net_index)
529 {
530         int ret = BT_STATUS_SUCCESS;
531         API_TRACE();
532         CHECK_OAL_MESH_ENABLED();
533
534         ret = mesh_api->subnet_execute((bt_uuid_t*)network_uuid,
535                 (bt_mesh_key_op_e)operation, net_index);
536         if (ret != BT_STATUS_SUCCESS) {
537                 BT_ERR("MESH: Create Subnet :failed: %s", status2string(ret));
538                 return convert_to_oal_status(ret);
539         }
540
541         return OAL_STATUS_SUCCESS;
542 }
543
544 oal_status_t mesh_network_appkey_execute(oal_uuid_t* network_uuid,
545                 oal_mesh_key_op_e operation,
546                         uint16_t net_index, uint16_t app_index)
547 {
548         int ret = BT_STATUS_SUCCESS;
549         API_TRACE();
550         CHECK_OAL_MESH_ENABLED();
551
552         ret = mesh_api->appkey_execute((bt_uuid_t*)network_uuid,
553                 (bt_mesh_key_op_e)operation,
554                         net_index, app_index);
555         if (ret != BT_STATUS_SUCCESS) {
556                 BT_ERR("MESH: Create Subnet :failed: %s",
557                         status2string(ret));
558                 return convert_to_oal_status(ret);
559         }
560
561         return OAL_STATUS_SUCCESS;
562 }
563
564 oal_status_t mesh_authentication_reply(
565                 oal_mesh_variant_authentication_e auth_type,
566                         const char* auth_value)
567 {
568         int ret = BT_STATUS_SUCCESS;
569         API_TRACE();
570         CHECK_OAL_MESH_ENABLED();
571
572         ret = mesh_api->auth_reply((bt_hal_mesh_auth_variant_e)auth_type,
573                         auth_value);
574         if (ret != BT_STATUS_SUCCESS) {
575                 BT_ERR("MESH: Device Provisioning :failed: %s",
576                         status2string(ret));
577                 return convert_to_oal_status(ret);
578         }
579
580         return OAL_STATUS_SUCCESS;
581 }