2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_NETWORK_THREAD_H__
19 #define __TIZEN_NETWORK_THREAD_H__
24 #include <tizen_error.h>
27 #include <thread-type.h>
29 #ifndef TIZEN_DEPRECATED_API
30 #define TIZEN_DEPRECATED_API __attribute__((__visibility__("default"), deprecated))
36 #endif /* __cplusplus */
40 * @brief API to control the Thread adapter and devices and communications.
41 * @ingroup CAPI_NETWORK_THREAD_MODULE
46 * @ingroup CAPI_NETWORK_THREAD_MODULE
47 * @brief Initializes the thread API.
50 * @remarks This function must be called before thread API starts. \n
52 * @return 0 on success, otherwise a negative error value.
53 * @retval #THREAD_ERROR_NONE Successful
54 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
55 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
57 * @see thread_deinitialize()
59 int thread_initialize(void);
62 * @ingroup CAPI_NETWORK_THREAD_MODULE
63 * @brief Releases all resources of the thread API.
66 * @remarks This function must be called if thread API is no longer needed.
68 * @return 0 on success, otherwise a negative error value.
69 * @retval #THREAD_ERROR_NONE Successful
70 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
71 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
72 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
74 * @pre thread API must be initialized with thread_initialize().
76 * @see thread_initialize()
78 int thread_deinitialize(void);
81 * @ingroup CAPI_NETWORK_THREAD_MODULE
82 * @brief Enable thread Module
85 * @return 0 on success, otherwise a negative error value.
86 * @retval #THREAD_ERROR_NONE Successful
87 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
88 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
89 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
91 * @pre thread API must be initialized with thread_initialize().
93 * @see thread_initialize()
95 int thread_enable(thread_instance_h *instance);
98 * @ingroup CAPI_NETWORK_THREAD_MODULE
99 * @brief Disable thread Module
102 * @return 0 on success, otherwise a negative error value.
103 * @retval #THREAD_ERROR_NONE Successful
104 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
105 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
106 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
108 * @pre thread API must be initialized with thread_initialize().
110 * @see thread_enable()
112 int thread_disable(thread_instance_h instance);
115 * @ingroup CAPI_NETWORK_THREAD_MODULE
116 * @brief Start Thread
119 * @return 0 on success, otherwise a negative error value.
120 * @retval #THREAD_ERROR_NONE Successful
121 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
122 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
123 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
125 * @pre thread API must be initialized with thread_initialize().
128 int thread_start(thread_instance_h instance);
131 * @ingroup CAPI_NETWORK_THREAD_MODULE
135 * @return 0 on success, otherwise a negative error value.
136 * @retval #THREAD_ERROR_NONE Successful
137 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
138 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
139 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
141 * @pre thread API must be initialized with thread_initialize().
142 * @see thread_start()
144 int thread_stop(thread_instance_h instance);
147 * @ingroup CAPI_NETWORK_THREAD_MODULE
148 * @brief Perform reset of OT hardware, tries to resume the network after reset
151 * @return 0 on success, otherwise a negative error value.
152 * @retval #THREAD_ERROR_NONE Successful
153 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
154 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
155 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
157 * @pre thread API must be initialized with thread_initialize().
159 * @see thread_enable()
161 int thread_reset(thread_instance_h instance);
164 * @ingroup CAPI_NETWORK_THREAD_MODULE
165 * @brief Perform Factory reset of OT hardware, wipes all Thread persistent data
168 * @return 0 on success, otherwise a negative error value.
169 * @retval #THREAD_ERROR_NONE Successful
170 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
171 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
172 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
174 * @pre thread API must be initialized with thread_initialize().
176 * @see thread_enable()
178 int thread_factoryreset(thread_instance_h instance);
181 * @ingroup CAPI_NETWORK_THREAD_MODULE
182 * @brief Get Thread Device Role
185 * @return 0 on success, otherwise a negative error value.
186 * @retval #THREAD_ERROR_NONE Successful
187 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
188 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
189 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
191 * @pre thread API must be initialized with thread_initialize().
193 int thread_get_device_role(thread_instance_h instance, thread_device_role_e *device_role);
196 * @ingroup CAPI_NETWORK_THREAD_MODULE
197 * @brief Set Thread Device Role changed callback
200 * @return 0 on success, otherwise a negative error value.
201 * @retval #THREAD_ERROR_NONE Successful
202 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
203 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
204 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
206 * @pre thread API must be initialized with thread_initialize().
208 int thread_set_device_role_changed_cb(thread_instance_h instance,
209 thread_device_role_cb callback, void *user_data);
212 * @ingroup CAPI_NETWORK_THREAD_MODULE
213 * @brief Set Thread Device Type
216 * @return 0 on success, otherwise a negative error value.
217 * @retval #THREAD_ERROR_NONE Successful
218 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
219 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
220 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
222 * @pre thread API must be initialized with thread_initialize().
224 int thread_set_device_type(thread_instance_h instance, thread_device_type_e device_type);
227 * @ingroup CAPI_NETWORK_THREAD_MODULE
228 * @brief Get Thread Device Type
231 * @return 0 on success, otherwise a negative error value.
232 * @retval #THREAD_ERROR_NONE Successful
233 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
234 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
235 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
237 * @pre thread API must be initialized with thread_initialize().
239 int thread_get_device_type(thread_instance_h instance, thread_device_type_e *device_type);
242 * @ingroup CAPI_NETWORK_THREAD_MODULE
243 * @brief Create Thread Network Scan param
246 * @return 0 on success, otherwise a negative error value.
247 * @retval #THREAD_ERROR_NONE Successful
248 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
249 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
250 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
252 * @pre thread API must be initialized with thread_initialize().
254 * @see thread_network_scan_result_cb()
256 int thread_scan_param_create(thread_instance_h instance,
257 uint16_t duration, thread_scan_param_h *param_handle);
260 * @ingroup CAPI_NETWORK_THREAD_MODULE
261 * @brief Destroys Thread Network Scan param
264 * @return 0 on success, otherwise a negative error value.
265 * @retval #THREAD_ERROR_NONE Successful
266 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
267 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
268 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
270 * @pre thread API must be initialized with thread_initialize().
272 * @see thread_network_scan_result_cb()
274 int thread_scan_param_destroy(thread_instance_h instance,
275 thread_scan_param_h param_handle);
278 * @ingroup CAPI_NETWORK_THREAD_MODULE
279 * @brief Scan Thread Network
282 * @return 0 on success, otherwise a negative error value.
283 * @retval #THREAD_ERROR_NONE Successful
284 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
285 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
286 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
288 * @pre thread API must be initialized with thread_initialize().
290 * @see thread_network_scan_result_cb()
292 int thread_scan(thread_instance_h instance, thread_scan_param_h handle,
293 thread_network_scan_result_cb callback, void *user_data);
296 * @ingroup CAPI_NETWORK_THREAD_MODULE
297 * @brief Gets the extended address
300 * @return 0 on success, otherwise a negative error value.
301 * @retval #THREAD_ERROR_NONE Successful
302 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
303 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
304 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
306 * @pre thread API must be initialized with thread_initialize().
308 int thread_get_extended_address(thread_instance_h instance, uint64_t *extended_address);
311 * @ingroup CAPI_NETWORK_THREAD_MODULE
312 * @brief Gets the extended uuid(EUI-64) of the Thread Device
315 * @return 0 on success, otherwise a negative error value.
316 * @retval #THREAD_ERROR_NONE Successful
317 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
318 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
319 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
321 * @pre thread API must be initialized with thread_initialize().
323 int thread_get_extended_uuid(thread_instance_h instance, const char **uuid);
326 * @ingroup CAPI_NETWORK_THREAD_MODULE
327 * @brief Set Active operational Network dataset
330 * @return 0 on success, otherwise a negative error value.
331 * @retval #THREAD_ERROR_NONE Successful
332 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
333 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
334 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
336 * @pre thread API must be initialized with thread_initialize().
338 * @see thread_active_dataset_tlvs_s
340 int thread_network_set_active_dataset_tlvs(thread_instance_h instance,
341 const uint8_t *tlvs_buffer, int length);
344 * @ingroup CAPI_NETWORK_THREAD_MODULE
345 * @brief Get Active operational Network dataset
348 * @return 0 on success, otherwise a negative error value.
349 * @retval #THREAD_ERROR_NONE Successful
350 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
351 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
352 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
354 * @remarks copy the data returned by buffer. It will go out of scope after API returns
356 * @pre thread API must be initialized with thread_initialize().
358 * @see thread_active_dataset_tlvs_s
359 * @see thread_set_active_dataset_tlvs()
361 int thread_network_get_active_dataset_tlvs(thread_instance_h instance,
362 uint8_t **tlvs_buffer, int *buf_len);
365 * @ingroup CAPI_NETWORK_THREAD_MODULE
366 * @brief Get the PanId from Operational Network
369 * @param[out] panid The PanId
371 * @return 0 on success, otherwise a negative error value.
372 * @retval #THREAD_ERROR_NONE Successful
373 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
374 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
375 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
377 * @pre thread API must be initialized with thread_initialize().
378 * @pre Active Operational Dataset must be set using thread_set_active_dataset_tlvs().
380 * @see thread_network_create()
381 * @see thread_set_operational_network()
382 * @see thread_set_active_dataset_tlvs()
384 int thread_network_get_panid(thread_instance_h instance, uint16_t *panid);
387 * @ingroup CAPI_NETWORK_THREAD_MODULE
388 * @brief Attach the OT hardware to the active Operational Network, which is pre-set
391 * @return 0 on success, otherwise a negative error value.
392 * @retval #THREAD_ERROR_NONE Successful
393 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
394 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
395 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
397 * @pre thread API must be initialized with thread_initialize().
398 * @pre Active Operational Dataset must be set using thread_set_active_dataset_tlvs().
400 * @see thread_set_active_dataset_tlvs()
402 int thread_network_attach(thread_instance_h instance);
405 * @ingroup CAPI_NETWORK_THREAD_MODULE
406 * @brief Detach the OT hardware from the active Operational Network
409 * @return 0 on success, otherwise a negative error value.
410 * @retval #THREAD_ERROR_NONE Successful
411 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
412 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
413 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
415 * @pre thread API must be initialized with thread_initialize().
416 * @pre Active Operational Dataset must be attached.
418 * @see thread_network_attach()
420 int thread_network_detach(thread_instance_h instance);
423 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
424 * @brief Enable OT Border Routing
427 * @return 0 on success, otherwise a negative error value.
428 * @retval #THREAD_ERROR_NONE Successful
429 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
430 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
431 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
433 * @pre thread API must be initialized with thread_initialize().
435 * @see thread_br_disable()
437 int thread_br_enable(thread_instance_h instance);
440 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
441 * @brief Disable OT Border Routing
444 * @return 0 on success, otherwise a negative error value.
445 * @retval #THREAD_ERROR_NONE Successful
446 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
447 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
448 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
450 * @pre thread API must be initialized with thread_initialize().
452 * @see thread_br_enable()
454 int thread_br_disable(thread_instance_h instance);
457 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
458 * @brief Get All External Route informations
461 * @return 0 on success, otherwise a negative error value.
462 * @retval #THREAD_ERROR_NONE Successful
463 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
464 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
465 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
467 * @pre thread API must be initialized with thread_initialize().
469 * @see thread_external_route_foreach_cb()
471 int thread_br_get_external_routes(thread_instance_h instance,
472 thread_external_route_foreach_cb callback, void *user_data);
475 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
476 * @brief Get ipv6 prefix for route
479 * @return 0 on success, otherwise a negative error value.
480 * @retval #THREAD_ERROR_NONE Successful
481 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
482 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
483 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
485 * @pre thread API must be initialized with thread_initialize().
487 * @see thread_external_route_foreach_cb()
489 int thread_br_get_ipv6_prefix(thread_route_info_h route,
490 uint8_t *ipv6_prefix, uint8_t *ipv6_prefix_len);
493 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
494 * @brief Get rloc16 for route
497 * @return 0 on success, otherwise a negative error value.
498 * @retval #THREAD_ERROR_NONE Successful
499 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
500 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
501 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
503 * @pre thread API must be initialized with thread_initialize().
505 * @see thread_external_route_foreach_cb()
507 int thread_br_get_rloc16(thread_route_info_h route,
511 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
512 * @brief Get preference for route
515 * @return 0 on success, otherwise a negative error value.
516 * @retval #THREAD_ERROR_NONE Successful
517 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
518 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
519 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
521 * @pre thread API must be initialized with thread_initialize().
523 * @see thread_external_route_foreach_cb()
525 int thread_br_get_preference(thread_route_info_h route,
529 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
530 * @brief Get stable for route
533 * @return 0 on success, otherwise a negative error value.
534 * @retval #THREAD_ERROR_NONE Successful
535 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
536 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
537 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
539 * @pre thread API must be initialized with thread_initialize().
541 * @see thread_external_route_foreach_cb()
543 int thread_br_check_stable(thread_route_info_h route,
547 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
548 * @brief Get device next hop for route
551 * @return 0 on success, otherwise a negative error value.
552 * @retval #THREAD_ERROR_NONE Successful
553 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
554 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
555 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
557 * @pre thread API must be initialized with thread_initialize().
559 * @see thread_external_route_foreach_cb()
561 int thread_br_check_device_nexthop(thread_route_info_h route,
562 bool *is_device_nexthop);
565 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
566 * @brief Add an external border routing rule to the network.
569 * @return 0 on success, otherwise a negative error value.
570 * @retval #THREAD_ERROR_NONE Successful
571 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
572 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
573 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
575 * @pre thread API must be initialized with thread_initialize().
577 * @see thread_remove_external_route()
579 int thread_br_add_external_route(thread_instance_h instance,
580 const uint8_t *ipv6_prefix, uint8_t ipv6_prefix_len,
581 uint16_t rloc16, int8_t preference,
582 bool is_stable, bool is_device_nexthop,
583 thread_route_info_h *route_handle);
586 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
587 * @brief Remove an external border routing rule from the network
590 * @return 0 on success, otherwise a negative error value.
591 * @retval #THREAD_ERROR_NONE Successful
592 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
593 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
594 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
596 * @pre thread API must be initialized with thread_initialize().
598 * @see thread_add_external_route()
600 int thread_br_remove_external_route(thread_instance_h instance, thread_route_info_h route_handle);
603 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
604 * @brief Create an on-mesh prefix info
607 * @return 0 on success, otherwise a negative error value.
608 * @retval #THREAD_ERROR_NONE Successful
609 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
610 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
611 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
613 * @pre thread API must be initialized with thread_initialize().
615 * @see thread_onmesh_prefix_destroy()
617 int thread_onmesh_prefix_create(thread_instance_h instance,
618 thread_onmesh_prefix_info_h *onmesh_prefix);
621 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
622 * @brief Destroy on-mesh prefix info
625 * @return 0 on success, otherwise a negative error value.
626 * @retval #THREAD_ERROR_NONE Successful
627 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
628 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
629 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
631 * @pre thread API must be initialized with thread_initialize().
633 * @see thread_onmesh_prefix_create()
635 int thread_onmesh_prefix_destroy(thread_instance_h instance,
636 thread_onmesh_prefix_info_h onmesh_prefix);
639 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
640 * @brief Set ipv6 prefix to on-mesh prefix info
643 * @return 0 on success, otherwise a negative error value.
644 * @retval #THREAD_ERROR_NONE Successful
645 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
646 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
647 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
649 * @pre thread API must be initialized with thread_initialize().
651 * @see thread_onmesh_prefix_create()
652 * @see thread_onmesh_prefix_destroy()
654 int thread_onmesh_prefix_set_ipv6_prefix(thread_onmesh_prefix_info_h onmesh_prefix,
655 const uint8_t *ipv6_prefix, uint8_t ipv6_prefix_len);
658 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
659 * @brief Get ipv6 prefix to on-mesh prefix info
662 * @return 0 on success, otherwise a negative error value.
663 * @retval #THREAD_ERROR_NONE Successful
664 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
665 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
666 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
668 * @pre thread API must be initialized with thread_initialize().
670 * @see thread_onmesh_prefix_create()
671 * @see thread_onmesh_prefix_destroy()
673 int thread_onmesh_prefix_get_ipv6_prefix(thread_onmesh_prefix_info_h onmesh_prefix,
674 uint8_t **ipv6_prefix, uint8_t *ipv6_prefix_len);
677 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
678 * @brief Set preference to on-mesh prefix info
681 * @return 0 on success, otherwise a negative error value.
682 * @retval #THREAD_ERROR_NONE Successful
683 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
684 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
685 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
687 * @pre thread API must be initialized with thread_initialize().
689 * @see thread_onmesh_prefix_create()
690 * @see thread_onmesh_prefix_destroy()
692 int thread_onmesh_prefix_set_preference(thread_onmesh_prefix_info_h onmesh_prefix,
696 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
697 * @brief Get preference to on-mesh prefix info
700 * @return 0 on success, otherwise a negative error value.
701 * @retval #THREAD_ERROR_NONE Successful
702 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
703 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
704 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
706 * @pre thread API must be initialized with thread_initialize().
708 * @see thread_onmesh_prefix_create()
709 * @see thread_onmesh_prefix_destroy()
711 int thread_onmesh_prefix_get_preference(thread_onmesh_prefix_info_h onmesh_prefix,
712 uint8_t *preference);
715 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
716 * @brief Set rloc to on-mesh prefix info
719 * @return 0 on success, otherwise a negative error value.
720 * @retval #THREAD_ERROR_NONE Successful
721 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
722 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
723 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
725 * @pre thread API must be initialized with thread_initialize().
727 * @see thread_onmesh_prefix_create()
728 * @see thread_onmesh_prefix_destroy()
730 int thread_onmesh_prefix_set_rloc(thread_onmesh_prefix_info_h onmesh_prefix,
734 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
735 * @brief Get rloc to on-mesh prefix info
738 * @return 0 on success, otherwise a negative error value.
739 * @retval #THREAD_ERROR_NONE Successful
740 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
741 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
742 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
744 * @pre thread API must be initialized with thread_initialize().
746 * @see thread_onmesh_prefix_create()
747 * @see thread_onmesh_prefix_destroy()
749 int thread_onmesh_prefix_get_rloc(thread_onmesh_prefix_info_h onmesh_prefix,
753 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
754 * @brief Set preferred to on-mesh prefix info
757 * @return 0 on success, otherwise a negative error value.
758 * @retval #THREAD_ERROR_NONE Successful
759 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
760 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
761 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
763 * @pre thread API must be initialized with thread_initialize().
765 * @see thread_onmesh_prefix_create()
766 * @see thread_onmesh_prefix_destroy()
768 int thread_onmesh_prefix_set_preferred(thread_onmesh_prefix_info_h onmesh_prefix,
772 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
773 * @brief Get preferred to on-mesh prefix info
776 * @return 0 on success, otherwise a negative error value.
777 * @retval #THREAD_ERROR_NONE Successful
778 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
779 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
780 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
782 * @pre thread API must be initialized with thread_initialize().
784 * @see thread_onmesh_prefix_create()
785 * @see thread_onmesh_prefix_destroy()
787 int thread_onmesh_prefix_get_preferred(thread_onmesh_prefix_info_h onmesh_prefix,
791 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
792 * @brief Set slaac to on-mesh prefix info
795 * @return 0 on success, otherwise a negative error value.
796 * @retval #THREAD_ERROR_NONE Successful
797 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
798 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
799 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
801 * @pre thread API must be initialized with thread_initialize().
803 * @see thread_onmesh_prefix_create()
804 * @see thread_onmesh_prefix_destroy()
806 int thread_onmesh_prefix_set_slaac(thread_onmesh_prefix_info_h onmesh_prefix,
810 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
811 * @brief Get slaac to on-mesh prefix info
814 * @return 0 on success, otherwise a negative error value.
815 * @retval #THREAD_ERROR_NONE Successful
816 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
817 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
818 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
820 * @pre thread API must be initialized with thread_initialize().
822 * @see thread_onmesh_prefix_create()
823 * @see thread_onmesh_prefix_destroy()
825 int thread_onmesh_prefix_get_slaac(thread_onmesh_prefix_info_h onmesh_prefix,
829 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
830 * @brief Set dhcp to on-mesh prefix info
833 * @return 0 on success, otherwise a negative error value.
834 * @retval #THREAD_ERROR_NONE Successful
835 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
836 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
837 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
839 * @pre thread API must be initialized with thread_initialize().
841 * @see thread_onmesh_prefix_create()
842 * @see thread_onmesh_prefix_destroy()
844 int thread_onmesh_prefix_set_dhcp(thread_onmesh_prefix_info_h onmesh_prefix,
848 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
849 * @brief Get dhcp to on-mesh prefix info
852 * @return 0 on success, otherwise a negative error value.
853 * @retval #THREAD_ERROR_NONE Successful
854 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
855 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
856 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
858 * @pre thread API must be initialized with thread_initialize().
860 * @see thread_onmesh_prefix_create()
861 * @see thread_onmesh_prefix_destroy()
863 int thread_onmesh_prefix_get_dhcp(thread_onmesh_prefix_info_h onmesh_prefix,
867 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
868 * @brief Set configure to on-mesh prefix info
871 * @return 0 on success, otherwise a negative error value.
872 * @retval #THREAD_ERROR_NONE Successful
873 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
874 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
875 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
877 * @pre thread API must be initialized with thread_initialize().
879 * @see thread_onmesh_prefix_create()
880 * @see thread_onmesh_prefix_destroy()
882 int thread_onmesh_prefix_set_configure(thread_onmesh_prefix_info_h onmesh_prefix,
886 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
887 * @brief Get configure to on-mesh prefix info
890 * @return 0 on success, otherwise a negative error value.
891 * @retval #THREAD_ERROR_NONE Successful
892 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
893 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
894 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
896 * @pre thread API must be initialized with thread_initialize().
898 * @see thread_onmesh_prefix_create()
899 * @see thread_onmesh_prefix_destroy()
901 int thread_onmesh_prefix_get_configure(thread_onmesh_prefix_info_h onmesh_prefix,
905 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
906 * @brief Get on mesh to on-mesh prefix info
909 * @return 0 on success, otherwise a negative error value.
910 * @retval #THREAD_ERROR_NONE Successful
911 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
912 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
913 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
915 * @pre thread API must be initialized with thread_initialize().
917 * @see thread_onmesh_prefix_create()
918 * @see thread_onmesh_prefix_destroy()
920 int thread_onmesh_prefix_get_on_mesh(thread_onmesh_prefix_info_h onmesh_prefix,
924 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
925 * @brief Set on mesh to on-mesh prefix info
928 * @return 0 on success, otherwise a negative error value.
929 * @retval #THREAD_ERROR_NONE Successful
930 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
931 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
932 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
934 * @pre thread API must be initialized with thread_initialize().
936 * @see thread_onmesh_prefix_create()
937 * @see thread_onmesh_prefix_destroy()
939 int thread_onmesh_prefix_set_on_mesh(thread_onmesh_prefix_info_h onmesh_prefix,
943 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
944 * @brief Get stable to on-mesh prefix info
947 * @return 0 on success, otherwise a negative error value.
948 * @retval #THREAD_ERROR_NONE Successful
949 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
950 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
951 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
953 * @pre thread API must be initialized with thread_initialize().
955 * @see thread_onmesh_prefix_create()
956 * @see thread_onmesh_prefix_destroy()
958 int thread_onmesh_prefix_get_stable(thread_onmesh_prefix_info_h onmesh_prefix,
962 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
963 * @brief Set stable to on-mesh prefix info
966 * @return 0 on success, otherwise a negative error value.
967 * @retval #THREAD_ERROR_NONE Successful
968 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
969 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
970 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
972 * @pre thread API must be initialized with thread_initialize().
974 * @see thread_onmesh_prefix_create()
975 * @see thread_onmesh_prefix_destroy()
977 int thread_onmesh_prefix_set_stable(thread_onmesh_prefix_info_h onmesh_prefix,
981 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
982 * @brief Get default route to on-mesh prefix info
985 * @return 0 on success, otherwise a negative error value.
986 * @retval #THREAD_ERROR_NONE Successful
987 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
988 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
989 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
991 * @pre thread API must be initialized with thread_initialize().
993 * @see thread_onmesh_prefix_create()
994 * @see thread_onmesh_prefix_destroy()
996 int thread_onmesh_prefix_get_default_route(thread_onmesh_prefix_info_h onmesh_prefix,
997 bool *is_default_route);
1000 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1001 * @brief Set default route to on-mesh prefix info
1004 * @return 0 on success, otherwise a negative error value.
1005 * @retval #THREAD_ERROR_NONE Successful
1006 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1007 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1008 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1010 * @pre thread API must be initialized with thread_initialize().
1012 * @see thread_onmesh_prefix_create()
1013 * @see thread_onmesh_prefix_destroy()
1015 int thread_onmesh_prefix_set_default_route(thread_onmesh_prefix_info_h onmesh_prefix,
1016 bool is_default_route);
1019 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1020 * @brief Get ND DNS to on-mesh prefix info
1023 * @return 0 on success, otherwise a negative error value.
1024 * @retval #THREAD_ERROR_NONE Successful
1025 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1026 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1027 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1029 * @pre thread API must be initialized with thread_initialize().
1031 * @see thread_onmesh_prefix_create()
1032 * @see thread_onmesh_prefix_destroy()
1034 int thread_onmesh_prefix_get_nd_dns(thread_onmesh_prefix_info_h onmesh_prefix,
1038 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1039 * @brief Set ND DNS to on-mesh prefix info
1042 * @return 0 on success, otherwise a negative error value.
1043 * @retval #THREAD_ERROR_NONE Successful
1044 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1045 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1046 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1048 * @pre thread API must be initialized with thread_initialize().
1050 * @see thread_onmesh_prefix_create()
1051 * @see thread_onmesh_prefix_destroy()
1053 int thread_onmesh_prefix_set_nd_dns(thread_onmesh_prefix_info_h onmesh_prefix,
1057 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1058 * @brief Get DP to on-mesh prefix info
1061 * @return 0 on success, otherwise a negative error value.
1062 * @retval #THREAD_ERROR_NONE Successful
1063 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1064 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1065 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1067 * @pre thread API must be initialized with thread_initialize().
1069 * @see thread_onmesh_prefix_create()
1070 * @see thread_onmesh_prefix_destroy()
1072 int thread_onmesh_prefix_get_dp(thread_onmesh_prefix_info_h onmesh_prefix,
1076 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1077 * @brief Set DP to on-mesh prefix info
1080 * @return 0 on success, otherwise a negative error value.
1081 * @retval #THREAD_ERROR_NONE Successful
1082 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1083 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1084 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1086 * @pre thread API must be initialized with thread_initialize().
1088 * @see thread_onmesh_prefix_create()
1089 * @see thread_onmesh_prefix_destroy()
1091 int thread_onmesh_prefix_set_dp(thread_onmesh_prefix_info_h onmesh_prefix,
1095 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1096 * @brief Get on-mesh prefixes to the network
1099 * @return 0 on success, otherwise a negative error value.
1100 * @retval #THREAD_ERROR_NONE Successful
1101 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1102 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1103 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1105 * @pre thread API must be initialized with thread_initialize().
1107 * @see thread_add_onmesh_prefix()
1108 * @see thread_remove_onmesh_prefix()
1110 int thread_br_get_onmesh_prefixes(thread_instance_h instance,
1111 thread_onmesh_prefix_foreach_cb callback, void *user_data);
1114 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1115 * @brief Add an on-mesh prefix to the network
1118 * @return 0 on success, otherwise a negative error value.
1119 * @retval #THREAD_ERROR_NONE Successful
1120 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1121 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1122 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1124 * @pre thread API must be initialized with thread_initialize().
1126 * @see thread_remove_onmesh_prefix()
1128 int thread_br_add_onmesh_prefix(thread_instance_h instance,
1129 thread_onmesh_prefix_info_h onmesh_prefix);
1132 * @ingroup CAPI_NETWORK_THREAD_BORDERROUTER_MODULE
1133 * @brief Remove on-mesh prefix from the network
1136 * @return 0 on success, otherwise a negative error value.
1137 * @retval #THREAD_ERROR_NONE Successful
1138 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1139 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1140 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1142 * @pre thread API must be initialized with thread_initialize().
1144 * @see thread_add_onmesh_prefix()
1146 int thread_br_remove_onmesh_prefix(thread_instance_h instance,
1147 thread_onmesh_prefix_info_h onmesh_prefix);
1150 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1151 * @brief Create thread network
1154 * @return 0 on success, otherwise a negative error value.
1155 * @retval #THREAD_ERROR_NONE Successful
1156 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1157 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1158 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1160 * @pre thread API must be initialized with thread_initialize().
1162 int thread_network_create(thread_network_h *network);
1165 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1166 * @brief Destroy thread network
1169 * @return 0 on success, otherwise a negative error value.
1170 * @retval #THREAD_ERROR_NONE Successful
1171 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1172 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1173 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1175 * @pre thread API must be initialized with thread_initialize().
1177 int thread_network_destroy(thread_network_h network);
1180 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1181 * @brief Set the thread network name
1184 * @return 0 on success, otherwise a negative error value.
1185 * @retval #THREAD_ERROR_NONE Successful
1186 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1187 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1188 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1190 * @pre thread API must be initialized with thread_initialize().
1192 int thread_network_set_name(thread_network_h network, const char *name);
1195 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1196 * @brief Set the thread network key
1199 * @return 0 on success, otherwise a negative error value.
1200 * @retval #THREAD_ERROR_NONE Successful
1201 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1202 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1203 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1205 * @pre thread API must be initialized with thread_initialize().
1207 int thread_network_set_key(thread_network_h network, const char *key);
1210 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1211 * @brief Set the thread network pskc
1214 * @return 0 on success, otherwise a negative error value.
1215 * @retval #THREAD_ERROR_NONE Successful
1216 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1217 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1218 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1220 * @pre thread API must be initialized with thread_initialize().
1222 int thread_network_set_pskc(thread_network_h network, const char *pskc);
1225 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1226 * @brief Set the thread network channel
1229 * @return 0 on success, otherwise a negative error value.
1230 * @retval #THREAD_ERROR_NONE Successful
1231 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1232 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1233 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1235 * @pre thread API must be initialized with thread_initialize().
1237 int thread_network_set_channel(thread_network_h network, uint32_t channel);
1240 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1241 * @brief Set the thread network extended pan id
1244 * @return 0 on success, otherwise a negative error value.
1245 * @retval #THREAD_ERROR_NONE Successful
1246 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1247 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1248 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1250 * @pre thread API must be initialized with thread_initialize().
1252 int thread_network_set_extended_panid(thread_network_h network, uint64_t extended_panid);
1255 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1256 * @brief Set the thread network pan id
1259 * @return 0 on success, otherwise a negative error value.
1260 * @retval #THREAD_ERROR_NONE Successful
1261 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1262 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1263 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1265 * @pre thread API must be initialized with thread_initialize().
1267 int thread_network_set_panid(thread_network_h network, uint16_t panid);
1270 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1271 * @brief Set the thread network to instance
1274 * @return 0 on success, otherwise a negative error value.
1275 * @retval #THREAD_ERROR_NONE Successful
1276 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1277 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1278 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1280 * @pre thread API must be initialized with thread_initialize().
1282 int thread_set_operational_network(thread_instance_h instance, thread_network_h network);
1285 * @ingroup CAPI_NETWORK_THREAD_NETWORK_MODULE
1286 * @brief Unset the thread network from instance
1289 * @return 0 on success, otherwise a negative error value.
1290 * @retval #THREAD_ERROR_NONE Successful
1291 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1292 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1293 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1295 * @pre thread API must be initialized with thread_initialize().
1297 int thread_unset_operational_network(thread_instance_h instance);
1300 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
1301 * @brief Start Thread joining with detailed informations
1304 * @return 0 on success, otherwise a negative error value.
1305 * @retval #THREAD_ERROR_NONE Successful
1306 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1307 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1308 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1310 * @pre thread API must be initialized with thread_initialize().
1311 * @see thread_joiner_stop()
1313 int thread_joiner_start(thread_instance_h instance,
1314 const char *pskd, const char *prov_url,
1315 const char *vendor_name, const char *vendor_model,
1316 const char *vendor_sw_ver, const char *vendor_data,
1317 thread_joiner_result_cb callback, void *user_data);
1320 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
1321 * @brief Stop Thread Joining
1324 * @return 0 on success, otherwise a negative error value.
1325 * @retval #THREAD_ERROR_NONE Successful
1326 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1327 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1328 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1330 * @pre thread API must be initialized with thread_initialize().
1331 * @see thread_joiner_start()
1333 int thread_joiner_stop(thread_instance_h instance);
1336 * @ingroup CAPI_NETWORK_THREAD_JOINER_MODULE
1337 * @brief Join Thread Network by Network key (Out-Of-Band Commisioning)
1338 * network key must be obtained by the commissioner via any trusted Out-Of-Band method
1341 * @return 0 on success, otherwise a negative error value.
1342 * @retval #THREAD_ERROR_NONE Successful
1343 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1344 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1345 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1347 * @pre thread API must be initialized with thread_initialize().
1349 int thread_joiner_join_by_network_key(thread_instance_h instance, const char *network_key, const char *panid);
1352 * @ingroup CAPI_NETWORK_THREAD_COMMISSIONER_MODULE
1353 * @brief Start thread commissioner (In-Band Commissioning)
1356 * @return 0 on success, otherwise a negative error value.
1357 * @retval #THREAD_ERROR_NONE Successful
1358 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1359 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1360 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1362 * @pre thread API must be initialized with thread_initialize().
1364 int thread_commissioner_start(thread_instance_h instance);
1367 * @ingroup CAPI_NETWORK_THREAD_COMMISSIONER_MODULE
1368 * @brief Set commissioning Data (In-Band Commissioning)
1371 * @return 0 on success, otherwise a negative error value.
1372 * @retval #THREAD_ERROR_NONE Successful
1373 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1374 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1375 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1377 * @pre thread API must be initialized with thread_initialize().
1379 int thread_commissioner_set_commissioning_data(thread_instance_h instance, const char *joiner_uuid,
1380 const char *joiner_passphrase);
1383 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1384 * @brief Start SRP Client
1387 * @return 0 on success, otherwise a negative error value.
1388 * @retval #THREAD_ERROR_NONE Successful
1389 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1390 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1391 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1393 * @pre thread API must be initialized with thread_initialize().
1394 * @see thread_srp_client_stop()
1396 int thread_srp_client_start(thread_instance_h instance);
1399 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1400 * @brief Stop SRP Client
1403 * @return 0 on success, otherwise a negative error value.
1404 * @retval #THREAD_ERROR_NONE Successful
1405 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1406 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1407 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1409 * @pre thread API must be initialized with thread_initialize().
1410 * @see thread_srp_client_start()
1412 int thread_srp_client_stop(thread_instance_h instance);
1415 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1416 * @brief Remove already registered SRP host service
1419 * @return 0 on success, otherwise a negative error value.
1420 * @retval #THREAD_ERROR_NONE Successful
1421 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1422 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1423 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1425 * @pre thread API must be initialized with thread_initialize().
1426 * @see thread_srp_client_start()
1428 int thread_srp_client_remove_host(thread_instance_h instance);
1431 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1432 * @brief Set Host name
1435 * @return 0 on success, otherwise a negative error value.
1436 * @retval #THREAD_ERROR_NONE Successful
1437 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1438 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1439 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1441 * @pre thread API must be initialized with thread_initialize().
1442 * @see thread_srp_client_start()
1444 int thread_srp_client_set_host_name(thread_instance_h instance, const char *host_name);
1447 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1448 * @brief Set Host address
1451 * @return 0 on success, otherwise a negative error value.
1452 * @retval #THREAD_ERROR_NONE Successful
1453 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1454 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1455 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1457 * @pre thread API must be initialized with thread_initialize().
1458 * @see thread_srp_client_start()
1460 int thread_srp_client_set_host_address(thread_instance_h instance, const char *ipv6_address);
1463 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1464 * @brief Register Service to SRP server
1467 * @return 0 on success, otherwise a negative error value.
1468 * @retval #THREAD_ERROR_NONE Successful
1469 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1470 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1471 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1473 * @pre thread API must be initialized with thread_initialize().
1474 * @see thread_srp_client_start()
1475 * @see thread_srp_client_set_host_address()
1477 int thread_srp_client_register_service(thread_instance_h instance,
1478 const char *service_name, const char *service_type, uint64_t port);
1481 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1482 * @brief Start SRP Server
1485 * @return 0 on success, otherwise a negative error value.
1486 * @retval #THREAD_ERROR_NONE Successful
1487 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1488 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1489 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1491 * @pre thread API must be initialized with thread_initialize().
1492 * @see thread_srp_server_stop()
1494 int thread_srp_server_start(thread_instance_h instance);
1497 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1498 * @brief Stop SRP Server
1501 * @return 0 on success, otherwise a negative error value.
1502 * @retval #THREAD_ERROR_NONE Successful
1503 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1504 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1505 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1507 * @pre thread API must be initialized with thread_initialize().
1508 * @see thread_srp_server_start()
1510 int thread_srp_server_stop(thread_instance_h instance);
1513 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1514 * @brief Get registered service detail from the SRP server
1517 * @return 0 on success, otherwise a negative error value.
1518 * @retval #THREAD_ERROR_NONE Successful
1519 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1520 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1521 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1523 * @pre thread API must be initialized with thread_initialize().
1524 * @see thread_srp_server_start()
1526 int thread_srp_server_get_registered_service(thread_instance_h instance, const char **service_name,
1527 const char **address, uint64_t *port, bool *is_deleted);
1530 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1531 * @brief Get node ip address of the thread network node
1534 * @return 0 on success, otherwise a negative error value.
1535 * @retval #THREAD_ERROR_NONE Successful
1536 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1537 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1538 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1540 * @pre thread API must be initialized with thread_initialize() and
1541 * enabled with thread_enable().
1542 * @see thread_initialize() and thread_enable()
1544 int thread_get_ipaddr(thread_instance_h instance, thread_ipaddr_foreach_cb callback,
1545 thread_ipaddr_type_e ipaddr_type, void *user_data);
1548 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1549 * @brief Up the netwotk interface for the thread node.
1552 * @return 0 on success, otherwise a negative error value.
1553 * @retval #THREAD_ERROR_NONE Successful
1554 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1555 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1556 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1558 * @pre thread API must be initialized with thread_initialize() and
1559 * enabled with thread_enable().
1560 * @see thread_initialize() and thread_enable()
1562 int thread_ifconfig_up(thread_instance_h instance);
1565 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1566 * @brief Add Ipv6 address to the thread node.
1569 * @param[in] ipv6_address Byte list
1571 * @return 0 on success, otherwise a negative error value.
1572 * @retval #THREAD_ERROR_NONE Successful
1573 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1574 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1575 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1577 * @pre thread API must be initialized with thread_initialize() and
1578 * enabled with thread_enable().
1579 * @see thread_initialize() and thread_enable()
1581 int thread_add_ipaddr(thread_instance_h instance, const uint8_t *ipv6_address);
1584 * @ingroup CAPI_NETWORK_THREAD_SRP_MODULE
1585 * @brief Remove Ipv6 address from the thread node.
1588 * @param[in] ipv6_address Byte list
1590 * @return 0 on success, otherwise a negative error value.
1591 * @retval #THREAD_ERROR_NONE Successful
1592 * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
1593 * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
1594 * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
1596 * @pre thread API must be initialized with thread_initialize() and
1597 * enabled with thread_enable().
1598 * @see thread_initialize() and thread_enable()
1600 int thread_remove_ipaddr(thread_instance_h instance, const uint8_t *ipv6_address);
1604 #endif /* __cplusplus */
1606 #endif /* __TIZEN_NETWORK_THREAD_H__ */