1 /* node-type-tracker.h 2 * 3 * Copyright (c) 2023 Apple Inc. All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * This file contains general support definitions for the thread network state tracker. 18 */ 19 20 #ifndef __NODE_TYPE_TRACKER_H__ 21 #define __NODE_TYPE_TRACKER_H__ 1 22 23 typedef struct node_type_tracker node_type_tracker_t; 24 25 typedef enum thread_node_type { 26 node_type_unknown, 27 node_type_router, 28 node_type_end_device, 29 node_type_sleepy_end_device, 30 node_type_synchronized_sleepy_end_device, 31 node_type_nest_lurker, 32 node_type_commissioner, 33 node_type_leader, 34 node_type_sleepy_router, 35 } thread_node_type_t; 36 37 RELEASE_RETAIN_DECLS(node_type_tracker); 38 #define node_type_tracker_retain(watcher) node_type_tracker_retain_(watcher, __FILE__, __LINE__) 39 #define node_type_tracker_release(watcher) node_type_tracker_release_(watcher, __FILE__, __LINE__) 40 const char *NONNULL node_type_tracker_thread_node_type_to_string(thread_node_type_t node_type); 41 void node_type_tracker_cancel(node_type_tracker_t *NONNULL publisher); 42 node_type_tracker_t *NULLABLE node_type_tracker_create(srp_server_t *NONNULL route_state); 43 void node_type_tracker_set_reconnect_callback(node_type_tracker_t *NONNULL tracker, 44 void (*NULLABLE reconnect_callback)(void *NULLABLE context)); 45 void node_type_tracker_start(node_type_tracker_t *NONNULL tracker); 46 bool node_type_tracker_callback_add(node_type_tracker_t *NONNULL tracker, void (*NONNULL callback)(void *NULLABLE context), 47 void (*NULLABLE context_release)(void *NULLABLE context), void *NULLABLE context); 48 void node_type_tracker_callback_cancel(node_type_tracker_t *NONNULL tracker, void *NONNULL context); 49 thread_node_type_t node_type_tracker_thread_node_type_get(node_type_tracker_t *NULLABLE tracker, bool previous); 50 #endif // __NODE_TYPE_TRACKER_H__ 51 52 // Local Variables: 53 // mode: C 54 // tab-width: 4 55 // c-file-style: "bsd" 56 // c-basic-offset: 4 57 // fill-column: 120 58 // indent-tabs-mode: nil 59 // End: 60