1#![allow(dead_code)]
8#![allow(non_camel_case_types)]
9#![allow(non_snake_case)]
10#![allow(non_upper_case_globals)]
11#![allow(clippy::missing_safety_doc)]
12
13#[repr(C)]
14#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct __BindgenBitfieldUnit<Storage> {
16 storage: Storage,
17}
18impl<Storage> __BindgenBitfieldUnit<Storage> {
19 #[inline]
20 pub const fn new(storage: Storage) -> Self {
21 Self { storage }
22 }
23}
24impl<Storage> __BindgenBitfieldUnit<Storage>
25where
26 Storage: AsRef<[u8]> + AsMut<[u8]>,
27{
28 #[inline]
29 fn extract_bit(byte: u8, index: usize) -> bool {
30 let bit_index = if cfg!(target_endian = "big") { 7 - (index % 8) } else { index % 8 };
31 let mask = 1 << bit_index;
32 byte & mask == mask
33 }
34 #[inline]
35 pub fn get_bit(&self, index: usize) -> bool {
36 debug_assert!(index / 8 < self.storage.as_ref().len());
37 let byte_index = index / 8;
38 let byte = self.storage.as_ref()[byte_index];
39 Self::extract_bit(byte, index)
40 }
41 #[inline]
42 pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
43 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
44 let byte_index = index / 8;
45 let byte = unsafe {
46 *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
47 };
48 Self::extract_bit(byte, index)
49 }
50 #[inline]
51 fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
52 let bit_index = if cfg!(target_endian = "big") { 7 - (index % 8) } else { index % 8 };
53 let mask = 1 << bit_index;
54 if val { byte | mask } else { byte & !mask }
55 }
56 #[inline]
57 pub fn set_bit(&mut self, index: usize, val: bool) {
58 debug_assert!(index / 8 < self.storage.as_ref().len());
59 let byte_index = index / 8;
60 let byte = &mut self.storage.as_mut()[byte_index];
61 *byte = Self::change_bit(*byte, index, val);
62 }
63 #[inline]
64 pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
65 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
66 let byte_index = index / 8;
67 let byte = unsafe {
68 (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
69 };
70 unsafe { *byte = Self::change_bit(*byte, index, val) };
71 }
72 #[inline]
73 pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
74 debug_assert!(bit_width <= 64);
75 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
76 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
77 let mut val = 0;
78 for i in 0..(bit_width as usize) {
79 if self.get_bit(i + bit_offset) {
80 let index =
81 if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
82 val |= 1 << index;
83 }
84 }
85 val
86 }
87 #[inline]
88 pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
89 debug_assert!(bit_width <= 64);
90 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
91 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
92 let mut val = 0;
93 for i in 0..(bit_width as usize) {
94 if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
95 let index =
96 if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
97 val |= 1 << index;
98 }
99 }
100 val
101 }
102 #[inline]
103 pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
104 debug_assert!(bit_width <= 64);
105 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
106 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
107 for i in 0..(bit_width as usize) {
108 let mask = 1 << i;
109 let val_bit_is_set = val & mask == mask;
110 let index = if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
111 self.set_bit(index + bit_offset, val_bit_is_set);
112 }
113 }
114 #[inline]
115 pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
116 debug_assert!(bit_width <= 64);
117 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
118 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
119 for i in 0..(bit_width as usize) {
120 let mask = 1 << i;
121 let val_bit_is_set = val & mask == mask;
122 let index = if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
123 unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
124 }
125 }
126}
127pub const OPENTHREAD_API_VERSION: u32 = 583;
128pub const OT_UPTIME_STRING_SIZE: u32 = 24;
129pub const OT_CHANGED_IP6_ADDRESS_ADDED: u32 = 1;
130pub const OT_CHANGED_IP6_ADDRESS_REMOVED: u32 = 2;
131pub const OT_CHANGED_THREAD_ROLE: u32 = 4;
132pub const OT_CHANGED_THREAD_LL_ADDR: u32 = 8;
133pub const OT_CHANGED_THREAD_ML_ADDR: u32 = 16;
134pub const OT_CHANGED_THREAD_RLOC_ADDED: u32 = 32;
135pub const OT_CHANGED_THREAD_RLOC_REMOVED: u32 = 64;
136pub const OT_CHANGED_THREAD_PARTITION_ID: u32 = 128;
137pub const OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER: u32 = 256;
138pub const OT_CHANGED_THREAD_NETDATA: u32 = 512;
139pub const OT_CHANGED_THREAD_CHILD_ADDED: u32 = 1024;
140pub const OT_CHANGED_THREAD_CHILD_REMOVED: u32 = 2048;
141pub const OT_CHANGED_IP6_MULTICAST_SUBSCRIBED: u32 = 4096;
142pub const OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED: u32 = 8192;
143pub const OT_CHANGED_THREAD_CHANNEL: u32 = 16384;
144pub const OT_CHANGED_THREAD_PANID: u32 = 32768;
145pub const OT_CHANGED_THREAD_NETWORK_NAME: u32 = 65536;
146pub const OT_CHANGED_THREAD_EXT_PANID: u32 = 131072;
147pub const OT_CHANGED_NETWORK_KEY: u32 = 262144;
148pub const OT_CHANGED_PSKC: u32 = 524288;
149pub const OT_CHANGED_SECURITY_POLICY: u32 = 1048576;
150pub const OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL: u32 = 2097152;
151pub const OT_CHANGED_SUPPORTED_CHANNEL_MASK: u32 = 4194304;
152pub const OT_CHANGED_COMMISSIONER_STATE: u32 = 8388608;
153pub const OT_CHANGED_THREAD_NETIF_STATE: u32 = 16777216;
154pub const OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE: u32 = 33554432;
155pub const OT_CHANGED_THREAD_BACKBONE_ROUTER_LOCAL: u32 = 67108864;
156pub const OT_CHANGED_JOINER_STATE: u32 = 134217728;
157pub const OT_CHANGED_ACTIVE_DATASET: u32 = 268435456;
158pub const OT_CHANGED_PENDING_DATASET: u32 = 536870912;
159pub const OT_CHANGED_NAT64_TRANSLATOR_STATE: u32 = 1073741824;
160pub const OT_CHANGED_PARENT_LINK_QUALITY: u32 = 2147483648;
161pub const OT_CRYPTO_SHA256_HASH_SIZE: u32 = 32;
162pub const OT_CRYPTO_ECDSA_MAX_DER_SIZE: u32 = 125;
163pub const OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE: u32 = 64;
164pub const OT_CRYPTO_ECDSA_SIGNATURE_SIZE: u32 = 64;
165pub const OT_CRYPTO_PBDKF2_MAX_SALT_SIZE: u32 = 30;
166pub const OT_PANID_BROADCAST: u32 = 65535;
167pub const OT_EXT_ADDRESS_SIZE: u32 = 8;
168pub const OT_MAC_KEY_SIZE: u32 = 16;
169pub const OT_IP6_PREFIX_SIZE: u32 = 8;
170pub const OT_IP6_PREFIX_BITSIZE: u32 = 64;
171pub const OT_IP6_IID_SIZE: u32 = 8;
172pub const OT_IP6_ADDRESS_SIZE: u32 = 16;
173pub const OT_IP6_ADDRESS_BITSIZE: u32 = 128;
174pub const OT_IP6_HEADER_SIZE: u32 = 40;
175pub const OT_IP6_HEADER_PROTO_OFFSET: u32 = 6;
176pub const OT_IP6_ADDRESS_STRING_SIZE: u32 = 40;
177pub const OT_IP6_SOCK_ADDR_STRING_SIZE: u32 = 48;
178pub const OT_IP6_PREFIX_STRING_SIZE: u32 = 45;
179pub const OT_IP6_MAX_MLR_ADDRESSES: u32 = 15;
180pub const OT_JOINER_MAX_DISCERNER_LENGTH: u32 = 64;
181pub const OT_STEERING_DATA_MIN_LENGTH: u32 = 1;
182pub const OT_STEERING_DATA_MAX_LENGTH: u32 = 16;
183pub const OT_COMMISSIONING_PASSPHRASE_MIN_SIZE: u32 = 6;
184pub const OT_COMMISSIONING_PASSPHRASE_MAX_SIZE: u32 = 255;
185pub const OT_PROVISIONING_URL_MAX_SIZE: u32 = 64;
186pub const OT_JOINER_MAX_PSKD_LENGTH: u32 = 32;
187pub const OT_NETWORK_DATA_ITERATOR_INIT: u32 = 0;
188pub const OT_SERVICE_DATA_MAX_SIZE: u32 = 252;
189pub const OT_SERVER_DATA_MAX_SIZE: u32 = 248;
190pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT: u32 = 0;
191pub const OT_BORDER_AGENT_MIN_EPHEMERAL_KEY_LENGTH: u32 = 6;
192pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_LENGTH: u32 = 32;
193pub const OT_BORDER_AGENT_DEFAULT_EPHEMERAL_KEY_TIMEOUT: u32 = 120000;
194pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT: u32 = 600000;
195pub const OT_BORDER_AGENT_EPHEMERAL_KEY_TAP_STRING_LENGTH: u32 = 9;
196pub const OT_DNS_MAX_NAME_SIZE: u32 = 255;
197pub const OT_DNS_MAX_LABEL_SIZE: u32 = 64;
198pub const OT_DNS_TXT_KEY_MIN_LENGTH: u32 = 1;
199pub const OT_DNS_TXT_KEY_MAX_LENGTH: u32 = 9;
200pub const OT_DNS_TXT_KEY_ITER_MAX_LENGTH: u32 = 64;
201pub const OT_BORDER_AGENT_ID_LENGTH: u32 = 16;
202pub const OT_BORDER_AGENT_MESHCOP_SERVICE_TXT_DATA_MAX_LENGTH: u32 = 256;
203pub const OT_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME_MAX_LENGTH: u32 = 47;
204pub const OT_LOG_LEVEL_NONE: u32 = 0;
205pub const OT_LOG_LEVEL_CRIT: u32 = 1;
206pub const OT_LOG_LEVEL_WARN: u32 = 2;
207pub const OT_LOG_LEVEL_NOTE: u32 = 3;
208pub const OT_LOG_LEVEL_INFO: u32 = 4;
209pub const OT_LOG_LEVEL_DEBG: u32 = 5;
210pub const OT_DEFAULT_COAP_PORT: u32 = 5683;
211pub const OT_COAP_DEFAULT_TOKEN_LENGTH: u32 = 2;
212pub const OT_COAP_MAX_TOKEN_LENGTH: u32 = 8;
213pub const OT_COAP_MAX_RETRANSMIT: u32 = 20;
214pub const OT_COAP_MIN_ACK_TIMEOUT: u32 = 1000;
215pub const OT_DEFAULT_COAP_SECURE_PORT: u32 = 5684;
216pub const OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE: u32 = 65535;
217pub const OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL: u32 = 60000000;
218pub const OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE: u32 = 0;
219pub const OT_NETWORK_KEY_SIZE: u32 = 16;
220pub const OT_NETWORK_NAME_MAX_SIZE: u32 = 16;
221pub const OT_EXT_PAN_ID_SIZE: u32 = 8;
222pub const OT_MESH_LOCAL_PREFIX_SIZE: u32 = 8;
223pub const OT_PSKC_MAX_SIZE: u32 = 16;
224pub const OT_CHANNEL_1_MASK: u32 = 2;
225pub const OT_CHANNEL_2_MASK: u32 = 4;
226pub const OT_CHANNEL_3_MASK: u32 = 8;
227pub const OT_CHANNEL_4_MASK: u32 = 16;
228pub const OT_CHANNEL_5_MASK: u32 = 32;
229pub const OT_CHANNEL_6_MASK: u32 = 64;
230pub const OT_CHANNEL_7_MASK: u32 = 128;
231pub const OT_CHANNEL_8_MASK: u32 = 256;
232pub const OT_CHANNEL_9_MASK: u32 = 512;
233pub const OT_CHANNEL_10_MASK: u32 = 1024;
234pub const OT_CHANNEL_11_MASK: u32 = 2048;
235pub const OT_CHANNEL_12_MASK: u32 = 4096;
236pub const OT_CHANNEL_13_MASK: u32 = 8192;
237pub const OT_CHANNEL_14_MASK: u32 = 16384;
238pub const OT_CHANNEL_15_MASK: u32 = 32768;
239pub const OT_CHANNEL_16_MASK: u32 = 65536;
240pub const OT_CHANNEL_17_MASK: u32 = 131072;
241pub const OT_CHANNEL_18_MASK: u32 = 262144;
242pub const OT_CHANNEL_19_MASK: u32 = 524288;
243pub const OT_CHANNEL_20_MASK: u32 = 1048576;
244pub const OT_CHANNEL_21_MASK: u32 = 2097152;
245pub const OT_CHANNEL_22_MASK: u32 = 4194304;
246pub const OT_CHANNEL_23_MASK: u32 = 8388608;
247pub const OT_CHANNEL_24_MASK: u32 = 16777216;
248pub const OT_CHANNEL_25_MASK: u32 = 33554432;
249pub const OT_CHANNEL_26_MASK: u32 = 67108864;
250pub const OT_OPERATIONAL_DATASET_MAX_LENGTH: u32 = 254;
251pub const OT_MAC_FILTER_FIXED_RSS_DISABLED: u32 = 127;
252pub const OT_MAC_FILTER_ITERATOR_INIT: u32 = 0;
253pub const OT_LINK_CSL_PERIOD_TEN_SYMBOLS_UNIT_IN_USEC: u32 = 160;
254pub const OT_THREAD_VERSION_INVALID: u32 = 0;
255pub const OT_THREAD_VERSION_1_1: u32 = 2;
256pub const OT_THREAD_VERSION_1_2: u32 = 3;
257pub const OT_THREAD_VERSION_1_3: u32 = 4;
258pub const OT_THREAD_VERSION_1_3_1: u32 = 5;
259pub const OT_THREAD_VERSION_1_4: u32 = 5;
260pub const OT_NETWORK_BASE_TLV_MAX_LENGTH: u32 = 254;
261pub const OT_NETWORK_MAX_ROUTER_ID: u32 = 62;
262pub const OT_NEIGHBOR_INFO_ITERATOR_INIT: u32 = 0;
263pub const OT_JOINER_ADVDATA_MAX_LENGTH: u32 = 64;
264pub const OT_DURATION_STRING_SIZE: u32 = 21;
265pub const OT_HISTORY_TRACKER_MAX_AGE: u32 = 4233600000;
266pub const OT_HISTORY_TRACKER_ENTRY_AGE_STRING_SIZE: u32 = 21;
267pub const OT_HISTORY_TRACKER_NO_NEXT_HOP: u32 = 63;
268pub const OT_HISTORY_TRACKER_INFINITE_PATH_COST: u32 = 0;
269pub const OT_ICMP6_HEADER_DATA_SIZE: u32 = 4;
270pub const OT_ICMP6_ROUTER_ADVERT_MIN_SIZE: u32 = 16;
271pub const OT_LOG_HEX_DUMP_LINE_SIZE: u32 = 73;
272pub const OT_IP4_ADDRESS_SIZE: u32 = 4;
273pub const OT_IP4_ADDRESS_STRING_SIZE: u32 = 17;
274pub const OT_IP4_CIDR_STRING_SIZE: u32 = 20;
275pub const OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS: u32 = 0;
276pub const OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS: u32 = 1;
277pub const OT_NETWORK_DIAGNOSTIC_TLV_MODE: u32 = 2;
278pub const OT_NETWORK_DIAGNOSTIC_TLV_TIMEOUT: u32 = 3;
279pub const OT_NETWORK_DIAGNOSTIC_TLV_CONNECTIVITY: u32 = 4;
280pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTE: u32 = 5;
281pub const OT_NETWORK_DIAGNOSTIC_TLV_LEADER_DATA: u32 = 6;
282pub const OT_NETWORK_DIAGNOSTIC_TLV_NETWORK_DATA: u32 = 7;
283pub const OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST: u32 = 8;
284pub const OT_NETWORK_DIAGNOSTIC_TLV_MAC_COUNTERS: u32 = 9;
285pub const OT_NETWORK_DIAGNOSTIC_TLV_BATTERY_LEVEL: u32 = 14;
286pub const OT_NETWORK_DIAGNOSTIC_TLV_SUPPLY_VOLTAGE: u32 = 15;
287pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE: u32 = 16;
288pub const OT_NETWORK_DIAGNOSTIC_TLV_CHANNEL_PAGES: u32 = 17;
289pub const OT_NETWORK_DIAGNOSTIC_TLV_TYPE_LIST: u32 = 18;
290pub const OT_NETWORK_DIAGNOSTIC_TLV_MAX_CHILD_TIMEOUT: u32 = 19;
291pub const OT_NETWORK_DIAGNOSTIC_TLV_EUI64: u32 = 23;
292pub const OT_NETWORK_DIAGNOSTIC_TLV_VERSION: u32 = 24;
293pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_NAME: u32 = 25;
294pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_MODEL: u32 = 26;
295pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_SW_VERSION: u32 = 27;
296pub const OT_NETWORK_DIAGNOSTIC_TLV_THREAD_STACK_VERSION: u32 = 28;
297pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD: u32 = 29;
298pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_IP6_ADDR_LIST: u32 = 30;
299pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTER_NEIGHBOR: u32 = 31;
300pub const OT_NETWORK_DIAGNOSTIC_TLV_ANSWER: u32 = 32;
301pub const OT_NETWORK_DIAGNOSTIC_TLV_QUERY_ID: u32 = 33;
302pub const OT_NETWORK_DIAGNOSTIC_TLV_MLE_COUNTERS: u32 = 34;
303pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_APP_URL: u32 = 35;
304pub const OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS: u32 = 36;
305pub const OT_NETWORK_DIAGNOSTIC_TLV_ENHANCED_ROUTE: u32 = 37;
306pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_STATE: u32 = 38;
307pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_IF_ADDRS: u32 = 39;
308pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_LOCAL_OMR_PREFIX: u32 = 40;
309pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_DHCP6_PD_OMR_PREFIX: u32 = 41;
310pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_LOCAL_OL_PREFIX: u32 = 42;
311pub const OT_NETWORK_DIAGNOSTIC_TLV_BR_FAVORED_OL_PREFIX: u32 = 43;
312pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH: u32 = 32;
313pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH: u32 = 32;
314pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH: u32 = 16;
315pub const OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH: u32 = 64;
316pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH: u32 = 96;
317pub const OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT: u32 = 0;
318pub const OT_TIME_SYNC_INVALID_SEQ: u32 = 0;
319pub const OT_PLAT_INFRA_IF_MAX_LINK_LAYER_ADDR_LENGTH: u32 = 16;
320pub const OT_MS_PER_S: u32 = 1000;
321pub const OT_US_PER_MS: u32 = 1000;
322pub const OT_US_PER_S: u32 = 1000000;
323pub const OT_NS_PER_US: u32 = 1000;
324pub const OT_SNTP_DEFAULT_SERVER_IP: &[u8; 19] = b"2001:4860:4806:8::\0";
325pub const OT_SNTP_DEFAULT_SERVER_PORT: u32 = 123;
326pub const OT_TCP_ENDPOINT_TCB_SIZE_BASE: u32 = 392;
327pub const OT_TCP_ENDPOINT_TCB_NUM_PTR: u32 = 36;
328pub const OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS: u32 = 2598;
329pub const OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS: u32 = 4157;
330pub const OT_TCP_LISTENER_TCB_SIZE_BASE: u32 = 16;
331pub const OT_TCP_LISTENER_TCB_NUM_PTR: u32 = 3;
332pub const OT_CHILD_IP6_ADDRESS_ITERATOR_INIT: u32 = 0;
333pub const OT_VERHOEFF_CHECKSUM_MAX_STRING_LENGTH: u32 = 128;
334#[doc = " No error."]
335pub const OT_ERROR_NONE: otError = 0;
336#[doc = " Operational failed."]
337pub const OT_ERROR_FAILED: otError = 1;
338#[doc = " Message was dropped."]
339pub const OT_ERROR_DROP: otError = 2;
340#[doc = " Insufficient buffers."]
341pub const OT_ERROR_NO_BUFS: otError = 3;
342#[doc = " No route available."]
343pub const OT_ERROR_NO_ROUTE: otError = 4;
344#[doc = " Service is busy and could not service the operation."]
345pub const OT_ERROR_BUSY: otError = 5;
346#[doc = " Failed to parse message."]
347pub const OT_ERROR_PARSE: otError = 6;
348#[doc = " Input arguments are invalid."]
349pub const OT_ERROR_INVALID_ARGS: otError = 7;
350#[doc = " Security checks failed."]
351pub const OT_ERROR_SECURITY: otError = 8;
352#[doc = " Address resolution requires an address query operation."]
353pub const OT_ERROR_ADDRESS_QUERY: otError = 9;
354#[doc = " Address is not in the source match table."]
355pub const OT_ERROR_NO_ADDRESS: otError = 10;
356#[doc = " Operation was aborted."]
357pub const OT_ERROR_ABORT: otError = 11;
358#[doc = " Function or method is not implemented."]
359pub const OT_ERROR_NOT_IMPLEMENTED: otError = 12;
360#[doc = " Cannot complete due to invalid state."]
361pub const OT_ERROR_INVALID_STATE: otError = 13;
362#[doc = " No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006)."]
363pub const OT_ERROR_NO_ACK: otError = 14;
364#[doc = " A transmission could not take place due to activity on the channel, i.e., the CSMA-CA mechanism has failed\n (IEEE 802.15.4-2006)."]
365pub const OT_ERROR_CHANNEL_ACCESS_FAILURE: otError = 15;
366#[doc = " Not currently attached to a Thread Partition."]
367pub const OT_ERROR_DETACHED: otError = 16;
368#[doc = " FCS check failure while receiving."]
369pub const OT_ERROR_FCS: otError = 17;
370#[doc = " No frame received."]
371pub const OT_ERROR_NO_FRAME_RECEIVED: otError = 18;
372#[doc = " Received a frame from an unknown neighbor."]
373pub const OT_ERROR_UNKNOWN_NEIGHBOR: otError = 19;
374#[doc = " Received a frame from an invalid source address."]
375pub const OT_ERROR_INVALID_SOURCE_ADDRESS: otError = 20;
376#[doc = " Received a frame filtered by the address filter (allowlisted or denylisted)."]
377pub const OT_ERROR_ADDRESS_FILTERED: otError = 21;
378#[doc = " Received a frame filtered by the destination address check."]
379pub const OT_ERROR_DESTINATION_ADDRESS_FILTERED: otError = 22;
380#[doc = " The requested item could not be found."]
381pub const OT_ERROR_NOT_FOUND: otError = 23;
382#[doc = " The operation is already in progress."]
383pub const OT_ERROR_ALREADY: otError = 24;
384#[doc = " The creation of IPv6 address failed."]
385pub const OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: otError = 26;
386#[doc = " Operation prevented by mode flags"]
387pub const OT_ERROR_NOT_CAPABLE: otError = 27;
388#[doc = " Coap response or acknowledgment or DNS, SNTP response not received."]
389pub const OT_ERROR_RESPONSE_TIMEOUT: otError = 28;
390#[doc = " Received a duplicated frame."]
391pub const OT_ERROR_DUPLICATED: otError = 29;
392#[doc = " Message is being dropped from reassembly list due to timeout."]
393pub const OT_ERROR_REASSEMBLY_TIMEOUT: otError = 30;
394#[doc = " Message is not a TMF Message."]
395pub const OT_ERROR_NOT_TMF: otError = 31;
396#[doc = " Received a non-lowpan data frame."]
397pub const OT_ERROR_NOT_LOWPAN_DATA_FRAME: otError = 32;
398#[doc = " The link margin was too low."]
399pub const OT_ERROR_LINK_MARGIN_LOW: otError = 34;
400#[doc = " Input (CLI) command is invalid."]
401pub const OT_ERROR_INVALID_COMMAND: otError = 35;
402#[doc = " Special error code used to indicate success/error status is pending and not yet known."]
403pub const OT_ERROR_PENDING: otError = 36;
404#[doc = " Request rejected."]
405pub const OT_ERROR_REJECTED: otError = 37;
406#[doc = " The number of defined errors."]
407pub const OT_NUM_ERRORS: otError = 38;
408#[doc = " Generic error (should not use)."]
409pub const OT_ERROR_GENERIC: otError = 255;
410#[doc = " Represents error codes used throughout OpenThread."]
411pub type otError = ::std::os::raw::c_uint;
412unsafe extern "C" {
413 #[doc = " Converts an otError enum into a string.\n\n @param[in] aError An otError enum.\n\n @returns A string representation of an otError."]
414 pub fn otThreadErrorToString(aError: otError) -> *const ::std::os::raw::c_char;
415}
416#[repr(C)]
417#[derive(Debug, Default, Copy, Clone)]
418pub struct otInstance {
419 _unused: [u8; 0],
420}
421unsafe extern "C" {
422 #[doc = " Initializes the OpenThread library.\n\n Initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be\n called before any other calls to OpenThread.\n\n Is available and can only be used when support for multiple OpenThread instances is enabled.\n\n @param[in] aInstanceBuffer The buffer for OpenThread to use for allocating the otInstance structure.\n @param[in,out] aInstanceBufferSize On input, the size of aInstanceBuffer. On output, if not enough space for\n otInstance, the number of bytes required for otInstance.\n\n @returns A pointer to the new OpenThread instance.\n\n @sa otInstanceFinalize"]
423 pub fn otInstanceInit(
424 aInstanceBuffer: *mut ::std::os::raw::c_void,
425 aInstanceBufferSize: *mut usize,
426 ) -> *mut otInstance;
427}
428unsafe extern "C" {
429 #[doc = " Initializes the static single instance of the OpenThread library.\n\n Initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be\n called before any other calls to OpenThread.\n\n Is available and can only be used when support for multiple OpenThread instances is disabled.\n\n @returns A pointer to the single OpenThread instance."]
430 pub fn otInstanceInitSingle() -> *mut otInstance;
431}
432unsafe extern "C" {
433 #[doc = " Gets the pointer to the single OpenThread instance when multiple instances are not in use.\n\n Is available and can only be used when support for multiple OpenThread instances is disabled.\n\n @returns A pointer to the single OpenThread instance."]
434 pub fn otInstanceGetSingle() -> *mut otInstance;
435}
436unsafe extern "C" {
437 #[doc = " Initializes the OpenThread instance.\n\n This function initializes OpenThread and prepares it for subsequent OpenThread API calls. This function must be\n called before any other calls to OpenThread. This method utilizes static buffer to initialize the OpenThread\n instance.\n\n This function is available and can only be used when support for multiple OpenThread static instances is\n enabled (`OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE`)\n\n @param[in] aIdx The index of the OpenThread instance to initialize.\n\n @returns A pointer to the new OpenThread instance."]
438 pub fn otInstanceInitMultiple(aIdx: u8) -> *mut otInstance;
439}
440unsafe extern "C" {
441 #[doc = " Gets the pointer to an OpenThread instance with the provided index when multiple instances are in use.\n\n This function is available when both `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` and\n `OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE` are enabled.\n\n @param[in] aIdx The index of the OpenThread instance.\n\n @returns A pointer to the corresponding OpenThread instance, or `NULL` if @p aIdx is out of bounds."]
442 pub fn otInstanceGetInstance(aIdx: u8) -> *mut otInstance;
443}
444unsafe extern "C" {
445 #[doc = " Gets the index of the OpenThread instance when multiple instance is in use.\n\n This function is available when both `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` and\n `OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE` are enabled.\n\n @param[in] aInstance The reference of the OpenThread instance to get index.\n\n @returns The index of the OpenThread instance."]
446 pub fn otInstanceGetIndex(aInstance: *mut otInstance) -> u8;
447}
448unsafe extern "C" {
449 #[doc = " Gets the instance identifier.\n\n The instance identifier is set to a random value when the instance is constructed, and then its value will not\n change after initialization.\n\n @returns The instance identifier."]
450 pub fn otInstanceGetId(aInstance: *mut otInstance) -> u32;
451}
452unsafe extern "C" {
453 #[doc = " Indicates whether or not the instance is valid/initialized.\n\n The instance is considered valid if it is acquired and initialized using either `otInstanceInitSingle()` (in single\n instance case) or `otInstanceInit()` (in multi instance case). A subsequent call to `otInstanceFinalize()` causes\n the instance to be considered as uninitialized.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if the given instance is valid/initialized, FALSE otherwise."]
454 pub fn otInstanceIsInitialized(aInstance: *mut otInstance) -> bool;
455}
456unsafe extern "C" {
457 #[doc = " Disables the OpenThread library.\n\n Call this function when OpenThread is no longer in use.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
458 pub fn otInstanceFinalize(aInstance: *mut otInstance);
459}
460unsafe extern "C" {
461 #[doc = " Returns the current instance uptime (in msec).\n\n Requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.\n\n The uptime is given as number of milliseconds since OpenThread instance was initialized.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The uptime (number of milliseconds)."]
462 pub fn otInstanceGetUptime(aInstance: *mut otInstance) -> u64;
463}
464unsafe extern "C" {
465 #[doc = " Returns the current instance uptime as a human-readable string.\n\n Requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.\n\n The string follows the format \"<hh>:<mm>:<ss>.<mmmm>\" for hours, minutes, seconds and millisecond (if uptime is\n shorter than one day) or \"<dd>d.<hh>:<mm>:<ss>.<mmmm>\" (if longer than a day).\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aBuffer A pointer to a char array to output the string.\n @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_UPTIME_STRING_SIZE`."]
466 pub fn otInstanceGetUptimeAsString(
467 aInstance: *mut otInstance,
468 aBuffer: *mut ::std::os::raw::c_char,
469 aSize: u16,
470 );
471}
472#[doc = " Represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*`\n definitions."]
473pub type otChangedFlags = u32;
474#[doc = " Pointer is called to notify certain configuration or state changes within OpenThread.\n\n @param[in] aFlags A bit-field indicating specific state that has changed. See `OT_CHANGED_*` definitions.\n @param[in] aContext A pointer to application-specific context."]
475pub type otStateChangedCallback = ::std::option::Option<
476 unsafe extern "C" fn(aFlags: otChangedFlags, aContext: *mut ::std::os::raw::c_void),
477>;
478unsafe extern "C" {
479 #[doc = " Registers a callback to indicate when certain configuration or state changes within OpenThread.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called with certain configuration or state changes.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Added the callback to the list of callbacks.\n @retval OT_ERROR_ALREADY The callback was already registered.\n @retval OT_ERROR_NO_BUFS Could not add the callback due to resource constraints."]
480 pub fn otSetStateChangedCallback(
481 aInstance: *mut otInstance,
482 aCallback: otStateChangedCallback,
483 aContext: *mut ::std::os::raw::c_void,
484 ) -> otError;
485}
486unsafe extern "C" {
487 #[doc = " Removes a callback to indicate when certain configuration or state changes within OpenThread.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called with certain configuration or state changes.\n @param[in] aContext A pointer to application-specific context."]
488 pub fn otRemoveStateChangeCallback(
489 aInstance: *mut otInstance,
490 aCallback: otStateChangedCallback,
491 aContext: *mut ::std::os::raw::c_void,
492 );
493}
494unsafe extern "C" {
495 #[doc = " Triggers a platform reset.\n\n The reset process ensures that all the OpenThread state/info (stored in volatile memory) is erased. Note that the\n `otPlatformReset` does not erase any persistent state/info saved in non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
496 pub fn otInstanceReset(aInstance: *mut otInstance);
497}
498unsafe extern "C" {
499 #[doc = " Triggers a platform reset to bootloader mode, if supported.\n\n Requires `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Reset to bootloader successfully.\n @retval OT_ERROR_BUSY Failed due to another operation is ongoing.\n @retval OT_ERROR_NOT_CAPABLE Not capable of resetting to bootloader."]
500 pub fn otInstanceResetToBootloader(aInstance: *mut otInstance) -> otError;
501}
502unsafe extern "C" {
503 #[doc = " Deletes all the settings stored on non-volatile memory, and then triggers a platform reset.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
504 pub fn otInstanceFactoryReset(aInstance: *mut otInstance);
505}
506unsafe extern "C" {
507 #[doc = " Resets the internal states of the OpenThread radio stack.\n\n Callbacks and configurations are preserved.\n\n This API is only available under radio builds (`OPENTHREAD_RADIO = 1`).\n\n @param[in] aInstance A pointer to an OpenThread instance."]
508 pub fn otInstanceResetRadioStack(aInstance: *mut otInstance);
509}
510unsafe extern "C" {
511 #[doc = " Erases all the OpenThread persistent info (network settings) stored on non-volatile memory.\n Erase is successful only if the device is in `disabled` state/role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE All persistent info/state was erased successfully.\n @retval OT_ERROR_INVALID_STATE Device is not in `disabled` state/role."]
512 pub fn otInstanceErasePersistentInfo(aInstance: *mut otInstance) -> otError;
513}
514unsafe extern "C" {
515 #[doc = " Gets the OpenThread version string.\n\n @returns A pointer to the OpenThread version."]
516 pub fn otGetVersionString() -> *const ::std::os::raw::c_char;
517}
518unsafe extern "C" {
519 #[doc = " Gets the OpenThread radio version string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the OpenThread radio version."]
520 pub fn otGetRadioVersionString(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
521}
522#[doc = " Represents Backbone Router configuration."]
523#[repr(C)]
524#[derive(Debug, Default, Copy, Clone)]
525pub struct otBackboneRouterConfig {
526 #[doc = "< Only used when get Primary Backbone Router information in the Thread Network"]
527 pub mServer16: u16,
528 #[doc = "< Reregistration Delay (in seconds)"]
529 pub mReregistrationDelay: u16,
530 #[doc = "< Multicast Listener Registration Timeout (in seconds)"]
531 pub mMlrTimeout: u32,
532 #[doc = "< Sequence Number"]
533 pub mSequenceNumber: u8,
534}
535unsafe extern "C" {
536 #[doc = " Gets the Primary Backbone Router information in the Thread Network.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aConfig A pointer to where to put Primary Backbone Router information.\n\n @retval OT_ERROR_NONE Successfully got Primary Backbone Router information.\n @retval OT_ERROR_NOT_FOUND No Primary Backbone Router exists."]
537 pub fn otBackboneRouterGetPrimary(
538 aInstance: *mut otInstance,
539 aConfig: *mut otBackboneRouterConfig,
540 ) -> otError;
541}
542#[repr(C)]
543#[derive(Debug, Default, Copy, Clone)]
544pub struct otMessage {
545 _unused: [u8; 0],
546}
547#[doc = "< Low priority level."]
548pub const OT_MESSAGE_PRIORITY_LOW: otMessagePriority = 0;
549#[doc = "< Normal priority level."]
550pub const OT_MESSAGE_PRIORITY_NORMAL: otMessagePriority = 1;
551#[doc = "< High priority level."]
552pub const OT_MESSAGE_PRIORITY_HIGH: otMessagePriority = 2;
553#[doc = " Defines the OpenThread message priority levels."]
554pub type otMessagePriority = ::std::os::raw::c_uint;
555#[doc = "< Message from Thread Netif."]
556pub const OT_MESSAGE_ORIGIN_THREAD_NETIF: otMessageOrigin = 0;
557#[doc = "< Message from a trusted source on host."]
558pub const OT_MESSAGE_ORIGIN_HOST_TRUSTED: otMessageOrigin = 1;
559#[doc = "< Message from an untrusted source on host."]
560pub const OT_MESSAGE_ORIGIN_HOST_UNTRUSTED: otMessageOrigin = 2;
561#[doc = " Defines the OpenThread message origins."]
562pub type otMessageOrigin = ::std::os::raw::c_uint;
563#[doc = " Represents a message settings."]
564#[repr(C)]
565#[derive(Debug, Default, Copy, Clone)]
566pub struct otMessageSettings {
567 #[doc = "< TRUE if the message should be secured at Layer 2."]
568 pub mLinkSecurityEnabled: bool,
569 #[doc = "< Priority level (MUST be a `OT_MESSAGE_PRIORITY_*` from `otMessagePriority`)."]
570 pub mPriority: u8,
571}
572#[doc = " Represents link-specific information for messages received from the Thread radio."]
573#[repr(C)]
574#[derive(Debug, Default, Copy, Clone)]
575pub struct otThreadLinkInfo {
576 #[doc = "< Source PAN ID"]
577 pub mPanId: u16,
578 #[doc = "< 802.15.4 Channel"]
579 pub mChannel: u8,
580 #[doc = "< Received Signal Strength in dBm (averaged over fragments)"]
581 pub mRss: i8,
582 #[doc = "< Average Link Quality Indicator (averaged over fragments)"]
583 pub mLqi: u8,
584 pub _bitfield_align_1: [u8; 0],
585 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
586 #[doc = "< The time sync sequence."]
587 pub mTimeSyncSeq: u8,
588 #[doc = "< The time offset to the Thread network time, in microseconds."]
589 pub mNetworkTimeOffset: i64,
590 #[doc = "< Radio link type."]
591 pub mRadioType: u8,
592}
593impl otThreadLinkInfo {
594 #[inline]
595 pub fn mLinkSecurity(&self) -> bool {
596 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
597 }
598 #[inline]
599 pub fn set_mLinkSecurity(&mut self, val: bool) {
600 unsafe {
601 let val: u8 = ::std::mem::transmute(val);
602 self._bitfield_1.set(0usize, 1u8, val as u64)
603 }
604 }
605 #[inline]
606 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
607 unsafe {
608 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
609 ::std::ptr::addr_of!((*this)._bitfield_1),
610 0usize,
611 1u8,
612 ) as u8)
613 }
614 }
615 #[inline]
616 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
617 unsafe {
618 let val: u8 = ::std::mem::transmute(val);
619 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
620 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
621 0usize,
622 1u8,
623 val as u64,
624 )
625 }
626 }
627 #[inline]
628 pub fn mIsDstPanIdBroadcast(&self) -> bool {
629 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
630 }
631 #[inline]
632 pub fn set_mIsDstPanIdBroadcast(&mut self, val: bool) {
633 unsafe {
634 let val: u8 = ::std::mem::transmute(val);
635 self._bitfield_1.set(1usize, 1u8, val as u64)
636 }
637 }
638 #[inline]
639 pub unsafe fn mIsDstPanIdBroadcast_raw(this: *const Self) -> bool {
640 unsafe {
641 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
642 ::std::ptr::addr_of!((*this)._bitfield_1),
643 1usize,
644 1u8,
645 ) as u8)
646 }
647 }
648 #[inline]
649 pub unsafe fn set_mIsDstPanIdBroadcast_raw(this: *mut Self, val: bool) {
650 unsafe {
651 let val: u8 = ::std::mem::transmute(val);
652 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
653 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
654 1usize,
655 1u8,
656 val as u64,
657 )
658 }
659 }
660 #[inline]
661 pub fn new_bitfield_1(
662 mLinkSecurity: bool,
663 mIsDstPanIdBroadcast: bool,
664 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
665 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
666 __bindgen_bitfield_unit.set(0usize, 1u8, {
667 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
668 mLinkSecurity as u64
669 });
670 __bindgen_bitfield_unit.set(1usize, 1u8, {
671 let mIsDstPanIdBroadcast: u8 = unsafe { ::std::mem::transmute(mIsDstPanIdBroadcast) };
672 mIsDstPanIdBroadcast as u64
673 });
674 __bindgen_bitfield_unit
675 }
676}
677unsafe extern "C" {
678 #[doc = " Gets the `otInstance` associated with a given message.\n\n @param[in] aMessage A message.\n\n @returns The `otInstance` associated with @p aMessage."]
679 pub fn otMessageGetInstance(aMessage: *const otMessage) -> *mut otInstance;
680}
681unsafe extern "C" {
682 #[doc = " Free an allocated message buffer.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageRead\n @sa otMessageWrite"]
683 pub fn otMessageFree(aMessage: *mut otMessage);
684}
685unsafe extern "C" {
686 #[doc = " Get the message length in bytes.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message length in bytes.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageRead\n @sa otMessageWrite\n @sa otMessageSetLength"]
687 pub fn otMessageGetLength(aMessage: *const otMessage) -> u16;
688}
689unsafe extern "C" {
690 #[doc = " Set the message length in bytes.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aLength A length in bytes.\n\n @retval OT_ERROR_NONE Successfully set the message length.\n @retval OT_ERROR_NO_BUFS No available buffers to grow the message.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageRead\n @sa otMessageWrite"]
691 pub fn otMessageSetLength(aMessage: *mut otMessage, aLength: u16) -> otError;
692}
693unsafe extern "C" {
694 #[doc = " Get the message offset in bytes.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message offset value.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageSetOffset\n @sa otMessageRead\n @sa otMessageWrite"]
695 pub fn otMessageGetOffset(aMessage: *const otMessage) -> u16;
696}
697unsafe extern "C" {
698 #[doc = " Set the message offset in bytes.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOffset An offset in bytes.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageRead\n @sa otMessageWrite"]
699 pub fn otMessageSetOffset(aMessage: *mut otMessage, aOffset: u16);
700}
701unsafe extern "C" {
702 #[doc = " Indicates whether or not link security is enabled for the message.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @retval TRUE If link security is enabled.\n @retval FALSE If link security is not enabled."]
703 pub fn otMessageIsLinkSecurityEnabled(aMessage: *const otMessage) -> bool;
704}
705unsafe extern "C" {
706 #[doc = " Indicates whether or not the message is allowed to be looped back to host.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @retval TRUE If the message is allowed to be looped back to host.\n @retval FALSE If the message is not allowed to be looped back to host."]
707 pub fn otMessageIsLoopbackToHostAllowed(aMessage: *const otMessage) -> bool;
708}
709unsafe extern "C" {
710 #[doc = " Sets whether or not the message is allowed to be looped back to host.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aAllowLoopbackToHost Whether to allow the message to be looped back to host."]
711 pub fn otMessageSetLoopbackToHostAllowed(aMessage: *mut otMessage, aAllowLoopbackToHost: bool);
712}
713unsafe extern "C" {
714 #[doc = " Indicates whether the given message may be looped back in a case of a multicast destination address.\n\n If @p aMessage is used along with an `otMessageInfo`, the `mMulticastLoop` field from `otMessageInfo` structure\n takes precedence and will be used instead of the the value set on @p aMessage.\n\n This API is mainly intended for use along with `otIp6Send()` which expects an already prepared IPv6 message.\n\n @param[in] aMessage A pointer to the message."]
715 pub fn otMessageIsMulticastLoopEnabled(aMessage: *mut otMessage) -> bool;
716}
717unsafe extern "C" {
718 #[doc = " Controls whether the given message may be looped back in a case of a multicast destination address.\n\n @param[in] aMessage A pointer to the message.\n @param[in] aEnabled The configuration value."]
719 pub fn otMessageSetMulticastLoopEnabled(aMessage: *mut otMessage, aEnabled: bool);
720}
721unsafe extern "C" {
722 #[doc = " Gets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message origin."]
723 pub fn otMessageGetOrigin(aMessage: *const otMessage) -> otMessageOrigin;
724}
725unsafe extern "C" {
726 #[doc = " Sets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOrigin The message origin."]
727 pub fn otMessageSetOrigin(aMessage: *mut otMessage, aOrigin: otMessageOrigin);
728}
729unsafe extern "C" {
730 #[doc = " Sets/forces the message to be forwarded using direct transmission.\n Default setting for a new message is `false`.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aEnabled If `true`, the message is forced to use direct transmission. If `false`, the message follows\n the normal procedure."]
731 pub fn otMessageSetDirectTransmission(aMessage: *mut otMessage, aEnabled: bool);
732}
733unsafe extern "C" {
734 #[doc = " Returns the average RSS (received signal strength) associated with the message.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The average RSS value (in dBm) or OT_RADIO_RSSI_INVALID if no average RSS is available."]
735 pub fn otMessageGetRss(aMessage: *const otMessage) -> i8;
736}
737unsafe extern "C" {
738 #[doc = " Retrieves the link-specific information for a message received over Thread radio.\n\n @param[in] aMessage The message from which to retrieve `otThreadLinkInfo`.\n @pram[out] aLinkInfo A pointer to an `otThreadLinkInfo` to populate.\n\n @retval OT_ERROR_NONE Successfully retrieved the link info, @p `aLinkInfo` is updated.\n @retval OT_ERROR_NOT_FOUND Message origin is not `OT_MESSAGE_ORIGIN_THREAD_NETIF`."]
739 pub fn otMessageGetThreadLinkInfo(
740 aMessage: *const otMessage,
741 aLinkInfo: *mut otThreadLinkInfo,
742 ) -> otError;
743}
744#[doc = " Represents the callback function pointer to notify the transmission outcome (success or failure) of a message.\n\n The error indicates the transmission status of the IPv6 message from this device to an immediate neighbor (one-hop\n transmission). It doesn't indicate that the message is received by its final intended destination (multi-hop away).\n\n For a unicast IPv6 message, an `OT_ERROR_NONE` error indicates that the message (all its corresponding fragment\n frames if the message is larger and requires fragmentation) was successfully delivered to the immediate neighbor,\n and a MAC layer acknowledgment was received for all fragments. This is reported regardless of whether the message\n is sent using direct TX or indirect TX (to a sleepy child using CSL or data poll triggered TX).\n\n For a multicast message, an `OT_ERROR_NONE` status indicates that the message (all its fragment frames) was\n successfully broadcast. Note that no MAC-level acknowledgment is required for broadcast frame TX.\n\n The OpenThread stack may alter the content of the message as it is prepared for transmission (e.g., IPv6 headers\n may be prepended, or additional metadata appended at the end). So, the content of @p aMessage when this callback\n is invoked may differ from its original content (e.g., when it was given as input in `otIp6Send()` for transmission).\n\n @param[in] aMessage A pointer to the message.\n @param[in] aError The TX error when sending the message.\n @param[in] aContext A pointer to the user-provided context when the callback was registered."]
745pub type otMessageTxCallback = ::std::option::Option<
746 unsafe extern "C" fn(
747 aMessage: *const otMessage,
748 aError: otError,
749 aContext: *mut ::std::os::raw::c_void,
750 ),
751>;
752unsafe extern "C" {
753 #[doc = " Registers a callback to be notified of a message's transmission outcome.\n\n Calling this function again for the same message will replace any previously registered callback.\n\n If the message is never actually sent (e.g., it's not passed to `otIp6Send()` or other send APIs), the callback\n will still be invoked when the message is freed. In this case, `OT_ERROR_DROP` will be passed as the error.\n\n @param[in] aMessage The message to register the callback with.\n @param[in] aCallback The TX callback.\n @param[in] aContext A pointer to a user-provided arbitrary context for the callback."]
754 pub fn otMessageRegisterTxCallback(
755 aMessage: *mut otMessage,
756 aCallback: otMessageTxCallback,
757 aContext: *mut ::std::os::raw::c_void,
758 );
759}
760unsafe extern "C" {
761 #[doc = " Append bytes to a message.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aBuf A pointer to the data to append.\n @param[in] aLength Number of bytes to append.\n\n @retval OT_ERROR_NONE Successfully appended to the message\n @retval OT_ERROR_NO_BUFS No available buffers to grow the message.\n\n @sa otMessageFree\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageRead\n @sa otMessageWrite"]
762 pub fn otMessageAppend(
763 aMessage: *mut otMessage,
764 aBuf: *const ::std::os::raw::c_void,
765 aLength: u16,
766 ) -> otError;
767}
768unsafe extern "C" {
769 #[doc = " Read bytes from a message.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOffset An offset in bytes.\n @param[in] aBuf A pointer to a buffer that message bytes are read to.\n @param[in] aLength Number of bytes to read.\n\n @returns The number of bytes read.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageWrite"]
770 pub fn otMessageRead(
771 aMessage: *const otMessage,
772 aOffset: u16,
773 aBuf: *mut ::std::os::raw::c_void,
774 aLength: u16,
775 ) -> u16;
776}
777unsafe extern "C" {
778 #[doc = " Write bytes to a message.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOffset An offset in bytes.\n @param[in] aBuf A pointer to a buffer that message bytes are written from.\n @param[in] aLength Number of bytes to write.\n\n @returns The number of bytes written.\n\n @sa otMessageFree\n @sa otMessageAppend\n @sa otMessageGetLength\n @sa otMessageSetLength\n @sa otMessageGetOffset\n @sa otMessageSetOffset\n @sa otMessageRead"]
779 pub fn otMessageWrite(
780 aMessage: *mut otMessage,
781 aOffset: u16,
782 aBuf: *const ::std::os::raw::c_void,
783 aLength: u16,
784 ) -> ::std::os::raw::c_int;
785}
786unsafe extern "C" {
787 #[doc = " Creates a clone of a given message.\n\n The new message is allocated from the same message pool as @p aMessage. The entire message content from @p aMessage\n is copied to the new message.\n\n The caller takes ownership of the returned message and must free it by calling `otMessageFree()` when it is no\n longer needed.\n\n @param[in] aMessage A pointer to the message to clone.\n\n @returns A pointer to the new message clone, or `nullptr` if no message buffers are available."]
788 pub fn otMessageClone(aMessage: *const otMessage) -> *mut otMessage;
789}
790#[doc = " Represents an OpenThread message queue."]
791#[repr(C)]
792#[derive(Debug, Copy, Clone)]
793pub struct otMessageQueue {
794 #[doc = "< Opaque data used by the implementation."]
795 pub mData: *mut ::std::os::raw::c_void,
796 #[doc = "< Opaque data used by the implementation."]
797 pub mData2: *mut ::std::os::raw::c_void,
798}
799impl Default for otMessageQueue {
800 fn default() -> Self {
801 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
802 unsafe {
803 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
804 s.assume_init()
805 }
806 }
807}
808#[doc = " Represents information about a message queue."]
809#[repr(C)]
810#[derive(Debug, Default, Copy, Clone)]
811pub struct otMessageQueueInfo {
812 #[doc = "< Number of messages in the queue."]
813 pub mNumMessages: u16,
814 #[doc = "< Number of data buffers used by messages in the queue."]
815 pub mNumBuffers: u16,
816 #[doc = "< Total number of bytes used by all messages in the queue."]
817 pub mTotalBytes: u32,
818}
819#[doc = " Represents the message buffer information for different queues used by OpenThread stack."]
820#[repr(C)]
821#[derive(Debug, Default, Copy, Clone)]
822pub struct otBufferInfo {
823 #[doc = "< The total number of buffers in the messages pool (0xffff if unknown)."]
824 pub mTotalBuffers: u16,
825 #[doc = "< The number of free buffers (0xffff if unknown)."]
826 pub mFreeBuffers: u16,
827 #[doc = " The maximum number of used buffers at the same time since OT stack initialization or last call to\n `otMessageResetBufferInfo()`."]
828 pub mMaxUsedBuffers: u16,
829 #[doc = "< Info about 6LoWPAN send queue."]
830 pub m6loSendQueue: otMessageQueueInfo,
831 #[doc = "< Info about 6LoWPAN reassembly queue."]
832 pub m6loReassemblyQueue: otMessageQueueInfo,
833 #[doc = "< Info about IPv6 send queue."]
834 pub mIp6Queue: otMessageQueueInfo,
835 #[doc = "< Info about MPL send queue."]
836 pub mMplQueue: otMessageQueueInfo,
837 #[doc = "< Info about MLE delayed message queue."]
838 pub mMleQueue: otMessageQueueInfo,
839 #[doc = "< Info about CoAP/TMF send queue."]
840 pub mCoapQueue: otMessageQueueInfo,
841 #[doc = "< Info about CoAP secure send queue."]
842 pub mCoapSecureQueue: otMessageQueueInfo,
843 #[doc = "< Info about application CoAP send queue."]
844 pub mApplicationCoapQueue: otMessageQueueInfo,
845}
846unsafe extern "C" {
847 #[doc = " Initialize the message queue.\n\n MUST be called once and only once for a `otMessageQueue` instance before any other `otMessageQueue`\n functions. The behavior is undefined if other queue APIs are used with an `otMessageQueue` before it being\n initialized or if it is initialized more than once.\n\n @param[in] aQueue A pointer to a message queue."]
848 pub fn otMessageQueueInit(aQueue: *mut otMessageQueue);
849}
850unsafe extern "C" {
851 #[doc = " Adds a message to the end of the given message queue.\n\n @param[in] aQueue A pointer to the message queue.\n @param[in] aMessage The message to add."]
852 pub fn otMessageQueueEnqueue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
853}
854unsafe extern "C" {
855 #[doc = " Adds a message at the head/front of the given message queue.\n\n @param[in] aQueue A pointer to the message queue.\n @param[in] aMessage The message to add."]
856 pub fn otMessageQueueEnqueueAtHead(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
857}
858unsafe extern "C" {
859 #[doc = " Removes a message from the given message queue.\n\n @param[in] aQueue A pointer to the message queue.\n @param[in] aMessage The message to remove."]
860 pub fn otMessageQueueDequeue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
861}
862unsafe extern "C" {
863 #[doc = " Returns a pointer to the message at the head of the queue.\n\n @param[in] aQueue A pointer to a message queue.\n\n @returns A pointer to the message at the head of queue or NULL if queue is empty."]
864 pub fn otMessageQueueGetHead(aQueue: *mut otMessageQueue) -> *mut otMessage;
865}
866unsafe extern "C" {
867 #[doc = " Returns a pointer to the next message in the queue by iterating forward (from head to tail).\n\n @param[in] aQueue A pointer to a message queue.\n @param[in] aMessage A pointer to current message buffer.\n\n @returns A pointer to the next message in the queue after `aMessage` or NULL if `aMessage is the tail of queue.\n NULL is returned if `aMessage` is not in the queue `aQueue`."]
868 pub fn otMessageQueueGetNext(
869 aQueue: *mut otMessageQueue,
870 aMessage: *const otMessage,
871 ) -> *mut otMessage;
872}
873unsafe extern "C" {
874 #[doc = " Get the Message Buffer information.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aBufferInfo A pointer where the message buffer information is written."]
875 pub fn otMessageGetBufferInfo(aInstance: *mut otInstance, aBufferInfo: *mut otBufferInfo);
876}
877unsafe extern "C" {
878 #[doc = " Reset the Message Buffer information counter tracking the maximum number buffers in use at the same time.\n\n This resets `mMaxUsedBuffers` in `otBufferInfo`.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
879 pub fn otMessageResetBufferInfo(aInstance: *mut otInstance);
880}
881#[doc = "< Key Type: Raw Data."]
882pub const OT_CRYPTO_KEY_TYPE_RAW: otCryptoKeyType = 0;
883#[doc = "< Key Type: AES."]
884pub const OT_CRYPTO_KEY_TYPE_AES: otCryptoKeyType = 1;
885#[doc = "< Key Type: HMAC."]
886pub const OT_CRYPTO_KEY_TYPE_HMAC: otCryptoKeyType = 2;
887#[doc = "< Key Type: ECDSA."]
888pub const OT_CRYPTO_KEY_TYPE_ECDSA: otCryptoKeyType = 3;
889#[doc = "< Key Type: Derive."]
890pub const OT_CRYPTO_KEY_TYPE_DERIVE: otCryptoKeyType = 4;
891#[doc = " Defines the key types."]
892pub type otCryptoKeyType = ::std::os::raw::c_uint;
893#[doc = "< Key Algorithm: Vendor Defined."]
894pub const OT_CRYPTO_KEY_ALG_VENDOR: otCryptoKeyAlgorithm = 0;
895#[doc = "< Key Algorithm: AES ECB."]
896pub const OT_CRYPTO_KEY_ALG_AES_ECB: otCryptoKeyAlgorithm = 1;
897#[doc = "< Key Algorithm: HMAC SHA-256."]
898pub const OT_CRYPTO_KEY_ALG_HMAC_SHA_256: otCryptoKeyAlgorithm = 2;
899#[doc = "< Key Algorithm: ECDSA."]
900pub const OT_CRYPTO_KEY_ALG_ECDSA: otCryptoKeyAlgorithm = 3;
901#[doc = "< Key Algorithm: HKDF SHA-256."]
902pub const OT_CRYPTO_KEY_ALG_HKDF_SHA256: otCryptoKeyAlgorithm = 4;
903#[doc = " Defines the key algorithms."]
904pub type otCryptoKeyAlgorithm = ::std::os::raw::c_uint;
905#[doc = "< Key Usage: Key Usage is empty."]
906pub const OT_CRYPTO_KEY_USAGE_NONE: _bindgen_ty_1 = 0;
907#[doc = "< Key Usage: Key can be exported."]
908pub const OT_CRYPTO_KEY_USAGE_EXPORT: _bindgen_ty_1 = 1;
909#[doc = "< Key Usage: Encryption (vendor defined)."]
910pub const OT_CRYPTO_KEY_USAGE_ENCRYPT: _bindgen_ty_1 = 2;
911#[doc = "< Key Usage: AES ECB."]
912pub const OT_CRYPTO_KEY_USAGE_DECRYPT: _bindgen_ty_1 = 4;
913#[doc = "< Key Usage: Sign Hash."]
914pub const OT_CRYPTO_KEY_USAGE_SIGN_HASH: _bindgen_ty_1 = 8;
915#[doc = "< Key Usage: Verify Hash."]
916pub const OT_CRYPTO_KEY_USAGE_VERIFY_HASH: _bindgen_ty_1 = 16;
917#[doc = "< Key Usage: Derive."]
918pub const OT_CRYPTO_KEY_USAGE_DERIVE: _bindgen_ty_1 = 32;
919#[doc = " Defines the key usage flags."]
920pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
921#[doc = "< Key Persistence: Key is volatile."]
922pub const OT_CRYPTO_KEY_STORAGE_VOLATILE: otCryptoKeyStorage = 0;
923#[doc = "< Key Persistence: Key is persistent."]
924pub const OT_CRYPTO_KEY_STORAGE_PERSISTENT: otCryptoKeyStorage = 1;
925#[doc = " Defines the key storage types."]
926pub type otCryptoKeyStorage = ::std::os::raw::c_uint;
927#[doc = " This datatype represents the key reference."]
928pub type otCryptoKeyRef = u32;
929#[doc = " @struct otCryptoKey\n\n Represents the Key Material required for Crypto operations."]
930#[repr(C)]
931#[derive(Debug, Copy, Clone)]
932pub struct otCryptoKey {
933 #[doc = "< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`."]
934 pub mKey: *const u8,
935 #[doc = "< The key length in bytes (applicable when `mKey` is not NULL)."]
936 pub mKeyLength: u16,
937 #[doc = "< The PSA key ref (requires `mKey` to be NULL)."]
938 pub mKeyRef: u32,
939}
940impl Default for otCryptoKey {
941 fn default() -> Self {
942 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
943 unsafe {
944 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
945 s.assume_init()
946 }
947 }
948}
949#[doc = " @struct otCryptoContext\n\n Stores the context object for platform APIs."]
950#[repr(C)]
951#[derive(Debug, Copy, Clone)]
952pub struct otCryptoContext {
953 #[doc = "< Pointer to the context."]
954 pub mContext: *mut ::std::os::raw::c_void,
955 #[doc = "< The length of the context in bytes."]
956 pub mContextSize: u16,
957}
958impl Default for otCryptoContext {
959 fn default() -> Self {
960 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
961 unsafe {
962 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
963 s.assume_init()
964 }
965 }
966}
967#[doc = " @struct otPlatCryptoSha256Hash\n\n Represents a SHA-256 hash."]
968#[repr(C, packed)]
969#[derive(Debug, Default, Copy, Clone)]
970pub struct otPlatCryptoSha256Hash {
971 #[doc = "< Hash bytes."]
972 pub m8: [u8; 32usize],
973}
974#[doc = " @struct otPlatCryptoEcdsaKeyPair\n\n Represents an ECDSA key pair (public and private keys).\n\n The key pair is stored using Distinguished Encoding Rules (DER) format (per RFC 5915)."]
975#[repr(C)]
976#[derive(Debug, Copy, Clone)]
977pub struct otPlatCryptoEcdsaKeyPair {
978 pub mDerBytes: [u8; 125usize],
979 pub mDerLength: u8,
980}
981impl Default for otPlatCryptoEcdsaKeyPair {
982 fn default() -> Self {
983 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
984 unsafe {
985 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
986 s.assume_init()
987 }
988 }
989}
990#[doc = " @struct otPlatCryptoEcdsaPublicKey\n\n Represents a ECDSA public key.\n\n The public key is stored as a byte sequence representation of an uncompressed curve point (RFC 6605 - sec 4)."]
991#[repr(C, packed)]
992#[derive(Debug, Copy, Clone)]
993pub struct otPlatCryptoEcdsaPublicKey {
994 pub m8: [u8; 64usize],
995}
996impl Default for otPlatCryptoEcdsaPublicKey {
997 fn default() -> Self {
998 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
999 unsafe {
1000 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1001 s.assume_init()
1002 }
1003 }
1004}
1005#[doc = " @struct otPlatCryptoEcdsaSignature\n\n Represents an ECDSA signature.\n\n The signature is encoded as the concatenated binary representation of two MPIs `r` and `s` which are calculated\n during signing (RFC 6605 - section 4)."]
1006#[repr(C, packed)]
1007#[derive(Debug, Copy, Clone)]
1008pub struct otPlatCryptoEcdsaSignature {
1009 pub m8: [u8; 64usize],
1010}
1011impl Default for otPlatCryptoEcdsaSignature {
1012 fn default() -> Self {
1013 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1014 unsafe {
1015 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1016 s.assume_init()
1017 }
1018 }
1019}
1020unsafe extern "C" {
1021 #[doc = " Initialize the Crypto module."]
1022 pub fn otPlatCryptoInit();
1023}
1024unsafe extern "C" {
1025 #[doc = " Import a key into PSA ITS.\n\n @param[in,out] aKeyRef Pointer to the key ref to be used for crypto operations.\n @param[in] aKeyType Key Type encoding for the key.\n @param[in] aKeyAlgorithm Key algorithm encoding for the key.\n @param[in] aKeyUsage Key Usage encoding for the key (combinations of `OT_CRYPTO_KEY_USAGE_*`).\n @param[in] aKeyPersistence Key Persistence for this key\n @param[in] aKey Actual key to be imported.\n @param[in] aKeyLen Length of the key to be imported.\n\n @retval OT_ERROR_NONE Successfully imported the key.\n @retval OT_ERROR_FAILED Failed to import the key.\n @retval OT_ERROR_INVALID_ARGS @p aKey was set to NULL.\n\n @note If OT_CRYPTO_KEY_STORAGE_PERSISTENT is passed for aKeyPersistence then @p aKeyRef is input and platform\n should use the given aKeyRef and MUST not change it.\n\n If OT_CRYPTO_KEY_STORAGE_VOLATILE is passed for aKeyPersistence then @p aKeyRef is output, the initial\n value does not matter and platform API MUST update it to return the new key ref.\n\n This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1026 pub fn otPlatCryptoImportKey(
1027 aKeyRef: *mut otCryptoKeyRef,
1028 aKeyType: otCryptoKeyType,
1029 aKeyAlgorithm: otCryptoKeyAlgorithm,
1030 aKeyUsage: ::std::os::raw::c_int,
1031 aKeyPersistence: otCryptoKeyStorage,
1032 aKey: *const u8,
1033 aKeyLen: usize,
1034 ) -> otError;
1035}
1036unsafe extern "C" {
1037 #[doc = " Export a key stored in PSA ITS.\n\n @param[in] aKeyRef The key ref to be used for crypto operations.\n @param[out] aBuffer Pointer to the buffer where key needs to be exported.\n @param[in] aBufferLen Length of the buffer passed to store the exported key.\n @param[out] aKeyLen Pointer to return the length of the exported key.\n\n @retval OT_ERROR_NONE Successfully exported @p aKeyRef.\n @retval OT_ERROR_FAILED Failed to export @p aKeyRef.\n @retval OT_ERROR_INVALID_ARGS @p aBuffer was NULL\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1038 pub fn otPlatCryptoExportKey(
1039 aKeyRef: otCryptoKeyRef,
1040 aBuffer: *mut u8,
1041 aBufferLen: usize,
1042 aKeyLen: *mut usize,
1043 ) -> otError;
1044}
1045unsafe extern "C" {
1046 #[doc = " Destroy a key stored in PSA ITS.\n\n @param[in] aKeyRef The key ref to be destroyed\n\n @retval OT_ERROR_NONE Successfully destroyed the key.\n @retval OT_ERROR_FAILED Failed to destroy the key.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1047 pub fn otPlatCryptoDestroyKey(aKeyRef: otCryptoKeyRef) -> otError;
1048}
1049unsafe extern "C" {
1050 #[doc = " Check if the key ref passed has an associated key in PSA ITS.\n\n @param[in] aKeyRef The Key Ref to check.\n\n @retval TRUE There is an associated key with @p aKeyRef.\n @retval FALSE There is no associated key with @p aKeyRef.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1051 pub fn otPlatCryptoHasKey(aKeyRef: otCryptoKeyRef) -> bool;
1052}
1053unsafe extern "C" {
1054 #[doc = " Dynamically allocates new memory for the Crypto subsystem. On platforms that support it, they should redirect to\n `calloc`. For those that don't support `calloc`, they should implement the standard `calloc` behavior.\n\n See: https://man7.org/linux/man-pages/man3/calloc.3.html\n\n Is required for `OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`.\n\n @param[in] aNum The number of blocks to allocate\n @param[in] aSize The size of each block to allocate\n\n @retval void* The pointer to the front of the memory allocated\n @retval NULL Failed to allocate the memory requested."]
1055 pub fn otPlatCryptoCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
1056}
1057unsafe extern "C" {
1058 #[doc = " Frees memory that was dynamically allocated by `otPlatCryptoCAlloc()`.\n\n Is required for `OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`.\n\n @param[in] aPtr A pointer the memory blocks to free. The pointer may be NULL."]
1059 pub fn otPlatCryptoFree(aPtr: *mut ::std::os::raw::c_void);
1060}
1061unsafe extern "C" {
1062 #[doc = " Initialize the HMAC operation.\n\n @param[in] aContext Context for HMAC operation.\n\n @retval OT_ERROR_NONE Successfully initialized HMAC operation.\n @retval OT_ERROR_FAILED Failed to initialize HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n @note The platform driver shall point the context to the correct object such as psa_mac_operation_t or\n mbedtls_md_context_t."]
1063 pub fn otPlatCryptoHmacSha256Init(aContext: *mut otCryptoContext) -> otError;
1064}
1065unsafe extern "C" {
1066 #[doc = " Uninitialize the HMAC operation.\n\n @param[in] aContext Context for HMAC operation.\n\n @retval OT_ERROR_NONE Successfully uninitialized HMAC operation.\n @retval OT_ERROR_FAILED Failed to uninitialized HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1067 pub fn otPlatCryptoHmacSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1068}
1069unsafe extern "C" {
1070 #[doc = " Start HMAC operation.\n\n @param[in] aContext Context for HMAC operation.\n @param[in] aKey Key material to be used for HMAC operation.\n\n @retval OT_ERROR_NONE Successfully started HMAC operation.\n @retval OT_ERROR_FAILED Failed to start HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL"]
1071 pub fn otPlatCryptoHmacSha256Start(
1072 aContext: *mut otCryptoContext,
1073 aKey: *const otCryptoKey,
1074 ) -> otError;
1075}
1076unsafe extern "C" {
1077 #[doc = " Update the HMAC operation with new input.\n\n @param[in] aContext Context for HMAC operation.\n @param[in] aBuf A pointer to the input buffer.\n @param[in] aBufLength The length of @p aBuf in bytes.\n\n @retval OT_ERROR_NONE Successfully updated HMAC with new input operation.\n @retval OT_ERROR_FAILED Failed to update HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL"]
1078 pub fn otPlatCryptoHmacSha256Update(
1079 aContext: *mut otCryptoContext,
1080 aBuf: *const ::std::os::raw::c_void,
1081 aBufLength: u16,
1082 ) -> otError;
1083}
1084unsafe extern "C" {
1085 #[doc = " Complete the HMAC operation.\n\n @param[in] aContext Context for HMAC operation.\n @param[out] aBuf A pointer to the output buffer.\n @param[in] aBufLength The length of @p aBuf in bytes.\n\n @retval OT_ERROR_NONE Successfully completed HMAC operation.\n @retval OT_ERROR_FAILED Failed to complete HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL"]
1086 pub fn otPlatCryptoHmacSha256Finish(
1087 aContext: *mut otCryptoContext,
1088 aBuf: *mut u8,
1089 aBufLength: usize,
1090 ) -> otError;
1091}
1092unsafe extern "C" {
1093 #[doc = " Initialise the AES operation.\n\n @param[in] aContext Context for AES operation.\n\n @retval OT_ERROR_NONE Successfully Initialised AES operation.\n @retval OT_ERROR_FAILED Failed to Initialise AES operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n @retval OT_ERROR_NO_BUFS Cannot allocate the context.\n\n @note The platform driver shall point the context to the correct object such as psa_key_id\n or mbedtls_aes_context_t."]
1094 pub fn otPlatCryptoAesInit(aContext: *mut otCryptoContext) -> otError;
1095}
1096unsafe extern "C" {
1097 #[doc = " Set the key for AES operation.\n\n @param[in] aContext Context for AES operation.\n @param[out] aKey Key to use for AES operation.\n\n @retval OT_ERROR_NONE Successfully set the key for AES operation.\n @retval OT_ERROR_FAILED Failed to set the key for AES operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey was NULL"]
1098 pub fn otPlatCryptoAesSetKey(
1099 aContext: *mut otCryptoContext,
1100 aKey: *const otCryptoKey,
1101 ) -> otError;
1102}
1103unsafe extern "C" {
1104 #[doc = " Encrypt the given data.\n\n @param[in] aContext Context for AES operation.\n @param[in] aInput Pointer to the input buffer.\n @param[in] aOutput Pointer to the output buffer.\n\n @retval OT_ERROR_NONE Successfully encrypted @p aInput.\n @retval OT_ERROR_FAILED Failed to encrypt @p aInput.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aKey or @p aOutput were NULL"]
1105 pub fn otPlatCryptoAesEncrypt(
1106 aContext: *mut otCryptoContext,
1107 aInput: *const u8,
1108 aOutput: *mut u8,
1109 ) -> otError;
1110}
1111unsafe extern "C" {
1112 #[doc = " Free the AES context.\n\n @param[in] aContext Context for AES operation.\n\n @retval OT_ERROR_NONE Successfully freed AES context.\n @retval OT_ERROR_FAILED Failed to free AES context.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1113 pub fn otPlatCryptoAesFree(aContext: *mut otCryptoContext) -> otError;
1114}
1115unsafe extern "C" {
1116 #[doc = " Initialise the HKDF context.\n\n @param[in] aContext Context for HKDF operation.\n\n @retval OT_ERROR_NONE Successfully Initialised AES operation.\n @retval OT_ERROR_FAILED Failed to Initialise AES operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n @note The platform driver shall point the context to the correct object such as psa_key_derivation_operation_t\n or HmacSha256::Hash"]
1117 pub fn otPlatCryptoHkdfInit(aContext: *mut otCryptoContext) -> otError;
1118}
1119unsafe extern "C" {
1120 #[doc = " Perform HKDF Expand step.\n\n @param[in] aContext Operation context for HKDF operation.\n @param[in] aInfo Pointer to the Info sequence.\n @param[in] aInfoLength Length of the Info sequence.\n @param[out] aOutputKey Pointer to the output Key.\n @param[in] aOutputKeyLength Size of the output key buffer.\n\n @retval OT_ERROR_NONE HKDF Expand was successful.\n @retval OT_ERROR_FAILED HKDF Expand failed.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1121 pub fn otPlatCryptoHkdfExpand(
1122 aContext: *mut otCryptoContext,
1123 aInfo: *const u8,
1124 aInfoLength: u16,
1125 aOutputKey: *mut u8,
1126 aOutputKeyLength: u16,
1127 ) -> otError;
1128}
1129unsafe extern "C" {
1130 #[doc = " Perform HKDF Extract step.\n\n @param[in] aContext Operation context for HKDF operation.\n @param[in] aSalt Pointer to the Salt for HKDF.\n @param[in] aSaltLength Length of Salt.\n @param[in] aInputKey Pointer to the input key.\n\n @retval OT_ERROR_NONE HKDF Extract was successful.\n @retval OT_ERROR_FAILED HKDF Extract failed."]
1131 pub fn otPlatCryptoHkdfExtract(
1132 aContext: *mut otCryptoContext,
1133 aSalt: *const u8,
1134 aSaltLength: u16,
1135 aInputKey: *const otCryptoKey,
1136 ) -> otError;
1137}
1138unsafe extern "C" {
1139 #[doc = " Uninitialize the HKDF context.\n\n @param[in] aContext Context for HKDF operation.\n\n @retval OT_ERROR_NONE Successfully un-initialised HKDF operation.\n @retval OT_ERROR_FAILED Failed to un-initialised HKDF operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1140 pub fn otPlatCryptoHkdfDeinit(aContext: *mut otCryptoContext) -> otError;
1141}
1142unsafe extern "C" {
1143 #[doc = " Initialise the SHA-256 operation.\n\n @param[in] aContext Context for SHA-256 operation.\n\n @retval OT_ERROR_NONE Successfully initialised SHA-256 operation.\n @retval OT_ERROR_FAILED Failed to initialise SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n\n @note The platform driver shall point the context to the correct object such as psa_hash_operation_t\n or mbedtls_sha256_context."]
1144 pub fn otPlatCryptoSha256Init(aContext: *mut otCryptoContext) -> otError;
1145}
1146unsafe extern "C" {
1147 #[doc = " Uninitialize the SHA-256 operation.\n\n @param[in] aContext Context for SHA-256 operation.\n\n @retval OT_ERROR_NONE Successfully un-initialised SHA-256 operation.\n @retval OT_ERROR_FAILED Failed to un-initialised SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1148 pub fn otPlatCryptoSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1149}
1150unsafe extern "C" {
1151 #[doc = " Start SHA-256 operation.\n\n @param[in] aContext Context for SHA-256 operation.\n\n @retval OT_ERROR_NONE Successfully started SHA-256 operation.\n @retval OT_ERROR_FAILED Failed to start SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL"]
1152 pub fn otPlatCryptoSha256Start(aContext: *mut otCryptoContext) -> otError;
1153}
1154unsafe extern "C" {
1155 #[doc = " Update SHA-256 operation with new input.\n\n @param[in] aContext Context for SHA-256 operation.\n @param[in] aBuf A pointer to the input buffer.\n @param[in] aBufLength The length of @p aBuf in bytes.\n\n @retval OT_ERROR_NONE Successfully updated SHA-256 with new input operation.\n @retval OT_ERROR_FAILED Failed to update SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aBuf was NULL"]
1156 pub fn otPlatCryptoSha256Update(
1157 aContext: *mut otCryptoContext,
1158 aBuf: *const ::std::os::raw::c_void,
1159 aBufLength: u16,
1160 ) -> otError;
1161}
1162unsafe extern "C" {
1163 #[doc = " Finish SHA-256 operation.\n\n @param[in] aContext Context for SHA-256 operation.\n @param[in] aHash A pointer to the output buffer, where hash needs to be stored.\n @param[in] aHashSize The length of @p aHash in bytes.\n\n @retval OT_ERROR_NONE Successfully completed the SHA-256 operation.\n @retval OT_ERROR_FAILED Failed to complete SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext or @p aHash was NULL"]
1164 pub fn otPlatCryptoSha256Finish(
1165 aContext: *mut otCryptoContext,
1166 aHash: *mut u8,
1167 aHashSize: u16,
1168 ) -> otError;
1169}
1170unsafe extern "C" {
1171 #[doc = " Initialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1172 pub fn otPlatCryptoRandomInit();
1173}
1174unsafe extern "C" {
1175 #[doc = " Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1176 pub fn otPlatCryptoRandomDeinit();
1177}
1178unsafe extern "C" {
1179 #[doc = " Fills a given buffer with cryptographically secure random bytes.\n\n @param[out] aBuffer A pointer to a buffer to fill with the random bytes.\n @param[in] aSize Size of buffer (number of bytes to fill).\n\n @retval OT_ERROR_NONE Successfully filled buffer with random values.\n @retval OT_ERROR_FAILED Operation failed."]
1180 pub fn otPlatCryptoRandomGet(aBuffer: *mut u8, aSize: u16) -> otError;
1181}
1182unsafe extern "C" {
1183 #[doc = " Generate and populate the output buffer with a new ECDSA key-pair.\n\n @param[out] aKeyPair A pointer to an ECDSA key-pair structure to store the generated key-pair.\n\n @retval OT_ERROR_NONE A new key-pair was generated successfully.\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for key generation.\n @retval OT_ERROR_NOT_CAPABLE Feature not supported.\n @retval OT_ERROR_FAILED Failed to generate key-pair."]
1184 pub fn otPlatCryptoEcdsaGenerateKey(aKeyPair: *mut otPlatCryptoEcdsaKeyPair) -> otError;
1185}
1186unsafe extern "C" {
1187 #[doc = " Get the associated public key from the input context.\n\n @param[in] aKeyPair A pointer to an ECDSA key-pair structure where the key-pair is stored.\n @param[out] aPublicKey A pointer to an ECDSA public key structure to store the public key.\n\n @retval OT_ERROR_NONE Public key was retrieved successfully, and @p aBuffer is updated.\n @retval OT_ERROR_PARSE The key-pair DER format could not be parsed (invalid format).\n @retval OT_ERROR_INVALID_ARGS The @p aContext is NULL."]
1188 pub fn otPlatCryptoEcdsaGetPublicKey(
1189 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1190 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1191 ) -> otError;
1192}
1193unsafe extern "C" {
1194 #[doc = " Calculate the ECDSA signature for a hashed message using the private key from the input context.\n\n Uses the deterministic digital signature generation procedure from RFC 6979.\n\n @param[in] aKeyPair A pointer to an ECDSA key-pair structure where the key-pair is stored.\n @param[in] aHash A pointer to a SHA-256 hash structure where the hash value for signature calculation\n is stored.\n @param[out] aSignature A pointer to an ECDSA signature structure to output the calculated signature.\n\n @retval OT_ERROR_NONE The signature was calculated successfully, @p aSignature was updated.\n @retval OT_ERROR_PARSE The key-pair DER format could not be parsed (invalid format).\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for signature calculation.\n @retval OT_ERROR_INVALID_ARGS The @p aContext is NULL."]
1195 pub fn otPlatCryptoEcdsaSign(
1196 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1197 aHash: *const otPlatCryptoSha256Hash,
1198 aSignature: *mut otPlatCryptoEcdsaSignature,
1199 ) -> otError;
1200}
1201unsafe extern "C" {
1202 #[doc = " Use the key from the input context to verify the ECDSA signature of a hashed message.\n\n @param[in] aPublicKey A pointer to an ECDSA public key structure where the public key for signature\n verification is stored.\n @param[in] aHash A pointer to a SHA-256 hash structure where the hash value for signature verification\n is stored.\n @param[in] aSignature A pointer to an ECDSA signature structure where the signature value to be verified is\n stored.\n\n @retval OT_ERROR_NONE The signature was verified successfully.\n @retval OT_ERROR_SECURITY The signature is invalid.\n @retval OT_ERROR_INVALID_ARGS The key or hash is invalid.\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for signature verification."]
1203 pub fn otPlatCryptoEcdsaVerify(
1204 aPublicKey: *const otPlatCryptoEcdsaPublicKey,
1205 aHash: *const otPlatCryptoSha256Hash,
1206 aSignature: *const otPlatCryptoEcdsaSignature,
1207 ) -> otError;
1208}
1209unsafe extern "C" {
1210 #[doc = " Calculate the ECDSA signature for a hashed message using the Key reference passed.\n\n Uses the deterministic digital signature generation procedure from RFC 6979.\n\n @param[in] aKeyRef Key Reference to the slot where the key-pair is stored.\n @param[in] aHash A pointer to a SHA-256 hash structure where the hash value for signature calculation\n is stored.\n @param[out] aSignature A pointer to an ECDSA signature structure to output the calculated signature.\n\n @retval OT_ERROR_NONE The signature was calculated successfully, @p aSignature was updated.\n @retval OT_ERROR_PARSE The key-pair DER format could not be parsed (invalid format).\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for signature calculation.\n @retval OT_ERROR_INVALID_ARGS The @p aContext is NULL.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1211 pub fn otPlatCryptoEcdsaSignUsingKeyRef(
1212 aKeyRef: otCryptoKeyRef,
1213 aHash: *const otPlatCryptoSha256Hash,
1214 aSignature: *mut otPlatCryptoEcdsaSignature,
1215 ) -> otError;
1216}
1217unsafe extern "C" {
1218 #[doc = " Get the associated public key from the key reference passed.\n\n The public key is stored differently depending on the crypto backend library being used\n (OPENTHREAD_CONFIG_CRYPTO_LIB).\n\n This API must make sure to return the public key as a byte sequence representation of an\n uncompressed curve point (RFC 6605 - sec 4)\n\n @param[in] aKeyRef Key Reference to the slot where the key-pair is stored.\n @param[out] aPublicKey A pointer to an ECDSA public key structure to store the public key.\n\n @retval OT_ERROR_NONE Public key was retrieved successfully, and @p aBuffer is updated.\n @retval OT_ERROR_PARSE The key-pair DER format could not be parsed (invalid format).\n @retval OT_ERROR_INVALID_ARGS The @p aContext is NULL.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1219 pub fn otPlatCryptoEcdsaExportPublicKey(
1220 aKeyRef: otCryptoKeyRef,
1221 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1222 ) -> otError;
1223}
1224unsafe extern "C" {
1225 #[doc = " Generate and import a new ECDSA key-pair at reference passed.\n\n @param[in] aKeyRef Key Reference to the slot where the key-pair is stored.\n\n @retval OT_ERROR_NONE A new key-pair was generated successfully.\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for key generation.\n @retval OT_ERROR_NOT_CAPABLE Feature not supported.\n @retval OT_ERROR_FAILED Failed to generate key-pair.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1226 pub fn otPlatCryptoEcdsaGenerateAndImportKey(aKeyRef: otCryptoKeyRef) -> otError;
1227}
1228unsafe extern "C" {
1229 #[doc = " Use the keyref to verify the ECDSA signature of a hashed message.\n\n @param[in] aKeyRef Key Reference to the slot where the key-pair is stored.\n @param[in] aHash A pointer to a SHA-256 hash structure where the hash value for signature verification\n is stored.\n @param[in] aSignature A pointer to an ECDSA signature structure where the signature value to be verified is\n stored.\n\n @retval OT_ERROR_NONE The signature was verified successfully.\n @retval OT_ERROR_SECURITY The signature is invalid.\n @retval OT_ERROR_INVALID_ARGS The key or hash is invalid.\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for signature verification.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled."]
1230 pub fn otPlatCryptoEcdsaVerifyUsingKeyRef(
1231 aKeyRef: otCryptoKeyRef,
1232 aHash: *const otPlatCryptoSha256Hash,
1233 aSignature: *const otPlatCryptoEcdsaSignature,
1234 ) -> otError;
1235}
1236unsafe extern "C" {
1237 #[doc = " Perform PKCS#5 PBKDF2 using CMAC (AES-CMAC-PRF-128).\n\n @param[in] aPassword Password to use when generating key.\n @param[in] aPasswordLen Length of password.\n @param[in] aSalt Salt to use when generating key.\n @param[in] aSaltLen Length of salt.\n @param[in] aIterationCounter Iteration count.\n @param[in] aKeyLen Length of generated key in bytes.\n @param[out] aKey A pointer to the generated key.\n\n @retval OT_ERROR_NONE A new key-pair was generated successfully.\n @retval OT_ERROR_NO_BUFS Failed to allocate buffer for key generation.\n @retval OT_ERROR_NOT_CAPABLE Feature not supported.\n @retval OT_ERROR_FAILED Failed to generate key."]
1238 pub fn otPlatCryptoPbkdf2GenerateKey(
1239 aPassword: *const u8,
1240 aPasswordLen: u16,
1241 aSalt: *const u8,
1242 aSaltLen: u16,
1243 aIterationCounter: u32,
1244 aKeyLen: u16,
1245 aKey: *mut u8,
1246 ) -> otError;
1247}
1248#[doc = "< aMaxPHYPacketSize (IEEE 802.15.4-2006)"]
1249pub const OT_RADIO_FRAME_MAX_SIZE: _bindgen_ty_2 = 127;
1250#[doc = "< Minimal size of frame FCS + CONTROL"]
1251pub const OT_RADIO_FRAME_MIN_SIZE: _bindgen_ty_2 = 3;
1252#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1253pub const OT_RADIO_SYMBOLS_PER_OCTET: _bindgen_ty_2 = 2;
1254#[doc = "< 2.4 GHz IEEE 802.15.4 (bits per second)"]
1255pub const OT_RADIO_BIT_RATE: _bindgen_ty_2 = 250000;
1256#[doc = "< Number of bits per octet"]
1257pub const OT_RADIO_BITS_PER_OCTET: _bindgen_ty_2 = 8;
1258#[doc = "< The O-QPSK PHY symbol rate when operating in the 780MHz, 915MHz, 2380MHz, 2450MHz"]
1259pub const OT_RADIO_SYMBOL_RATE: _bindgen_ty_2 = 62500;
1260#[doc = "< Symbol duration time in unit of microseconds"]
1261pub const OT_RADIO_SYMBOL_TIME: _bindgen_ty_2 = 16;
1262#[doc = "< Time for 10 symbols in unit of microseconds"]
1263pub const OT_RADIO_TEN_SYMBOLS_TIME: _bindgen_ty_2 = 160;
1264#[doc = "< LQI measurement not supported"]
1265pub const OT_RADIO_LQI_NONE: _bindgen_ty_2 = 0;
1266#[doc = "< Invalid or unknown RSSI value"]
1267pub const OT_RADIO_RSSI_INVALID: _bindgen_ty_2 = 127;
1268#[doc = "< Invalid or unknown power value"]
1269pub const OT_RADIO_POWER_INVALID: _bindgen_ty_2 = 127;
1270#[doc = "< Invalid short address."]
1271pub const OT_RADIO_INVALID_SHORT_ADDR: _bindgen_ty_2 = 65534;
1272#[doc = "< Broadcast short address."]
1273pub const OT_RADIO_BROADCAST_SHORT_ADDR: _bindgen_ty_2 = 65535;
1274#[doc = " @defgroup radio-types Radio Types\n\n @brief\n This module includes the platform abstraction for a radio frame.\n\n @{"]
1275pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
1276#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1277pub const OT_RADIO_CHANNEL_PAGE_0: _bindgen_ty_3 = 0;
1278#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1279pub const OT_RADIO_CHANNEL_PAGE_0_MASK: _bindgen_ty_3 = 1;
1280#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1281pub const OT_RADIO_CHANNEL_PAGE_2: _bindgen_ty_3 = 2;
1282#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1283pub const OT_RADIO_CHANNEL_PAGE_2_MASK: _bindgen_ty_3 = 4;
1284#[doc = " Defines the channel page."]
1285pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
1286#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1287pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 1;
1288#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1289pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 10;
1290#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1291pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 2046;
1292#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1293pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 11;
1294#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1295pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 26;
1296#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1297pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 134215680;
1298#[doc = " Defines the frequency band channel range."]
1299pub type _bindgen_ty_4 = ::std::os::raw::c_uint;
1300#[doc = " Represents radio capabilities.\n\n The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions."]
1301pub type otRadioCaps = u16;
1302#[doc = "< Radio supports no capability."]
1303pub const OT_RADIO_CAPS_NONE: _bindgen_ty_5 = 0;
1304#[doc = "< Radio supports AckTime event."]
1305pub const OT_RADIO_CAPS_ACK_TIMEOUT: _bindgen_ty_5 = 1;
1306#[doc = "< Radio supports Energy Scans."]
1307pub const OT_RADIO_CAPS_ENERGY_SCAN: _bindgen_ty_5 = 2;
1308#[doc = "< Radio supports tx retry logic with collision avoidance (CSMA)."]
1309pub const OT_RADIO_CAPS_TRANSMIT_RETRIES: _bindgen_ty_5 = 4;
1310#[doc = "< Radio supports CSMA backoff for frame tx (but no retry)."]
1311pub const OT_RADIO_CAPS_CSMA_BACKOFF: _bindgen_ty_5 = 8;
1312#[doc = "< Radio supports direct transition from sleep to TX with CSMA."]
1313pub const OT_RADIO_CAPS_SLEEP_TO_TX: _bindgen_ty_5 = 16;
1314#[doc = "< Radio supports tx security."]
1315pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_5 = 32;
1316#[doc = "< Radio supports tx at specific time."]
1317pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_5 = 64;
1318#[doc = "< Radio supports rx at specific time."]
1319pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_5 = 128;
1320#[doc = "< Radio supports RxOnWhenIdle handling."]
1321pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_5 = 256;
1322#[doc = "< Radio supports setting per-frame transmit power."]
1323pub const OT_RADIO_CAPS_TRANSMIT_FRAME_POWER: _bindgen_ty_5 = 512;
1324#[doc = "< Radio supports setting alternate short address."]
1325pub const OT_RADIO_CAPS_ALT_SHORT_ADDR: _bindgen_ty_5 = 1024;
1326#[doc = " Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`."]
1327pub type _bindgen_ty_5 = ::std::os::raw::c_uint;
1328#[doc = " Represents the IEEE 802.15.4 PAN ID."]
1329pub type otPanId = u16;
1330#[doc = " Represents the IEEE 802.15.4 Short Address."]
1331pub type otShortAddress = u16;
1332#[doc = "< Size of IE header in bytes."]
1333pub const OT_IE_HEADER_SIZE: _bindgen_ty_6 = 2;
1334#[doc = "< Size of CSL IE content in bytes."]
1335pub const OT_CSL_IE_SIZE: _bindgen_ty_6 = 4;
1336#[doc = "< Max length for header IE in ACK."]
1337pub const OT_ACK_IE_MAX_SIZE: _bindgen_ty_6 = 16;
1338#[doc = "< Max length of Link Metrics data in Vendor-Specific IE."]
1339pub const OT_ENH_PROBING_IE_DATA_MAX_SIZE: _bindgen_ty_6 = 2;
1340#[doc = " Defines constants about size of header IE in ACK."]
1341pub type _bindgen_ty_6 = ::std::os::raw::c_uint;
1342#[doc = " @struct otExtAddress\n\n Represents the IEEE 802.15.4 Extended Address."]
1343#[repr(C, packed)]
1344#[derive(Debug, Default, Copy, Clone)]
1345pub struct otExtAddress {
1346 #[doc = "< IEEE 802.15.4 Extended Address bytes"]
1347 pub m8: [u8; 8usize],
1348}
1349#[doc = " @struct otMacKey\n\n Represents a MAC Key."]
1350#[repr(C, packed)]
1351#[derive(Debug, Default, Copy, Clone)]
1352pub struct otMacKey {
1353 #[doc = "< MAC Key bytes."]
1354 pub m8: [u8; 16usize],
1355}
1356#[doc = " Represents a MAC Key Ref used by PSA."]
1357pub type otMacKeyRef = otCryptoKeyRef;
1358#[doc = " @struct otMacKeyMaterial\n\n Represents a MAC Key."]
1359#[repr(C)]
1360#[derive(Copy, Clone)]
1361pub struct otMacKeyMaterial {
1362 pub mKeyMaterial: otMacKeyMaterial__bindgen_ty_1,
1363}
1364#[repr(C)]
1365#[derive(Copy, Clone)]
1366pub union otMacKeyMaterial__bindgen_ty_1 {
1367 #[doc = "< Reference to the key stored."]
1368 pub mKeyRef: otMacKeyRef,
1369 #[doc = "< Key stored as literal."]
1370 pub mKey: otMacKey,
1371}
1372impl Default for otMacKeyMaterial__bindgen_ty_1 {
1373 fn default() -> Self {
1374 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1375 unsafe {
1376 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1377 s.assume_init()
1378 }
1379 }
1380}
1381impl Default for otMacKeyMaterial {
1382 fn default() -> Self {
1383 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1384 unsafe {
1385 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1386 s.assume_init()
1387 }
1388 }
1389}
1390#[doc = "< Use Literal Keys."]
1391pub const OT_KEY_TYPE_LITERAL_KEY: otRadioKeyType = 0;
1392#[doc = "< Use Reference to Key."]
1393pub const OT_KEY_TYPE_KEY_REF: otRadioKeyType = 1;
1394#[doc = " Defines constants about key types."]
1395pub type otRadioKeyType = ::std::os::raw::c_uint;
1396#[doc = " Represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame."]
1397#[repr(C)]
1398#[derive(Debug, Default, Copy, Clone)]
1399pub struct otRadioIeInfo {
1400 #[doc = "< The time offset to the Thread network time."]
1401 pub mNetworkTimeOffset: i64,
1402 #[doc = "< The Time IE offset from the start of PSDU."]
1403 pub mTimeIeOffset: u8,
1404 #[doc = "< The Time sync sequence."]
1405 pub mTimeSyncSeq: u8,
1406}
1407#[doc = " Represents an IEEE 802.15.4 radio frame."]
1408#[repr(C)]
1409#[derive(Copy, Clone)]
1410pub struct otRadioFrame {
1411 #[doc = "< The PSDU."]
1412 pub mPsdu: *mut u8,
1413 #[doc = "< Length of the PSDU."]
1414 pub mLength: u16,
1415 #[doc = "< Channel used to transmit/receive the frame."]
1416 pub mChannel: u8,
1417 #[doc = "< Radio link type - should be ignored by radio driver."]
1418 pub mRadioType: u8,
1419 pub mInfo: otRadioFrame__bindgen_ty_1,
1420}
1421#[doc = " The union of transmit and receive information for a radio frame."]
1422#[repr(C)]
1423#[derive(Copy, Clone)]
1424pub union otRadioFrame__bindgen_ty_1 {
1425 pub mTxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_1,
1426 pub mRxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_2,
1427}
1428#[doc = " Structure representing radio frame transmit information."]
1429#[repr(C)]
1430#[derive(Debug, Copy, Clone)]
1431pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1432 #[doc = "< The key material used for AES-CCM frame security."]
1433 pub mAesKey: *const otMacKeyMaterial,
1434 #[doc = "< The pointer to the Header IE(s) related information."]
1435 pub mIeInfo: *mut otRadioIeInfo,
1436 #[doc = " The base time in microseconds for scheduled transmissions\n relative to the local radio clock, see `otPlatRadioGetNow` and\n `mTxDelay`.\n\n If this field is non-zero, `mMaxCsmaBackoffs` should be ignored.\n\n This field does not affect CCA behavior which is controlled by `mCsmaCaEnabled`."]
1437 pub mTxDelayBaseTime: u32,
1438 #[doc = " The delay time in microseconds for this transmission referenced\n to `mTxDelayBaseTime`.\n\n Note: `mTxDelayBaseTime` + `mTxDelay` SHALL point to the point in\n time when the end of the SFD will be present at the local\n antenna, relative to the local radio clock.\n\n If this field is non-zero, `mMaxCsmaBackoffs` should be ignored.\n\n This field does not affect CCA behavior which is controlled by `mCsmaCaEnabled`."]
1439 pub mTxDelay: u32,
1440 #[doc = " Maximum number of CSMA backoff attempts before declaring channel access failure.\n\n This is applicable and MUST be used when radio platform provides the `OT_RADIO_CAPS_CSMA_BACKOFF` and/or\n `OT_RADIO_CAPS_TRANSMIT_RETRIES`.\n\n This field MUST be ignored if `mCsmaCaEnabled` is set to `false` (CCA is disabled) or\n either `mTxDelayBaseTime` or `mTxDelay` is non-zero (frame transmission is expected at a specific time).\n\n It can be set to `0` to skip backoff mechanism (note that CCA MUST still be performed assuming\n `mCsmaCaEnabled` is `true`)."]
1441 pub mMaxCsmaBackoffs: u8,
1442 #[doc = "< Maximum number of retries allowed after a transmission failure."]
1443 pub mMaxFrameRetries: u8,
1444 #[doc = " The RX channel after frame TX is done (after all frame retries - ack received, or timeout, or abort).\n\n Radio platforms can choose to fully ignore this. OT stack will make sure to call `otPlatRadioReceive()`\n with the desired RX channel after a frame TX is done and signaled in `otPlatRadioTxDone()` callback.\n Radio platforms that don't provide `OT_RADIO_CAPS_TRANSMIT_RETRIES` must always ignore this.\n\n This is intended for situations where there may be delay in interactions between OT stack and radio, as\n an example this is used in RCP/host architecture to make sure RCP switches to PAN channel more quickly.\n In particular, this can help with CSL tx to a sleepy child, where the child may use a different channel\n for CSL than the PAN channel. After frame tx, we want the radio/RCP to go back to the PAN channel\n quickly to ensure that parent does not miss tx from child afterwards, e.g., child responding to the\n earlier CSL transmitted frame from parent using PAN channel while radio still staying on CSL channel.\n\n The switch to the RX channel MUST happen after the frame TX is fully done, i.e., after all retries and\n when ack is received (when \"Ack Request\" flag is set on the TX frame) or ack timeout. Note that ack is\n expected on the same channel that frame is sent on."]
1445 pub mRxChannelAfterTxDone: u8,
1446 #[doc = " The transmit power in dBm.\n\n If the platform layer does not provide `OT_RADIO_CAPS_TRANSMIT_FRAME_POWER` capability, it can ignore\n this value.\n\n If the value is OT_RADIO_POWER_INVALID, then the platform should ignore this value and transmit the frame\n with its default transmit power.\n\n Otherwise, the platform should transmit this frame with the maximum power no larger than minimal of the\n following values:\n 1. mTxPower,\n 2. The power limit set by otPlatRadioSetChannelTargetPower(),\n 3. The power limit set by otPlatRadioSetChannelMaxTransmitPower(),\n 4. The power limit set by otPlatRadioSetRegion()."]
1447 pub mTxPower: i8,
1448 pub _bitfield_align_1: [u8; 0],
1449 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1450 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna.\n\n The platform should update this field before otPlatRadioTxStarted() is fired for each transmit attempt."]
1451 pub mTimestamp: u64,
1452}
1453impl Default for otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1454 fn default() -> Self {
1455 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1456 unsafe {
1457 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1458 s.assume_init()
1459 }
1460 }
1461}
1462impl otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1463 #[inline]
1464 pub fn mIsHeaderUpdated(&self) -> bool {
1465 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1466 }
1467 #[inline]
1468 pub fn set_mIsHeaderUpdated(&mut self, val: bool) {
1469 unsafe {
1470 let val: u8 = ::std::mem::transmute(val);
1471 self._bitfield_1.set(0usize, 1u8, val as u64)
1472 }
1473 }
1474 #[inline]
1475 pub unsafe fn mIsHeaderUpdated_raw(this: *const Self) -> bool {
1476 unsafe {
1477 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1478 ::std::ptr::addr_of!((*this)._bitfield_1),
1479 0usize,
1480 1u8,
1481 ) as u8)
1482 }
1483 }
1484 #[inline]
1485 pub unsafe fn set_mIsHeaderUpdated_raw(this: *mut Self, val: bool) {
1486 unsafe {
1487 let val: u8 = ::std::mem::transmute(val);
1488 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1489 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1490 0usize,
1491 1u8,
1492 val as u64,
1493 )
1494 }
1495 }
1496 #[inline]
1497 pub fn mIsARetx(&self) -> bool {
1498 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1499 }
1500 #[inline]
1501 pub fn set_mIsARetx(&mut self, val: bool) {
1502 unsafe {
1503 let val: u8 = ::std::mem::transmute(val);
1504 self._bitfield_1.set(1usize, 1u8, val as u64)
1505 }
1506 }
1507 #[inline]
1508 pub unsafe fn mIsARetx_raw(this: *const Self) -> bool {
1509 unsafe {
1510 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1511 ::std::ptr::addr_of!((*this)._bitfield_1),
1512 1usize,
1513 1u8,
1514 ) as u8)
1515 }
1516 }
1517 #[inline]
1518 pub unsafe fn set_mIsARetx_raw(this: *mut Self, val: bool) {
1519 unsafe {
1520 let val: u8 = ::std::mem::transmute(val);
1521 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1522 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1523 1usize,
1524 1u8,
1525 val as u64,
1526 )
1527 }
1528 }
1529 #[inline]
1530 pub fn mCsmaCaEnabled(&self) -> bool {
1531 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1532 }
1533 #[inline]
1534 pub fn set_mCsmaCaEnabled(&mut self, val: bool) {
1535 unsafe {
1536 let val: u8 = ::std::mem::transmute(val);
1537 self._bitfield_1.set(2usize, 1u8, val as u64)
1538 }
1539 }
1540 #[inline]
1541 pub unsafe fn mCsmaCaEnabled_raw(this: *const Self) -> bool {
1542 unsafe {
1543 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1544 ::std::ptr::addr_of!((*this)._bitfield_1),
1545 2usize,
1546 1u8,
1547 ) as u8)
1548 }
1549 }
1550 #[inline]
1551 pub unsafe fn set_mCsmaCaEnabled_raw(this: *mut Self, val: bool) {
1552 unsafe {
1553 let val: u8 = ::std::mem::transmute(val);
1554 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1555 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1556 2usize,
1557 1u8,
1558 val as u64,
1559 )
1560 }
1561 }
1562 #[inline]
1563 pub fn mCslPresent(&self) -> bool {
1564 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1565 }
1566 #[inline]
1567 pub fn set_mCslPresent(&mut self, val: bool) {
1568 unsafe {
1569 let val: u8 = ::std::mem::transmute(val);
1570 self._bitfield_1.set(3usize, 1u8, val as u64)
1571 }
1572 }
1573 #[inline]
1574 pub unsafe fn mCslPresent_raw(this: *const Self) -> bool {
1575 unsafe {
1576 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1577 ::std::ptr::addr_of!((*this)._bitfield_1),
1578 3usize,
1579 1u8,
1580 ) as u8)
1581 }
1582 }
1583 #[inline]
1584 pub unsafe fn set_mCslPresent_raw(this: *mut Self, val: bool) {
1585 unsafe {
1586 let val: u8 = ::std::mem::transmute(val);
1587 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1588 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1589 3usize,
1590 1u8,
1591 val as u64,
1592 )
1593 }
1594 }
1595 #[inline]
1596 pub fn mIsSecurityProcessed(&self) -> bool {
1597 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1598 }
1599 #[inline]
1600 pub fn set_mIsSecurityProcessed(&mut self, val: bool) {
1601 unsafe {
1602 let val: u8 = ::std::mem::transmute(val);
1603 self._bitfield_1.set(4usize, 1u8, val as u64)
1604 }
1605 }
1606 #[inline]
1607 pub unsafe fn mIsSecurityProcessed_raw(this: *const Self) -> bool {
1608 unsafe {
1609 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1610 ::std::ptr::addr_of!((*this)._bitfield_1),
1611 4usize,
1612 1u8,
1613 ) as u8)
1614 }
1615 }
1616 #[inline]
1617 pub unsafe fn set_mIsSecurityProcessed_raw(this: *mut Self, val: bool) {
1618 unsafe {
1619 let val: u8 = ::std::mem::transmute(val);
1620 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1621 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1622 4usize,
1623 1u8,
1624 val as u64,
1625 )
1626 }
1627 }
1628 #[inline]
1629 pub fn new_bitfield_1(
1630 mIsHeaderUpdated: bool,
1631 mIsARetx: bool,
1632 mCsmaCaEnabled: bool,
1633 mCslPresent: bool,
1634 mIsSecurityProcessed: bool,
1635 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1636 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1637 __bindgen_bitfield_unit.set(0usize, 1u8, {
1638 let mIsHeaderUpdated: u8 = unsafe { ::std::mem::transmute(mIsHeaderUpdated) };
1639 mIsHeaderUpdated as u64
1640 });
1641 __bindgen_bitfield_unit.set(1usize, 1u8, {
1642 let mIsARetx: u8 = unsafe { ::std::mem::transmute(mIsARetx) };
1643 mIsARetx as u64
1644 });
1645 __bindgen_bitfield_unit.set(2usize, 1u8, {
1646 let mCsmaCaEnabled: u8 = unsafe { ::std::mem::transmute(mCsmaCaEnabled) };
1647 mCsmaCaEnabled as u64
1648 });
1649 __bindgen_bitfield_unit.set(3usize, 1u8, {
1650 let mCslPresent: u8 = unsafe { ::std::mem::transmute(mCslPresent) };
1651 mCslPresent as u64
1652 });
1653 __bindgen_bitfield_unit.set(4usize, 1u8, {
1654 let mIsSecurityProcessed: u8 = unsafe { ::std::mem::transmute(mIsSecurityProcessed) };
1655 mIsSecurityProcessed as u64
1656 });
1657 __bindgen_bitfield_unit
1658 }
1659}
1660#[doc = " Structure representing radio frame receive information."]
1661#[repr(C)]
1662#[derive(Debug, Default, Copy, Clone)]
1663pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1664 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna."]
1665 pub mTimestamp: u64,
1666 #[doc = "< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set)."]
1667 pub mAckFrameCounter: u32,
1668 #[doc = "< ACK security key index (applicable when `mAckedWithSecEnhAck` is set)."]
1669 pub mAckKeyId: u8,
1670 #[doc = "< Received signal strength indicator in dBm for received frames."]
1671 pub mRssi: i8,
1672 #[doc = "< Link Quality Indicator for received frames."]
1673 pub mLqi: u8,
1674 pub _bitfield_align_1: [u8; 0],
1675 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1676}
1677impl otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1678 #[inline]
1679 pub fn mAckedWithFramePending(&self) -> bool {
1680 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1681 }
1682 #[inline]
1683 pub fn set_mAckedWithFramePending(&mut self, val: bool) {
1684 unsafe {
1685 let val: u8 = ::std::mem::transmute(val);
1686 self._bitfield_1.set(0usize, 1u8, val as u64)
1687 }
1688 }
1689 #[inline]
1690 pub unsafe fn mAckedWithFramePending_raw(this: *const Self) -> bool {
1691 unsafe {
1692 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1693 ::std::ptr::addr_of!((*this)._bitfield_1),
1694 0usize,
1695 1u8,
1696 ) as u8)
1697 }
1698 }
1699 #[inline]
1700 pub unsafe fn set_mAckedWithFramePending_raw(this: *mut Self, val: bool) {
1701 unsafe {
1702 let val: u8 = ::std::mem::transmute(val);
1703 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1704 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1705 0usize,
1706 1u8,
1707 val as u64,
1708 )
1709 }
1710 }
1711 #[inline]
1712 pub fn mAckedWithSecEnhAck(&self) -> bool {
1713 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1714 }
1715 #[inline]
1716 pub fn set_mAckedWithSecEnhAck(&mut self, val: bool) {
1717 unsafe {
1718 let val: u8 = ::std::mem::transmute(val);
1719 self._bitfield_1.set(1usize, 1u8, val as u64)
1720 }
1721 }
1722 #[inline]
1723 pub unsafe fn mAckedWithSecEnhAck_raw(this: *const Self) -> bool {
1724 unsafe {
1725 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1726 ::std::ptr::addr_of!((*this)._bitfield_1),
1727 1usize,
1728 1u8,
1729 ) as u8)
1730 }
1731 }
1732 #[inline]
1733 pub unsafe fn set_mAckedWithSecEnhAck_raw(this: *mut Self, val: bool) {
1734 unsafe {
1735 let val: u8 = ::std::mem::transmute(val);
1736 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1737 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1738 1usize,
1739 1u8,
1740 val as u64,
1741 )
1742 }
1743 }
1744 #[inline]
1745 pub fn new_bitfield_1(
1746 mAckedWithFramePending: bool,
1747 mAckedWithSecEnhAck: bool,
1748 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1749 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1750 __bindgen_bitfield_unit.set(0usize, 1u8, {
1751 let mAckedWithFramePending: u8 =
1752 unsafe { ::std::mem::transmute(mAckedWithFramePending) };
1753 mAckedWithFramePending as u64
1754 });
1755 __bindgen_bitfield_unit.set(1usize, 1u8, {
1756 let mAckedWithSecEnhAck: u8 = unsafe { ::std::mem::transmute(mAckedWithSecEnhAck) };
1757 mAckedWithSecEnhAck as u64
1758 });
1759 __bindgen_bitfield_unit
1760 }
1761}
1762impl Default for otRadioFrame__bindgen_ty_1 {
1763 fn default() -> Self {
1764 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1765 unsafe {
1766 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1767 s.assume_init()
1768 }
1769 }
1770}
1771impl Default for otRadioFrame {
1772 fn default() -> Self {
1773 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1774 unsafe {
1775 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1776 s.assume_init()
1777 }
1778 }
1779}
1780pub const OT_RADIO_STATE_DISABLED: otRadioState = 0;
1781pub const OT_RADIO_STATE_SLEEP: otRadioState = 1;
1782pub const OT_RADIO_STATE_RECEIVE: otRadioState = 2;
1783pub const OT_RADIO_STATE_TRANSMIT: otRadioState = 3;
1784pub const OT_RADIO_STATE_INVALID: otRadioState = 255;
1785#[doc = " Represents the state of a radio.\n Initially, a radio is in the Disabled state."]
1786pub type otRadioState = ::std::os::raw::c_uint;
1787#[doc = " Represents radio coexistence metrics."]
1788#[repr(C)]
1789#[derive(Debug, Default, Copy, Clone)]
1790pub struct otRadioCoexMetrics {
1791 #[doc = "< Number of grant glitches."]
1792 pub mNumGrantGlitch: u32,
1793 #[doc = "< Number of tx requests."]
1794 pub mNumTxRequest: u32,
1795 #[doc = "< Number of tx requests while grant was active."]
1796 pub mNumTxGrantImmediate: u32,
1797 #[doc = "< Number of tx requests while grant was inactive."]
1798 pub mNumTxGrantWait: u32,
1799 #[doc = "< Number of tx requests while grant was inactive that were ultimately granted."]
1800 pub mNumTxGrantWaitActivated: u32,
1801 #[doc = "< Number of tx requests while grant was inactive that timed out."]
1802 pub mNumTxGrantWaitTimeout: u32,
1803 #[doc = "< Number of tx that were in progress when grant was deactivated."]
1804 pub mNumTxGrantDeactivatedDuringRequest: u32,
1805 #[doc = "< Number of tx requests that were not granted within 50us."]
1806 pub mNumTxDelayedGrant: u32,
1807 #[doc = "< Average time in usec from tx request to grant."]
1808 pub mAvgTxRequestToGrantTime: u32,
1809 #[doc = "< Number of rx requests."]
1810 pub mNumRxRequest: u32,
1811 #[doc = "< Number of rx requests while grant was active."]
1812 pub mNumRxGrantImmediate: u32,
1813 #[doc = "< Number of rx requests while grant was inactive."]
1814 pub mNumRxGrantWait: u32,
1815 #[doc = "< Number of rx requests while grant was inactive that were ultimately granted."]
1816 pub mNumRxGrantWaitActivated: u32,
1817 #[doc = "< Number of rx requests while grant was inactive that timed out."]
1818 pub mNumRxGrantWaitTimeout: u32,
1819 #[doc = "< Number of rx that were in progress when grant was deactivated."]
1820 pub mNumRxGrantDeactivatedDuringRequest: u32,
1821 #[doc = "< Number of rx requests that were not granted within 50us."]
1822 pub mNumRxDelayedGrant: u32,
1823 #[doc = "< Average time in usec from rx request to grant."]
1824 pub mAvgRxRequestToGrantTime: u32,
1825 #[doc = "< Number of rx requests that completed without receiving grant."]
1826 pub mNumRxGrantNone: u32,
1827 #[doc = "< Stats collection stopped due to saturation."]
1828 pub mStopped: bool,
1829}
1830#[doc = " Represents what metrics are specified to query."]
1831#[repr(C)]
1832#[derive(Debug, Default, Copy, Clone)]
1833pub struct otLinkMetrics {
1834 pub _bitfield_align_1: [u8; 0],
1835 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1836}
1837impl otLinkMetrics {
1838 #[inline]
1839 pub fn mPduCount(&self) -> bool {
1840 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1841 }
1842 #[inline]
1843 pub fn set_mPduCount(&mut self, val: bool) {
1844 unsafe {
1845 let val: u8 = ::std::mem::transmute(val);
1846 self._bitfield_1.set(0usize, 1u8, val as u64)
1847 }
1848 }
1849 #[inline]
1850 pub unsafe fn mPduCount_raw(this: *const Self) -> bool {
1851 unsafe {
1852 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1853 ::std::ptr::addr_of!((*this)._bitfield_1),
1854 0usize,
1855 1u8,
1856 ) as u8)
1857 }
1858 }
1859 #[inline]
1860 pub unsafe fn set_mPduCount_raw(this: *mut Self, val: bool) {
1861 unsafe {
1862 let val: u8 = ::std::mem::transmute(val);
1863 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1864 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1865 0usize,
1866 1u8,
1867 val as u64,
1868 )
1869 }
1870 }
1871 #[inline]
1872 pub fn mLqi(&self) -> bool {
1873 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1874 }
1875 #[inline]
1876 pub fn set_mLqi(&mut self, val: bool) {
1877 unsafe {
1878 let val: u8 = ::std::mem::transmute(val);
1879 self._bitfield_1.set(1usize, 1u8, val as u64)
1880 }
1881 }
1882 #[inline]
1883 pub unsafe fn mLqi_raw(this: *const Self) -> bool {
1884 unsafe {
1885 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1886 ::std::ptr::addr_of!((*this)._bitfield_1),
1887 1usize,
1888 1u8,
1889 ) as u8)
1890 }
1891 }
1892 #[inline]
1893 pub unsafe fn set_mLqi_raw(this: *mut Self, val: bool) {
1894 unsafe {
1895 let val: u8 = ::std::mem::transmute(val);
1896 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1897 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1898 1usize,
1899 1u8,
1900 val as u64,
1901 )
1902 }
1903 }
1904 #[inline]
1905 pub fn mLinkMargin(&self) -> bool {
1906 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1907 }
1908 #[inline]
1909 pub fn set_mLinkMargin(&mut self, val: bool) {
1910 unsafe {
1911 let val: u8 = ::std::mem::transmute(val);
1912 self._bitfield_1.set(2usize, 1u8, val as u64)
1913 }
1914 }
1915 #[inline]
1916 pub unsafe fn mLinkMargin_raw(this: *const Self) -> bool {
1917 unsafe {
1918 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1919 ::std::ptr::addr_of!((*this)._bitfield_1),
1920 2usize,
1921 1u8,
1922 ) as u8)
1923 }
1924 }
1925 #[inline]
1926 pub unsafe fn set_mLinkMargin_raw(this: *mut Self, val: bool) {
1927 unsafe {
1928 let val: u8 = ::std::mem::transmute(val);
1929 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1930 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1931 2usize,
1932 1u8,
1933 val as u64,
1934 )
1935 }
1936 }
1937 #[inline]
1938 pub fn mRssi(&self) -> bool {
1939 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1940 }
1941 #[inline]
1942 pub fn set_mRssi(&mut self, val: bool) {
1943 unsafe {
1944 let val: u8 = ::std::mem::transmute(val);
1945 self._bitfield_1.set(3usize, 1u8, val as u64)
1946 }
1947 }
1948 #[inline]
1949 pub unsafe fn mRssi_raw(this: *const Self) -> bool {
1950 unsafe {
1951 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1952 ::std::ptr::addr_of!((*this)._bitfield_1),
1953 3usize,
1954 1u8,
1955 ) as u8)
1956 }
1957 }
1958 #[inline]
1959 pub unsafe fn set_mRssi_raw(this: *mut Self, val: bool) {
1960 unsafe {
1961 let val: u8 = ::std::mem::transmute(val);
1962 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1963 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1964 3usize,
1965 1u8,
1966 val as u64,
1967 )
1968 }
1969 }
1970 #[inline]
1971 pub fn mReserved(&self) -> bool {
1972 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1973 }
1974 #[inline]
1975 pub fn set_mReserved(&mut self, val: bool) {
1976 unsafe {
1977 let val: u8 = ::std::mem::transmute(val);
1978 self._bitfield_1.set(4usize, 1u8, val as u64)
1979 }
1980 }
1981 #[inline]
1982 pub unsafe fn mReserved_raw(this: *const Self) -> bool {
1983 unsafe {
1984 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1985 ::std::ptr::addr_of!((*this)._bitfield_1),
1986 4usize,
1987 1u8,
1988 ) as u8)
1989 }
1990 }
1991 #[inline]
1992 pub unsafe fn set_mReserved_raw(this: *mut Self, val: bool) {
1993 unsafe {
1994 let val: u8 = ::std::mem::transmute(val);
1995 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1996 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1997 4usize,
1998 1u8,
1999 val as u64,
2000 )
2001 }
2002 }
2003 #[inline]
2004 pub fn new_bitfield_1(
2005 mPduCount: bool,
2006 mLqi: bool,
2007 mLinkMargin: bool,
2008 mRssi: bool,
2009 mReserved: bool,
2010 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2011 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2012 __bindgen_bitfield_unit.set(0usize, 1u8, {
2013 let mPduCount: u8 = unsafe { ::std::mem::transmute(mPduCount) };
2014 mPduCount as u64
2015 });
2016 __bindgen_bitfield_unit.set(1usize, 1u8, {
2017 let mLqi: u8 = unsafe { ::std::mem::transmute(mLqi) };
2018 mLqi as u64
2019 });
2020 __bindgen_bitfield_unit.set(2usize, 1u8, {
2021 let mLinkMargin: u8 = unsafe { ::std::mem::transmute(mLinkMargin) };
2022 mLinkMargin as u64
2023 });
2024 __bindgen_bitfield_unit.set(3usize, 1u8, {
2025 let mRssi: u8 = unsafe { ::std::mem::transmute(mRssi) };
2026 mRssi as u64
2027 });
2028 __bindgen_bitfield_unit.set(4usize, 1u8, {
2029 let mReserved: u8 = unsafe { ::std::mem::transmute(mReserved) };
2030 mReserved as u64
2031 });
2032 __bindgen_bitfield_unit
2033 }
2034}
2035unsafe extern "C" {
2036 #[doc = " Get the radio capabilities.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The radio capability bit vector (see `OT_RADIO_CAP_*` definitions)."]
2037 pub fn otPlatRadioGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
2038}
2039unsafe extern "C" {
2040 #[doc = " Get the radio version string.\n\n This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses\n the OpenThread version instead (@sa otGetVersionString()).\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns A pointer to the OpenThread radio version."]
2041 pub fn otPlatRadioGetVersionString(aInstance: *mut otInstance)
2042 -> *const ::std::os::raw::c_char;
2043}
2044unsafe extern "C" {
2045 #[doc = " Get the radio receive sensitivity value.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The radio receive sensitivity value in dBm."]
2046 pub fn otPlatRadioGetReceiveSensitivity(aInstance: *mut otInstance) -> i8;
2047}
2048unsafe extern "C" {
2049 #[doc = " Gets the factory-assigned IEEE EUI-64 for this interface.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aIeeeEui64 A pointer to the factory-assigned IEEE EUI-64."]
2050 pub fn otPlatRadioGetIeeeEui64(aInstance: *mut otInstance, aIeeeEui64: *mut u8);
2051}
2052unsafe extern "C" {
2053 #[doc = " Set the PAN ID for address filtering.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aPanId The IEEE 802.15.4 PAN ID."]
2054 pub fn otPlatRadioSetPanId(aInstance: *mut otInstance, aPanId: otPanId);
2055}
2056unsafe extern "C" {
2057 #[doc = " Set the Extended Address for address filtering.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address stored in little-endian byte order."]
2058 pub fn otPlatRadioSetExtendedAddress(
2059 aInstance: *mut otInstance,
2060 aExtAddress: *const otExtAddress,
2061 );
2062}
2063unsafe extern "C" {
2064 #[doc = " Set the Short Address for address filtering.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aShortAddress The IEEE 802.15.4 Short Address."]
2065 pub fn otPlatRadioSetShortAddress(aInstance: *mut otInstance, aShortAddress: otShortAddress);
2066}
2067unsafe extern "C" {
2068 #[doc = " Set the alternate short address.\n\n This is an optional radio platform API. The radio platform MUST indicate support for this API by including the\n capability `OT_RADIO_CAPS_ALT_SHORT_ADDR` in `otPlatRadioGetCaps()`.\n\n When supported, the radio should accept received frames destined to the specified alternate short address in\n addition to the short address provided in `otPlatRadioSetShortAddress()`.\n\n The @p aShortAddress can be set to `OT_RADIO_INVALID_SHORT_ADDR` (0xfffe) to clear any previously set alternate\n short address.\n\n This function is used by OpenThread stack during child-to-router role transitions, allowing the device to continue\n receiving frames addressed to its previous short address for a short period.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aShortAddress The alternate IEEE 802.15.4 short address. `OT_RADIO_INVALID_SHORT_ADDR` to clear."]
2069 pub fn otPlatRadioSetAlternateShortAddress(
2070 aInstance: *mut otInstance,
2071 aShortAddress: otShortAddress,
2072 );
2073}
2074unsafe extern "C" {
2075 #[doc = " Get the radio's transmit power in dBm.\n\n @note The transmit power returned will be no larger than the power specified in the max power table for\n the current channel.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aPower The transmit power in dBm.\n\n @retval OT_ERROR_NONE Successfully retrieved the transmit power.\n @retval OT_ERROR_INVALID_ARGS @p aPower was NULL.\n @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented."]
2076 pub fn otPlatRadioGetTransmitPower(aInstance: *mut otInstance, aPower: *mut i8) -> otError;
2077}
2078unsafe extern "C" {
2079 #[doc = " Set the radio's transmit power in dBm for all channels.\n\n @note The real transmit power will be no larger than the power specified in the max power table for\n the current channel that was configured by `otPlatRadioSetChannelMaxTransmitPower()`.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aPower The transmit power in dBm.\n\n @retval OT_ERROR_NONE Successfully set the transmit power.\n @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented."]
2080 pub fn otPlatRadioSetTransmitPower(aInstance: *mut otInstance, aPower: i8) -> otError;
2081}
2082unsafe extern "C" {
2083 #[doc = " Get the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aThreshold The CCA ED threshold in dBm.\n\n @retval OT_ERROR_NONE Successfully retrieved the CCA ED threshold.\n @retval OT_ERROR_INVALID_ARGS @p aThreshold was NULL.\n @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented."]
2084 pub fn otPlatRadioGetCcaEnergyDetectThreshold(
2085 aInstance: *mut otInstance,
2086 aThreshold: *mut i8,
2087 ) -> otError;
2088}
2089unsafe extern "C" {
2090 #[doc = " Set the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aThreshold The CCA ED threshold in dBm.\n\n @retval OT_ERROR_NONE Successfully set the transmit power.\n @retval OT_ERROR_INVALID_ARGS Given threshold is out of range.\n @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented."]
2091 pub fn otPlatRadioSetCcaEnergyDetectThreshold(
2092 aInstance: *mut otInstance,
2093 aThreshold: i8,
2094 ) -> otError;
2095}
2096unsafe extern "C" {
2097 #[doc = " Gets the external FEM's Rx LNA gain in dBm.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aGain The external FEM's Rx LNA gain in dBm.\n\n @retval OT_ERROR_NONE Successfully retrieved the external FEM's LNA gain.\n @retval OT_ERROR_INVALID_ARGS @p aGain was NULL.\n @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA setting is not implemented."]
2098 pub fn otPlatRadioGetFemLnaGain(aInstance: *mut otInstance, aGain: *mut i8) -> otError;
2099}
2100unsafe extern "C" {
2101 #[doc = " Sets the external FEM's Rx LNA gain in dBm.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aGain The external FEM's Rx LNA gain in dBm.\n\n @retval OT_ERROR_NONE Successfully set the external FEM's LNA gain.\n @retval OT_ERROR_NOT_IMPLEMENTED External FEM's LNA gain setting is not implemented."]
2102 pub fn otPlatRadioSetFemLnaGain(aInstance: *mut otInstance, aGain: i8) -> otError;
2103}
2104unsafe extern "C" {
2105 #[doc = " Get the status of promiscuous mode.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval TRUE Promiscuous mode is enabled.\n @retval FALSE Promiscuous mode is disabled."]
2106 pub fn otPlatRadioGetPromiscuous(aInstance: *mut otInstance) -> bool;
2107}
2108unsafe extern "C" {
2109 #[doc = " Enable or disable promiscuous mode.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode."]
2110 pub fn otPlatRadioSetPromiscuous(aInstance: *mut otInstance, aEnable: bool);
2111}
2112unsafe extern "C" {
2113 #[doc = " Sets the rx-on-when-idle state to the radio platform.\n\n There are a few situations that the radio can enter sleep state if the device is in rx-off-when-idle state but\n it's hard and costly for the SubMac to identify these situations and instruct the radio to enter sleep:\n\n - Finalization of a regular frame reception task, provided that:\n - The frame is received without errors and passes the filtering and it's not an spurious ACK.\n - ACK is not requested or transmission of ACK is not possible due to internal conditions.\n - Finalization of a frame transmission or transmission of an ACK frame, when ACK is not requested in the transmitted\n frame.\n - Finalization of the reception operation of a requested ACK due to:\n - ACK timeout expiration.\n - Reception of an invalid ACK or not an ACK frame.\n - Reception of the proper ACK, unless the transmitted frame was a Data Request Command and the frame pending bit\n on the received ACK is set to true. In this case the radio platform implementation SHOULD keep the receiver on\n until a determined timeout which triggers an idle period start.`OPENTHREAD_CONFIG_MAC_DATA_POLL_TIMEOUT` can be\n taken as a reference for this.\n - Finalization of a stand alone CCA task.\n - Finalization of a CCA operation with busy result during CSMA/CA procedure.\n - Finalization of an Energy Detection task.\n - Finalization of a radio reception window scheduled with `otPlatRadioReceiveAt`.\n\n If a platform supports `OT_RADIO_CAPS_RX_ON_WHEN_IDLE` it must also support `OT_RADIO_CAPS_CSMA_BACKOFF` and handle\n idle periods after CCA as described above.\n\n Upon the transition of the \"RxOnWhenIdle\" flag from TRUE to FALSE, the radio platform should enter sleep mode.\n If the radio is currently in receive mode, it should enter sleep mode immediately. Otherwise, it should enter sleep\n mode after the current operation is completed.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable TRUE to keep radio in Receive state, FALSE to put to Sleep state during idle periods."]
2114 pub fn otPlatRadioSetRxOnWhenIdle(aInstance: *mut otInstance, aEnable: bool);
2115}
2116unsafe extern "C" {
2117 #[doc = " Update MAC keys and key index\n\n Is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability.\n\n The radio platform should reset the current security MAC frame counter tracked by the radio on this call. While this\n is highly recommended, the OpenThread stack, as a safeguard, will also reset the frame counter using the\n `otPlatRadioSetMacFrameCounter()` before calling this API.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyIdMode The key ID mode.\n @param[in] aKeyId Current MAC key index.\n @param[in] aPrevKey A pointer to the previous MAC key.\n @param[in] aCurrKey A pointer to the current MAC key.\n @param[in] aNextKey A pointer to the next MAC key.\n @param[in] aKeyType Key Type used."]
2118 pub fn otPlatRadioSetMacKey(
2119 aInstance: *mut otInstance,
2120 aKeyIdMode: u8,
2121 aKeyId: u8,
2122 aPrevKey: *const otMacKeyMaterial,
2123 aCurrKey: *const otMacKeyMaterial,
2124 aNextKey: *const otMacKeyMaterial,
2125 aKeyType: otRadioKeyType,
2126 );
2127}
2128unsafe extern "C" {
2129 #[doc = " Sets the current MAC frame counter value.\n\n Is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMacFrameCounter The MAC frame counter value."]
2130 pub fn otPlatRadioSetMacFrameCounter(aInstance: *mut otInstance, aMacFrameCounter: u32);
2131}
2132unsafe extern "C" {
2133 #[doc = " Sets the current MAC frame counter value only if the new given value is larger than the current value.\n\n Is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMacFrameCounter The MAC frame counter value."]
2134 pub fn otPlatRadioSetMacFrameCounterIfLarger(aInstance: *mut otInstance, aMacFrameCounter: u32);
2135}
2136unsafe extern "C" {
2137 #[doc = " Get the current time in microseconds referenced to a continuous monotonic\n local radio clock (64 bits width).\n\n The radio clock SHALL NOT wrap during the device's uptime. Implementations\n SHALL therefore identify and compensate for internal counter overflows. The\n clock does not have a defined epoch and it SHALL NOT introduce any continuous\n or discontinuous adjustments (e.g. leap seconds). Implementations SHALL\n compensate for any sleep times of the device.\n\n Implementations MAY choose to discipline the radio clock and compensate for\n sleep times by any means (e.g. by combining a high precision/low power RTC\n with a high resolution counter) as long as the exposed combined clock\n provides continuous monotonic microsecond resolution ticks within the\n accuracy limits announced by @ref otPlatRadioGetCslAccuracy.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current time in microseconds. UINT64_MAX when platform does not\n support or radio time is not ready."]
2138 pub fn otPlatRadioGetNow(aInstance: *mut otInstance) -> u64;
2139}
2140unsafe extern "C" {
2141 #[doc = " Get the bus speed in bits/second between the host and the radio chip.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The bus speed in bits/second between the host and the radio chip.\n Return 0 when the MAC and above layer and Radio layer resides on the same chip."]
2142 pub fn otPlatRadioGetBusSpeed(aInstance: *mut otInstance) -> u32;
2143}
2144unsafe extern "C" {
2145 #[doc = " Get the bus latency in microseconds between the host and the radio chip.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The bus latency in microseconds between the host and the radio chip.\n Return 0 when the MAC and above layer and Radio layer resides on the same chip."]
2146 pub fn otPlatRadioGetBusLatency(aInstance: *mut otInstance) -> u32;
2147}
2148unsafe extern "C" {
2149 #[doc = " Get current state of the radio.\n\n Is not required by OpenThread. It may be used for debugging and/or application-specific purposes.\n\n @note This function may be not implemented. It does not affect OpenThread.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @return Current state of the radio."]
2150 pub fn otPlatRadioGetState(aInstance: *mut otInstance) -> otRadioState;
2151}
2152unsafe extern "C" {
2153 #[doc = " Enable the radio.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully enabled.\n @retval OT_ERROR_FAILED The radio could not be enabled."]
2154 pub fn otPlatRadioEnable(aInstance: *mut otInstance) -> otError;
2155}
2156unsafe extern "C" {
2157 #[doc = " Disable the radio.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully transitioned to Disabled.\n @retval OT_ERROR_INVALID_STATE The radio was not in sleep state."]
2158 pub fn otPlatRadioDisable(aInstance: *mut otInstance) -> otError;
2159}
2160unsafe extern "C" {
2161 #[doc = " Check whether radio is enabled or not.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns TRUE if the radio is enabled, FALSE otherwise."]
2162 pub fn otPlatRadioIsEnabled(aInstance: *mut otInstance) -> bool;
2163}
2164unsafe extern "C" {
2165 #[doc = " Transition the radio from Receive to Sleep (turn off the radio).\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully transitioned to Sleep.\n @retval OT_ERROR_BUSY The radio was transmitting.\n @retval OT_ERROR_INVALID_STATE The radio was disabled."]
2166 pub fn otPlatRadioSleep(aInstance: *mut otInstance) -> otError;
2167}
2168unsafe extern "C" {
2169 #[doc = " Transition the radio from Sleep to Receive (turn on the radio).\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The channel to use for receiving.\n\n @retval OT_ERROR_NONE Successfully transitioned to Receive.\n @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting."]
2170 pub fn otPlatRadioReceive(aInstance: *mut otInstance, aChannel: u8) -> otError;
2171}
2172unsafe extern "C" {
2173 #[doc = " Schedule a radio reception window at a specific time and duration.\n\n After a radio reception is successfully scheduled for a future time and duration, a subsequent call to this\n function MUST be handled as follows:\n\n - If the start time of the previously scheduled reception window has not yet been reached, the new call to\n `otPlatRadioReceiveAt()` MUST cancel the previous schedule, effectively replacing it.\n\n - If the start of the previous window has already passed, the previous receive schedule is already being executed\n by the radio and MUST NOT be replaced or impacted. The new call to `otPlatRadioReceiveAt()` would then schedule\n a new future receive window. In particular, if the new `otPlatRadioReceiveAt()` call occurs after the start\n but while still within the previous reception window, the ongoing reception window MUST NOT be impacted.\n\n @param[in] aChannel The radio channel on which to receive.\n @param[in] aStart The receive window start time relative to the local\n radio clock, see `otPlatRadioGetNow`. The radio\n receiver SHALL be on and ready to receive the first\n symbol of a frame's SHR at the window start time.\n @param[in] aDuration The receive window duration, in microseconds, as\n measured by the local radio clock. The radio SHOULD be\n turned off (or switched to TX mode if an ACK frame\n needs to be sent) after that duration unless it is\n still actively receiving a frame. In the latter case\n the radio SHALL be kept in reception mode until frame\n reception has either succeeded or failed.\n\n @retval OT_ERROR_NONE Successfully scheduled receive window.\n @retval OT_ERROR_FAILED The receive window could not be scheduled. For example, if @p aStart is in the past."]
2174 pub fn otPlatRadioReceiveAt(
2175 aInstance: *mut otInstance,
2176 aChannel: u8,
2177 aStart: u32,
2178 aDuration: u32,
2179 ) -> otError;
2180}
2181unsafe extern "C" {
2182 #[doc = " The radio driver calls this function to notify OpenThread of a received frame.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.\n @param[in] aError OT_ERROR_NONE when successfully received a frame,\n OT_ERROR_ABORT when reception was aborted and a frame was not received,\n OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space."]
2183 pub fn otPlatRadioReceiveDone(
2184 aInstance: *mut otInstance,
2185 aFrame: *mut otRadioFrame,
2186 aError: otError,
2187 );
2188}
2189unsafe extern "C" {
2190 #[doc = " The radio driver calls this function to notify OpenThread diagnostics module of a received frame.\n\n @note This function is deprecated and will be removed in the future. It is recommended to use the function\n `otPlatRadioReceiveDone()`.\n\n Is used when diagnostics is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.\n @param[in] aError OT_ERROR_NONE when successfully received a frame,\n OT_ERROR_ABORT when reception was aborted and a frame was not received,\n OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space."]
2191 pub fn otPlatDiagRadioReceiveDone(
2192 aInstance: *mut otInstance,
2193 aFrame: *mut otRadioFrame,
2194 aError: otError,
2195 );
2196}
2197unsafe extern "C" {
2198 #[doc = " Get the radio transmit frame buffer.\n\n OpenThread forms the IEEE 802.15.4 frame in this buffer then calls `otPlatRadioTransmit()` to request transmission.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns A pointer to the transmit frame buffer."]
2199 pub fn otPlatRadioGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
2200}
2201unsafe extern "C" {
2202 #[doc = " Begin the transmit sequence on the radio.\n\n The caller must form the IEEE 802.15.4 frame in the buffer provided by `otPlatRadioGetTransmitBuffer()` before\n requesting transmission. The channel and transmit power are also included in the otRadioFrame structure.\n\n The transmit sequence consists of:\n 1. Transitioning the radio to Transmit from one of the following states:\n - Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported\n - Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported.\n 2. Transmits the psdu on the given channel and at the given transmit power.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aFrame A pointer to the frame to be transmitted.\n\n @retval OT_ERROR_NONE Successfully transitioned to Transmit.\n @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state."]
2203 pub fn otPlatRadioTransmit(aInstance: *mut otInstance, aFrame: *mut otRadioFrame) -> otError;
2204}
2205unsafe extern "C" {
2206 #[doc = " The radio driver calls this function to notify OpenThread that the transmission has started.\n\n @note This function should be called by the same thread that executes all of the other OpenThread code. It should\n not be called by ISR or any other task.\n\n @param[in] aInstance A pointer to the OpenThread instance structure.\n @param[in] aFrame A pointer to the frame that is being transmitted."]
2207 pub fn otPlatRadioTxStarted(aInstance: *mut otInstance, aFrame: *mut otRadioFrame);
2208}
2209unsafe extern "C" {
2210 #[doc = " The radio driver calls this function to notify OpenThread that the transmit operation has completed,\n providing both the transmitted frame and, if applicable, the received ack frame.\n\n When radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, radio platform layer updates @p aFrame\n with the security frame counter and key index values maintained by the radio.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aFrame A pointer to the frame that was transmitted.\n @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.\n @param[in] aError OT_ERROR_NONE when the frame was transmitted,\n OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,\n OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel,\n OT_ERROR_ABORT when transmission was aborted for other reasons."]
2211 pub fn otPlatRadioTxDone(
2212 aInstance: *mut otInstance,
2213 aFrame: *mut otRadioFrame,
2214 aAckFrame: *mut otRadioFrame,
2215 aError: otError,
2216 );
2217}
2218unsafe extern "C" {
2219 #[doc = " The radio driver calls this function to notify OpenThread diagnostics module that the transmission has completed.\n\n @note This function is deprecated and will be removed in the future. It is recommended to use the function\n `otPlatRadioTxDone()`.\n\n Is used when diagnostics is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aFrame A pointer to the frame that was transmitted.\n @param[in] aError OT_ERROR_NONE when the frame was transmitted,\n OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel,\n OT_ERROR_ABORT when transmission was aborted for other reasons."]
2220 pub fn otPlatDiagRadioTransmitDone(
2221 aInstance: *mut otInstance,
2222 aFrame: *mut otRadioFrame,
2223 aError: otError,
2224 );
2225}
2226unsafe extern "C" {
2227 #[doc = " Return a recent RSSI measurement when the radio is in receive state.\n\n If the radio is not in receive state, then `OT_RADIO_RSSI_INVALID` MUST be returned. If the radio is in receive\n state, then a single RSSI measurement is taken on the current receive channel and returned.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The RSSI in dBm when it is valid. `OT_RADIO_RSSI_INVALID` when RSSI is invalid."]
2228 pub fn otPlatRadioGetRssi(aInstance: *mut otInstance) -> i8;
2229}
2230unsafe extern "C" {
2231 #[doc = " Begin the energy scan sequence on the radio.\n\n Is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aScanChannel The channel to perform the energy scan on.\n @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned.\n\n @retval OT_ERROR_NONE Successfully started scanning the channel.\n @retval OT_ERROR_BUSY The radio is performing energy scanning.\n @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning."]
2232 pub fn otPlatRadioEnergyScan(
2233 aInstance: *mut otInstance,
2234 aScanChannel: u8,
2235 aScanDuration: u16,
2236 ) -> otError;
2237}
2238unsafe extern "C" {
2239 #[doc = " The radio driver calls this function to notify OpenThread that the energy scan is complete.\n\n Is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel."]
2240 pub fn otPlatRadioEnergyScanDone(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8);
2241}
2242unsafe extern "C" {
2243 #[doc = " The radio driver calls this function to notify OpenThread that the spinel bus latency has been changed.\n\n @param[in] aInstance The OpenThread instance structure."]
2244 pub fn otPlatRadioBusLatencyChanged(aInstance: *mut otInstance);
2245}
2246unsafe extern "C" {
2247 #[doc = " Enable/Disable source address match feature.\n\n The source address match feature controls how the radio layer decides the \"frame pending\" bit for acks sent in\n response to data request commands from children.\n\n If disabled, the radio layer must set the \"frame pending\" on all acks to data request commands.\n\n If enabled, the radio layer uses the source address match table to determine whether to set or clear the \"frame\n pending\" bit in an ack to a data request command.\n\n The source address match table provides the list of children for which there is a pending frame. Either a short\n address or an extended/long address can be added to the source address match table.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable Enable/disable source address match feature."]
2248 pub fn otPlatRadioEnableSrcMatch(aInstance: *mut otInstance, aEnable: bool);
2249}
2250unsafe extern "C" {
2251 #[doc = " Add a short address to the source address match table.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aShortAddress The short address to be added.\n\n @retval OT_ERROR_NONE Successfully added short address to the source match table.\n @retval OT_ERROR_NO_BUFS No available entry in the source match table."]
2252 pub fn otPlatRadioAddSrcMatchShortEntry(
2253 aInstance: *mut otInstance,
2254 aShortAddress: otShortAddress,
2255 ) -> otError;
2256}
2257unsafe extern "C" {
2258 #[doc = " Add an extended address to the source address match table.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aExtAddress The extended address to be added stored in little-endian byte order.\n\n @retval OT_ERROR_NONE Successfully added extended address to the source match table.\n @retval OT_ERROR_NO_BUFS No available entry in the source match table."]
2259 pub fn otPlatRadioAddSrcMatchExtEntry(
2260 aInstance: *mut otInstance,
2261 aExtAddress: *const otExtAddress,
2262 ) -> otError;
2263}
2264unsafe extern "C" {
2265 #[doc = " Remove a short address from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aShortAddress The short address to be removed.\n\n @retval OT_ERROR_NONE Successfully removed short address from the source match table.\n @retval OT_ERROR_NO_ADDRESS The short address is not in source address match table."]
2266 pub fn otPlatRadioClearSrcMatchShortEntry(
2267 aInstance: *mut otInstance,
2268 aShortAddress: otShortAddress,
2269 ) -> otError;
2270}
2271unsafe extern "C" {
2272 #[doc = " Remove an extended address from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aExtAddress The extended address to be removed stored in little-endian byte order.\n\n @retval OT_ERROR_NONE Successfully removed the extended address from the source match table.\n @retval OT_ERROR_NO_ADDRESS The extended address is not in source address match table."]
2273 pub fn otPlatRadioClearSrcMatchExtEntry(
2274 aInstance: *mut otInstance,
2275 aExtAddress: *const otExtAddress,
2276 ) -> otError;
2277}
2278unsafe extern "C" {
2279 #[doc = " Clear all short addresses from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2280 pub fn otPlatRadioClearSrcMatchShortEntries(aInstance: *mut otInstance);
2281}
2282unsafe extern "C" {
2283 #[doc = " Clear all the extended/long addresses from source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2284 pub fn otPlatRadioClearSrcMatchExtEntries(aInstance: *mut otInstance);
2285}
2286unsafe extern "C" {
2287 #[doc = " Get the radio supported channel mask that the device is allowed to be on.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The radio supported channel mask."]
2288 pub fn otPlatRadioGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
2289}
2290unsafe extern "C" {
2291 #[doc = " Gets the radio preferred channel mask that the device prefers to form on.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The radio preferred channel mask."]
2292 pub fn otPlatRadioGetPreferredChannelMask(aInstance: *mut otInstance) -> u32;
2293}
2294unsafe extern "C" {
2295 #[doc = " Enable the radio coex.\n\n Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnabled TRUE to enable the radio coex, FALSE otherwise.\n\n @retval OT_ERROR_NONE Successfully enabled.\n @retval OT_ERROR_FAILED The radio coex could not be enabled."]
2296 pub fn otPlatRadioSetCoexEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
2297}
2298unsafe extern "C" {
2299 #[doc = " Check whether radio coex is enabled or not.\n\n Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns TRUE if the radio coex is enabled, FALSE otherwise."]
2300 pub fn otPlatRadioIsCoexEnabled(aInstance: *mut otInstance) -> bool;
2301}
2302unsafe extern "C" {
2303 #[doc = " Get the radio coexistence metrics.\n\n Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aCoexMetrics A pointer to the coexistence metrics structure.\n\n @retval OT_ERROR_NONE Successfully retrieved the coex metrics.\n @retval OT_ERROR_INVALID_ARGS @p aCoexMetrics was NULL."]
2304 pub fn otPlatRadioGetCoexMetrics(
2305 aInstance: *mut otInstance,
2306 aCoexMetrics: *mut otRadioCoexMetrics,
2307 ) -> otError;
2308}
2309unsafe extern "C" {
2310 #[doc = " Enable or disable CSL receiver.\n\n Regarding @p aExtAddr, this function assumes big-endian byte order. Note that this differs from\n `otPlatRadioSetExtendedAddress()`, `otPlatRadioAddSrcMatchExtEntry()`, and `otPlatRadioClearSrcMatchExtEntry()`,\n which use little-endian byte order for the Extended MAC address.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCslPeriod CSL period, 0 for disabling CSL. CSL period is in unit of 10 symbols.\n @param[in] aShortAddr The short source address of CSL receiver's peer.\n @param[in] aExtAddr The extended source address of CSL receiver's peer. The @p aExtAddr assumes big-endian\n byte order.\n\n @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks.\n\n @retval OT_ERROR_NOT_IMPLEMENTED Radio driver doesn't support CSL.\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully enabled or disabled CSL."]
2311 pub fn otPlatRadioEnableCsl(
2312 aInstance: *mut otInstance,
2313 aCslPeriod: u32,
2314 aShortAddr: otShortAddress,
2315 aExtAddr: *const otExtAddress,
2316 ) -> otError;
2317}
2318unsafe extern "C" {
2319 #[doc = " Reset CSL receiver in the platform.\n\n @note Defaults to `otPlatRadioEnableCsl(aInstance,0, Mac::kShortAddrInvalid, NULL);`\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NOT_IMPLEMENTED Radio driver doesn't support CSL.\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully disabled CSL."]
2320 pub fn otPlatRadioResetCsl(aInstance: *mut otInstance) -> otError;
2321}
2322unsafe extern "C" {
2323 #[doc = " Update CSL sample time in radio driver.\n\n Sample time is stored in radio driver as a copy to calculate phase when\n sending ACK with CSL IE. The CSL sample (window) of the CSL receiver extends\n before and after the sample time. The CSL sample time marks a timestamp in\n the CSL sample window when a frame should be received in \"ideal conditions\"\n if there would be no inaccuracy/clock-drift.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCslSampleTime The next sample time, in microseconds. It is\n the time when the first symbol of the MHR of\n the frame is expected."]
2324 pub fn otPlatRadioUpdateCslSampleTime(aInstance: *mut otInstance, aCslSampleTime: u32);
2325}
2326unsafe extern "C" {
2327 #[doc = " Get the current estimated worst case accuracy (maximum ± deviation from the\n nominal frequency) of the local radio clock in units of PPM. This is the\n clock used to schedule CSL operations.\n\n @note Implementations MAY estimate this value based on current operating\n conditions (e.g. temperature).\n\n In case the implementation does not estimate the current value but returns a\n fixed value, this value MUST be the worst-case accuracy over all possible\n foreseen operating conditions (temperature, pressure, etc) of the\n implementation.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current CSL rx/tx scheduling drift, in PPM."]
2328 pub fn otPlatRadioGetCslAccuracy(aInstance: *mut otInstance) -> u8;
2329}
2330unsafe extern "C" {
2331 #[doc = " The fixed uncertainty (i.e. random jitter) of the arrival time of CSL\n transmissions received by this device in units of 10 microseconds.\n\n This designates the worst case constant positive or negative deviation of\n the actual arrival time of a transmission from the transmission time\n calculated relative to the local radio clock independent of elapsed time. In\n addition to uncertainty accumulated over elapsed time, the CSL channel sample\n (\"RX window\") must be extended by twice this deviation such that an actual\n transmission is guaranteed to be detected by the local receiver in the\n presence of random arrival time jitter.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL Uncertainty in units of 10 us."]
2332 pub fn otPlatRadioGetCslUncertainty(aInstance: *mut otInstance) -> u8;
2333}
2334unsafe extern "C" {
2335 #[doc = " Set the max transmit power for a specific channel.\n\n @note This function will be deprecated in October 2027. It is recommended to use the function\n `otPlatRadioSetChannelTargetPower()`.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel.\n @param[in] aMaxPower The max power in dBm, passing OT_RADIO_RSSI_INVALID will disable this channel.\n\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented\n @retval OT_ERROR_INVALID_ARGS The specified channel is not valid.\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully set max transmit power."]
2336 pub fn otPlatRadioSetChannelMaxTransmitPower(
2337 aInstance: *mut otInstance,
2338 aChannel: u8,
2339 aMaxPower: i8,
2340 ) -> otError;
2341}
2342unsafe extern "C" {
2343 #[doc = " Set the region code.\n\n The radio region format is the 2-bytes ascii representation of the\n ISO 3166 alpha-2 code.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aRegionCode The radio region code. The `aRegionCode >> 8` is first ascii char\n and the `aRegionCode & 0xff` is the second ascii char.\n\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully set region code.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
2344 pub fn otPlatRadioSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
2345}
2346unsafe extern "C" {
2347 #[doc = " Get the region code.\n\n The radio region format is the 2-bytes ascii representation of the\n ISO 3166 alpha-2 code.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aRegionCode The radio region.\n\n @retval OT_ERROR_INVALID_ARGS @p aRegionCode is NULL.\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully got region code.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
2348 pub fn otPlatRadioGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
2349}
2350unsafe extern "C" {
2351 #[doc = " Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator.\n\n After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that\n node should include Vendor-Specific IE containing Link Metrics data. This function informs the radio to start/stop to\n collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that\n Probing Initiator.\n\n Regarding @p aExtAddress, this function assumes big-endian byte order. Note that this differs from\n `otPlatRadioSetExtendedAddress()`, `otPlatRadioAddSrcMatchExtEntry()`, and `otPlatRadioClearSrcMatchExtEntry()`,\n which use little-endian byte order for the Extended MAC address.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aLinkMetrics This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics\n can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0.\n @param[in] aShortAddress The short address of the Probing Initiator.\n @param[in] aExtAddress The extended source address of the Probing Initiator. @p aExtAddress MUST NOT be `NULL`.\n The @p aExtAddress assumes big-endian byte order.\n\n @retval OT_ERROR_NONE Successfully configured the Enhanced-ACK Based Probing.\n @retval OT_ERROR_INVALID_ARGS @p aExtAddress is `NULL`.\n @retval OT_ERROR_NOT_FOUND The Initiator indicated by @p aShortAddress is not found when trying to clear.\n @retval OT_ERROR_NO_BUFS No more Initiator can be supported.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
2352 pub fn otPlatRadioConfigureEnhAckProbing(
2353 aInstance: *mut otInstance,
2354 aLinkMetrics: otLinkMetrics,
2355 aShortAddress: otShortAddress,
2356 aExtAddress: *const otExtAddress,
2357 ) -> otError;
2358}
2359unsafe extern "C" {
2360 #[doc = " Add a calibrated power of the specified channel to the power calibration table.\n\n @note This API is an optional radio platform API. It's up to the platform layer to implement it.\n\n The @p aActualPower is the actual measured output power when the parameters of the radio hardware modules\n are set to the @p aRawPowerSetting.\n\n The raw power setting is an opaque byte array. OpenThread doesn't define the format of the raw power setting.\n Its format is radio hardware related and it should be defined by the developers in the platform radio driver.\n For example, if the radio hardware contains both the radio chip and the FEM chip, the raw power setting can be\n a combination of the radio power register and the FEM gain value.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel.\n @param[in] aActualPower The actual power in 0.01dBm.\n @param[in] aRawPowerSetting A pointer to the raw power setting byte array.\n @param[in] aRawPowerSettingLength The length of the @p aRawPowerSetting.\n\n @retval OT_ERROR_NONE Successfully added the calibrated power to the power calibration table.\n @retval OT_ERROR_NO_BUFS No available entry in the power calibration table.\n @retval OT_ERROR_INVALID_ARGS The @p aChannel, @p aActualPower or @p aRawPowerSetting is invalid or the\n @p aActualPower already exists in the power calibration table.\n @retval OT_ERROR_NOT_IMPLEMENTED This feature is not implemented."]
2361 pub fn otPlatRadioAddCalibratedPower(
2362 aInstance: *mut otInstance,
2363 aChannel: u8,
2364 aActualPower: i16,
2365 aRawPowerSetting: *const u8,
2366 aRawPowerSettingLength: u16,
2367 ) -> otError;
2368}
2369unsafe extern "C" {
2370 #[doc = " Clear all calibrated powers from the power calibration table.\n\n @note This API is an optional radio platform API. It's up to the platform layer to implement it.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully cleared all calibrated powers from the power calibration table.\n @retval OT_ERROR_NOT_IMPLEMENTED This feature is not implemented."]
2371 pub fn otPlatRadioClearCalibratedPowers(aInstance: *mut otInstance) -> otError;
2372}
2373unsafe extern "C" {
2374 #[doc = " Set the target power for the given channel.\n\n @note This API is an optional radio platform API. It's up to the platform layer to implement it.\n If this function and `otPlatRadioSetTransmitPower()` are implemented at the same time:\n - If neither of these two functions is called, the radio outputs the platform-defined default power.\n - If both functions are called, the last one to be called takes effect.\n\n The radio driver should set the actual output power to be less than or equal to the @p aTargetPower and as close\n as possible to the @p aTargetPower. If the @p aTargetPower is lower than the minimum output power supported\n by the platform, the output power should be set to the minimum output power supported by the platform. If the\n @p aTargetPower is higher than the maximum output power supported by the platform, the output power should be\n set to the maximum output power supported by the platform. If the @p aTargetPower is set to `INT16_MAX`, the\n corresponding channel is disabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel.\n @param[in] aTargetPower The target power in 0.01dBm.\n\n @retval OT_ERROR_NONE Successfully set the target power.\n @retval OT_ERROR_INVALID_ARGS The @p aChannel is invalid.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
2375 pub fn otPlatRadioSetChannelTargetPower(
2376 aInstance: *mut otInstance,
2377 aChannel: u8,
2378 aTargetPower: i16,
2379 ) -> otError;
2380}
2381unsafe extern "C" {
2382 #[doc = " Get the raw power setting for the given channel.\n\n @note OpenThread `src/core/utils` implements a default implementation of the API `otPlatRadioAddCalibratedPower()`,\n `otPlatRadioClearCalibratedPowers()` and `otPlatRadioSetChannelTargetPower()`. This API is provided by\n the default implementation to get the raw power setting for the given channel. If the platform doesn't\n use the default implementation, it can ignore this API.\n\n Platform radio layer should parse the raw power setting based on the radio layer defined format and set the\n parameters of each radio hardware module.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel.\n @param[out] aRawPowerSetting A pointer to the raw power setting byte array.\n @param[in,out] aRawPowerSettingLength On input, a pointer to the size of @p aRawPowerSetting.\n On output, a pointer to the length of the raw power setting data.\n\n @retval OT_ERROR_NONE Successfully got the target power.\n @retval OT_ERROR_INVALID_ARGS The @p aChannel is invalid, @p aRawPowerSetting or @p aRawPowerSettingLength is NULL\n or @aRawPowerSettingLength is too short.\n @retval OT_ERROR_NOT_FOUND The raw power setting for the @p aChannel was not found."]
2383 pub fn otPlatRadioGetRawPowerSetting(
2384 aInstance: *mut otInstance,
2385 aChannel: u8,
2386 aRawPowerSetting: *mut u8,
2387 aRawPowerSettingLength: *mut u16,
2388 ) -> otError;
2389}
2390#[doc = " @struct otIp6InterfaceIdentifier\n\n Represents the Interface Identifier of an IPv6 address."]
2391#[repr(C, packed)]
2392#[derive(Copy, Clone)]
2393pub struct otIp6InterfaceIdentifier {
2394 #[doc = "< The Interface Identifier accessor fields"]
2395 pub mFields: otIp6InterfaceIdentifier__bindgen_ty_1,
2396}
2397#[repr(C, packed)]
2398#[derive(Copy, Clone)]
2399pub union otIp6InterfaceIdentifier__bindgen_ty_1 {
2400 #[doc = "< 8-bit fields"]
2401 pub m8: [u8; 8usize],
2402 #[doc = "< 16-bit fields"]
2403 pub m16: [u16; 4usize],
2404 #[doc = "< 32-bit fields"]
2405 pub m32: [u32; 2usize],
2406}
2407impl Default for otIp6InterfaceIdentifier__bindgen_ty_1 {
2408 fn default() -> Self {
2409 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2410 unsafe {
2411 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2412 s.assume_init()
2413 }
2414 }
2415}
2416impl Default for otIp6InterfaceIdentifier {
2417 fn default() -> Self {
2418 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2419 unsafe {
2420 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2421 s.assume_init()
2422 }
2423 }
2424}
2425#[doc = " @struct otIp6NetworkPrefix\n\n Represents the Network Prefix of an IPv6 address (most significant 64 bits of the address)."]
2426#[repr(C, packed)]
2427#[derive(Debug, Default, Copy, Clone)]
2428pub struct otIp6NetworkPrefix {
2429 #[doc = "< The Network Prefix."]
2430 pub m8: [u8; 8usize],
2431}
2432#[doc = " @struct otIp6AddressComponents\n\n Represents the components of an IPv6 address."]
2433#[repr(C, packed)]
2434#[derive(Copy, Clone)]
2435pub struct otIp6AddressComponents {
2436 #[doc = "< The Network Prefix (most significant 64 bits of the address)"]
2437 pub mNetworkPrefix: otIp6NetworkPrefix,
2438 #[doc = "< The Interface Identifier (least significant 64 bits of the address)"]
2439 pub mIid: otIp6InterfaceIdentifier,
2440}
2441impl Default for otIp6AddressComponents {
2442 fn default() -> Self {
2443 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2444 unsafe {
2445 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2446 s.assume_init()
2447 }
2448 }
2449}
2450#[doc = " @struct otIp6Address\n\n Represents an IPv6 address."]
2451#[repr(C, packed)]
2452#[derive(Copy, Clone)]
2453pub struct otIp6Address {
2454 #[doc = "< IPv6 accessor fields"]
2455 pub mFields: otIp6Address__bindgen_ty_1,
2456}
2457#[repr(C, packed)]
2458#[derive(Copy, Clone)]
2459pub union otIp6Address__bindgen_ty_1 {
2460 #[doc = "< 8-bit fields"]
2461 pub m8: [u8; 16usize],
2462 #[doc = "< 16-bit fields"]
2463 pub m16: [u16; 8usize],
2464 #[doc = "< 32-bit fields"]
2465 pub m32: [u32; 4usize],
2466 #[doc = "< IPv6 address components"]
2467 pub mComponents: otIp6AddressComponents,
2468}
2469impl Default for otIp6Address__bindgen_ty_1 {
2470 fn default() -> Self {
2471 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2472 unsafe {
2473 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2474 s.assume_init()
2475 }
2476 }
2477}
2478impl Default for otIp6Address {
2479 fn default() -> Self {
2480 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2481 unsafe {
2482 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2483 s.assume_init()
2484 }
2485 }
2486}
2487#[doc = " @struct otIp6Prefix\n\n Represents an IPv6 prefix."]
2488#[repr(C, packed)]
2489#[derive(Copy, Clone)]
2490pub struct otIp6Prefix {
2491 #[doc = "< The IPv6 prefix."]
2492 pub mPrefix: otIp6Address,
2493 #[doc = "< The IPv6 prefix length (in bits)."]
2494 pub mLength: u8,
2495}
2496impl Default for otIp6Prefix {
2497 fn default() -> Self {
2498 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2499 unsafe {
2500 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2501 s.assume_init()
2502 }
2503 }
2504}
2505#[doc = "< Thread assigned (ALOC, RLOC, MLEID, etc.)"]
2506pub const OT_ADDRESS_ORIGIN_THREAD: _bindgen_ty_7 = 0;
2507#[doc = "< SLAAC assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2508pub const OT_ADDRESS_ORIGIN_SLAAC: _bindgen_ty_7 = 1;
2509#[doc = "< DHCPv6 assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2510pub const OT_ADDRESS_ORIGIN_DHCPV6: _bindgen_ty_7 = 2;
2511#[doc = "< Manually assigned address."]
2512pub const OT_ADDRESS_ORIGIN_MANUAL: _bindgen_ty_7 = 3;
2513#[doc = " IPv6 Address origins"]
2514pub type _bindgen_ty_7 = ::std::os::raw::c_uint;
2515#[doc = " Represents an IPv6 network interface unicast address."]
2516#[repr(C)]
2517#[derive(Copy, Clone)]
2518pub struct otNetifAddress {
2519 #[doc = "< The IPv6 unicast address."]
2520 pub mAddress: otIp6Address,
2521 #[doc = "< The Prefix length (in bits)."]
2522 pub mPrefixLength: u8,
2523 #[doc = "< The IPv6 address origin (OT_ADDRESS_ORIGIN_* values)."]
2524 pub mAddressOrigin: u8,
2525 pub _bitfield_align_1: [u8; 0],
2526 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
2527 #[doc = "< A pointer to the next network interface address."]
2528 pub mNext: *const otNetifAddress,
2529}
2530impl Default for otNetifAddress {
2531 fn default() -> Self {
2532 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2533 unsafe {
2534 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2535 s.assume_init()
2536 }
2537 }
2538}
2539impl otNetifAddress {
2540 #[inline]
2541 pub fn mPreferred(&self) -> bool {
2542 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2543 }
2544 #[inline]
2545 pub fn set_mPreferred(&mut self, val: bool) {
2546 unsafe {
2547 let val: u8 = ::std::mem::transmute(val);
2548 self._bitfield_1.set(0usize, 1u8, val as u64)
2549 }
2550 }
2551 #[inline]
2552 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
2553 unsafe {
2554 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2555 ::std::ptr::addr_of!((*this)._bitfield_1),
2556 0usize,
2557 1u8,
2558 ) as u8)
2559 }
2560 }
2561 #[inline]
2562 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
2563 unsafe {
2564 let val: u8 = ::std::mem::transmute(val);
2565 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2566 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2567 0usize,
2568 1u8,
2569 val as u64,
2570 )
2571 }
2572 }
2573 #[inline]
2574 pub fn mValid(&self) -> bool {
2575 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2576 }
2577 #[inline]
2578 pub fn set_mValid(&mut self, val: bool) {
2579 unsafe {
2580 let val: u8 = ::std::mem::transmute(val);
2581 self._bitfield_1.set(1usize, 1u8, val as u64)
2582 }
2583 }
2584 #[inline]
2585 pub unsafe fn mValid_raw(this: *const Self) -> bool {
2586 unsafe {
2587 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2588 ::std::ptr::addr_of!((*this)._bitfield_1),
2589 1usize,
2590 1u8,
2591 ) as u8)
2592 }
2593 }
2594 #[inline]
2595 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
2596 unsafe {
2597 let val: u8 = ::std::mem::transmute(val);
2598 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2599 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2600 1usize,
2601 1u8,
2602 val as u64,
2603 )
2604 }
2605 }
2606 #[inline]
2607 pub fn mScopeOverrideValid(&self) -> bool {
2608 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2609 }
2610 #[inline]
2611 pub fn set_mScopeOverrideValid(&mut self, val: bool) {
2612 unsafe {
2613 let val: u8 = ::std::mem::transmute(val);
2614 self._bitfield_1.set(2usize, 1u8, val as u64)
2615 }
2616 }
2617 #[inline]
2618 pub unsafe fn mScopeOverrideValid_raw(this: *const Self) -> bool {
2619 unsafe {
2620 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2621 ::std::ptr::addr_of!((*this)._bitfield_1),
2622 2usize,
2623 1u8,
2624 ) as u8)
2625 }
2626 }
2627 #[inline]
2628 pub unsafe fn set_mScopeOverrideValid_raw(this: *mut Self, val: bool) {
2629 unsafe {
2630 let val: u8 = ::std::mem::transmute(val);
2631 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2632 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2633 2usize,
2634 1u8,
2635 val as u64,
2636 )
2637 }
2638 }
2639 #[inline]
2640 pub fn mScopeOverride(&self) -> ::std::os::raw::c_uint {
2641 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 4u8) as u32) }
2642 }
2643 #[inline]
2644 pub fn set_mScopeOverride(&mut self, val: ::std::os::raw::c_uint) {
2645 unsafe {
2646 let val: u32 = ::std::mem::transmute(val);
2647 self._bitfield_1.set(3usize, 4u8, val as u64)
2648 }
2649 }
2650 #[inline]
2651 pub unsafe fn mScopeOverride_raw(this: *const Self) -> ::std::os::raw::c_uint {
2652 unsafe {
2653 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2654 ::std::ptr::addr_of!((*this)._bitfield_1),
2655 3usize,
2656 4u8,
2657 ) as u32)
2658 }
2659 }
2660 #[inline]
2661 pub unsafe fn set_mScopeOverride_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
2662 unsafe {
2663 let val: u32 = ::std::mem::transmute(val);
2664 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2665 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2666 3usize,
2667 4u8,
2668 val as u64,
2669 )
2670 }
2671 }
2672 #[inline]
2673 pub fn mRloc(&self) -> bool {
2674 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
2675 }
2676 #[inline]
2677 pub fn set_mRloc(&mut self, val: bool) {
2678 unsafe {
2679 let val: u8 = ::std::mem::transmute(val);
2680 self._bitfield_1.set(7usize, 1u8, val as u64)
2681 }
2682 }
2683 #[inline]
2684 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
2685 unsafe {
2686 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2687 ::std::ptr::addr_of!((*this)._bitfield_1),
2688 7usize,
2689 1u8,
2690 ) as u8)
2691 }
2692 }
2693 #[inline]
2694 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
2695 unsafe {
2696 let val: u8 = ::std::mem::transmute(val);
2697 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2698 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2699 7usize,
2700 1u8,
2701 val as u64,
2702 )
2703 }
2704 }
2705 #[inline]
2706 pub fn mMeshLocal(&self) -> bool {
2707 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
2708 }
2709 #[inline]
2710 pub fn set_mMeshLocal(&mut self, val: bool) {
2711 unsafe {
2712 let val: u8 = ::std::mem::transmute(val);
2713 self._bitfield_1.set(8usize, 1u8, val as u64)
2714 }
2715 }
2716 #[inline]
2717 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
2718 unsafe {
2719 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2720 ::std::ptr::addr_of!((*this)._bitfield_1),
2721 8usize,
2722 1u8,
2723 ) as u8)
2724 }
2725 }
2726 #[inline]
2727 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
2728 unsafe {
2729 let val: u8 = ::std::mem::transmute(val);
2730 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2731 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2732 8usize,
2733 1u8,
2734 val as u64,
2735 )
2736 }
2737 }
2738 #[inline]
2739 pub fn mSrpRegistered(&self) -> bool {
2740 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
2741 }
2742 #[inline]
2743 pub fn set_mSrpRegistered(&mut self, val: bool) {
2744 unsafe {
2745 let val: u8 = ::std::mem::transmute(val);
2746 self._bitfield_1.set(9usize, 1u8, val as u64)
2747 }
2748 }
2749 #[inline]
2750 pub unsafe fn mSrpRegistered_raw(this: *const Self) -> bool {
2751 unsafe {
2752 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2753 ::std::ptr::addr_of!((*this)._bitfield_1),
2754 9usize,
2755 1u8,
2756 ) as u8)
2757 }
2758 }
2759 #[inline]
2760 pub unsafe fn set_mSrpRegistered_raw(this: *mut Self, val: bool) {
2761 unsafe {
2762 let val: u8 = ::std::mem::transmute(val);
2763 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2764 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2765 9usize,
2766 1u8,
2767 val as u64,
2768 )
2769 }
2770 }
2771 #[inline]
2772 pub fn new_bitfield_1(
2773 mPreferred: bool,
2774 mValid: bool,
2775 mScopeOverrideValid: bool,
2776 mScopeOverride: ::std::os::raw::c_uint,
2777 mRloc: bool,
2778 mMeshLocal: bool,
2779 mSrpRegistered: bool,
2780 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
2781 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
2782 __bindgen_bitfield_unit.set(0usize, 1u8, {
2783 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
2784 mPreferred as u64
2785 });
2786 __bindgen_bitfield_unit.set(1usize, 1u8, {
2787 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
2788 mValid as u64
2789 });
2790 __bindgen_bitfield_unit.set(2usize, 1u8, {
2791 let mScopeOverrideValid: u8 = unsafe { ::std::mem::transmute(mScopeOverrideValid) };
2792 mScopeOverrideValid as u64
2793 });
2794 __bindgen_bitfield_unit.set(3usize, 4u8, {
2795 let mScopeOverride: u32 = unsafe { ::std::mem::transmute(mScopeOverride) };
2796 mScopeOverride as u64
2797 });
2798 __bindgen_bitfield_unit.set(7usize, 1u8, {
2799 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
2800 mRloc as u64
2801 });
2802 __bindgen_bitfield_unit.set(8usize, 1u8, {
2803 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
2804 mMeshLocal as u64
2805 });
2806 __bindgen_bitfield_unit.set(9usize, 1u8, {
2807 let mSrpRegistered: u8 = unsafe { ::std::mem::transmute(mSrpRegistered) };
2808 mSrpRegistered as u64
2809 });
2810 __bindgen_bitfield_unit
2811 }
2812}
2813#[doc = " Represents an IPv6 network interface multicast address.\n\n The `mAddressOrigin` field is set to either `OT_ADDRESS_ORIGIN_THREAD` if the multicast address is subscribed by\n OpenThread core or `OT_ADDRESS_ORIGIN_MANUAL` if it is subscribed manually using `otIp6SubscribeMulticastAddress()`.\n\n The multicast addresses subscribed by OpenThread core include addresses such as\n - link-local all nodes (`ff02::01`),\n - realm-local all nodes (`ff03::01`),\n - link-local all routers (`ff02::02`),\n - realm-local all routers (`ff03::02`),\n - realm-local all MPL forwarders (`ff03::fc`),\n - link-local all Thread nodes,\n - realm-local all Thread nodes."]
2814#[repr(C)]
2815#[derive(Copy, Clone)]
2816pub struct otNetifMulticastAddress {
2817 #[doc = "< The IPv6 multicast address."]
2818 pub mAddress: otIp6Address,
2819 #[doc = "< A pointer to the next multicast address."]
2820 pub mNext: *const otNetifMulticastAddress,
2821 #[doc = "< The multicast address origin."]
2822 pub mAddressOrigin: u8,
2823 #[doc = "< Opaque data used by OpenThread core."]
2824 pub mData: u8,
2825}
2826impl Default for otNetifMulticastAddress {
2827 fn default() -> Self {
2828 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2829 unsafe {
2830 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2831 s.assume_init()
2832 }
2833 }
2834}
2835#[doc = " Represents an IPv6 socket address."]
2836#[repr(C)]
2837#[derive(Copy, Clone)]
2838pub struct otSockAddr {
2839 #[doc = "< An IPv6 address."]
2840 pub mAddress: otIp6Address,
2841 #[doc = "< A transport-layer port."]
2842 pub mPort: u16,
2843}
2844impl Default for otSockAddr {
2845 fn default() -> Self {
2846 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2847 unsafe {
2848 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2849 s.assume_init()
2850 }
2851 }
2852}
2853#[doc = "< Non-ECT"]
2854pub const OT_ECN_NOT_CAPABLE: _bindgen_ty_8 = 0;
2855#[doc = "< ECT(0)"]
2856pub const OT_ECN_CAPABLE_0: _bindgen_ty_8 = 2;
2857#[doc = "< ECT(1)"]
2858pub const OT_ECN_CAPABLE_1: _bindgen_ty_8 = 1;
2859#[doc = "< Congestion encountered (CE)"]
2860pub const OT_ECN_MARKED: _bindgen_ty_8 = 3;
2861#[doc = " ECN statuses, represented as in the IP header."]
2862pub type _bindgen_ty_8 = ::std::os::raw::c_uint;
2863#[doc = " Represents the local and peer IPv6 socket addresses."]
2864#[repr(C)]
2865#[derive(Copy, Clone)]
2866pub struct otMessageInfo {
2867 #[doc = "< The local IPv6 address."]
2868 pub mSockAddr: otIp6Address,
2869 #[doc = "< The peer IPv6 address."]
2870 pub mPeerAddr: otIp6Address,
2871 #[doc = "< The local transport-layer port."]
2872 pub mSockPort: u16,
2873 #[doc = "< The peer transport-layer port."]
2874 pub mPeerPort: u16,
2875 #[doc = "< The IPv6 Hop Limit value. Only applies if `mAllowZeroHopLimit` is FALSE.\n< If `0`, IPv6 Hop Limit is default value `OPENTHREAD_CONFIG_IP6_HOP_LIMIT_DEFAULT`.\n< Otherwise, specifies the IPv6 Hop Limit."]
2876 pub mHopLimit: u8,
2877 pub _bitfield_align_1: [u8; 0],
2878 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2879}
2880impl Default for otMessageInfo {
2881 fn default() -> Self {
2882 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2883 unsafe {
2884 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2885 s.assume_init()
2886 }
2887 }
2888}
2889impl otMessageInfo {
2890 #[inline]
2891 pub fn mEcn(&self) -> u8 {
2892 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
2893 }
2894 #[inline]
2895 pub fn set_mEcn(&mut self, val: u8) {
2896 unsafe {
2897 let val: u8 = ::std::mem::transmute(val);
2898 self._bitfield_1.set(0usize, 2u8, val as u64)
2899 }
2900 }
2901 #[inline]
2902 pub unsafe fn mEcn_raw(this: *const Self) -> u8 {
2903 unsafe {
2904 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2905 ::std::ptr::addr_of!((*this)._bitfield_1),
2906 0usize,
2907 2u8,
2908 ) as u8)
2909 }
2910 }
2911 #[inline]
2912 pub unsafe fn set_mEcn_raw(this: *mut Self, val: u8) {
2913 unsafe {
2914 let val: u8 = ::std::mem::transmute(val);
2915 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2916 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2917 0usize,
2918 2u8,
2919 val as u64,
2920 )
2921 }
2922 }
2923 #[inline]
2924 pub fn mIsHostInterface(&self) -> bool {
2925 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2926 }
2927 #[inline]
2928 pub fn set_mIsHostInterface(&mut self, val: bool) {
2929 unsafe {
2930 let val: u8 = ::std::mem::transmute(val);
2931 self._bitfield_1.set(2usize, 1u8, val as u64)
2932 }
2933 }
2934 #[inline]
2935 pub unsafe fn mIsHostInterface_raw(this: *const Self) -> bool {
2936 unsafe {
2937 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2938 ::std::ptr::addr_of!((*this)._bitfield_1),
2939 2usize,
2940 1u8,
2941 ) as u8)
2942 }
2943 }
2944 #[inline]
2945 pub unsafe fn set_mIsHostInterface_raw(this: *mut Self, val: bool) {
2946 unsafe {
2947 let val: u8 = ::std::mem::transmute(val);
2948 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2949 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2950 2usize,
2951 1u8,
2952 val as u64,
2953 )
2954 }
2955 }
2956 #[inline]
2957 pub fn mAllowZeroHopLimit(&self) -> bool {
2958 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
2959 }
2960 #[inline]
2961 pub fn set_mAllowZeroHopLimit(&mut self, val: bool) {
2962 unsafe {
2963 let val: u8 = ::std::mem::transmute(val);
2964 self._bitfield_1.set(3usize, 1u8, val as u64)
2965 }
2966 }
2967 #[inline]
2968 pub unsafe fn mAllowZeroHopLimit_raw(this: *const Self) -> bool {
2969 unsafe {
2970 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2971 ::std::ptr::addr_of!((*this)._bitfield_1),
2972 3usize,
2973 1u8,
2974 ) as u8)
2975 }
2976 }
2977 #[inline]
2978 pub unsafe fn set_mAllowZeroHopLimit_raw(this: *mut Self, val: bool) {
2979 unsafe {
2980 let val: u8 = ::std::mem::transmute(val);
2981 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2982 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2983 3usize,
2984 1u8,
2985 val as u64,
2986 )
2987 }
2988 }
2989 #[inline]
2990 pub fn mMulticastLoop(&self) -> bool {
2991 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
2992 }
2993 #[inline]
2994 pub fn set_mMulticastLoop(&mut self, val: bool) {
2995 unsafe {
2996 let val: u8 = ::std::mem::transmute(val);
2997 self._bitfield_1.set(4usize, 1u8, val as u64)
2998 }
2999 }
3000 #[inline]
3001 pub unsafe fn mMulticastLoop_raw(this: *const Self) -> bool {
3002 unsafe {
3003 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3004 ::std::ptr::addr_of!((*this)._bitfield_1),
3005 4usize,
3006 1u8,
3007 ) as u8)
3008 }
3009 }
3010 #[inline]
3011 pub unsafe fn set_mMulticastLoop_raw(this: *mut Self, val: bool) {
3012 unsafe {
3013 let val: u8 = ::std::mem::transmute(val);
3014 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3015 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3016 4usize,
3017 1u8,
3018 val as u64,
3019 )
3020 }
3021 }
3022 #[inline]
3023 pub fn new_bitfield_1(
3024 mEcn: u8,
3025 mIsHostInterface: bool,
3026 mAllowZeroHopLimit: bool,
3027 mMulticastLoop: bool,
3028 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3029 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3030 __bindgen_bitfield_unit.set(0usize, 2u8, {
3031 let mEcn: u8 = unsafe { ::std::mem::transmute(mEcn) };
3032 mEcn as u64
3033 });
3034 __bindgen_bitfield_unit.set(2usize, 1u8, {
3035 let mIsHostInterface: u8 = unsafe { ::std::mem::transmute(mIsHostInterface) };
3036 mIsHostInterface as u64
3037 });
3038 __bindgen_bitfield_unit.set(3usize, 1u8, {
3039 let mAllowZeroHopLimit: u8 = unsafe { ::std::mem::transmute(mAllowZeroHopLimit) };
3040 mAllowZeroHopLimit as u64
3041 });
3042 __bindgen_bitfield_unit.set(4usize, 1u8, {
3043 let mMulticastLoop: u8 = unsafe { ::std::mem::transmute(mMulticastLoop) };
3044 mMulticastLoop as u64
3045 });
3046 __bindgen_bitfield_unit
3047 }
3048}
3049#[doc = "< IPv6 Hop-by-Hop Option"]
3050pub const OT_IP6_PROTO_HOP_OPTS: _bindgen_ty_9 = 0;
3051#[doc = "< Transmission Control Protocol"]
3052pub const OT_IP6_PROTO_TCP: _bindgen_ty_9 = 6;
3053#[doc = "< User Datagram"]
3054pub const OT_IP6_PROTO_UDP: _bindgen_ty_9 = 17;
3055#[doc = "< IPv6 encapsulation"]
3056pub const OT_IP6_PROTO_IP6: _bindgen_ty_9 = 41;
3057#[doc = "< Routing Header for IPv6"]
3058pub const OT_IP6_PROTO_ROUTING: _bindgen_ty_9 = 43;
3059#[doc = "< Fragment Header for IPv6"]
3060pub const OT_IP6_PROTO_FRAGMENT: _bindgen_ty_9 = 44;
3061#[doc = "< ICMP for IPv6"]
3062pub const OT_IP6_PROTO_ICMP6: _bindgen_ty_9 = 58;
3063#[doc = "< No Next Header for IPv6"]
3064pub const OT_IP6_PROTO_NONE: _bindgen_ty_9 = 59;
3065#[doc = "< Destination Options for IPv6"]
3066pub const OT_IP6_PROTO_DST_OPTS: _bindgen_ty_9 = 60;
3067#[doc = " Internet Protocol Numbers."]
3068pub type _bindgen_ty_9 = ::std::os::raw::c_uint;
3069unsafe extern "C" {
3070 #[doc = " Initializes the IPv6 interface and its external address pools.\n\n Requires `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`.\n\n It provides the memory buffers for the external unicast and multicast address pools and must be called before\n enabling the IPv6 interface.\n\n The provided memory buffers MUST persist and remain valid as long as the OpenThread instance is initialized.\n OpenThread will use these provided buffers to manage the pools of externally added unicast and multicast\n addresses (i.e., those added via `otIp6AddUnicastAddress()` and `otIp6SubscribeMulticastAddress()`).\n\n This function can only be called once. Subsequent calls will return `OT_ERROR_ALREADY`.\n\n The `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE` feature and this function allow the external unicast/multicast\n address pools to be configured at run-time after OpenThread instance initialization, rather than build-time.\n When this feature is disabled, the build-time configs `OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS` and\n `OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS` specify the pool sizes used by the OpenThread stack.\n\n This feature allows the OpenThread stack to be compiled as a library without specifying the address pool sizes.\n It delegates the configuration of the pools to the next layer, allowing the OpenThread stack to be integrated into\n various projects without requiring a new OpenThread stack configuration to be built.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aUnicastAddrPool A pointer to an array of `otNetifAddress`.\n @param[in] aUnicastAddrPoolSize The number of entries in @p aUnicastAddrPool.\n @param[in] aMulticastAddrPool A pointer to an array of `otNetifMulticastAddress`.\n @param[in] aMulticastAddrPoolSize The number of entries in @p aMulticastAddrPool.\n\n @retval OT_ERROR_NONE Successfully initialized the IPv6 interface.\n @retval OT_ERROR_ALREADY The IPv6 interface is already initialized."]
3071 pub fn otIp6Init(
3072 aInstance: *mut otInstance,
3073 aUnicastAddrPool: *mut otNetifAddress,
3074 aUnicastAddrPoolSize: u16,
3075 aMulticastAddrPool: *mut otNetifMulticastAddress,
3076 aMulticastAddrPoolSize: u16,
3077 ) -> otError;
3078}
3079unsafe extern "C" {
3080 #[doc = " Brings the IPv6 interface up or down.\n\n Call this to enable or disable IPv6 communication.\n\n When `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE` is enabled, `otIp6Init()` MUST be called prior to calling\n this function. If it is not, this function will return `OT_ERROR_INVALID_STATE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable IPv6, FALSE otherwise.\n\n @retval OT_ERROR_NONE Successfully brought the IPv6 interface up/down.\n @retval OT_ERROR_INVALID_STATE IPv6 interface is not available since device is operating in raw-link mode\n (applicable only when `OPENTHREAD_CONFIG_LINK_RAW_ENABLE` feature is enabled),\n or not initialized under `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`."]
3081 pub fn otIp6SetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3082}
3083unsafe extern "C" {
3084 #[doc = " Indicates whether or not the IPv6 interface is up.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The IPv6 interface is enabled.\n @retval FALSE The IPv6 interface is disabled."]
3085 pub fn otIp6IsEnabled(aInstance: *mut otInstance) -> bool;
3086}
3087unsafe extern "C" {
3088 #[doc = " Adds a Network Interface Address to the Thread interface.\n\n The passed-in instance @p aAddress is copied by the Thread interface. The Thread interface only\n supports a fixed number of externally added unicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS`\n and `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress A pointer to a Network Interface Address.\n\n @retval OT_ERROR_NONE Successfully added (or updated) the Network Interface Address.\n @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is an internal address.\n @retval OT_ERROR_NO_BUFS The Network Interface is already storing the maximum allowed external addresses."]
3089 pub fn otIp6AddUnicastAddress(
3090 aInstance: *mut otInstance,
3091 aAddress: *const otNetifAddress,
3092 ) -> otError;
3093}
3094unsafe extern "C" {
3095 #[doc = " Removes a Network Interface Address from the Thread interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress A pointer to an IP Address.\n\n @retval OT_ERROR_NONE Successfully removed the Network Interface Address.\n @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is an internal address.\n @retval OT_ERROR_NOT_FOUND The IP Address indicated by @p aAddress was not found."]
3096 pub fn otIp6RemoveUnicastAddress(
3097 aInstance: *mut otInstance,
3098 aAddress: *const otIp6Address,
3099 ) -> otError;
3100}
3101unsafe extern "C" {
3102 #[doc = " Gets the list of IPv6 addresses assigned to the Thread interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the first Network Interface Address."]
3103 pub fn otIp6GetUnicastAddresses(aInstance: *mut otInstance) -> *const otNetifAddress;
3104}
3105unsafe extern "C" {
3106 #[doc = " Indicates whether or not a unicast IPv6 address is assigned to the Thread interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress A pointer to the unicast address.\n\n @retval TRUE If @p aAddress is assigned to the Thread interface.\n @retval FALSE If @p aAddress is not assigned to the Thread interface."]
3107 pub fn otIp6HasUnicastAddress(
3108 aInstance: *mut otInstance,
3109 aAddress: *const otIp6Address,
3110 ) -> bool;
3111}
3112unsafe extern "C" {
3113 #[doc = " Subscribes the Thread interface to a Network Interface Multicast Address.\n\n The passed in instance @p aAddress will be copied by the Thread interface. The Thread interface only\n supports a fixed number of externally added multicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS`\n and `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`.\n\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress A pointer to an IP Address.\n\n @retval OT_ERROR_NONE Successfully subscribed to the Network Interface Multicast Address.\n @retval OT_ERROR_ALREADY The multicast address is already subscribed.\n @retval OT_ERROR_INVALID_ARGS The IP Address indicated by @p aAddress is an invalid multicast address.\n @retval OT_ERROR_REJECTED The IP Address indicated by @p aAddress is an internal multicast address.\n @retval OT_ERROR_NO_BUFS The Network Interface is already storing the maximum allowed external multicast\n addresses."]
3114 pub fn otIp6SubscribeMulticastAddress(
3115 aInstance: *mut otInstance,
3116 aAddress: *const otIp6Address,
3117 ) -> otError;
3118}
3119unsafe extern "C" {
3120 #[doc = " Unsubscribes the Thread interface to a Network Interface Multicast Address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress A pointer to an IP Address.\n\n @retval OT_ERROR_NONE Successfully unsubscribed to the Network Interface Multicast Address.\n @retval OT_ERROR_REJECTED The IP Address indicated by @p aAddress is an internal address.\n @retval OT_ERROR_NOT_FOUND The IP Address indicated by @p aAddress was not found."]
3121 pub fn otIp6UnsubscribeMulticastAddress(
3122 aInstance: *mut otInstance,
3123 aAddress: *const otIp6Address,
3124 ) -> otError;
3125}
3126unsafe extern "C" {
3127 #[doc = " Gets the list of IPv6 multicast addresses subscribed to the Thread interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the first Network Interface Multicast Address."]
3128 pub fn otIp6GetMulticastAddresses(aInstance: *mut otInstance)
3129 -> *const otNetifMulticastAddress;
3130}
3131unsafe extern "C" {
3132 #[doc = " Allocate a new message buffer for sending an IPv6 message.\n\n @note If @p aSettings is 'NULL', the link layer security is enabled and the message priority is set to\n OT_MESSAGE_PRIORITY_NORMAL by default.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSettings A pointer to the message settings or NULL to set default settings.\n\n @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.\n\n @sa otMessageFree"]
3133 pub fn otIp6NewMessage(
3134 aInstance: *mut otInstance,
3135 aSettings: *const otMessageSettings,
3136 ) -> *mut otMessage;
3137}
3138unsafe extern "C" {
3139 #[doc = " Allocate a new message buffer and write the IPv6 datagram to the message buffer for sending an IPv6 message.\n\n @note If @p aSettings is NULL, the link layer security is enabled and the message priority is obtained from IPv6\n message itself.\n If @p aSettings is not NULL, the @p aSetting->mPriority is ignored and obtained from IPv6 message itself.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aData A pointer to the IPv6 datagram buffer.\n @param[in] aDataLength The size of the IPv6 datagram buffer pointed by @p aData.\n @param[in] aSettings A pointer to the message settings or NULL to set default settings.\n\n @returns A pointer to the message or NULL if malformed IPv6 header or insufficient message buffers are available.\n\n @sa otMessageFree"]
3140 pub fn otIp6NewMessageFromBuffer(
3141 aInstance: *mut otInstance,
3142 aData: *const u8,
3143 aDataLength: u16,
3144 aSettings: *const otMessageSettings,
3145 ) -> *mut otMessage;
3146}
3147#[doc = " Pointer is called when an IPv6 datagram is received.\n\n @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram. This function transfers\n the ownership of the @p aMessage to the receiver of the callback. The message should be\n freed by the receiver of the callback after it is processed (see otMessageFree()).\n @param[in] aContext A pointer to application-specific context."]
3148pub type otIp6ReceiveCallback = ::std::option::Option<
3149 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
3150>;
3151unsafe extern "C" {
3152 #[doc = " Registers a callback to provide received IPv6 datagrams.\n\n By default, this callback does not pass Thread control traffic. See otIp6SetReceiveFilterEnabled() to\n change the Thread control traffic filter setting.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called when an IPv6 datagram is received or\n NULL to disable the callback.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @sa otIp6IsReceiveFilterEnabled\n @sa otIp6SetReceiveFilterEnabled"]
3153 pub fn otIp6SetReceiveCallback(
3154 aInstance: *mut otInstance,
3155 aCallback: otIp6ReceiveCallback,
3156 aCallbackContext: *mut ::std::os::raw::c_void,
3157 );
3158}
3159#[doc = " Represents IPv6 address information."]
3160#[repr(C)]
3161#[derive(Debug, Copy, Clone)]
3162pub struct otIp6AddressInfo {
3163 #[doc = "< A pointer to the IPv6 address."]
3164 pub mAddress: *const otIp6Address,
3165 #[doc = "< The prefix length of mAddress if it is a unicast address."]
3166 pub mPrefixLength: u8,
3167 pub _bitfield_align_1: [u8; 0],
3168 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3169 pub __bindgen_padding_0: [u16; 3usize],
3170}
3171impl Default for otIp6AddressInfo {
3172 fn default() -> Self {
3173 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3174 unsafe {
3175 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3176 s.assume_init()
3177 }
3178 }
3179}
3180impl otIp6AddressInfo {
3181 #[inline]
3182 pub fn mScope(&self) -> u8 {
3183 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
3184 }
3185 #[inline]
3186 pub fn set_mScope(&mut self, val: u8) {
3187 unsafe {
3188 let val: u8 = ::std::mem::transmute(val);
3189 self._bitfield_1.set(0usize, 4u8, val as u64)
3190 }
3191 }
3192 #[inline]
3193 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
3194 unsafe {
3195 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3196 ::std::ptr::addr_of!((*this)._bitfield_1),
3197 0usize,
3198 4u8,
3199 ) as u8)
3200 }
3201 }
3202 #[inline]
3203 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
3204 unsafe {
3205 let val: u8 = ::std::mem::transmute(val);
3206 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3207 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3208 0usize,
3209 4u8,
3210 val as u64,
3211 )
3212 }
3213 }
3214 #[inline]
3215 pub fn mPreferred(&self) -> bool {
3216 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3217 }
3218 #[inline]
3219 pub fn set_mPreferred(&mut self, val: bool) {
3220 unsafe {
3221 let val: u8 = ::std::mem::transmute(val);
3222 self._bitfield_1.set(4usize, 1u8, val as u64)
3223 }
3224 }
3225 #[inline]
3226 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
3227 unsafe {
3228 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3229 ::std::ptr::addr_of!((*this)._bitfield_1),
3230 4usize,
3231 1u8,
3232 ) as u8)
3233 }
3234 }
3235 #[inline]
3236 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
3237 unsafe {
3238 let val: u8 = ::std::mem::transmute(val);
3239 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3240 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3241 4usize,
3242 1u8,
3243 val as u64,
3244 )
3245 }
3246 }
3247 #[inline]
3248 pub fn mMeshLocal(&self) -> bool {
3249 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
3250 }
3251 #[inline]
3252 pub fn set_mMeshLocal(&mut self, val: bool) {
3253 unsafe {
3254 let val: u8 = ::std::mem::transmute(val);
3255 self._bitfield_1.set(5usize, 1u8, val as u64)
3256 }
3257 }
3258 #[inline]
3259 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
3260 unsafe {
3261 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3262 ::std::ptr::addr_of!((*this)._bitfield_1),
3263 5usize,
3264 1u8,
3265 ) as u8)
3266 }
3267 }
3268 #[inline]
3269 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
3270 unsafe {
3271 let val: u8 = ::std::mem::transmute(val);
3272 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3273 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3274 5usize,
3275 1u8,
3276 val as u64,
3277 )
3278 }
3279 }
3280 #[inline]
3281 pub fn new_bitfield_1(
3282 mScope: u8,
3283 mPreferred: bool,
3284 mMeshLocal: bool,
3285 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3286 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3287 __bindgen_bitfield_unit.set(0usize, 4u8, {
3288 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
3289 mScope as u64
3290 });
3291 __bindgen_bitfield_unit.set(4usize, 1u8, {
3292 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
3293 mPreferred as u64
3294 });
3295 __bindgen_bitfield_unit.set(5usize, 1u8, {
3296 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
3297 mMeshLocal as u64
3298 });
3299 __bindgen_bitfield_unit
3300 }
3301}
3302#[doc = " Pointer is called when an internal IPv6 address is added or removed.\n\n @param[in] aAddressInfo A pointer to the IPv6 address information.\n @param[in] aIsAdded TRUE if the @p aAddress was added, FALSE if @p aAddress was removed.\n @param[in] aContext A pointer to application-specific context."]
3303pub type otIp6AddressCallback = ::std::option::Option<
3304 unsafe extern "C" fn(
3305 aAddressInfo: *const otIp6AddressInfo,
3306 aIsAdded: bool,
3307 aContext: *mut ::std::os::raw::c_void,
3308 ),
3309>;
3310unsafe extern "C" {
3311 #[doc = " Registers a callback to notify internal IPv6 address changes.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called when an internal IPv6 address is added or\n removed. NULL to disable the callback.\n @param[in] aCallbackContext A pointer to application-specific context."]
3312 pub fn otIp6SetAddressCallback(
3313 aInstance: *mut otInstance,
3314 aCallback: otIp6AddressCallback,
3315 aCallbackContext: *mut ::std::os::raw::c_void,
3316 );
3317}
3318unsafe extern "C" {
3319 #[doc = " Indicates whether or not Thread control traffic is filtered out when delivering IPv6 datagrams\n via the callback specified in otIp6SetReceiveCallback().\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if Thread control traffic is filtered out, FALSE otherwise.\n\n @sa otIp6SetReceiveCallback\n @sa otIp6SetReceiveFilterEnabled"]
3320 pub fn otIp6IsReceiveFilterEnabled(aInstance: *mut otInstance) -> bool;
3321}
3322unsafe extern "C" {
3323 #[doc = " Sets whether or not Thread control traffic is filtered out when delivering IPv6 datagrams\n via the callback specified in otIp6SetReceiveCallback().\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE if Thread control traffic is filtered out, FALSE otherwise.\n\n @sa otIp6SetReceiveCallback\n @sa otIsReceiveIp6FilterEnabled"]
3324 pub fn otIp6SetReceiveFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
3325}
3326unsafe extern "C" {
3327 #[doc = " Sends an IPv6 datagram via the Thread interface.\n\n The caller transfers ownership of @p aMessage when making this call. OpenThread will free @p aMessage when\n processing is complete, including when a value other than `OT_ERROR_NONE` is returned.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message buffer containing the IPv6 datagram.\n\n @retval OT_ERROR_NONE Successfully processed the message.\n @retval OT_ERROR_DROP Message was well-formed but not fully processed due to packet processing\n rules.\n @retval OT_ERROR_NO_BUFS Could not allocate necessary message buffers when processing the datagram.\n @retval OT_ERROR_NO_ROUTE No route to host.\n @retval OT_ERROR_INVALID_SOURCE_ADDRESS Source address is invalid, e.g. an anycast address or a multicast address.\n @retval OT_ERROR_PARSE Encountered a malformed header when processing the message.\n @retval OT_ERROR_INVALID_ARGS The message's metadata is invalid, e.g. the message uses\n `OT_MESSAGE_ORIGIN_THREAD_NETIF` as the origin."]
3328 pub fn otIp6Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
3329}
3330unsafe extern "C" {
3331 #[doc = " Adds a port to the allowed unsecured port list.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPort The port value.\n\n @retval OT_ERROR_NONE The port was successfully added to the allowed unsecure port list.\n @retval OT_ERROR_INVALID_ARGS The port is invalid (value 0 is reserved for internal use).\n @retval OT_ERROR_NO_BUFS The unsecure port list is full."]
3332 pub fn otIp6AddUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3333}
3334unsafe extern "C" {
3335 #[doc = " Removes a port from the allowed unsecure port list.\n\n @note This function removes @p aPort by overwriting @p aPort with the element after @p aPort in the internal port\n list. Be careful when calling otIp6GetUnsecurePorts() followed by otIp6RemoveUnsecurePort() to remove unsecure\n ports.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPort The port value.\n\n @retval OT_ERROR_NONE The port was successfully removed from the allowed unsecure port list.\n @retval OT_ERROR_INVALID_ARGS The port is invalid (value 0 is reserved for internal use).\n @retval OT_ERROR_NOT_FOUND The port was not found in the unsecure port list."]
3336 pub fn otIp6RemoveUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3337}
3338unsafe extern "C" {
3339 #[doc = " Removes all ports from the allowed unsecure port list.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3340 pub fn otIp6RemoveAllUnsecurePorts(aInstance: *mut otInstance);
3341}
3342unsafe extern "C" {
3343 #[doc = " Returns a pointer to the unsecure port list.\n\n @note Port value 0 is used to indicate an invalid entry.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumEntries The number of entries in the list.\n\n @returns A pointer to the unsecure port list."]
3344 pub fn otIp6GetUnsecurePorts(aInstance: *mut otInstance, aNumEntries: *mut u8) -> *const u16;
3345}
3346unsafe extern "C" {
3347 #[doc = " Test if two IPv6 addresses are the same.\n\n @param[in] aFirst A pointer to the first IPv6 address to compare.\n @param[in] aSecond A pointer to the second IPv6 address to compare.\n\n @retval TRUE The two IPv6 addresses are the same.\n @retval FALSE The two IPv6 addresses are not the same."]
3348 pub fn otIp6IsAddressEqual(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> bool;
3349}
3350unsafe extern "C" {
3351 #[doc = " Test whether or not the IPv6 address is a link-local unicast address.\n\n @param[in] aAddress A pointer to the IPv6 address to test.\n\n @retval TRUE If the IPv6 address is a link-local unicast address.\n @retval FALSE If the IPv6 address is not a link-local unicast address."]
3352 pub fn otIp6IsLinkLocalUnicast(aAddress: *const otIp6Address) -> bool;
3353}
3354unsafe extern "C" {
3355 #[doc = " Forms a link-local unicast IPv6 address from the Interface Identifier generated from the given\n MAC Extended Address with the universal/local bit inverted.\n\n @param[in] aExtAddress A pointer to the MAC Extended Address (used to generate the IID).\n @param[out] aAddress A pointer to output the IPv6 link-local unicast address."]
3356 pub fn otIp6FormLinkLocalAddressFromExtAddress(
3357 aExtAddress: *const otExtAddress,
3358 aAddress: *mut otIp6Address,
3359 );
3360}
3361unsafe extern "C" {
3362 #[doc = " Extracts the MAC Extended Address from the Interface Identifier of the given IPv6 address.\n\n @param[in] aAddress A pointer to the IPv6 address.\n @param[out] aExtAddress A pointer to output the MAC Extended Address (generated from the IID)."]
3363 pub fn otIp6ExtractExtAddressFromIp6AddressIid(
3364 aAddress: *const otIp6Address,
3365 aExtAddress: *mut otExtAddress,
3366 );
3367}
3368unsafe extern "C" {
3369 #[doc = " Test if two IPv6 prefixes are the same.\n\n @param[in] aFirst A pointer to the first IPv6 prefix to compare.\n @param[in] aSecond A pointer to the second IPv6 prefix to compare.\n\n @retval TRUE The two IPv6 prefixes are the same.\n @retval FALSE The two IPv6 prefixes are not the same."]
3370 pub fn otIp6ArePrefixesEqual(aFirst: *const otIp6Prefix, aSecond: *const otIp6Prefix) -> bool;
3371}
3372unsafe extern "C" {
3373 #[doc = " Converts a human-readable IPv6 address string into a binary representation.\n\n @param[in] aString A pointer to a NULL-terminated string.\n @param[out] aAddress A pointer to an IPv6 address.\n\n @retval OT_ERROR_NONE Successfully parsed @p aString and updated @p aAddress.\n @retval OT_ERROR_PARSE Failed to parse @p aString as an IPv6 address."]
3374 pub fn otIp6AddressFromString(
3375 aString: *const ::std::os::raw::c_char,
3376 aAddress: *mut otIp6Address,
3377 ) -> otError;
3378}
3379unsafe extern "C" {
3380 #[doc = " Converts a human-readable IPv6 prefix string into a binary representation.\n\n The @p aString parameter should be a string in the format \"<address>/<plen>\", where `<address>` is an IPv6\n address and `<plen>` is a prefix length.\n\n @param[in] aString A pointer to a NULL-terminated string.\n @param[out] aPrefix A pointer to an IPv6 prefix.\n\n @retval OT_ERROR_NONE Successfully parsed the string as an IPv6 prefix and updated @p aPrefix.\n @retval OT_ERROR_PARSE Failed to parse @p aString as an IPv6 prefix."]
3381 pub fn otIp6PrefixFromString(
3382 aString: *const ::std::os::raw::c_char,
3383 aPrefix: *mut otIp6Prefix,
3384 ) -> otError;
3385}
3386unsafe extern "C" {
3387 #[doc = " Converts a given IPv6 address to a human-readable string.\n\n The IPv6 address string is formatted as 16 hex values separated by ':' (i.e., \"%x:%x:%x:...:%x\").\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n @param[in] aAddress A pointer to an IPv6 address (MUST NOT be NULL).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_IP6_ADDRESS_STRING_SIZE`."]
3388 pub fn otIp6AddressToString(
3389 aAddress: *const otIp6Address,
3390 aBuffer: *mut ::std::os::raw::c_char,
3391 aSize: u16,
3392 );
3393}
3394unsafe extern "C" {
3395 #[doc = " Converts a given IPv6 socket address to a human-readable string.\n\n The IPv6 socket address string is formatted as [`address`]:`port` where `address` is shown\n as 16 hex values separated by `:` and `port` is the port number in decimal format,\n for example \"[%x:%x:...:%x]:%u\".\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n @param[in] aSockAddr A pointer to an IPv6 socket address (MUST NOT be NULL).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_IP6_SOCK_ADDR_STRING_SIZE`."]
3396 pub fn otIp6SockAddrToString(
3397 aSockAddr: *const otSockAddr,
3398 aBuffer: *mut ::std::os::raw::c_char,
3399 aSize: u16,
3400 );
3401}
3402unsafe extern "C" {
3403 #[doc = " Converts a given IPv6 prefix to a human-readable string.\n\n The IPv6 address string is formatted as \"%x:%x:%x:...[::]/plen\".\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n @param[in] aPrefix A pointer to an IPv6 prefix (MUST NOT be NULL).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_IP6_PREFIX_STRING_SIZE`."]
3404 pub fn otIp6PrefixToString(
3405 aPrefix: *const otIp6Prefix,
3406 aBuffer: *mut ::std::os::raw::c_char,
3407 aSize: u16,
3408 );
3409}
3410unsafe extern "C" {
3411 #[doc = " Returns the prefix match length (bits) for two IPv6 addresses.\n\n @param[in] aFirst A pointer to the first IPv6 address.\n @param[in] aSecond A pointer to the second IPv6 address.\n\n @returns The prefix match length in bits."]
3412 pub fn otIp6PrefixMatch(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> u8;
3413}
3414unsafe extern "C" {
3415 #[doc = " Gets a prefix with @p aLength from @p aAddress.\n\n @param[in] aAddress A pointer to an IPv6 address.\n @param[in] aLength The length of prefix in bits.\n @param[out] aPrefix A pointer to output the IPv6 prefix."]
3416 pub fn otIp6GetPrefix(aAddress: *const otIp6Address, aLength: u8, aPrefix: *mut otIp6Prefix);
3417}
3418unsafe extern "C" {
3419 #[doc = " Indicates whether or not a given IPv6 address is the Unspecified Address.\n\n @param[in] aAddress A pointer to an IPv6 address.\n\n @retval TRUE If the IPv6 address is the Unspecified Address.\n @retval FALSE If the IPv6 address is not the Unspecified Address."]
3420 pub fn otIp6IsAddressUnspecified(aAddress: *const otIp6Address) -> bool;
3421}
3422unsafe extern "C" {
3423 #[doc = " Perform OpenThread source address selection.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aMessageInfo A pointer to the message information.\n\n @retval OT_ERROR_NONE Found a source address and is filled into mSockAddr of @p aMessageInfo.\n @retval OT_ERROR_NOT_FOUND No source address was found and @p aMessageInfo is unchanged."]
3424 pub fn otIp6SelectSourceAddress(
3425 aInstance: *mut otInstance,
3426 aMessageInfo: *mut otMessageInfo,
3427 ) -> otError;
3428}
3429unsafe extern "C" {
3430 #[doc = " Indicates whether the SLAAC module is enabled or not.\n\n `OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE` build-time feature must be enabled.\n\n @retval TRUE SLAAC module is enabled.\n @retval FALSE SLAAC module is disabled."]
3431 pub fn otIp6IsSlaacEnabled(aInstance: *mut otInstance) -> bool;
3432}
3433unsafe extern "C" {
3434 #[doc = " Enables/disables the SLAAC module.\n\n `OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE` build-time feature must be enabled.\n\n When SLAAC module is enabled, SLAAC addresses (based on on-mesh prefixes in Network Data) are added to the interface.\n When SLAAC module is disabled any previously added SLAAC address is removed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable, FALSE to disable."]
3435 pub fn otIp6SetSlaacEnabled(aInstance: *mut otInstance, aEnabled: bool);
3436}
3437#[doc = " Pointer allows user to filter prefixes and not allow an SLAAC address based on a prefix to be added.\n\n `otIp6SetSlaacPrefixFilter()` can be used to set the filter handler. The filter handler is invoked by SLAAC module\n when it is about to add a SLAAC address based on a prefix. Its boolean return value determines whether the address\n is filtered (not added) or not.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefix A pointer to prefix for which SLAAC address is about to be added.\n\n @retval TRUE Indicates that the SLAAC address based on the prefix should be filtered and NOT added.\n @retval FALSE Indicates that the SLAAC address based on the prefix should be added."]
3438pub type otIp6SlaacPrefixFilter = ::std::option::Option<
3439 unsafe extern "C" fn(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix) -> bool,
3440>;
3441unsafe extern "C" {
3442 #[doc = " Sets the SLAAC module filter handler.\n\n `OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE` build-time feature must be enabled.\n\n The filter handler is called by SLAAC module when it is about to add a SLAAC address based on a prefix to decide\n whether the address should be added or not.\n\n A NULL filter handler disables filtering and allows all SLAAC addresses to be added.\n\n If this function is not called, the default filter used by SLAAC module will be NULL (filtering is disabled).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aFilter A pointer to SLAAC prefix filter handler, or NULL to disable filtering."]
3443 pub fn otIp6SetSlaacPrefixFilter(aInstance: *mut otInstance, aFilter: otIp6SlaacPrefixFilter);
3444}
3445#[doc = " Pointer is called with results of `otIp6RegisterMulticastListeners`.\n\n @param[in] aContext A pointer to the user context.\n @param[in] aError OT_ERROR_NONE when successfully sent MLR.req and received MLR.rsp,\n OT_ERROR_RESPONSE_TIMEOUT when failed to receive MLR.rsp,\n OT_ERROR_PARSE when failed to parse MLR.rsp.\n @param[in] aMlrStatus The Multicast Listener Registration status when @p aError is OT_ERROR_NONE.\n @param[in] aFailedAddresses A pointer to the failed IPv6 addresses when @p aError is OT_ERROR_NONE.\n @param[in] aFailedAddressNum The number of failed IPv6 addresses when @p aError is OT_ERROR_NONE.\n\n @sa otIp6RegisterMulticastListeners"]
3446pub type otIp6RegisterMulticastListenersCallback = ::std::option::Option<
3447 unsafe extern "C" fn(
3448 aContext: *mut ::std::os::raw::c_void,
3449 aError: otError,
3450 aMlrStatus: u8,
3451 aFailedAddresses: *const otIp6Address,
3452 aFailedAddressNum: u8,
3453 ),
3454>;
3455unsafe extern "C" {
3456 #[doc = " Registers Multicast Listeners to Primary Backbone Router.\n\n `OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE` and `OPENTHREAD_CONFIG_COMMISSIONER_ENABLE`\n must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddresses A Multicast Address Array to register.\n @param[in] aAddressNum The number of Multicast Address to register (0 if @p aAddresses is NULL).\n @param[in] aTimeout A pointer to the timeout value (in seconds) to be included in MLR.req. A timeout value of 0\n removes the corresponding Multicast Listener. If NULL, MLR.req would have no Timeout Tlv by\n default.\n @param[in] aCallback A pointer to the callback function.\n @param[in] aContext A pointer to the user context.\n\n @retval OT_ERROR_NONE Successfully sent MLR.req. The @p aCallback will be called iff this method\n returns OT_ERROR_NONE.\n @retval OT_ERROR_BUSY If a previous registration was ongoing.\n @retval OT_ERROR_INVALID_ARGS If one or more arguments are invalid.\n @retval OT_ERROR_INVALID_STATE If the device was not in a valid state to send MLR.req (e.g. Commissioner not\n started, Primary Backbone Router not found).\n @retval OT_ERROR_NO_BUFS If insufficient message buffers available.\n\n @sa otIp6RegisterMulticastListenersCallback"]
3457 pub fn otIp6RegisterMulticastListeners(
3458 aInstance: *mut otInstance,
3459 aAddresses: *const otIp6Address,
3460 aAddressNum: u8,
3461 aTimeout: *const u32,
3462 aCallback: otIp6RegisterMulticastListenersCallback,
3463 aContext: *mut ::std::os::raw::c_void,
3464 ) -> otError;
3465}
3466unsafe extern "C" {
3467 #[doc = " Sets the Mesh Local IID (for test purpose).\n\n Requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aIid A pointer to the Mesh Local IID to set.\n\n @retval OT_ERROR_NONE Successfully set the Mesh Local IID.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
3468 pub fn otIp6SetMeshLocalIid(
3469 aInstance: *mut otInstance,
3470 aIid: *const otIp6InterfaceIdentifier,
3471 ) -> otError;
3472}
3473unsafe extern "C" {
3474 #[doc = " Converts a given IP protocol number to a human-readable string.\n\n @param[in] aIpProto An IP protocol number (`OT_IP6_PROTO_*` enumeration).\n\n @returns A string representing @p aIpProto."]
3475 pub fn otIp6ProtoToString(aIpProto: u8) -> *const ::std::os::raw::c_char;
3476}
3477#[doc = " Represents the counters for packets and bytes."]
3478#[repr(C)]
3479#[derive(Debug, Default, Copy, Clone)]
3480pub struct otPacketsAndBytes {
3481 #[doc = "< The number of packets."]
3482 pub mPackets: u64,
3483 #[doc = "< The number of bytes."]
3484 pub mBytes: u64,
3485}
3486#[doc = " Represents the counters of packets forwarded via Border Routing."]
3487#[repr(C)]
3488#[derive(Debug, Default, Copy, Clone)]
3489pub struct otBorderRoutingCounters {
3490 #[doc = "< The counters for inbound unicast."]
3491 pub mInboundUnicast: otPacketsAndBytes,
3492 #[doc = "< The counters for inbound multicast."]
3493 pub mInboundMulticast: otPacketsAndBytes,
3494 #[doc = "< The counters for outbound unicast."]
3495 pub mOutboundUnicast: otPacketsAndBytes,
3496 #[doc = "< The counters for outbound multicast."]
3497 pub mOutboundMulticast: otPacketsAndBytes,
3498 #[doc = "< The counters for inbound Internet when DHCPv6 PD enabled."]
3499 pub mInboundInternet: otPacketsAndBytes,
3500 #[doc = "< The counters for outbound Internet when DHCPv6 PD enabled."]
3501 pub mOutboundInternet: otPacketsAndBytes,
3502 #[doc = "< The number of received RA packets."]
3503 pub mRaRx: u32,
3504 #[doc = "< The number of RA packets successfully transmitted."]
3505 pub mRaTxSuccess: u32,
3506 #[doc = "< The number of RA packets failed to transmit."]
3507 pub mRaTxFailure: u32,
3508 #[doc = "< The number of received RS packets."]
3509 pub mRsRx: u32,
3510 #[doc = "< The number of RS packets successfully transmitted."]
3511 pub mRsTxSuccess: u32,
3512 #[doc = "< The number of RS packets failed to transmit."]
3513 pub mRsTxFailure: u32,
3514}
3515unsafe extern "C" {
3516 #[doc = " Gets the Border Routing counters.\n\n `OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE` build-time feature must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Border Routing counters."]
3517 pub fn otIp6GetBorderRoutingCounters(
3518 aInstance: *mut otInstance,
3519 ) -> *const otBorderRoutingCounters;
3520}
3521unsafe extern "C" {
3522 #[doc = " Resets the Border Routing counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3523 pub fn otIp6ResetBorderRoutingCounters(aInstance: *mut otInstance);
3524}
3525pub const OT_JOINER_STATE_IDLE: otJoinerState = 0;
3526pub const OT_JOINER_STATE_DISCOVER: otJoinerState = 1;
3527pub const OT_JOINER_STATE_CONNECT: otJoinerState = 2;
3528pub const OT_JOINER_STATE_CONNECTED: otJoinerState = 3;
3529pub const OT_JOINER_STATE_ENTRUST: otJoinerState = 4;
3530pub const OT_JOINER_STATE_JOINED: otJoinerState = 5;
3531#[doc = " Defines the Joiner State."]
3532pub type otJoinerState = ::std::os::raw::c_uint;
3533#[doc = " Represents a Joiner Discerner."]
3534#[repr(C)]
3535#[derive(Debug, Default, Copy, Clone)]
3536pub struct otJoinerDiscerner {
3537 #[doc = "< Discerner value (the lowest `mLength` bits specify the discerner)."]
3538 pub mValue: u64,
3539 #[doc = "< Length (number of bits) - must be non-zero and at most `OT_JOINER_MAX_DISCERNER_LENGTH`."]
3540 pub mLength: u8,
3541}
3542#[doc = " Pointer is called to notify the completion of a join operation.\n\n @param[in] aError OT_ERROR_NONE if the join process succeeded.\n OT_ERROR_SECURITY if the join process failed due to security credentials.\n OT_ERROR_NOT_FOUND if no joinable network was discovered.\n OT_ERROR_RESPONSE_TIMEOUT if a response timed out.\n @param[in] aContext A pointer to application-specific context."]
3543pub type otJoinerCallback = ::std::option::Option<
3544 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
3545>;
3546unsafe extern "C" {
3547 #[doc = " Enables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPskd A pointer to the PSKd.\n @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be NULL).\n @param[in] aVendorName A pointer to the Vendor Name (may be NULL).\n @param[in] aVendorModel A pointer to the Vendor Model (may be NULL).\n @param[in] aVendorSwVersion A pointer to the Vendor SW Version (may be NULL).\n @param[in] aVendorData A pointer to the Vendor Data (may be NULL).\n @param[in] aCallback A pointer to a function that is called when the join operation completes.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully started the Joiner role.\n @retval OT_ERROR_BUSY The previous attempt is still on-going.\n @retval OT_ERROR_INVALID_ARGS @p aPskd or @p aProvisioningUrl is invalid.\n @retval OT_ERROR_INVALID_STATE The IPv6 stack is not enabled or Thread stack is fully enabled."]
3548 pub fn otJoinerStart(
3549 aInstance: *mut otInstance,
3550 aPskd: *const ::std::os::raw::c_char,
3551 aProvisioningUrl: *const ::std::os::raw::c_char,
3552 aVendorName: *const ::std::os::raw::c_char,
3553 aVendorModel: *const ::std::os::raw::c_char,
3554 aVendorSwVersion: *const ::std::os::raw::c_char,
3555 aVendorData: *const ::std::os::raw::c_char,
3556 aCallback: otJoinerCallback,
3557 aContext: *mut ::std::os::raw::c_void,
3558 ) -> otError;
3559}
3560unsafe extern "C" {
3561 #[doc = " Disables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3562 pub fn otJoinerStop(aInstance: *mut otInstance);
3563}
3564unsafe extern "C" {
3565 #[doc = " Gets the Joiner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The joiner state."]
3566 pub fn otJoinerGetState(aInstance: *mut otInstance) -> otJoinerState;
3567}
3568unsafe extern "C" {
3569 #[doc = " Gets the Joiner ID.\n\n If a Joiner Discerner is not set, Joiner ID is the first 64 bits of the result of computing SHA-256 over\n factory-assigned IEEE EUI-64. Otherwise the Joiner ID is calculated from the Joiner Discerner value.\n\n The Joiner ID is also used as the device's IEEE 802.15.4 Extended Address during the commissioning process.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to the Joiner ID."]
3570 pub fn otJoinerGetId(aInstance: *mut otInstance) -> *const otExtAddress;
3571}
3572unsafe extern "C" {
3573 #[doc = " Sets the Joiner Discerner.\n\n The Joiner Discerner is used to calculate the Joiner ID during the Thread Commissioning process. For more\n information, refer to #otJoinerGetId.\n @note The Joiner Discerner takes the place of the Joiner EUI-64 during the joiner session of Thread Commissioning.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aDiscerner A pointer to a Joiner Discerner. If NULL clears any previously set discerner.\n\n @retval OT_ERROR_NONE The Joiner Discerner updated successfully.\n @retval OT_ERROR_INVALID_ARGS @p aDiscerner is not valid (specified length is not within valid range).\n @retval OT_ERROR_INVALID_STATE There is an ongoing Joining process so Joiner Discerner could not be changed."]
3574 pub fn otJoinerSetDiscerner(
3575 aInstance: *mut otInstance,
3576 aDiscerner: *mut otJoinerDiscerner,
3577 ) -> otError;
3578}
3579unsafe extern "C" {
3580 #[doc = " Gets the Joiner Discerner. For more information, refer to #otJoinerSetDiscerner.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to Joiner Discerner or NULL if none is set."]
3581 pub fn otJoinerGetDiscerner(aInstance: *mut otInstance) -> *const otJoinerDiscerner;
3582}
3583unsafe extern "C" {
3584 #[doc = " Converts a given joiner state enumeration value to a human-readable string.\n\n @param[in] aState The joiner state.\n\n @returns A human-readable string representation of @p aState."]
3585 pub fn otJoinerStateToString(aState: otJoinerState) -> *const ::std::os::raw::c_char;
3586}
3587#[doc = " Represents the steering data."]
3588#[repr(C)]
3589#[derive(Debug, Default, Copy, Clone)]
3590pub struct otSteeringData {
3591 #[doc = "< Length of Steering Data (bytes)."]
3592 pub mLength: u8,
3593 #[doc = "< Byte values."]
3594 pub m8: [u8; 16usize],
3595}
3596unsafe extern "C" {
3597 #[doc = " Initializes the Steering Data.\n\n @param[out] aSteeringData The Steering Data to initialize.\n @param[in] aLength The length of the Steering Data in bytes.\n\n @retval OT_ERROR_NONE Successfully initialized the Steering Data.\n @retval OT_ERROR_INVALID_ARGS The @p aLength is invalid."]
3598 pub fn otSteeringDataInit(aSteeringData: *mut otSteeringData, aLength: u8) -> otError;
3599}
3600unsafe extern "C" {
3601 #[doc = " Checks whether the Steering Data has a valid length.\n\n @param[in] aSteeringData The Steering Data to check.\n\n @retval TRUE If the Steering Data's length is valid.\n @retval FALSE If the Steering Data's length is not valid."]
3602 pub fn otSteeringDataIsValid(aSteeringData: *const otSteeringData) -> bool;
3603}
3604unsafe extern "C" {
3605 #[doc = " Sets the Steering Data to permit all joiners.\n\n @param[out] aSteeringData The Steering Data to update."]
3606 pub fn otSteeringDataSetToPermitAllJoiners(aSteeringData: *mut otSteeringData);
3607}
3608unsafe extern "C" {
3609 #[doc = " Updates the Steering Data's bloom filter with a Joiner ID.\n\n @param[out] aSteeringData The Steering Data to update.\n @param[in] aJoinerId The Joiner ID to add.\n\n @retval OT_ERROR_NONE Successfully updated the Steering Data.\n @retval OT_ERROR_INVALID_ARGS The Steering Data is not valid (incorrect length)."]
3610 pub fn otSteeringDataUpdateWithJoinerId(
3611 aSteeringData: *mut otSteeringData,
3612 aJoinerId: *const otExtAddress,
3613 ) -> otError;
3614}
3615unsafe extern "C" {
3616 #[doc = " Updates the Steering Data's bloom filter with a Joiner Discerner.\n\n @param[out] aSteeringData The Steering Data to update\n @param[in] aDiscerner The Joiner Discerner to add.\n\n @retval OT_ERROR_NONE Successfully updated the Steering Data.\n @retval OT_ERROR_INVALID_ARGS The Steering Data is not valid (incorrect length)."]
3617 pub fn otSteeringDataUpdateWithDiscerner(
3618 aSteeringData: *mut otSteeringData,
3619 aDiscerner: *const otJoinerDiscerner,
3620 ) -> otError;
3621}
3622unsafe extern "C" {
3623 #[doc = " Merges two Steering Data bloom filters.\n\n The @p aOtherSteeringData must have a length that is a divisor of the @p aSteeringData length.\n\n @param[out] aSteeringData The Steering Data to merge into.\n @param[in] aOtherSteeringData The other Steering Data to merge from.\n\n @retval OT_ERROR_NONE Successfully merged the Steering Data.\n @retval OT_ERROR_INVALID_ARGS The Steering Data lengths are not valid or they cannot be merged."]
3624 pub fn otSteeringDataMerge(
3625 aSteeringData: *mut otSteeringData,
3626 aOtherSteeringData: *const otSteeringData,
3627 ) -> otError;
3628}
3629unsafe extern "C" {
3630 #[doc = " Checks if the Steering Data permits all joiners.\n\n @param[in] aSteeringData The Steering Data to check.\n\n @retval TRUE If the Steering Data permits all joiners.\n @retval FALSE If the Steering Data does not permit all joiners."]
3631 pub fn otSteeringDataPermitsAllJoiners(aSteeringData: *const otSteeringData) -> bool;
3632}
3633unsafe extern "C" {
3634 #[doc = " Checks if the Steering Data is empty.\n\n @param[in] aSteeringData The Steering Data to check.\n\n @retval TRUE If the Steering Data is empty.\n @retval FALSE If the Steering Data is not empty."]
3635 pub fn otSteeringDataIsEmpty(aSteeringData: *const otSteeringData) -> bool;
3636}
3637unsafe extern "C" {
3638 #[doc = " Checks if the Steering Data contains a Joiner ID.\n\n @param[in] aSteeringData The Steering Data to check.\n @param[in] aJoinerId The Joiner ID.\n\n @retval TRUE If the Steering Data contains the Joiner ID.\n @retval FALSE If the Steering Data does not contain the Joiner ID."]
3639 pub fn otSteeringDataContainsJoinerId(
3640 aSteeringData: *const otSteeringData,
3641 aJoinerId: *const otExtAddress,
3642 ) -> bool;
3643}
3644unsafe extern "C" {
3645 #[doc = " Checks if the Steering Data contains a Joiner Discerner.\n\n @param[in] aSteeringData The Steering Data to check.\n @param[in] aDiscerner The Joiner Discerner.\n\n @retval TRUE If the Steering Data contains the Joiner Discerner.\n @retval FALSE If the Steering Data does not contain the Joiner Discerner."]
3646 pub fn otSteeringDataContainsDiscerner(
3647 aSteeringData: *const otSteeringData,
3648 aDiscerner: *const otJoinerDiscerner,
3649 ) -> bool;
3650}
3651#[doc = "< Commissioner role is disabled."]
3652pub const OT_COMMISSIONER_STATE_DISABLED: otCommissionerState = 0;
3653#[doc = "< Currently petitioning to become a Commissioner."]
3654pub const OT_COMMISSIONER_STATE_PETITION: otCommissionerState = 1;
3655#[doc = "< Commissioner role is active."]
3656pub const OT_COMMISSIONER_STATE_ACTIVE: otCommissionerState = 2;
3657#[doc = " Defines the Commissioner State."]
3658pub type otCommissionerState = ::std::os::raw::c_uint;
3659pub const OT_COMMISSIONER_JOINER_START: otCommissionerJoinerEvent = 0;
3660pub const OT_COMMISSIONER_JOINER_CONNECTED: otCommissionerJoinerEvent = 1;
3661pub const OT_COMMISSIONER_JOINER_FINALIZE: otCommissionerJoinerEvent = 2;
3662pub const OT_COMMISSIONER_JOINER_END: otCommissionerJoinerEvent = 3;
3663pub const OT_COMMISSIONER_JOINER_REMOVED: otCommissionerJoinerEvent = 4;
3664#[doc = " Defines a Joiner Event on the Commissioner."]
3665pub type otCommissionerJoinerEvent = ::std::os::raw::c_uint;
3666#[doc = " Represents a Commissioning Dataset."]
3667#[repr(C)]
3668#[derive(Debug, Default, Copy, Clone)]
3669pub struct otCommissioningDataset {
3670 #[doc = "< Border Router RLOC16"]
3671 pub mLocator: u16,
3672 #[doc = "< Commissioner Session Id"]
3673 pub mSessionId: u16,
3674 #[doc = "< Steering Data"]
3675 pub mSteeringData: otSteeringData,
3676 #[doc = "< Joiner UDP Port"]
3677 pub mJoinerUdpPort: u16,
3678 pub _bitfield_align_1: [u8; 0],
3679 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3680 pub __bindgen_padding_0: u8,
3681}
3682impl otCommissioningDataset {
3683 #[inline]
3684 pub fn mIsLocatorSet(&self) -> bool {
3685 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
3686 }
3687 #[inline]
3688 pub fn set_mIsLocatorSet(&mut self, val: bool) {
3689 unsafe {
3690 let val: u8 = ::std::mem::transmute(val);
3691 self._bitfield_1.set(0usize, 1u8, val as u64)
3692 }
3693 }
3694 #[inline]
3695 pub unsafe fn mIsLocatorSet_raw(this: *const Self) -> bool {
3696 unsafe {
3697 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3698 ::std::ptr::addr_of!((*this)._bitfield_1),
3699 0usize,
3700 1u8,
3701 ) as u8)
3702 }
3703 }
3704 #[inline]
3705 pub unsafe fn set_mIsLocatorSet_raw(this: *mut Self, val: bool) {
3706 unsafe {
3707 let val: u8 = ::std::mem::transmute(val);
3708 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3709 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3710 0usize,
3711 1u8,
3712 val as u64,
3713 )
3714 }
3715 }
3716 #[inline]
3717 pub fn mIsSessionIdSet(&self) -> bool {
3718 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
3719 }
3720 #[inline]
3721 pub fn set_mIsSessionIdSet(&mut self, val: bool) {
3722 unsafe {
3723 let val: u8 = ::std::mem::transmute(val);
3724 self._bitfield_1.set(1usize, 1u8, val as u64)
3725 }
3726 }
3727 #[inline]
3728 pub unsafe fn mIsSessionIdSet_raw(this: *const Self) -> bool {
3729 unsafe {
3730 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3731 ::std::ptr::addr_of!((*this)._bitfield_1),
3732 1usize,
3733 1u8,
3734 ) as u8)
3735 }
3736 }
3737 #[inline]
3738 pub unsafe fn set_mIsSessionIdSet_raw(this: *mut Self, val: bool) {
3739 unsafe {
3740 let val: u8 = ::std::mem::transmute(val);
3741 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3742 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3743 1usize,
3744 1u8,
3745 val as u64,
3746 )
3747 }
3748 }
3749 #[inline]
3750 pub fn mIsSteeringDataSet(&self) -> bool {
3751 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
3752 }
3753 #[inline]
3754 pub fn set_mIsSteeringDataSet(&mut self, val: bool) {
3755 unsafe {
3756 let val: u8 = ::std::mem::transmute(val);
3757 self._bitfield_1.set(2usize, 1u8, val as u64)
3758 }
3759 }
3760 #[inline]
3761 pub unsafe fn mIsSteeringDataSet_raw(this: *const Self) -> bool {
3762 unsafe {
3763 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3764 ::std::ptr::addr_of!((*this)._bitfield_1),
3765 2usize,
3766 1u8,
3767 ) as u8)
3768 }
3769 }
3770 #[inline]
3771 pub unsafe fn set_mIsSteeringDataSet_raw(this: *mut Self, val: bool) {
3772 unsafe {
3773 let val: u8 = ::std::mem::transmute(val);
3774 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3775 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3776 2usize,
3777 1u8,
3778 val as u64,
3779 )
3780 }
3781 }
3782 #[inline]
3783 pub fn mIsJoinerUdpPortSet(&self) -> bool {
3784 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3785 }
3786 #[inline]
3787 pub fn set_mIsJoinerUdpPortSet(&mut self, val: bool) {
3788 unsafe {
3789 let val: u8 = ::std::mem::transmute(val);
3790 self._bitfield_1.set(3usize, 1u8, val as u64)
3791 }
3792 }
3793 #[inline]
3794 pub unsafe fn mIsJoinerUdpPortSet_raw(this: *const Self) -> bool {
3795 unsafe {
3796 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3797 ::std::ptr::addr_of!((*this)._bitfield_1),
3798 3usize,
3799 1u8,
3800 ) as u8)
3801 }
3802 }
3803 #[inline]
3804 pub unsafe fn set_mIsJoinerUdpPortSet_raw(this: *mut Self, val: bool) {
3805 unsafe {
3806 let val: u8 = ::std::mem::transmute(val);
3807 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3808 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3809 3usize,
3810 1u8,
3811 val as u64,
3812 )
3813 }
3814 }
3815 #[inline]
3816 pub fn mHasExtraTlv(&self) -> bool {
3817 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3818 }
3819 #[inline]
3820 pub fn set_mHasExtraTlv(&mut self, val: bool) {
3821 unsafe {
3822 let val: u8 = ::std::mem::transmute(val);
3823 self._bitfield_1.set(4usize, 1u8, val as u64)
3824 }
3825 }
3826 #[inline]
3827 pub unsafe fn mHasExtraTlv_raw(this: *const Self) -> bool {
3828 unsafe {
3829 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3830 ::std::ptr::addr_of!((*this)._bitfield_1),
3831 4usize,
3832 1u8,
3833 ) as u8)
3834 }
3835 }
3836 #[inline]
3837 pub unsafe fn set_mHasExtraTlv_raw(this: *mut Self, val: bool) {
3838 unsafe {
3839 let val: u8 = ::std::mem::transmute(val);
3840 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3841 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3842 4usize,
3843 1u8,
3844 val as u64,
3845 )
3846 }
3847 }
3848 #[inline]
3849 pub fn new_bitfield_1(
3850 mIsLocatorSet: bool,
3851 mIsSessionIdSet: bool,
3852 mIsSteeringDataSet: bool,
3853 mIsJoinerUdpPortSet: bool,
3854 mHasExtraTlv: bool,
3855 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3856 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3857 __bindgen_bitfield_unit.set(0usize, 1u8, {
3858 let mIsLocatorSet: u8 = unsafe { ::std::mem::transmute(mIsLocatorSet) };
3859 mIsLocatorSet as u64
3860 });
3861 __bindgen_bitfield_unit.set(1usize, 1u8, {
3862 let mIsSessionIdSet: u8 = unsafe { ::std::mem::transmute(mIsSessionIdSet) };
3863 mIsSessionIdSet as u64
3864 });
3865 __bindgen_bitfield_unit.set(2usize, 1u8, {
3866 let mIsSteeringDataSet: u8 = unsafe { ::std::mem::transmute(mIsSteeringDataSet) };
3867 mIsSteeringDataSet as u64
3868 });
3869 __bindgen_bitfield_unit.set(3usize, 1u8, {
3870 let mIsJoinerUdpPortSet: u8 = unsafe { ::std::mem::transmute(mIsJoinerUdpPortSet) };
3871 mIsJoinerUdpPortSet as u64
3872 });
3873 __bindgen_bitfield_unit.set(4usize, 1u8, {
3874 let mHasExtraTlv: u8 = unsafe { ::std::mem::transmute(mHasExtraTlv) };
3875 mHasExtraTlv as u64
3876 });
3877 __bindgen_bitfield_unit
3878 }
3879}
3880#[doc = " Represents a Joiner PSKd."]
3881#[repr(C)]
3882#[derive(Debug, Copy, Clone)]
3883pub struct otJoinerPskd {
3884 #[doc = "< Char string array (must be null terminated - +1 is for null char)."]
3885 pub m8: [::std::os::raw::c_char; 33usize],
3886}
3887impl Default for otJoinerPskd {
3888 fn default() -> Self {
3889 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3890 unsafe {
3891 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3892 s.assume_init()
3893 }
3894 }
3895}
3896#[doc = "< Accept any Joiner (no EUI64 or Discerner is specified)."]
3897pub const OT_JOINER_INFO_TYPE_ANY: otJoinerInfoType = 0;
3898#[doc = "< Joiner EUI-64 is specified (`mSharedId.mEui64` in `otJoinerInfo`)."]
3899pub const OT_JOINER_INFO_TYPE_EUI64: otJoinerInfoType = 1;
3900#[doc = "< Joiner Discerner is specified (`mSharedId.mDiscerner` in `otJoinerInfo`)."]
3901pub const OT_JOINER_INFO_TYPE_DISCERNER: otJoinerInfoType = 2;
3902#[doc = " Defines a Joiner Info Type."]
3903pub type otJoinerInfoType = ::std::os::raw::c_uint;
3904#[doc = " Represents a Joiner Info."]
3905#[repr(C)]
3906#[derive(Copy, Clone)]
3907pub struct otJoinerInfo {
3908 #[doc = "< Joiner type."]
3909 pub mType: otJoinerInfoType,
3910 #[doc = "< Shared fields"]
3911 pub mSharedId: otJoinerInfo__bindgen_ty_1,
3912 #[doc = "< Joiner PSKd"]
3913 pub mPskd: otJoinerPskd,
3914 #[doc = "< Joiner expiration time in msec"]
3915 pub mExpirationTime: u32,
3916}
3917#[repr(C)]
3918#[derive(Copy, Clone)]
3919pub union otJoinerInfo__bindgen_ty_1 {
3920 #[doc = "< Joiner EUI64 (when `mType` is `OT_JOINER_INFO_TYPE_EUI64`)"]
3921 pub mEui64: otExtAddress,
3922 #[doc = "< Joiner Discerner (when `mType` is `OT_JOINER_INFO_TYPE_DISCERNER`)"]
3923 pub mDiscerner: otJoinerDiscerner,
3924}
3925impl Default for otJoinerInfo__bindgen_ty_1 {
3926 fn default() -> Self {
3927 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3928 unsafe {
3929 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3930 s.assume_init()
3931 }
3932 }
3933}
3934impl Default for otJoinerInfo {
3935 fn default() -> Self {
3936 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3937 unsafe {
3938 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3939 s.assume_init()
3940 }
3941 }
3942}
3943#[doc = " Pointer is called whenever the commissioner state changes.\n\n @param[in] aState The Commissioner state.\n @param[in] aContext A pointer to application-specific context."]
3944pub type otCommissionerStateCallback = ::std::option::Option<
3945 unsafe extern "C" fn(aState: otCommissionerState, aContext: *mut ::std::os::raw::c_void),
3946>;
3947#[doc = " Pointer is called whenever the joiner state changes.\n\n @param[in] aEvent The joiner event type.\n @param[in] aJoinerInfo A pointer to the Joiner Info.\n @param[in] aJoinerId A pointer to the Joiner ID (if not known, it will be NULL).\n @param[in] aContext A pointer to application-specific context."]
3948pub type otCommissionerJoinerCallback = ::std::option::Option<
3949 unsafe extern "C" fn(
3950 aEvent: otCommissionerJoinerEvent,
3951 aJoinerInfo: *const otJoinerInfo,
3952 aJoinerId: *const otExtAddress,
3953 aContext: *mut ::std::os::raw::c_void,
3954 ),
3955>;
3956unsafe extern "C" {
3957 #[doc = " Enables the Thread Commissioner role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStateCallback A pointer to a function that is called when the commissioner state changes.\n @param[in] aJoinerCallback A pointer to a function that is called with a joiner event occurs.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully started the Commissioner service.\n @retval OT_ERROR_ALREADY Commissioner is already started.\n @retval OT_ERROR_INVALID_STATE Device is not currently attached to a network."]
3958 pub fn otCommissionerStart(
3959 aInstance: *mut otInstance,
3960 aStateCallback: otCommissionerStateCallback,
3961 aJoinerCallback: otCommissionerJoinerCallback,
3962 aCallbackContext: *mut ::std::os::raw::c_void,
3963 ) -> otError;
3964}
3965unsafe extern "C" {
3966 #[doc = " Disables the Thread Commissioner role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully stopped the Commissioner service.\n @retval OT_ERROR_ALREADY Commissioner is already stopped."]
3967 pub fn otCommissionerStop(aInstance: *mut otInstance) -> otError;
3968}
3969unsafe extern "C" {
3970 #[doc = " Returns the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Commissioner Id."]
3971 pub fn otCommissionerGetId(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
3972}
3973unsafe extern "C" {
3974 #[doc = " Sets the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aId A pointer to a string character array. Must be null terminated.\n\n @retval OT_ERROR_NONE Successfully set the Commissioner Id.\n @retval OT_ERROR_INVALID_ARGS Given name is too long.\n @retval OT_ERROR_INVALID_STATE The commissioner is active and id cannot be changed."]
3975 pub fn otCommissionerSetId(
3976 aInstance: *mut otInstance,
3977 aId: *const ::std::os::raw::c_char,
3978 ) -> otError;
3979}
3980unsafe extern "C" {
3981 #[doc = " Adds a Joiner entry.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.\n @param[in] aPskd A pointer to the PSKd.\n @param[in] aTimeout A time after which a Joiner is automatically removed, in seconds.\n\n @retval OT_ERROR_NONE Successfully added the Joiner.\n @retval OT_ERROR_NO_BUFS No buffers available to add the Joiner.\n @retval OT_ERROR_INVALID_ARGS @p aEui64 or @p aPskd is invalid.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
3982 pub fn otCommissionerAddJoiner(
3983 aInstance: *mut otInstance,
3984 aEui64: *const otExtAddress,
3985 aPskd: *const ::std::os::raw::c_char,
3986 aTimeout: u32,
3987 ) -> otError;
3988}
3989unsafe extern "C" {
3990 #[doc = " Adds a Joiner entry with a given Joiner Discerner value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDiscerner A pointer to the Joiner Discerner.\n @param[in] aPskd A pointer to the PSKd.\n @param[in] aTimeout A time after which a Joiner is automatically removed, in seconds.\n\n @retval OT_ERROR_NONE Successfully added the Joiner.\n @retval OT_ERROR_NO_BUFS No buffers available to add the Joiner.\n @retval OT_ERROR_INVALID_ARGS @p aDiscerner or @p aPskd is invalid.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
3991 pub fn otCommissionerAddJoinerWithDiscerner(
3992 aInstance: *mut otInstance,
3993 aDiscerner: *const otJoinerDiscerner,
3994 aPskd: *const ::std::os::raw::c_char,
3995 aTimeout: u32,
3996 ) -> otError;
3997}
3998unsafe extern "C" {
3999 #[doc = " Get joiner info at aIterator position.\n\n @param[in] aInstance A pointer to instance.\n @param[in,out] aIterator A pointer to the Joiner Info iterator context.\n @param[out] aJoiner A reference to Joiner info.\n\n @retval OT_ERROR_NONE Successfully get the Joiner info.\n @retval OT_ERROR_NOT_FOUND Not found next Joiner."]
4000 pub fn otCommissionerGetNextJoinerInfo(
4001 aInstance: *mut otInstance,
4002 aIterator: *mut u16,
4003 aJoiner: *mut otJoinerInfo,
4004 ) -> otError;
4005}
4006unsafe extern "C" {
4007 #[doc = " Removes a Joiner entry.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.\n\n @retval OT_ERROR_NONE Successfully removed the Joiner.\n @retval OT_ERROR_NOT_FOUND The Joiner specified by @p aEui64 was not found.\n @retval OT_ERROR_INVALID_ARGS @p aEui64 is invalid.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
4008 pub fn otCommissionerRemoveJoiner(
4009 aInstance: *mut otInstance,
4010 aEui64: *const otExtAddress,
4011 ) -> otError;
4012}
4013unsafe extern "C" {
4014 #[doc = " Removes a Joiner entry.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDiscerner A pointer to the Joiner Discerner.\n\n @retval OT_ERROR_NONE Successfully removed the Joiner.\n @retval OT_ERROR_NOT_FOUND The Joiner specified by @p aEui64 was not found.\n @retval OT_ERROR_INVALID_ARGS @p aDiscerner is invalid.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
4015 pub fn otCommissionerRemoveJoinerWithDiscerner(
4016 aInstance: *mut otInstance,
4017 aDiscerner: *const otJoinerDiscerner,
4018 ) -> otError;
4019}
4020unsafe extern "C" {
4021 #[doc = " Gets the Provisioning URL.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the URL string."]
4022 pub fn otCommissionerGetProvisioningUrl(
4023 aInstance: *mut otInstance,
4024 ) -> *const ::std::os::raw::c_char;
4025}
4026unsafe extern "C" {
4027 #[doc = " Sets the Provisioning URL.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aProvisioningUrl A pointer to the Provisioning URL (may be NULL to set as empty string).\n\n @retval OT_ERROR_NONE Successfully set the Provisioning URL.\n @retval OT_ERROR_INVALID_ARGS @p aProvisioningUrl is invalid (too long)."]
4028 pub fn otCommissionerSetProvisioningUrl(
4029 aInstance: *mut otInstance,
4030 aProvisioningUrl: *const ::std::os::raw::c_char,
4031 ) -> otError;
4032}
4033unsafe extern "C" {
4034 #[doc = " Sends an Announce Begin message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask The channel mask value.\n @param[in] aCount The number of Announcement messages per channel.\n @param[in] aPeriod The time between two successive MLE Announce transmissions (in milliseconds).\n @param[in] aAddress A pointer to the IPv6 destination.\n\n @retval OT_ERROR_NONE Successfully enqueued the Announce Begin message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate an Announce Begin message.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
4035 pub fn otCommissionerAnnounceBegin(
4036 aInstance: *mut otInstance,
4037 aChannelMask: u32,
4038 aCount: u8,
4039 aPeriod: u16,
4040 aAddress: *const otIp6Address,
4041 ) -> otError;
4042}
4043#[doc = " Pointer is called when the Commissioner receives an Energy Report.\n\n @param[in] aChannelMask The channel mask value.\n @param[in] aEnergyList A pointer to the energy measurement list.\n @param[in] aEnergyListLength Number of entries in @p aEnergyListLength.\n @param[in] aContext A pointer to application-specific context."]
4044pub type otCommissionerEnergyReportCallback = ::std::option::Option<
4045 unsafe extern "C" fn(
4046 aChannelMask: u32,
4047 aEnergyList: *const u8,
4048 aEnergyListLength: u8,
4049 aContext: *mut ::std::os::raw::c_void,
4050 ),
4051>;
4052unsafe extern "C" {
4053 #[doc = " Sends an Energy Scan Query message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask The channel mask value.\n @param[in] aCount The number of energy measurements per channel.\n @param[in] aPeriod The time between energy measurements (milliseconds).\n @param[in] aScanDuration The scan duration for each energy measurement (milliseconds).\n @param[in] aAddress A pointer to the IPv6 destination.\n @param[in] aCallback A pointer to a function called on receiving an Energy Report message.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully enqueued the Energy Scan Query message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate an Energy Scan Query message.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
4054 pub fn otCommissionerEnergyScan(
4055 aInstance: *mut otInstance,
4056 aChannelMask: u32,
4057 aCount: u8,
4058 aPeriod: u16,
4059 aScanDuration: u16,
4060 aAddress: *const otIp6Address,
4061 aCallback: otCommissionerEnergyReportCallback,
4062 aContext: *mut ::std::os::raw::c_void,
4063 ) -> otError;
4064}
4065#[doc = " Pointer is called when the Commissioner receives a PAN ID Conflict message.\n\n @param[in] aPanId The PAN ID value.\n @param[in] aChannelMask The channel mask value.\n @param[in] aContext A pointer to application-specific context."]
4066pub type otCommissionerPanIdConflictCallback = ::std::option::Option<
4067 unsafe extern "C" fn(aPanId: u16, aChannelMask: u32, aContext: *mut ::std::os::raw::c_void),
4068>;
4069unsafe extern "C" {
4070 #[doc = " Sends a PAN ID Query message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPanId The PAN ID to query.\n @param[in] aChannelMask The channel mask value.\n @param[in] aAddress A pointer to the IPv6 destination.\n @param[in] aCallback A pointer to a function called on receiving a PAN ID Conflict message.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully enqueued the PAN ID Query message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate a PAN ID Query message.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active.\n\n @note Only use this after successfully starting the Commissioner role with otCommissionerStart()."]
4071 pub fn otCommissionerPanIdQuery(
4072 aInstance: *mut otInstance,
4073 aPanId: u16,
4074 aChannelMask: u32,
4075 aAddress: *const otIp6Address,
4076 aCallback: otCommissionerPanIdConflictCallback,
4077 aContext: *mut ::std::os::raw::c_void,
4078 ) -> otError;
4079}
4080unsafe extern "C" {
4081 #[doc = " Sends MGMT_COMMISSIONER_GET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTlvs A pointer to TLVs.\n @param[in] aLength The length of TLVs.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active."]
4082 pub fn otCommissionerSendMgmtGet(
4083 aInstance: *mut otInstance,
4084 aTlvs: *const u8,
4085 aLength: u8,
4086 ) -> otError;
4087}
4088unsafe extern "C" {
4089 #[doc = " Sends MGMT_COMMISSIONER_SET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to commissioning dataset.\n @param[in] aTlvs A pointer to TLVs.\n @param[in] aLength The length of TLVs.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.\n @retval OT_ERROR_INVALID_STATE The commissioner is not active."]
4090 pub fn otCommissionerSendMgmtSet(
4091 aInstance: *mut otInstance,
4092 aDataset: *const otCommissioningDataset,
4093 aTlvs: *const u8,
4094 aLength: u8,
4095 ) -> otError;
4096}
4097unsafe extern "C" {
4098 #[doc = " Returns the Commissioner Session ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current commissioner session id."]
4099 pub fn otCommissionerGetSessionId(aInstance: *mut otInstance) -> u16;
4100}
4101unsafe extern "C" {
4102 #[doc = " Returns the Commissioner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_COMMISSIONER_STATE_DISABLED Commissioner disabled.\n @retval OT_COMMISSIONER_STATE_PETITION Becoming the commissioner.\n @retval OT_COMMISSIONER_STATE_ACTIVE Commissioner enabled."]
4103 pub fn otCommissionerGetState(aInstance: *mut otInstance) -> otCommissionerState;
4104}
4105pub type otNetworkDataIterator = u32;
4106#[doc = " Represents a Border Router configuration."]
4107#[repr(C)]
4108#[repr(align(4))]
4109#[derive(Copy, Clone)]
4110pub struct otBorderRouterConfig {
4111 #[doc = "< The IPv6 prefix."]
4112 pub mPrefix: otIp6Prefix,
4113 pub _bitfield_align_1: [u8; 0],
4114 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
4115 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4116 pub mRloc16: u16,
4117}
4118impl Default for otBorderRouterConfig {
4119 fn default() -> Self {
4120 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4121 unsafe {
4122 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4123 s.assume_init()
4124 }
4125 }
4126}
4127impl otBorderRouterConfig {
4128 #[inline]
4129 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4130 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4131 }
4132 #[inline]
4133 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4134 unsafe {
4135 let val: u32 = ::std::mem::transmute(val);
4136 self._bitfield_1.set(0usize, 2u8, val as u64)
4137 }
4138 }
4139 #[inline]
4140 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4141 unsafe {
4142 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4143 ::std::ptr::addr_of!((*this)._bitfield_1),
4144 0usize,
4145 2u8,
4146 ) as u32)
4147 }
4148 }
4149 #[inline]
4150 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4151 unsafe {
4152 let val: u32 = ::std::mem::transmute(val);
4153 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4154 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4155 0usize,
4156 2u8,
4157 val as u64,
4158 )
4159 }
4160 }
4161 #[inline]
4162 pub fn mPreferred(&self) -> bool {
4163 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4164 }
4165 #[inline]
4166 pub fn set_mPreferred(&mut self, val: bool) {
4167 unsafe {
4168 let val: u8 = ::std::mem::transmute(val);
4169 self._bitfield_1.set(2usize, 1u8, val as u64)
4170 }
4171 }
4172 #[inline]
4173 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
4174 unsafe {
4175 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4176 ::std::ptr::addr_of!((*this)._bitfield_1),
4177 2usize,
4178 1u8,
4179 ) as u8)
4180 }
4181 }
4182 #[inline]
4183 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
4184 unsafe {
4185 let val: u8 = ::std::mem::transmute(val);
4186 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4187 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4188 2usize,
4189 1u8,
4190 val as u64,
4191 )
4192 }
4193 }
4194 #[inline]
4195 pub fn mSlaac(&self) -> bool {
4196 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4197 }
4198 #[inline]
4199 pub fn set_mSlaac(&mut self, val: bool) {
4200 unsafe {
4201 let val: u8 = ::std::mem::transmute(val);
4202 self._bitfield_1.set(3usize, 1u8, val as u64)
4203 }
4204 }
4205 #[inline]
4206 pub unsafe fn mSlaac_raw(this: *const Self) -> bool {
4207 unsafe {
4208 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4209 ::std::ptr::addr_of!((*this)._bitfield_1),
4210 3usize,
4211 1u8,
4212 ) as u8)
4213 }
4214 }
4215 #[inline]
4216 pub unsafe fn set_mSlaac_raw(this: *mut Self, val: bool) {
4217 unsafe {
4218 let val: u8 = ::std::mem::transmute(val);
4219 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4220 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4221 3usize,
4222 1u8,
4223 val as u64,
4224 )
4225 }
4226 }
4227 #[inline]
4228 pub fn mDhcp(&self) -> bool {
4229 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4230 }
4231 #[inline]
4232 pub fn set_mDhcp(&mut self, val: bool) {
4233 unsafe {
4234 let val: u8 = ::std::mem::transmute(val);
4235 self._bitfield_1.set(4usize, 1u8, val as u64)
4236 }
4237 }
4238 #[inline]
4239 pub unsafe fn mDhcp_raw(this: *const Self) -> bool {
4240 unsafe {
4241 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4242 ::std::ptr::addr_of!((*this)._bitfield_1),
4243 4usize,
4244 1u8,
4245 ) as u8)
4246 }
4247 }
4248 #[inline]
4249 pub unsafe fn set_mDhcp_raw(this: *mut Self, val: bool) {
4250 unsafe {
4251 let val: u8 = ::std::mem::transmute(val);
4252 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4253 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4254 4usize,
4255 1u8,
4256 val as u64,
4257 )
4258 }
4259 }
4260 #[inline]
4261 pub fn mConfigure(&self) -> bool {
4262 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4263 }
4264 #[inline]
4265 pub fn set_mConfigure(&mut self, val: bool) {
4266 unsafe {
4267 let val: u8 = ::std::mem::transmute(val);
4268 self._bitfield_1.set(5usize, 1u8, val as u64)
4269 }
4270 }
4271 #[inline]
4272 pub unsafe fn mConfigure_raw(this: *const Self) -> bool {
4273 unsafe {
4274 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4275 ::std::ptr::addr_of!((*this)._bitfield_1),
4276 5usize,
4277 1u8,
4278 ) as u8)
4279 }
4280 }
4281 #[inline]
4282 pub unsafe fn set_mConfigure_raw(this: *mut Self, val: bool) {
4283 unsafe {
4284 let val: u8 = ::std::mem::transmute(val);
4285 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4286 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4287 5usize,
4288 1u8,
4289 val as u64,
4290 )
4291 }
4292 }
4293 #[inline]
4294 pub fn mDefaultRoute(&self) -> bool {
4295 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
4296 }
4297 #[inline]
4298 pub fn set_mDefaultRoute(&mut self, val: bool) {
4299 unsafe {
4300 let val: u8 = ::std::mem::transmute(val);
4301 self._bitfield_1.set(6usize, 1u8, val as u64)
4302 }
4303 }
4304 #[inline]
4305 pub unsafe fn mDefaultRoute_raw(this: *const Self) -> bool {
4306 unsafe {
4307 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4308 ::std::ptr::addr_of!((*this)._bitfield_1),
4309 6usize,
4310 1u8,
4311 ) as u8)
4312 }
4313 }
4314 #[inline]
4315 pub unsafe fn set_mDefaultRoute_raw(this: *mut Self, val: bool) {
4316 unsafe {
4317 let val: u8 = ::std::mem::transmute(val);
4318 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4319 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4320 6usize,
4321 1u8,
4322 val as u64,
4323 )
4324 }
4325 }
4326 #[inline]
4327 pub fn mOnMesh(&self) -> bool {
4328 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
4329 }
4330 #[inline]
4331 pub fn set_mOnMesh(&mut self, val: bool) {
4332 unsafe {
4333 let val: u8 = ::std::mem::transmute(val);
4334 self._bitfield_1.set(7usize, 1u8, val as u64)
4335 }
4336 }
4337 #[inline]
4338 pub unsafe fn mOnMesh_raw(this: *const Self) -> bool {
4339 unsafe {
4340 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4341 ::std::ptr::addr_of!((*this)._bitfield_1),
4342 7usize,
4343 1u8,
4344 ) as u8)
4345 }
4346 }
4347 #[inline]
4348 pub unsafe fn set_mOnMesh_raw(this: *mut Self, val: bool) {
4349 unsafe {
4350 let val: u8 = ::std::mem::transmute(val);
4351 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4352 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4353 7usize,
4354 1u8,
4355 val as u64,
4356 )
4357 }
4358 }
4359 #[inline]
4360 pub fn mStable(&self) -> bool {
4361 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
4362 }
4363 #[inline]
4364 pub fn set_mStable(&mut self, val: bool) {
4365 unsafe {
4366 let val: u8 = ::std::mem::transmute(val);
4367 self._bitfield_1.set(8usize, 1u8, val as u64)
4368 }
4369 }
4370 #[inline]
4371 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4372 unsafe {
4373 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4374 ::std::ptr::addr_of!((*this)._bitfield_1),
4375 8usize,
4376 1u8,
4377 ) as u8)
4378 }
4379 }
4380 #[inline]
4381 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4382 unsafe {
4383 let val: u8 = ::std::mem::transmute(val);
4384 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4385 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4386 8usize,
4387 1u8,
4388 val as u64,
4389 )
4390 }
4391 }
4392 #[inline]
4393 pub fn mNdDns(&self) -> bool {
4394 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
4395 }
4396 #[inline]
4397 pub fn set_mNdDns(&mut self, val: bool) {
4398 unsafe {
4399 let val: u8 = ::std::mem::transmute(val);
4400 self._bitfield_1.set(9usize, 1u8, val as u64)
4401 }
4402 }
4403 #[inline]
4404 pub unsafe fn mNdDns_raw(this: *const Self) -> bool {
4405 unsafe {
4406 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4407 ::std::ptr::addr_of!((*this)._bitfield_1),
4408 9usize,
4409 1u8,
4410 ) as u8)
4411 }
4412 }
4413 #[inline]
4414 pub unsafe fn set_mNdDns_raw(this: *mut Self, val: bool) {
4415 unsafe {
4416 let val: u8 = ::std::mem::transmute(val);
4417 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4418 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4419 9usize,
4420 1u8,
4421 val as u64,
4422 )
4423 }
4424 }
4425 #[inline]
4426 pub fn mDp(&self) -> bool {
4427 unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
4428 }
4429 #[inline]
4430 pub fn set_mDp(&mut self, val: bool) {
4431 unsafe {
4432 let val: u8 = ::std::mem::transmute(val);
4433 self._bitfield_1.set(10usize, 1u8, val as u64)
4434 }
4435 }
4436 #[inline]
4437 pub unsafe fn mDp_raw(this: *const Self) -> bool {
4438 unsafe {
4439 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4440 ::std::ptr::addr_of!((*this)._bitfield_1),
4441 10usize,
4442 1u8,
4443 ) as u8)
4444 }
4445 }
4446 #[inline]
4447 pub unsafe fn set_mDp_raw(this: *mut Self, val: bool) {
4448 unsafe {
4449 let val: u8 = ::std::mem::transmute(val);
4450 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4451 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4452 10usize,
4453 1u8,
4454 val as u64,
4455 )
4456 }
4457 }
4458 #[inline]
4459 pub fn new_bitfield_1(
4460 mPreference: ::std::os::raw::c_int,
4461 mPreferred: bool,
4462 mSlaac: bool,
4463 mDhcp: bool,
4464 mConfigure: bool,
4465 mDefaultRoute: bool,
4466 mOnMesh: bool,
4467 mStable: bool,
4468 mNdDns: bool,
4469 mDp: bool,
4470 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
4471 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
4472 __bindgen_bitfield_unit.set(0usize, 2u8, {
4473 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
4474 mPreference as u64
4475 });
4476 __bindgen_bitfield_unit.set(2usize, 1u8, {
4477 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
4478 mPreferred as u64
4479 });
4480 __bindgen_bitfield_unit.set(3usize, 1u8, {
4481 let mSlaac: u8 = unsafe { ::std::mem::transmute(mSlaac) };
4482 mSlaac as u64
4483 });
4484 __bindgen_bitfield_unit.set(4usize, 1u8, {
4485 let mDhcp: u8 = unsafe { ::std::mem::transmute(mDhcp) };
4486 mDhcp as u64
4487 });
4488 __bindgen_bitfield_unit.set(5usize, 1u8, {
4489 let mConfigure: u8 = unsafe { ::std::mem::transmute(mConfigure) };
4490 mConfigure as u64
4491 });
4492 __bindgen_bitfield_unit.set(6usize, 1u8, {
4493 let mDefaultRoute: u8 = unsafe { ::std::mem::transmute(mDefaultRoute) };
4494 mDefaultRoute as u64
4495 });
4496 __bindgen_bitfield_unit.set(7usize, 1u8, {
4497 let mOnMesh: u8 = unsafe { ::std::mem::transmute(mOnMesh) };
4498 mOnMesh as u64
4499 });
4500 __bindgen_bitfield_unit.set(8usize, 1u8, {
4501 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4502 mStable as u64
4503 });
4504 __bindgen_bitfield_unit.set(9usize, 1u8, {
4505 let mNdDns: u8 = unsafe { ::std::mem::transmute(mNdDns) };
4506 mNdDns as u64
4507 });
4508 __bindgen_bitfield_unit.set(10usize, 1u8, {
4509 let mDp: u8 = unsafe { ::std::mem::transmute(mDp) };
4510 mDp as u64
4511 });
4512 __bindgen_bitfield_unit
4513 }
4514}
4515#[doc = " Represents 6LoWPAN Context ID information associated with a prefix in Network Data."]
4516#[repr(C)]
4517#[derive(Copy, Clone)]
4518pub struct otLowpanContextInfo {
4519 #[doc = "< The 6LoWPAN Context ID."]
4520 pub mContextId: u8,
4521 pub _bitfield_align_1: [u8; 0],
4522 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4523 #[doc = "< The associated IPv6 prefix."]
4524 pub mPrefix: otIp6Prefix,
4525}
4526impl Default for otLowpanContextInfo {
4527 fn default() -> Self {
4528 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4529 unsafe {
4530 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4531 s.assume_init()
4532 }
4533 }
4534}
4535impl otLowpanContextInfo {
4536 #[inline]
4537 pub fn mCompressFlag(&self) -> bool {
4538 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4539 }
4540 #[inline]
4541 pub fn set_mCompressFlag(&mut self, val: bool) {
4542 unsafe {
4543 let val: u8 = ::std::mem::transmute(val);
4544 self._bitfield_1.set(0usize, 1u8, val as u64)
4545 }
4546 }
4547 #[inline]
4548 pub unsafe fn mCompressFlag_raw(this: *const Self) -> bool {
4549 unsafe {
4550 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4551 ::std::ptr::addr_of!((*this)._bitfield_1),
4552 0usize,
4553 1u8,
4554 ) as u8)
4555 }
4556 }
4557 #[inline]
4558 pub unsafe fn set_mCompressFlag_raw(this: *mut Self, val: bool) {
4559 unsafe {
4560 let val: u8 = ::std::mem::transmute(val);
4561 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4562 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4563 0usize,
4564 1u8,
4565 val as u64,
4566 )
4567 }
4568 }
4569 #[inline]
4570 pub fn mStable(&self) -> bool {
4571 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
4572 }
4573 #[inline]
4574 pub fn set_mStable(&mut self, val: bool) {
4575 unsafe {
4576 let val: u8 = ::std::mem::transmute(val);
4577 self._bitfield_1.set(1usize, 1u8, val as u64)
4578 }
4579 }
4580 #[inline]
4581 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4582 unsafe {
4583 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4584 ::std::ptr::addr_of!((*this)._bitfield_1),
4585 1usize,
4586 1u8,
4587 ) as u8)
4588 }
4589 }
4590 #[inline]
4591 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4592 unsafe {
4593 let val: u8 = ::std::mem::transmute(val);
4594 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4595 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4596 1usize,
4597 1u8,
4598 val as u64,
4599 )
4600 }
4601 }
4602 #[inline]
4603 pub fn new_bitfield_1(
4604 mCompressFlag: bool,
4605 mStable: bool,
4606 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4607 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4608 __bindgen_bitfield_unit.set(0usize, 1u8, {
4609 let mCompressFlag: u8 = unsafe { ::std::mem::transmute(mCompressFlag) };
4610 mCompressFlag as u64
4611 });
4612 __bindgen_bitfield_unit.set(1usize, 1u8, {
4613 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4614 mStable as u64
4615 });
4616 __bindgen_bitfield_unit
4617 }
4618}
4619#[doc = " Represents an External Route configuration."]
4620#[repr(C)]
4621#[repr(align(4))]
4622#[derive(Copy, Clone)]
4623pub struct otExternalRouteConfig {
4624 #[doc = "< The IPv6 prefix."]
4625 pub mPrefix: otIp6Prefix,
4626 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4627 pub mRloc16: u16,
4628 pub _bitfield_align_1: [u8; 0],
4629 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4630 pub __bindgen_padding_0: [u8; 3usize],
4631}
4632impl Default for otExternalRouteConfig {
4633 fn default() -> Self {
4634 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4635 unsafe {
4636 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4637 s.assume_init()
4638 }
4639 }
4640}
4641impl otExternalRouteConfig {
4642 #[inline]
4643 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4644 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4645 }
4646 #[inline]
4647 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4648 unsafe {
4649 let val: u32 = ::std::mem::transmute(val);
4650 self._bitfield_1.set(0usize, 2u8, val as u64)
4651 }
4652 }
4653 #[inline]
4654 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4655 unsafe {
4656 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4657 ::std::ptr::addr_of!((*this)._bitfield_1),
4658 0usize,
4659 2u8,
4660 ) as u32)
4661 }
4662 }
4663 #[inline]
4664 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4665 unsafe {
4666 let val: u32 = ::std::mem::transmute(val);
4667 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4668 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4669 0usize,
4670 2u8,
4671 val as u64,
4672 )
4673 }
4674 }
4675 #[inline]
4676 pub fn mNat64(&self) -> bool {
4677 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4678 }
4679 #[inline]
4680 pub fn set_mNat64(&mut self, val: bool) {
4681 unsafe {
4682 let val: u8 = ::std::mem::transmute(val);
4683 self._bitfield_1.set(2usize, 1u8, val as u64)
4684 }
4685 }
4686 #[inline]
4687 pub unsafe fn mNat64_raw(this: *const Self) -> bool {
4688 unsafe {
4689 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4690 ::std::ptr::addr_of!((*this)._bitfield_1),
4691 2usize,
4692 1u8,
4693 ) as u8)
4694 }
4695 }
4696 #[inline]
4697 pub unsafe fn set_mNat64_raw(this: *mut Self, val: bool) {
4698 unsafe {
4699 let val: u8 = ::std::mem::transmute(val);
4700 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4701 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4702 2usize,
4703 1u8,
4704 val as u64,
4705 )
4706 }
4707 }
4708 #[inline]
4709 pub fn mStable(&self) -> bool {
4710 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4711 }
4712 #[inline]
4713 pub fn set_mStable(&mut self, val: bool) {
4714 unsafe {
4715 let val: u8 = ::std::mem::transmute(val);
4716 self._bitfield_1.set(3usize, 1u8, val as u64)
4717 }
4718 }
4719 #[inline]
4720 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4721 unsafe {
4722 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4723 ::std::ptr::addr_of!((*this)._bitfield_1),
4724 3usize,
4725 1u8,
4726 ) as u8)
4727 }
4728 }
4729 #[inline]
4730 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4731 unsafe {
4732 let val: u8 = ::std::mem::transmute(val);
4733 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4734 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4735 3usize,
4736 1u8,
4737 val as u64,
4738 )
4739 }
4740 }
4741 #[inline]
4742 pub fn mNextHopIsThisDevice(&self) -> bool {
4743 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4744 }
4745 #[inline]
4746 pub fn set_mNextHopIsThisDevice(&mut self, val: bool) {
4747 unsafe {
4748 let val: u8 = ::std::mem::transmute(val);
4749 self._bitfield_1.set(4usize, 1u8, val as u64)
4750 }
4751 }
4752 #[inline]
4753 pub unsafe fn mNextHopIsThisDevice_raw(this: *const Self) -> bool {
4754 unsafe {
4755 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4756 ::std::ptr::addr_of!((*this)._bitfield_1),
4757 4usize,
4758 1u8,
4759 ) as u8)
4760 }
4761 }
4762 #[inline]
4763 pub unsafe fn set_mNextHopIsThisDevice_raw(this: *mut Self, val: bool) {
4764 unsafe {
4765 let val: u8 = ::std::mem::transmute(val);
4766 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4767 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4768 4usize,
4769 1u8,
4770 val as u64,
4771 )
4772 }
4773 }
4774 #[inline]
4775 pub fn mAdvPio(&self) -> bool {
4776 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4777 }
4778 #[inline]
4779 pub fn set_mAdvPio(&mut self, val: bool) {
4780 unsafe {
4781 let val: u8 = ::std::mem::transmute(val);
4782 self._bitfield_1.set(5usize, 1u8, val as u64)
4783 }
4784 }
4785 #[inline]
4786 pub unsafe fn mAdvPio_raw(this: *const Self) -> bool {
4787 unsafe {
4788 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4789 ::std::ptr::addr_of!((*this)._bitfield_1),
4790 5usize,
4791 1u8,
4792 ) as u8)
4793 }
4794 }
4795 #[inline]
4796 pub unsafe fn set_mAdvPio_raw(this: *mut Self, val: bool) {
4797 unsafe {
4798 let val: u8 = ::std::mem::transmute(val);
4799 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4800 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4801 5usize,
4802 1u8,
4803 val as u64,
4804 )
4805 }
4806 }
4807 #[inline]
4808 pub fn new_bitfield_1(
4809 mPreference: ::std::os::raw::c_int,
4810 mNat64: bool,
4811 mStable: bool,
4812 mNextHopIsThisDevice: bool,
4813 mAdvPio: bool,
4814 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4815 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4816 __bindgen_bitfield_unit.set(0usize, 2u8, {
4817 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
4818 mPreference as u64
4819 });
4820 __bindgen_bitfield_unit.set(2usize, 1u8, {
4821 let mNat64: u8 = unsafe { ::std::mem::transmute(mNat64) };
4822 mNat64 as u64
4823 });
4824 __bindgen_bitfield_unit.set(3usize, 1u8, {
4825 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4826 mStable as u64
4827 });
4828 __bindgen_bitfield_unit.set(4usize, 1u8, {
4829 let mNextHopIsThisDevice: u8 = unsafe { ::std::mem::transmute(mNextHopIsThisDevice) };
4830 mNextHopIsThisDevice as u64
4831 });
4832 __bindgen_bitfield_unit.set(5usize, 1u8, {
4833 let mAdvPio: u8 = unsafe { ::std::mem::transmute(mAdvPio) };
4834 mAdvPio as u64
4835 });
4836 __bindgen_bitfield_unit
4837 }
4838}
4839#[doc = "< Low route preference."]
4840pub const OT_ROUTE_PREFERENCE_LOW: otRoutePreference = -1;
4841#[doc = "< Medium route preference."]
4842pub const OT_ROUTE_PREFERENCE_MED: otRoutePreference = 0;
4843#[doc = "< High route preference."]
4844pub const OT_ROUTE_PREFERENCE_HIGH: otRoutePreference = 1;
4845#[doc = " Defines valid values for `mPreference` in `otExternalRouteConfig` and `otBorderRouterConfig`."]
4846pub type otRoutePreference = ::std::os::raw::c_int;
4847#[doc = " Represents a Server configuration."]
4848#[repr(C)]
4849#[derive(Debug, Copy, Clone)]
4850pub struct otServerConfig {
4851 pub _bitfield_align_1: [u8; 0],
4852 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4853 #[doc = "< Length of server data."]
4854 pub mServerDataLength: u8,
4855 #[doc = "< Server data bytes."]
4856 pub mServerData: [u8; 248usize],
4857 #[doc = "< The Server RLOC16."]
4858 pub mRloc16: u16,
4859}
4860impl Default for otServerConfig {
4861 fn default() -> Self {
4862 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4863 unsafe {
4864 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4865 s.assume_init()
4866 }
4867 }
4868}
4869impl otServerConfig {
4870 #[inline]
4871 pub fn mStable(&self) -> bool {
4872 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4873 }
4874 #[inline]
4875 pub fn set_mStable(&mut self, val: bool) {
4876 unsafe {
4877 let val: u8 = ::std::mem::transmute(val);
4878 self._bitfield_1.set(0usize, 1u8, val as u64)
4879 }
4880 }
4881 #[inline]
4882 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4883 unsafe {
4884 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4885 ::std::ptr::addr_of!((*this)._bitfield_1),
4886 0usize,
4887 1u8,
4888 ) as u8)
4889 }
4890 }
4891 #[inline]
4892 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4893 unsafe {
4894 let val: u8 = ::std::mem::transmute(val);
4895 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4896 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4897 0usize,
4898 1u8,
4899 val as u64,
4900 )
4901 }
4902 }
4903 #[inline]
4904 pub fn new_bitfield_1(mStable: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4905 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4906 __bindgen_bitfield_unit.set(0usize, 1u8, {
4907 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4908 mStable as u64
4909 });
4910 __bindgen_bitfield_unit
4911 }
4912}
4913#[doc = " Represents a Service configuration."]
4914#[repr(C)]
4915#[derive(Debug, Copy, Clone)]
4916pub struct otServiceConfig {
4917 #[doc = "< Service ID (when iterating over the Network Data)."]
4918 pub mServiceId: u8,
4919 #[doc = "< IANA Enterprise Number."]
4920 pub mEnterpriseNumber: u32,
4921 #[doc = "< Length of service data."]
4922 pub mServiceDataLength: u8,
4923 #[doc = "< Service data bytes."]
4924 pub mServiceData: [u8; 252usize],
4925 #[doc = "< The Server configuration."]
4926 pub mServerConfig: otServerConfig,
4927}
4928impl Default for otServiceConfig {
4929 fn default() -> Self {
4930 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4931 unsafe {
4932 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4933 s.assume_init()
4934 }
4935 }
4936}
4937unsafe extern "C" {
4938 #[doc = " Provide full or stable copy of the Partition's Thread Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.\n @param[out] aData A pointer to the data buffer.\n @param[in,out] aDataLength On entry, size of the data buffer pointed to by @p aData.\n On exit, number of copied bytes.\n\n @retval OT_ERROR_NONE Successfully copied the Thread Network Data into @p aData and updated @p aDataLength.\n @retval OT_ERROR_NO_BUFS Not enough space in @p aData to fully copy the Thread Network Data."]
4939 pub fn otNetDataGet(
4940 aInstance: *mut otInstance,
4941 aStable: bool,
4942 aData: *mut u8,
4943 aDataLength: *mut u8,
4944 ) -> otError;
4945}
4946unsafe extern "C" {
4947 #[doc = " Get the current length (number of bytes) of Partition's Thread Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @return The length of the Network Data."]
4948 pub fn otNetDataGetLength(aInstance: *mut otInstance) -> u8;
4949}
4950unsafe extern "C" {
4951 #[doc = " Get the maximum observed length of the Thread Network Data since OT stack initialization or since the last call to\n `otNetDataResetMaxLength()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @return The maximum length of the Network Data (high water mark for Network Data length)."]
4952 pub fn otNetDataGetMaxLength(aInstance: *mut otInstance) -> u8;
4953}
4954unsafe extern "C" {
4955 #[doc = " Reset the tracked maximum length of the Thread Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @sa otNetDataGetMaxLength"]
4956 pub fn otNetDataResetMaxLength(aInstance: *mut otInstance);
4957}
4958unsafe extern "C" {
4959 #[doc = " Get the next On Mesh Prefix in the partition's Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first on-mesh entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to where the On Mesh Prefix information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next On Mesh prefix.\n @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data."]
4960 pub fn otNetDataGetNextOnMeshPrefix(
4961 aInstance: *mut otInstance,
4962 aIterator: *mut otNetworkDataIterator,
4963 aConfig: *mut otBorderRouterConfig,
4964 ) -> otError;
4965}
4966unsafe extern "C" {
4967 #[doc = " Get the next external route in the partition's Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first external route entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to where the External Route information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next External Route.\n @retval OT_ERROR_NOT_FOUND No subsequent external route entry exists in the Thread Network Data."]
4968 pub fn otNetDataGetNextRoute(
4969 aInstance: *mut otInstance,
4970 aIterator: *mut otNetworkDataIterator,
4971 aConfig: *mut otExternalRouteConfig,
4972 ) -> otError;
4973}
4974unsafe extern "C" {
4975 #[doc = " Get the next service in the partition's Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first service entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to where the service information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next service.\n @retval OT_ERROR_NOT_FOUND No subsequent service exists in the partition's Network Data."]
4976 pub fn otNetDataGetNextService(
4977 aInstance: *mut otInstance,
4978 aIterator: *mut otNetworkDataIterator,
4979 aConfig: *mut otServiceConfig,
4980 ) -> otError;
4981}
4982unsafe extern "C" {
4983 #[doc = " Get the next 6LoWPAN Context ID info in the partition's Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator. To get the first service entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aContextInfo A pointer to where the retrieved 6LoWPAN Context ID information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next 6LoWPAN Context ID info.\n @retval OT_ERROR_NOT_FOUND No subsequent 6LoWPAN Context info exists in the partition's Network Data."]
4984 pub fn otNetDataGetNextLowpanContextInfo(
4985 aInstance: *mut otInstance,
4986 aIterator: *mut otNetworkDataIterator,
4987 aContextInfo: *mut otLowpanContextInfo,
4988 ) -> otError;
4989}
4990unsafe extern "C" {
4991 #[doc = " Gets the Commissioning Dataset from the partition's Network Data.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aDataset A pointer to a `otCommissioningDataset` to populate."]
4992 pub fn otNetDataGetCommissioningDataset(
4993 aInstance: *mut otInstance,
4994 aDataset: *mut otCommissioningDataset,
4995 );
4996}
4997unsafe extern "C" {
4998 #[doc = " Get the Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Network Data Version."]
4999 pub fn otNetDataGetVersion(aInstance: *mut otInstance) -> u8;
5000}
5001unsafe extern "C" {
5002 #[doc = " Get the Stable Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Stable Network Data Version."]
5003 pub fn otNetDataGetStableVersion(aInstance: *mut otInstance) -> u8;
5004}
5005unsafe extern "C" {
5006 #[doc = " Check if the steering data includes a Joiner.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEui64 A pointer to the Joiner's IEEE EUI-64.\n\n @retval OT_ERROR_NONE @p aEui64 is included in the steering data.\n @retval OT_ERROR_INVALID_STATE No steering data present.\n @retval OT_ERROR_NOT_FOUND @p aEui64 is not included in the steering data."]
5007 pub fn otNetDataSteeringDataCheckJoiner(
5008 aInstance: *mut otInstance,
5009 aEui64: *const otExtAddress,
5010 ) -> otError;
5011}
5012unsafe extern "C" {
5013 #[doc = " Check if the steering data includes a Joiner with a given discerner value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDiscerner A pointer to the Joiner Discerner.\n\n @retval OT_ERROR_NONE @p aDiscerner is included in the steering data.\n @retval OT_ERROR_INVALID_STATE No steering data present.\n @retval OT_ERROR_NOT_FOUND @p aDiscerner is not included in the steering data."]
5014 pub fn otNetDataSteeringDataCheckJoinerWithDiscerner(
5015 aInstance: *mut otInstance,
5016 aDiscerner: *const otJoinerDiscerner,
5017 ) -> otError;
5018}
5019unsafe extern "C" {
5020 #[doc = " Check whether a given Prefix can act as a valid OMR prefix and also the Leader's Network Data contains this prefix.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefix A pointer to the IPv6 prefix.\n\n @returns Whether @p aPrefix is a valid OMR prefix and Leader's Network Data contains the OMR prefix @p aPrefix.\n\n @note This API is only available when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is used."]
5021 pub fn otNetDataContainsOmrPrefix(
5022 aInstance: *mut otInstance,
5023 aPrefix: *const otIp6Prefix,
5024 ) -> bool;
5025}
5026#[doc = "< Backbone function is disabled."]
5027pub const OT_BACKBONE_ROUTER_STATE_DISABLED: otBackboneRouterState = 0;
5028#[doc = "< Secondary Backbone Router."]
5029pub const OT_BACKBONE_ROUTER_STATE_SECONDARY: otBackboneRouterState = 1;
5030#[doc = "< The Primary Backbone Router."]
5031pub const OT_BACKBONE_ROUTER_STATE_PRIMARY: otBackboneRouterState = 2;
5032#[doc = " Represents the Backbone Router Status."]
5033pub type otBackboneRouterState = ::std::os::raw::c_uint;
5034unsafe extern "C" {
5035 #[doc = " Enables or disables Backbone functionality.\n\n If enabled, a Server Data Request message `SRV_DATA.ntf` is triggered for the attached\n device if there is no Backbone Router Service in the Thread Network Data.\n\n If disabled, `SRV_DATA.ntf` is triggered if the Backbone Router is in the Primary state.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable TRUE to enable Backbone functionality, FALSE otherwise.\n\n @sa otBackboneRouterGetState\n @sa otBackboneRouterGetConfig\n @sa otBackboneRouterSetConfig\n @sa otBackboneRouterRegister"]
5036 pub fn otBackboneRouterSetEnabled(aInstance: *mut otInstance, aEnable: bool);
5037}
5038unsafe extern "C" {
5039 #[doc = " Gets the Backbone Router #otBackboneRouterState.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_BACKBONE_ROUTER_STATE_DISABLED Backbone functionality is disabled.\n @retval OT_BACKBONE_ROUTER_STATE_SECONDARY Secondary Backbone Router.\n @retval OT_BACKBONE_ROUTER_STATE_PRIMARY The Primary Backbone Router.\n\n @sa otBackboneRouterSetEnabled\n @sa otBackboneRouterGetConfig\n @sa otBackboneRouterSetConfig\n @sa otBackboneRouterRegister"]
5040 pub fn otBackboneRouterGetState(aInstance: *mut otInstance) -> otBackboneRouterState;
5041}
5042unsafe extern "C" {
5043 #[doc = " Gets the local Backbone Router configuration.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aConfig A pointer where to put local Backbone Router configuration.\n\n\n @sa otBackboneRouterSetEnabled\n @sa otBackboneRouterGetState\n @sa otBackboneRouterSetConfig\n @sa otBackboneRouterRegister"]
5044 pub fn otBackboneRouterGetConfig(
5045 aInstance: *mut otInstance,
5046 aConfig: *mut otBackboneRouterConfig,
5047 );
5048}
5049unsafe extern "C" {
5050 #[doc = " Sets the local Backbone Router configuration #otBackboneRouterConfig.\n\n A Server Data Request message `SRV_DATA.ntf` is initiated automatically if BBR Dataset changes for Primary\n Backbone Router.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the Backbone Router configuration to take effect.\n\n @retval OT_ERROR_NONE Successfully updated configuration.\n @retval OT_ERROR_INVALID_ARGS The configuration in @p aConfig is invalid.\n\n @sa otBackboneRouterSetEnabled\n @sa otBackboneRouterGetState\n @sa otBackboneRouterGetConfig\n @sa otBackboneRouterRegister"]
5051 pub fn otBackboneRouterSetConfig(
5052 aInstance: *mut otInstance,
5053 aConfig: *const otBackboneRouterConfig,
5054 ) -> otError;
5055}
5056unsafe extern "C" {
5057 #[doc = " Explicitly registers local Backbone Router configuration.\n\n A Server Data Request message `SRV_DATA.ntf` is triggered for the attached device.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NO_BUFS Insufficient space to add the Backbone Router service.\n @retval OT_ERROR_NONE Successfully queued a Server Data Request message for delivery.\n\n @sa otBackboneRouterSetEnabled\n @sa otBackboneRouterGetState\n @sa otBackboneRouterGetConfig\n @sa otBackboneRouterSetConfig"]
5058 pub fn otBackboneRouterRegister(aInstance: *mut otInstance) -> otError;
5059}
5060unsafe extern "C" {
5061 #[doc = " Returns the Backbone Router registration jitter value.\n\n @returns The Backbone Router registration jitter value.\n\n @sa otBackboneRouterSetRegistrationJitter"]
5062 pub fn otBackboneRouterGetRegistrationJitter(aInstance: *mut otInstance) -> u8;
5063}
5064unsafe extern "C" {
5065 #[doc = " Sets the Backbone Router registration jitter value.\n\n @param[in] aJitter the Backbone Router registration jitter value to set.\n\n @sa otBackboneRouterGetRegistrationJitter"]
5066 pub fn otBackboneRouterSetRegistrationJitter(aInstance: *mut otInstance, aJitter: u8);
5067}
5068unsafe extern "C" {
5069 #[doc = " Gets the local Domain Prefix configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aConfig A pointer to the Domain Prefix configuration.\n\n @retval OT_ERROR_NONE Successfully got the Domain Prefix configuration.\n @retval OT_ERROR_NOT_FOUND No Domain Prefix was configured."]
5070 pub fn otBackboneRouterGetDomainPrefix(
5071 aInstance: *mut otInstance,
5072 aConfig: *mut otBorderRouterConfig,
5073 ) -> otError;
5074}
5075unsafe extern "C" {
5076 #[doc = " Configures response status for next DUA registration.\n\n Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n Only used for test and certification.\n\n TODO: (DUA) support coap error code and corresponding process for certification purpose.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMlIid A pointer to the Mesh Local IID. If NULL, respond with @p aStatus for any\n coming DUA.req, otherwise only respond the one with matching @p aMlIid.\n @param[in] aStatus The status to respond."]
5077 pub fn otBackboneRouterConfigNextDuaRegistrationResponse(
5078 aInstance: *mut otInstance,
5079 aMlIid: *const otIp6InterfaceIdentifier,
5080 aStatus: u8,
5081 );
5082}
5083unsafe extern "C" {
5084 #[doc = " Configures the response status for the next Multicast Listener Registration.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,\n `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and\n `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStatus The status to respond."]
5085 pub fn otBackboneRouterConfigNextMulticastListenerRegistrationResponse(
5086 aInstance: *mut otInstance,
5087 aStatus: u8,
5088 );
5089}
5090#[doc = "< Multicast Listener was added."]
5091pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ADDED: otBackboneRouterMulticastListenerEvent = 0;
5092#[doc = "< Multicast Listener was removed or expired."]
5093pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_REMOVED: otBackboneRouterMulticastListenerEvent = 1;
5094#[doc = " Represents the Multicast Listener events."]
5095pub type otBackboneRouterMulticastListenerEvent = ::std::os::raw::c_uint;
5096#[doc = " Pointer is called whenever the Multicast Listeners change.\n\n @param[in] aContext The user context pointer.\n @param[in] aEvent The Multicast Listener event.\n @param[in] aAddress The IPv6 multicast address of the Multicast Listener."]
5097pub type otBackboneRouterMulticastListenerCallback = ::std::option::Option<
5098 unsafe extern "C" fn(
5099 aContext: *mut ::std::os::raw::c_void,
5100 aEvent: otBackboneRouterMulticastListenerEvent,
5101 aAddress: *const otIp6Address,
5102 ),
5103>;
5104unsafe extern "C" {
5105 #[doc = " Sets the Backbone Router Multicast Listener callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to the Multicast Listener callback.\n @param[in] aContext A user context pointer."]
5106 pub fn otBackboneRouterSetMulticastListenerCallback(
5107 aInstance: *mut otInstance,
5108 aCallback: otBackboneRouterMulticastListenerCallback,
5109 aContext: *mut ::std::os::raw::c_void,
5110 );
5111}
5112unsafe extern "C" {
5113 #[doc = " Clears the Multicast Listeners.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,\n `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and\n `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @sa otBackboneRouterMulticastListenerAdd\n @sa otBackboneRouterMulticastListenerGetNext"]
5114 pub fn otBackboneRouterMulticastListenerClear(aInstance: *mut otInstance);
5115}
5116unsafe extern "C" {
5117 #[doc = " Adds a Multicast Listener with a timeout value, in seconds.\n\n Pass `0` to use the default MLR timeout.\n\n Available when `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE`,\n `OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE`, and\n `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` are enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAddress The Multicast Listener address.\n @param[in] aTimeout The timeout (in seconds) of the Multicast Listener, or 0 to use the default MLR timeout.\n\n @retval OT_ERROR_NONE If the Multicast Listener was successfully added.\n @retval OT_ERROR_INVALID_ARGS If the Multicast Listener address was invalid.\n @retval OT_ERROR_NO_BUFS No space available to save the Multicast Listener.\n\n @sa otBackboneRouterMulticastListenerClear\n @sa otBackboneRouterMulticastListenerGetNext"]
5118 pub fn otBackboneRouterMulticastListenerAdd(
5119 aInstance: *mut otInstance,
5120 aAddress: *const otIp6Address,
5121 aTimeout: u32,
5122 ) -> otError;
5123}
5124pub type otBackboneRouterMulticastListenerIterator = u16;
5125#[doc = " Represents a Backbone Router Multicast Listener info."]
5126#[repr(C)]
5127#[derive(Copy, Clone)]
5128pub struct otBackboneRouterMulticastListenerInfo {
5129 pub mAddress: otIp6Address,
5130 pub mTimeout: u32,
5131}
5132impl Default for otBackboneRouterMulticastListenerInfo {
5133 fn default() -> Self {
5134 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5135 unsafe {
5136 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5137 s.assume_init()
5138 }
5139 }
5140}
5141unsafe extern "C" {
5142 #[doc = " Gets the next Multicast Listener info (using an iterator).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next\n Multicast Listener. To get the first entry the iterator should be set to\n OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT.\n @param[out] aListenerInfo A pointer to an `otBackboneRouterMulticastListenerInfo` where information of next\n Multicast Listener is placed (on success).\n\n @retval OT_ERROR_NONE Successfully found the next Multicast Listener info (@p aListenerInfo was successfully\n updated).\n @retval OT_ERROR_NOT_FOUND No subsequent Multicast Listener info was found.\n\n @sa otBackboneRouterMulticastListenerClear\n @sa otBackboneRouterMulticastListenerAdd"]
5143 pub fn otBackboneRouterMulticastListenerGetNext(
5144 aInstance: *mut otInstance,
5145 aIterator: *mut otBackboneRouterMulticastListenerIterator,
5146 aListenerInfo: *mut otBackboneRouterMulticastListenerInfo,
5147 ) -> otError;
5148}
5149#[doc = "< ND Proxy was added."]
5150pub const OT_BACKBONE_ROUTER_NDPROXY_ADDED: otBackboneRouterNdProxyEvent = 0;
5151#[doc = "< ND Proxy was removed."]
5152pub const OT_BACKBONE_ROUTER_NDPROXY_REMOVED: otBackboneRouterNdProxyEvent = 1;
5153#[doc = "< ND Proxy was renewed."]
5154pub const OT_BACKBONE_ROUTER_NDPROXY_RENEWED: otBackboneRouterNdProxyEvent = 2;
5155#[doc = "< All ND Proxies were cleared."]
5156pub const OT_BACKBONE_ROUTER_NDPROXY_CLEARED: otBackboneRouterNdProxyEvent = 3;
5157#[doc = " Represents the ND Proxy events."]
5158pub type otBackboneRouterNdProxyEvent = ::std::os::raw::c_uint;
5159#[doc = " Pointer is called whenever the Nd Proxy changed.\n\n @param[in] aContext The user context pointer.\n @param[in] aEvent The ND Proxy event.\n @param[in] aDua The Domain Unicast Address of the ND Proxy, or NULL if @p aEvent is\n `OT_BACKBONE_ROUTER_NDPROXY_CLEARED`."]
5160pub type otBackboneRouterNdProxyCallback = ::std::option::Option<
5161 unsafe extern "C" fn(
5162 aContext: *mut ::std::os::raw::c_void,
5163 aEvent: otBackboneRouterNdProxyEvent,
5164 aDua: *const otIp6Address,
5165 ),
5166>;
5167unsafe extern "C" {
5168 #[doc = " Sets the Backbone Router ND Proxy callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to the ND Proxy callback.\n @param[in] aContext A user context pointer."]
5169 pub fn otBackboneRouterSetNdProxyCallback(
5170 aInstance: *mut otInstance,
5171 aCallback: otBackboneRouterNdProxyCallback,
5172 aContext: *mut ::std::os::raw::c_void,
5173 );
5174}
5175#[doc = " Represents the Backbone Router ND Proxy info."]
5176#[repr(C)]
5177#[derive(Debug, Copy, Clone)]
5178pub struct otBackboneRouterNdProxyInfo {
5179 #[doc = "< Mesh-local IID"]
5180 pub mMeshLocalIid: *mut otIp6InterfaceIdentifier,
5181 #[doc = "< Time since last transaction (Seconds)"]
5182 pub mTimeSinceLastTransaction: u32,
5183 #[doc = "< RLOC16"]
5184 pub mRloc16: u16,
5185}
5186impl Default for otBackboneRouterNdProxyInfo {
5187 fn default() -> Self {
5188 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5189 unsafe {
5190 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5191 s.assume_init()
5192 }
5193 }
5194}
5195unsafe extern "C" {
5196 #[doc = " Gets the Backbone Router ND Proxy info.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDua The Domain Unicast Address.\n @param[out] aNdProxyInfo A pointer to the ND Proxy info.\n\n @retval OT_ERROR_NONE Successfully got the ND Proxy info.\n @retval OT_ERROR_NOT_FOUND Failed to find the Domain Unicast Address in the ND Proxy table."]
5197 pub fn otBackboneRouterGetNdProxyInfo(
5198 aInstance: *mut otInstance,
5199 aDua: *const otIp6Address,
5200 aNdProxyInfo: *mut otBackboneRouterNdProxyInfo,
5201 ) -> otError;
5202}
5203#[doc = "< Domain Prefix was added."]
5204pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED: otBackboneRouterDomainPrefixEvent = 0;
5205#[doc = "< Domain Prefix was removed."]
5206pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED: otBackboneRouterDomainPrefixEvent = 1;
5207#[doc = "< Domain Prefix was changed."]
5208pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED: otBackboneRouterDomainPrefixEvent = 2;
5209#[doc = " Represents the Domain Prefix events."]
5210pub type otBackboneRouterDomainPrefixEvent = ::std::os::raw::c_uint;
5211#[doc = " Pointer is called whenever the Domain Prefix changed.\n\n @param[in] aContext The user context pointer.\n @param[in] aEvent The Domain Prefix event.\n @param[in] aDomainPrefix The new Domain Prefix if added or changed, NULL otherwise."]
5212pub type otBackboneRouterDomainPrefixCallback = ::std::option::Option<
5213 unsafe extern "C" fn(
5214 aContext: *mut ::std::os::raw::c_void,
5215 aEvent: otBackboneRouterDomainPrefixEvent,
5216 aDomainPrefix: *const otIp6Prefix,
5217 ),
5218>;
5219unsafe extern "C" {
5220 #[doc = " Sets the Backbone Router Domain Prefix callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to the Domain Prefix callback.\n @param[in] aContext A user context pointer."]
5221 pub fn otBackboneRouterSetDomainPrefixCallback(
5222 aInstance: *mut otInstance,
5223 aCallback: otBackboneRouterDomainPrefixCallback,
5224 aContext: *mut ::std::os::raw::c_void,
5225 );
5226}
5227#[doc = "< Ephemeral Key Manager is disabled."]
5228pub const OT_BORDER_AGENT_STATE_DISABLED: otBorderAgentEphemeralKeyState = 0;
5229#[doc = "< Enabled, but no ephemeral key is in use (not set or started)."]
5230pub const OT_BORDER_AGENT_STATE_STOPPED: otBorderAgentEphemeralKeyState = 1;
5231#[doc = "< Ephemeral key is set. Listening to accept secure connections."]
5232pub const OT_BORDER_AGENT_STATE_STARTED: otBorderAgentEphemeralKeyState = 2;
5233#[doc = "< Session is established with an external commissioner candidate."]
5234pub const OT_BORDER_AGENT_STATE_CONNECTED: otBorderAgentEphemeralKeyState = 3;
5235#[doc = "< Session is established and candidate is accepted as full commissioner."]
5236pub const OT_BORDER_AGENT_STATE_ACCEPTED: otBorderAgentEphemeralKeyState = 4;
5237#[doc = " Represents Border Agent's Ephemeral Key Manager state."]
5238pub type otBorderAgentEphemeralKeyState = ::std::os::raw::c_uint;
5239#[doc = " Represents a Thread Administration One-Time Passcode (TAP)."]
5240#[repr(C)]
5241#[derive(Debug, Default, Copy, Clone)]
5242pub struct otBorderAgentEphemeralKeyTap {
5243 #[doc = "< TAP string buffer (including `\\0` character)."]
5244 pub mTap: [::std::os::raw::c_char; 10usize],
5245}
5246unsafe extern "C" {
5247 #[doc = " Gets the state of Border Agent's Ephemeral Key Manager.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current state of Ephemeral Key Manager."]
5248 pub fn otBorderAgentEphemeralKeyGetState(
5249 aInstance: *mut otInstance,
5250 ) -> otBorderAgentEphemeralKeyState;
5251}
5252unsafe extern "C" {
5253 #[doc = " Enables/disables the Border Agent's Ephemeral Key Manager.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n If this function is called to disable, while an an ephemeral key is in use, the ephemeral key use will be stopped\n (as if `otBorderAgentEphemeralKeyStop()` is called).\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aEnabled Whether to enable or disable the Ephemeral Key Manager."]
5254 pub fn otBorderAgentEphemeralKeySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
5255}
5256unsafe extern "C" {
5257 #[doc = " Starts using an ephemeral key for a given timeout duration.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n An ephemeral key can only be set when `otBorderAgentEphemeralKeyGetState()` is `OT_BORDER_AGENT_STATE_STOPPED`,\n i.e., enabled but not yet started. Otherwise, `OT_ERROR_INVALID_STATE` is returned. This means that setting the\n ephemeral key again while a previously set key is still in use will fail. Callers can stop the previous key by\n calling `otBorderAgentEphemeralKeyStop()` before starting with a new key.\n\n The Ephemeral Key Manager and the Border Agent service (which uses PSKc) can be enabled and used in parallel, as\n they use independent and separate DTLS transport and sessions.\n\n The given @p aKeyString is used directly as the ephemeral PSK (excluding the trailing null `\\0` character).\n Its length must be between `OT_BORDER_AGENT_MIN_EPHEMERAL_KEY_LENGTH` and `OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_LENGTH`,\n inclusive. Otherwise `OT_ERROR_INVALID_ARGS` is returned.\n\n When successfully set, the ephemeral key can be used only once by an external commissioner candidate to establish a\n secure session. After the commissioner candidate disconnects, the use of the ephemeral key is stopped. If the\n timeout expires, the use of the ephemeral key is stopped, and any connected session using the key is immediately\n disconnected.\n\n The Ephemeral Key Manager limits the number of failed DTLS connections to 10 attempts. After the 10th failed\n attempt, the use of the ephemeral key is automatically stopped (even if the timeout has not yet expired).\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aKeyString The ephemeral key.\n @param[in] aTimeout The timeout duration, in milliseconds, to use the ephemeral key.\n If zero, the default `OT_BORDER_AGENT_DEFAULT_EPHEMERAL_KEY_TIMEOUT` value is used. If the\n timeout value is larger than `OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT`, the maximum value\n is used instead.\n @param[in] aUdpPort The UDP port to use with the ephemeral key. If the UDP port is zero, an ephemeral port will\n be used. `otBorderAgentEphemeralKeyGetUdpPort()` returns the current UDP port being used.\n\n @retval OT_ERROR_NONE Successfully started using the ephemeral key.\n @retval OT_ERROR_INVALID_STATE A previously set ephemeral key is still in use or the feature is disabled.\n @retval OT_ERROR_INVALID_ARGS The given @p aKeyString is not valid.\n @retval OT_ERROR_FAILED Failed to start (e.g., it could not bind to the given UDP port)."]
5258 pub fn otBorderAgentEphemeralKeyStart(
5259 aInstance: *mut otInstance,
5260 aKeyString: *const ::std::os::raw::c_char,
5261 aTimeout: u32,
5262 aUdpPort: u16,
5263 ) -> otError;
5264}
5265unsafe extern "C" {
5266 #[doc = " Stops the ephemeral key use and disconnects any session using it.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n If there is no ephemeral key in use, calling this function has no effect.\n\n @param[in] aInstance The OpenThread instance."]
5267 pub fn otBorderAgentEphemeralKeyStop(aInstance: *mut otInstance);
5268}
5269unsafe extern "C" {
5270 #[doc = " Gets the UDP port used by Border Agent's Ephemeral Key Manager.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n The port is applicable if an ephemeral key is in use, i.e., the state is not `OT_BORDER_AGENT_STATE_DISABLED` or\n `OT_BORDER_AGENT_STATE_STOPPED`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The UDP port being used by Border Agent's Ephemeral Key Manager (when active)."]
5271 pub fn otBorderAgentEphemeralKeyGetUdpPort(aInstance: *mut otInstance) -> u16;
5272}
5273#[doc = " Callback function pointer to signal state changes to the Border Agent's Ephemeral Key Manager.\n\n This callback is invoked whenever the `otBorderAgentEphemeralKeyGetState()` gets changed.\n\n Any OpenThread API, including `otBorderAgent` APIs, can be safely called from this callback.\n\n @param[in] aContext A pointer to an arbitrary context (provided when callback is set)."]
5274pub type otBorderAgentEphemeralKeyCallback =
5275 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5276unsafe extern "C" {
5277 #[doc = " Sets the callback function to notify state changes of Border Agent's Ephemeral Key Manager.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.\n\n A subsequent call to this function will replace any previously set callback.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aCallback The callback function pointer.\n @param[in] aContext The arbitrary context to use with callback."]
5278 pub fn otBorderAgentEphemeralKeySetCallback(
5279 aInstance: *mut otInstance,
5280 aCallback: otBorderAgentEphemeralKeyCallback,
5281 aContext: *mut ::std::os::raw::c_void,
5282 );
5283}
5284unsafe extern "C" {
5285 #[doc = " Converts a given `otBorderAgentEphemeralKeyState` to a human-readable string.\n\n @param[in] aState The state to convert.\n\n @returns Human-readable string corresponding to @p aState."]
5286 pub fn otBorderAgentEphemeralKeyStateToString(
5287 aState: otBorderAgentEphemeralKeyState,
5288 ) -> *const ::std::os::raw::c_char;
5289}
5290unsafe extern "C" {
5291 #[doc = " Generates a cryptographically secure random Thread Administration One-Time Passcode (TAP) string.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE` and `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.\n\n The TAP is a string of 9 characters, generated as a sequence of eight cryptographically secure random\n numeric digits [`0`-`9`] followed by a single check digit determined using the Verhoeff algorithm.\n\n @param[out] aTap A pointer to an `otBorderAgentEphemeralKeyTap` to output the generated TAP.\n\n @retval OT_ERROR_NONE Successfully generated a random TAP. @p aTap is updated.\n @retval OT_ERROR_FAILED Failed to generate a random TAP."]
5292 pub fn otBorderAgentEphemeralKeyGenerateTap(aTap: *mut otBorderAgentEphemeralKeyTap)
5293 -> otError;
5294}
5295unsafe extern "C" {
5296 #[doc = " Validates a given Thread Administration One-Time Passcode (TAP) string.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE` and `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.\n\n Validates that the TAP string has the proper length, contains digit characters [`0`-`9`], and validates the\n Verhoeff checksum.\n\n @param[in] aTap The `otBorderAgentEphemeralKeyTap` to validate.\n\n @retval OT_ERROR_NONE Successfully validated the @p aTap.\n @retval OT_ERROR_INVALID_ARGS The @p aTap string has an invalid length or contains non-digit characters.\n @retval OT_ERROR_FAILED Checksum validation failed."]
5297 pub fn otBorderAgentEphemeralKeyValidateTap(
5298 aTap: *const otBorderAgentEphemeralKeyTap,
5299 ) -> otError;
5300}
5301#[doc = " Represents a TXT record entry representing a key/value pair (RFC 6763 - section 6.3).\n\n The string buffers pointed to by `mKey` and `mValue` MUST persist and remain unchanged after an instance of such\n structure is passed to OpenThread (as part of `otSrpClientService` instance).\n\n An array of `otDnsTxtEntry` entries are used in `otSrpClientService` to specify the full TXT record (a list of\n entries)."]
5302#[repr(C)]
5303#[derive(Debug, Copy, Clone)]
5304pub struct otDnsTxtEntry {
5305 #[doc = " The TXT record key string.\n\n If `mKey` is not NULL, then it MUST be a null-terminated C string. The entry is treated as key/value pair with\n `mValue` buffer providing the value.\n - The entry is encoded as follows:\n - A single string length byte followed by \"key=value\" format (without the quotation marks).\n- In this case, the overall encoded length must be 255 bytes or less.\n - If `mValue` is NULL, then key is treated as a boolean attribute and encoded as \"key\" (with no `=`).\n - If `mValue` is not NULL but `mValueLength` is zero, then it is treated as empty value and encoded as \"key=\".\n\n If `mKey` is NULL, then `mValue` buffer is treated as an already encoded TXT-DATA and is appended as is in the\n DNS message."]
5306 pub mKey: *const ::std::os::raw::c_char,
5307 #[doc = "< The TXT record value or already encoded TXT-DATA (depending on `mKey`)."]
5308 pub mValue: *const u8,
5309 #[doc = "< Number of bytes in `mValue` buffer."]
5310 pub mValueLength: u16,
5311}
5312impl Default for otDnsTxtEntry {
5313 fn default() -> Self {
5314 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5315 unsafe {
5316 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5317 s.assume_init()
5318 }
5319 }
5320}
5321#[doc = " Represents an iterator for TXT record entries (key/value pairs).\n\n The data fields in this structure are intended for use by OpenThread core and caller should not read or change them."]
5322#[repr(C)]
5323#[derive(Debug, Copy, Clone)]
5324pub struct otDnsTxtEntryIterator {
5325 pub mPtr: *const ::std::os::raw::c_void,
5326 pub mData: [u16; 2usize],
5327 pub mChar: [::std::os::raw::c_char; 65usize],
5328}
5329impl Default for otDnsTxtEntryIterator {
5330 fn default() -> Self {
5331 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5332 unsafe {
5333 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5334 s.assume_init()
5335 }
5336 }
5337}
5338unsafe extern "C" {
5339 #[doc = " Initializes a TXT record iterator.\n\n The buffer pointer @p aTxtData and its content MUST persist and remain unchanged while @p aIterator object\n is being used.\n\n @param[in] aIterator A pointer to the iterator to initialize (MUST NOT be NULL).\n @param[in] aTxtData A pointer to buffer containing the encoded TXT data.\n @param[in] aTxtDataLength The length (number of bytes) of @p aTxtData."]
5340 pub fn otDnsInitTxtEntryIterator(
5341 aIterator: *mut otDnsTxtEntryIterator,
5342 aTxtData: *const u8,
5343 aTxtDataLength: u16,
5344 );
5345}
5346unsafe extern "C" {
5347 #[doc = " Parses the TXT data from an iterator and gets the next TXT record entry (key/value pair).\n\n The @p aIterator MUST be initialized using `otDnsInitTxtEntryIterator()` before calling this function and the TXT\n data buffer used to initialize the iterator MUST persist and remain unchanged. Otherwise the behavior of this\n function is undefined.\n\n If the parsed key string length is smaller than or equal to `OT_DNS_TXT_KEY_ITER_MAX_LENGTH` the key string is\n returned in `mKey` in @p aEntry. But if the key is longer, then `mKey` is set to NULL and the entire encoded TXT\n entry string is returned in `mValue` and `mValueLength`.\n\n @param[in] aIterator A pointer to the iterator (MUST NOT be NULL).\n @param[out] aEntry A pointer to a `otDnsTxtEntry` structure to output the parsed/read entry (MUST NOT be NULL).\n\n @retval OT_ERROR_NONE The next entry was parsed successfully. @p aEntry is updated.\n @retval OT_ERROR_NOT_FOUND No more entries in the TXT data.\n @retval OT_ERROR_PARSE The TXT data from @p aIterator is not well-formed."]
5348 pub fn otDnsGetNextTxtEntry(
5349 aIterator: *mut otDnsTxtEntryIterator,
5350 aEntry: *mut otDnsTxtEntry,
5351 ) -> otError;
5352}
5353unsafe extern "C" {
5354 #[doc = " Encodes a given list of TXT record entries (key/value pairs) into TXT data (following format specified by RFC 6763).\n\n @param[in] aTxtEntries Pointer to an array of `otDnsTxtEntry`.\n @param[in] aNumTxtEntries Number of entries in @p aTxtEntries array.\n @param[out] aTxtData A pointer to a buffer to output the encoded TXT data.\n @param[in,out] aTxtDataLength On input, size of buffer @p aTxtData. On output, length of the encoded TXT data.\n\n @retval OT_ERROR_NONE Encoded TXT data successfully, @p aTxtData and @p aTxtDataLength are updated.\n @retval OT_ERROR_INVALID_ARGS The @p aTxtEntries is not valid.\n @retval OT_ERROR_NO_BUS Could not fit the encoded data in @p aTxtData buffer with its @p aTxtDataLength."]
5355 pub fn otDnsEncodeTxtData(
5356 aTxtEntries: *const otDnsTxtEntry,
5357 aNumTxtEntries: u16,
5358 aTxtData: *mut u8,
5359 aTxtDataLength: *mut u16,
5360 ) -> otError;
5361}
5362unsafe extern "C" {
5363 #[doc = " Enables/disables the \"DNS name compression\" mode.\n\n By default, DNS name compression is enabled. When disabled, DNS names are appended in full and are never compressed.\n This applies to OpenThread's DNS and SRP client/server modules.\n\n DNS name compression cannot be disabled if the OpenThread mDNS module is enabled. Enabling the mDNS module will\n automatically enable name compression if it was previously disabled. Attempting to disable compression while the mDNS\n module is active will return `OT_ERROR_NOT_CAPABLE`.\n\n This is intended for testing only and available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` config is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable the \"DNS name compression\" mode, FALSE to disable.\n\n @retval OT_ERROR_NONE The \"DNS name compression\" mode is updated.\n @retval OT_ERROR_NOT_CAPABLE The \"DNS name compression\" mode cannot be disabled since OpenThread mDNS module is\n enabled."]
5364 pub fn otDnsSetNameCompressionEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
5365}
5366unsafe extern "C" {
5367 #[doc = " Indicates whether the \"DNS name compression\" mode is enabled or not.\n\n This is intended for testing only and available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` config is enabled.\n\n @returns TRUE if the \"DNS name compression\" mode is enabled, FALSE otherwise."]
5368 pub fn otDnsIsNameCompressionEnabled(aInstance: *mut otInstance) -> bool;
5369}
5370#[doc = " Represents a Border Agent Identifier."]
5371#[repr(C)]
5372#[derive(Debug, Default, Copy, Clone)]
5373pub struct otBorderAgentId {
5374 #[doc = "< Border Agent ID bytes."]
5375 pub mId: [u8; 16usize],
5376}
5377#[doc = " Defines Border Agent counters.\n\n The `mEpskc` related counters require `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`."]
5378#[repr(C)]
5379#[derive(Debug, Default, Copy, Clone)]
5380pub struct otBorderAgentCounters {
5381 #[doc = "< The number of ePSKc activations"]
5382 pub mEpskcActivations: u32,
5383 #[doc = "< The number of ePSKc deactivations via API"]
5384 pub mEpskcDeactivationClears: u32,
5385 #[doc = "< The number of ePSKc deactivations due to timeout"]
5386 pub mEpskcDeactivationTimeouts: u32,
5387 #[doc = "< The number of ePSKc deactivations due to reached max attempts"]
5388 pub mEpskcDeactivationMaxAttempts: u32,
5389 #[doc = "< The number of ePSKc deactivations due to commissioner disconnected"]
5390 pub mEpskcDeactivationDisconnects: u32,
5391 #[doc = "< The number of invalid border agent state errors at ePSKc activation"]
5392 pub mEpskcInvalidBaStateErrors: u32,
5393 #[doc = "< The number of invalid args errors at ePSKc activation"]
5394 pub mEpskcInvalidArgsErrors: u32,
5395 #[doc = "< The number of start secure session errors at ePSKc activation"]
5396 pub mEpskcStartSecureSessionErrors: u32,
5397 #[doc = "< The number of established secure sessions with ePSKc"]
5398 pub mEpskcSecureSessionSuccesses: u32,
5399 #[doc = "< The number of failed secure sessions with ePSKc"]
5400 pub mEpskcSecureSessionFailures: u32,
5401 #[doc = "< The number of successful commissioner petitions with ePSKc"]
5402 pub mEpskcCommissionerPetitions: u32,
5403 #[doc = "< The number of established secure sessions with PSKc"]
5404 pub mPskcSecureSessionSuccesses: u32,
5405 #[doc = "< The number of failed secure sessions with PSKc"]
5406 pub mPskcSecureSessionFailures: u32,
5407 #[doc = "< The number of successful commissioner petitions with PSKc"]
5408 pub mPskcCommissionerPetitions: u32,
5409 #[doc = "< The number of MGMT_ACTIVE_GET.req sent over secure sessions"]
5410 pub mMgmtActiveGets: u32,
5411 #[doc = "< The number of MGMT_PENDING_GET.req sent over secure sessions"]
5412 pub mMgmtPendingGets: u32,
5413}
5414#[doc = " Represents information about a Border Agent session.\n\n This structure is populated by `otBorderAgentGetNextSessionInfo()` during iteration over the list of sessions using\n an `otBorderAgentSessionIterator`.\n\n To ensure consistent `mLifetime` calculations, the iterator's initialization time is stored within the iterator,\n and each session's `mLifetime` is calculated relative to this time."]
5415#[repr(C)]
5416#[derive(Copy, Clone)]
5417pub struct otBorderAgentSessionInfo {
5418 #[doc = "< Socket address (IPv6 address and port number) of session peer."]
5419 pub mPeerSockAddr: otSockAddr,
5420 #[doc = "< Indicates whether the session is connected."]
5421 pub mIsConnected: bool,
5422 #[doc = "< Indicates whether the session is accepted as full commissioner."]
5423 pub mIsCommissioner: bool,
5424 #[doc = "< Milliseconds since the session was first established."]
5425 pub mLifetime: u64,
5426}
5427impl Default for otBorderAgentSessionInfo {
5428 fn default() -> Self {
5429 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5430 unsafe {
5431 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5432 s.assume_init()
5433 }
5434 }
5435}
5436#[doc = " Represents an iterator for Border Agent sessions.\n\n The caller MUST NOT access or update the fields in this struct. It is intended for OpenThread internal use only."]
5437#[repr(C)]
5438#[derive(Debug, Copy, Clone)]
5439pub struct otBorderAgentSessionIterator {
5440 pub mPtr: *mut ::std::os::raw::c_void,
5441 pub mData: u64,
5442}
5443impl Default for otBorderAgentSessionIterator {
5444 fn default() -> Self {
5445 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5446 unsafe {
5447 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5448 s.assume_init()
5449 }
5450 }
5451}
5452#[doc = " Represents the Border Agent MeshCoP Service TXT data."]
5453#[repr(C)]
5454#[derive(Debug, Copy, Clone)]
5455pub struct otBorderAgentMeshCoPServiceTxtData {
5456 pub mData: [u8; 256usize],
5457 pub mLength: u16,
5458}
5459impl Default for otBorderAgentMeshCoPServiceTxtData {
5460 fn default() -> Self {
5461 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5462 unsafe {
5463 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5464 s.assume_init()
5465 }
5466 }
5467}
5468unsafe extern "C" {
5469 #[doc = " Enables or disables the Border Agent service on the device.\n\n By default, the Border Agent service is enabled when the `OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE` feature is used.\n This function allows higher-layer code to explicitly control its state. This can be useful in scenarios such as:\n\n - The higher-layer code wishes to delay the start of the Border Agent service (and its mDNS advertisement of the\n `_meshcop._udp` service on the infrastructure link). This allows time to prepare or determine vendor-specific TXT\n data entries for inclusion.\n - Unit tests or test scripts might disable the Border Agent service to prevent it from interfering with specific\n test steps. For example, tests validating mDNS or DNS-SD functionality may disable the Border Agent to prevent its\n registration of the MeshCoP service.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aEnabled A boolean to indicate whether to to enable (TRUE), or disable (FALSE)."]
5470 pub fn otBorderAgentSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
5471}
5472unsafe extern "C" {
5473 #[doc = " Indicates whether or not the Border Agent service is enabled.\n\n @param[in] aInstance The OpenThread instance.\n\n @retval TRUE The Border Agent service is enabled.\n @retval FALSE The Border Agent service is disabled."]
5474 pub fn otBorderAgentIsEnabled(aInstance: *mut otInstance) -> bool;
5475}
5476unsafe extern "C" {
5477 #[doc = " Indicates whether or not the Border Agent service is enabled and also active.\n\n While the Border Agent is active, external commissioner candidates can try to connect to and establish secure DTLS\n sessions with the Border Agent using PSKc. A connected commissioner can then petition to become a full commissioner.\n\n If `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE` is enabled, independent and separate DTLS transport and\n sessions are used for the ephemeral key. Therefore, the ephemeral key and Border Agent service can be enabled and\n used in parallel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The Border Agent is active.\n @retval FALSE The Border Agent is not active."]
5478 pub fn otBorderAgentIsActive(aInstance: *mut otInstance) -> bool;
5479}
5480unsafe extern "C" {
5481 #[doc = " Gets the UDP port of the Thread Border Agent service.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns UDP port of the Border Agent."]
5482 pub fn otBorderAgentGetUdpPort(aInstance: *mut otInstance) -> u16;
5483}
5484#[doc = " This callback informs the application of the changes in the state of the MeshCoP service.\n\n In specific, the 'state' includes the MeshCoP TXT data originated from the Thread network and whether the\n Border Agent is Active (which can be obtained by `otBorderAgentIsActive`).\n\n @param[in] aContext A pointer to application-specific context."]
5485pub type otBorderAgentMeshCoPServiceChangedCallback =
5486 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5487unsafe extern "C" {
5488 #[doc = " Sets the callback function used by the Border Agent to notify of any changes to the state of the MeshCoP service.\n\n The callback is invoked when the 'Is Active' state of the Border Agent or the MeshCoP service TXT data values\n change. For example, it is invoked when the network name or the extended PAN ID changes and passes the updated\n encoded TXT data to the application layer.\n\n This callback is invoked once right after this API is called to provide initial states of the MeshCoP service.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback The callback to be invoked when there are any changes of the MeshCoP service.\n @param[in] aContext A pointer to application-specific context."]
5489 pub fn otBorderAgentSetMeshCoPServiceChangedCallback(
5490 aInstance: *mut otInstance,
5491 aCallback: otBorderAgentMeshCoPServiceChangedCallback,
5492 aContext: *mut ::std::os::raw::c_void,
5493 );
5494}
5495unsafe extern "C" {
5496 #[doc = " Gets the MeshCoP service TXT data.\n\n The generated TXT data includes a subset of keys (depending on the device's current state and whether features are\n enabled) as specified in the documentation of the `OT_BORDER_AGENT_MESHCOP_SERVICE_TXT_DATA_MAX_LENGTH` constant.\n Notably, if `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` is enabled and `otBorderAgentSetVendorTxtData()`\n was used to set extra vendor-specific TXT data bytes, those vendor-specified TXT data bytes are NOT included in the\n TXT data returned by this function.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aTxtData A pointer to a MeshCoP Service TXT data struct to get the data.\n\n @retval OT_ERROR_NONE If successfully retrieved the Border Agent MeshCoP Service TXT data.\n @retval OT_ERROR_NO_BUFS If the buffer in @p aTxtData doesn't have enough size."]
5497 pub fn otBorderAgentGetMeshCoPServiceTxtData(
5498 aInstance: *mut otInstance,
5499 aTxtData: *mut otBorderAgentMeshCoPServiceTxtData,
5500 ) -> otError;
5501}
5502unsafe extern "C" {
5503 #[doc = " Sets the base name to construct the service instance name used when advertising the mDNS `_meshcop._udp` service by\n the Border Agent.\n\n Requires the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` feature.\n\n The name can also be configured using the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME` configuration\n option (which is the recommended way to specify this name). This API is provided for projects where the name needs\n to be set after device initialization and at run-time.\n\n Per the Thread specification, the service instance should be a user-friendly name identifying the device model or\n product. A recommended format is \"VendorName ProductName\".\n\n To construct the full name and ensure name uniqueness, the OpenThread Border Agent module will append the Extended\n Address of the device (as 16-character hex digits) to the given base name.\n\n Note that the same name will be used for the ephemeral key service `_meshcop-e._udp` when the ephemeral key feature\n is enabled and used.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aBaseName The base name to use (MUST not be NULL).\n\n @retval OT_ERROR_NONE The name was set successfully.\n @retval OT_ERROR_INVALID_ARGS The name is too long or invalid."]
5504 pub fn otBorderAgentSetMeshCoPServiceBaseName(
5505 aInstance: *mut otInstance,
5506 aBaseName: *const ::std::os::raw::c_char,
5507 ) -> otError;
5508}
5509unsafe extern "C" {
5510 #[doc = " Sets the vendor extra TXT data to be included when the Border Agent advertises the mDNS `_meshcop._udp` service.\n\n Requires the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` feature.\n\n The provided @p aVendorData bytes are appended as they appear in the buffer to the end of the TXT data generated by\n the Border Agent itself, and are then included in the advertised mDNS `_meshcop._udp` service.\n\n This function itself does not perform any validation of the format of the provided @p aVendorData. Therefore, the\n caller MUST ensure it is formatted properly. Per the Thread specification, vendor-specific Key-Value TXT data pairs\n use TXT keys starting with 'v'. For example, `vn` for vendor name and generally `v*`.\n\n The OpenThread stack will create and retain its own copy of the bytes in @p aVendorData. So, the buffer passed to\n this function does not need to persist beyond the scope of the call.\n\n The vendor TXT data can be set at any time while the Border Agent is in any state. If there is a change from the\n previously set value, it will trigger an update of the registered mDNS service to advertise the new TXT data.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aVendorData A pointer to the buffer containing the vendor TXT data.\n @param[in] aVendorDataLength The length of @p aVendorData in bytes."]
5511 pub fn otBorderAgentSetVendorTxtData(
5512 aInstance: *mut otInstance,
5513 aVendorData: *const u8,
5514 aVendorDataLength: u16,
5515 );
5516}
5517unsafe extern "C" {
5518 #[doc = " Gets the randomly generated Border Agent ID.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE`.\n\n The ID is saved in persistent storage and survives reboots. The typical use case of the ID is to\n be published in the MeshCoP mDNS service as the `id` TXT value for the client to identify this\n Border Router/Agent device.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aId A pointer to buffer to receive the ID.\n\n @retval OT_ERROR_NONE If successfully retrieved the Border Agent ID.\n @retval ... If failed to retrieve the Border Agent ID.\n\n @sa otBorderAgentSetId"]
5519 pub fn otBorderAgentGetId(aInstance: *mut otInstance, aId: *mut otBorderAgentId) -> otError;
5520}
5521unsafe extern "C" {
5522 #[doc = " Sets the Border Agent ID.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE`.\n\n The Border Agent ID will be saved in persistent storage and survive reboots. It's required to\n set the ID only once after factory reset. If the ID has never been set by calling this function,\n a random ID will be generated and returned when `otBorderAgentGetId` is called.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aId A pointer to the Border Agent ID.\n\n @retval OT_ERROR_NONE If successfully set the Border Agent ID.\n @retval ... If failed to set the Border Agent ID.\n\n @sa otBorderAgentGetId"]
5523 pub fn otBorderAgentSetId(aInstance: *mut otInstance, aId: *const otBorderAgentId) -> otError;
5524}
5525unsafe extern "C" {
5526 #[doc = " Initializes a session iterator.\n\n An iterator MUST be initialized before being used in `otBorderAgentGetNextSessionInfo()`. A previously initialized\n iterator can be re-initialized to start from the beginning of the session list.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
5527 pub fn otBorderAgentInitSessionIterator(
5528 aInstance: *mut otInstance,
5529 aIterator: *mut otBorderAgentSessionIterator,
5530 );
5531}
5532unsafe extern "C" {
5533 #[doc = " Retrieves the next Border Agent session information.\n\n @param[in] aIterator The iterator to use.\n @param[out] aSessionInfo A pointer to an `otBorderAgentSessionInfo` to populate.\n\n @retval OT_ERROR_NONE Successfully retrieved the next session info.\n @retval OT_ERROR_NOT_FOUND No more sessions are available. The end of the list has been reached."]
5534 pub fn otBorderAgentGetNextSessionInfo(
5535 aIterator: *mut otBorderAgentSessionIterator,
5536 aSessionInfo: *mut otBorderAgentSessionInfo,
5537 ) -> otError;
5538}
5539unsafe extern "C" {
5540 #[doc = " Gets the counters of the Thread Border Agent.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Border Agent counters."]
5541 pub fn otBorderAgentGetCounters(aInstance: *mut otInstance) -> *const otBorderAgentCounters;
5542}
5543unsafe extern "C" {
5544 #[doc = " Forcefully evicts the current active Thread Commissioner.\n\n Requires `OPENTHREAD_CONFIG_BORDER_AGENT_COMMISSIONER_EVICTION_API_ENABLE`.\n\n This is intended as an administrator tool to address a misbehaving or stale commissioner session that may be\n connected through a different Border Agent. It provides a mechanism to clear the single Active Commissioner role\n within the Thread network, allowing a new candidate to be selected as the Active commissioner.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully sent the eviction request to the Leader.\n @retval OT_ERROR_NOT_FOUND There is no active commissioner session to evict.\n @retval OT_ERROR_NO_BUFS Could not allocate a message buffer to send the request."]
5545 pub fn otBorderAgentEvictActiveCommissioner(aInstance: *mut otInstance) -> otError;
5546}
5547unsafe extern "C" {
5548 #[doc = " Provides a full or stable copy of the local Thread Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.\n @param[out] aData A pointer to the data buffer.\n @param[in,out] aDataLength On entry, size of the data buffer pointed to by @p aData.\n On exit, number of copied bytes."]
5549 pub fn otBorderRouterGetNetData(
5550 aInstance: *mut otInstance,
5551 aStable: bool,
5552 aData: *mut u8,
5553 aDataLength: *mut u8,
5554 ) -> otError;
5555}
5556unsafe extern "C" {
5557 #[doc = " Add a border router configuration to the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the border router configuration.\n\n @retval OT_ERROR_NONE Successfully added the configuration to the local network data.\n @retval OT_ERROR_INVALID_ARGS One or more configuration parameters were invalid.\n @retval OT_ERROR_NO_BUFS Not enough room is available to add the configuration to the local network data.\n\n @sa otBorderRouterRemoveOnMeshPrefix\n @sa otBorderRouterRegister"]
5558 pub fn otBorderRouterAddOnMeshPrefix(
5559 aInstance: *mut otInstance,
5560 aConfig: *const otBorderRouterConfig,
5561 ) -> otError;
5562}
5563unsafe extern "C" {
5564 #[doc = " Remove a border router configuration from the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefix A pointer to an IPv6 prefix.\n\n @retval OT_ERROR_NONE Successfully removed the configuration from the local network data.\n @retval OT_ERROR_NOT_FOUND Could not find the Border Router entry.\n\n @sa otBorderRouterAddOnMeshPrefix\n @sa otBorderRouterRegister"]
5565 pub fn otBorderRouterRemoveOnMeshPrefix(
5566 aInstance: *mut otInstance,
5567 aPrefix: *const otIp6Prefix,
5568 ) -> otError;
5569}
5570unsafe extern "C" {
5571 #[doc = " Gets the next On Mesh Prefix in the local Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first on-mesh entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to the On Mesh Prefix information.\n\n @retval OT_ERROR_NONE Successfully found the next On Mesh prefix.\n @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data."]
5572 pub fn otBorderRouterGetNextOnMeshPrefix(
5573 aInstance: *mut otInstance,
5574 aIterator: *mut otNetworkDataIterator,
5575 aConfig: *mut otBorderRouterConfig,
5576 ) -> otError;
5577}
5578unsafe extern "C" {
5579 #[doc = " Add an external route configuration to the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the external route configuration.\n\n @retval OT_ERROR_NONE Successfully added the configuration to the local network data.\n @retval OT_ERROR_INVALID_ARGS One or more configuration parameters were invalid.\n @retval OT_ERROR_NO_BUFS Not enough room is available to add the configuration to the local network data.\n\n @sa otBorderRouterRemoveRoute\n @sa otBorderRouterRegister"]
5580 pub fn otBorderRouterAddRoute(
5581 aInstance: *mut otInstance,
5582 aConfig: *const otExternalRouteConfig,
5583 ) -> otError;
5584}
5585unsafe extern "C" {
5586 #[doc = " Remove an external route configuration from the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefix A pointer to an IPv6 prefix.\n\n @retval OT_ERROR_NONE Successfully removed the configuration from the local network data.\n @retval OT_ERROR_NOT_FOUND Could not find the Border Router entry.\n\n @sa otBorderRouterAddRoute\n @sa otBorderRouterRegister"]
5587 pub fn otBorderRouterRemoveRoute(
5588 aInstance: *mut otInstance,
5589 aPrefix: *const otIp6Prefix,
5590 ) -> otError;
5591}
5592unsafe extern "C" {
5593 #[doc = " Gets the next external route in the local Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first external route entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to the External Route information.\n\n @retval OT_ERROR_NONE Successfully found the next External Route.\n @retval OT_ERROR_NOT_FOUND No subsequent external route entry exists in the Thread Network Data."]
5594 pub fn otBorderRouterGetNextRoute(
5595 aInstance: *mut otInstance,
5596 aIterator: *mut otNetworkDataIterator,
5597 aConfig: *mut otExternalRouteConfig,
5598 ) -> otError;
5599}
5600unsafe extern "C" {
5601 #[doc = " Immediately register the local network data with the Leader.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully queued a Server Data Request message for delivery.\n\n @sa otBorderRouterAddOnMeshPrefix\n @sa otBorderRouterRemoveOnMeshPrefix\n @sa otBorderRouterAddRoute\n @sa otBorderRouterRemoveRoute"]
5602 pub fn otBorderRouterRegister(aInstance: *mut otInstance) -> otError;
5603}
5604#[doc = " Function pointer callback which is invoked when Network Data (local or leader) gets full.\n\n @param[in] aContext A pointer to arbitrary context information."]
5605pub type otBorderRouterNetDataFullCallback =
5606 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5607unsafe extern "C" {
5608 #[doc = " Sets the callback to indicate when Network Data gets full.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL`.\n\n The callback is invoked whenever:\n - The device is acting as a leader and receives a Network Data registration from a Border Router (BR) that it cannot\n add to Network Data (running out of space).\n - The device is acting as a BR and new entries cannot be added to its local Network Data.\n - The device is acting as a BR and tries to register its local Network Data entries with the leader, but determines\n that its local entries will not fit.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback The callback.\n @param[in] aContext A pointer to arbitrary context information used with @p aCallback."]
5609 pub fn otBorderRouterSetNetDataFullCallback(
5610 aInstance: *mut otInstance,
5611 aCallback: otBorderRouterNetDataFullCallback,
5612 aContext: *mut ::std::os::raw::c_void,
5613 );
5614}
5615unsafe extern "C" {
5616 #[doc = " Requests a Thread network channel change.\n\n The network switches to the given channel after a specified delay (see #otChannelManagerSetDelay()). The channel\n change is performed by updating the Pending Operational Dataset.\n\n A subsequent call will cancel an ongoing previously requested channel change.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The new channel for the Thread network."]
5617 pub fn otChannelManagerRequestChannelChange(aInstance: *mut otInstance, aChannel: u8);
5618}
5619unsafe extern "C" {
5620 #[doc = " Gets the channel from the last successful call to `otChannelManagerRequestChannelChange()`\n\n @returns The last requested channel or zero if there has been no channel change request yet."]
5621 pub fn otChannelManagerGetRequestedChannel(aInstance: *mut otInstance) -> u8;
5622}
5623unsafe extern "C" {
5624 #[doc = " Gets the delay (in seconds) used by Channel Manager for a network channel change.\n\n Only available on FTDs.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The delay (in seconds) for channel change."]
5625 pub fn otChannelManagerGetDelay(aInstance: *mut otInstance) -> u16;
5626}
5627unsafe extern "C" {
5628 #[doc = " Sets the delay (in seconds) used for a network channel change.\n\n Only available on FTDs. The delay should preferably be longer than the maximum data poll interval used by all\n Sleepy End Devices within the Thread network.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDelay Delay in seconds.\n\n @retval OT_ERROR_NONE Delay was updated successfully.\n @retval OT_ERROR_INVALID_ARGS The given delay @p aDelay is too short."]
5629 pub fn otChannelManagerSetDelay(aInstance: *mut otInstance, aDelay: u16) -> otError;
5630}
5631unsafe extern "C" {
5632 #[doc = " Requests that `ChannelManager` checks and selects a new channel and starts a channel change.\n\n Unlike the `otChannelManagerRequestChannelChange()` where the channel must be given as a parameter, this function\n asks the `ChannelManager` to select a channel by itself (based on collected channel quality info).\n\n Once called, the Channel Manager will perform the following 3 steps:\n\n 1) `ChannelManager` decides if the channel change would be helpful. This check can be skipped if\n `aSkipQualityCheck` is set to true (forcing a channel selection to happen and skipping the quality check).\n This step uses the collected link quality metrics on the device (such as CCA failure rate, frame and message\n error rates per neighbor, etc.) to determine if the current channel quality is at the level that justifies\n a channel change.\n\n 2) If the first step passes, then `ChannelManager` selects a potentially better channel. It uses the collected\n channel quality data by `ChannelMonitor` module. The supported and favored channels are used at this step.\n (see `otChannelManagerSetSupportedChannels()` and `otChannelManagerSetFavoredChannels()`).\n\n 3) If the newly selected channel is different from the current channel, `ChannelManager` requests/starts the\n channel change process (internally invoking a `RequestChannelChange()`).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSkipQualityCheck Indicates whether the quality check (step 1) should be skipped.\n\n @retval OT_ERROR_NONE Channel selection finished successfully.\n @retval OT_ERROR_NOT_FOUND Supported channel mask is empty, therefore could not select a channel."]
5633 pub fn otChannelManagerRequestChannelSelect(
5634 aInstance: *mut otInstance,
5635 aSkipQualityCheck: bool,
5636 ) -> otError;
5637}
5638unsafe extern "C" {
5639 #[doc = " Requests that `ChannelManager` checks and selects a new CSL channel and starts a CSL channel change.\n\n Only available with `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE &&\n OPENTHREAD_CONFIG_CHANNEL_MANAGER_CSL_CHANNEL_SELECT_ENABLE`. This function asks the `ChannelManager` to select a\n channel by itself (based on collected channel quality info).\n\n Once called, the Channel Manager will perform the following 3 steps:\n\n 1) `ChannelManager` decides if the CSL channel change would be helpful. This check can be skipped if\n `aSkipQualityCheck` is set to true (forcing a CSL channel selection to happen and skipping the quality check).\n This step uses the collected link quality metrics on the device (such as CCA failure rate, frame and message\n error rates per neighbor, etc.) to determine if the current channel quality is at the level that justifies\n a CSL channel change.\n\n 2) If the first step passes, then `ChannelManager` selects a potentially better CSL channel. It uses the collected\n channel quality data by `ChannelMonitor` module. The supported and favored channels are used at this step.\n (see `otChannelManagerSetSupportedChannels()` and `otChannelManagerSetFavoredChannels()`).\n\n 3) If the newly selected CSL channel is different from the current CSL channel, `ChannelManager` starts the\n CSL channel change process.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSkipQualityCheck Indicates whether the quality check (step 1) should be skipped.\n\n @retval OT_ERROR_NONE Channel selection finished successfully.\n @retval OT_ERROR_NOT_FOUND Supported channel mask is empty, therefore could not select a channel."]
5640 pub fn otChannelManagerRequestCslChannelSelect(
5641 aInstance: *mut otInstance,
5642 aSkipQualityCheck: bool,
5643 ) -> otError;
5644}
5645unsafe extern "C" {
5646 #[doc = " Enables or disables the auto-channel-selection functionality for network channel.\n\n When enabled, `ChannelManager` will periodically invoke a `RequestChannelSelect(false)`. The period interval\n can be set by `otChannelManagerSetAutoChannelSelectionInterval()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled Indicates whether to enable or disable this functionality."]
5647 pub fn otChannelManagerSetAutoChannelSelectionEnabled(
5648 aInstance: *mut otInstance,
5649 aEnabled: bool,
5650 );
5651}
5652unsafe extern "C" {
5653 #[doc = " Indicates whether the auto-channel-selection functionality for a network channel is enabled or not.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if enabled, FALSE if disabled."]
5654 pub fn otChannelManagerGetAutoChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5655}
5656unsafe extern "C" {
5657 #[doc = " Enables or disables the auto-channel-selection functionality for a CSL channel.\n\n Only available with `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE &&\n OPENTHREAD_CONFIG_CHANNEL_MANAGER_CSL_CHANNEL_SELECT_ENABLE`. When enabled, `ChannelManager` will periodically invoke\n a `otChannelManagerRequestCslChannelSelect()`. The period interval can be set by\n `otChannelManagerSetAutoChannelSelectionInterval()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled Indicates whether to enable or disable this functionality."]
5658 pub fn otChannelManagerSetAutoCslChannelSelectionEnabled(
5659 aInstance: *mut otInstance,
5660 aEnabled: bool,
5661 );
5662}
5663unsafe extern "C" {
5664 #[doc = " Indicates whether the auto-csl-channel-selection functionality is enabled or not.\n\n Only available with `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE &&\n OPENTHREAD_CONFIG_CHANNEL_MANAGER_CSL_CHANNEL_SELECT_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if enabled, FALSE if disabled."]
5665 pub fn otChannelManagerGetAutoCslChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5666}
5667unsafe extern "C" {
5668 #[doc = " Sets the period interval (in seconds) used by auto-channel-selection functionality.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInterval The interval in seconds.\n\n @retval OT_ERROR_NONE The interval was set successfully.\n @retval OT_ERROR_INVALID_ARGS The @p aInterval is not valid (zero)."]
5669 pub fn otChannelManagerSetAutoChannelSelectionInterval(
5670 aInstance: *mut otInstance,
5671 aInterval: u32,
5672 ) -> otError;
5673}
5674unsafe extern "C" {
5675 #[doc = " Gets the period interval (in seconds) used by auto-channel-selection functionality.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The interval in seconds."]
5676 pub fn otChannelManagerGetAutoChannelSelectionInterval(aInstance: *mut otInstance) -> u32;
5677}
5678unsafe extern "C" {
5679 #[doc = " Gets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The supported channels as a bit-mask."]
5680 pub fn otChannelManagerGetSupportedChannels(aInstance: *mut otInstance) -> u32;
5681}
5682unsafe extern "C" {
5683 #[doc = " Sets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5684 pub fn otChannelManagerSetSupportedChannels(aInstance: *mut otInstance, aChannelMask: u32);
5685}
5686unsafe extern "C" {
5687 #[doc = " Gets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The favored channels as a bit-mask."]
5688 pub fn otChannelManagerGetFavoredChannels(aInstance: *mut otInstance) -> u32;
5689}
5690unsafe extern "C" {
5691 #[doc = " Sets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5692 pub fn otChannelManagerSetFavoredChannels(aInstance: *mut otInstance, aChannelMask: u32);
5693}
5694unsafe extern "C" {
5695 #[doc = " Gets the CCA failure rate threshold.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CCA failure rate threshold. Value 0 maps to 0% and 0xffff maps to 100%."]
5696 pub fn otChannelManagerGetCcaFailureRateThreshold(aInstance: *mut otInstance) -> u16;
5697}
5698unsafe extern "C" {
5699 #[doc = " Sets the CCA failure rate threshold.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aThreshold A CCA failure rate threshold. Value 0 maps to 0% and 0xffff maps to 100%."]
5700 pub fn otChannelManagerSetCcaFailureRateThreshold(aInstance: *mut otInstance, aThreshold: u16);
5701}
5702unsafe extern "C" {
5703 #[doc = " Enables or disables the Channel Monitoring operation.\n\n Once operation starts, any previously collected data is cleared. However, after operation is disabled, the previous\n collected data is still valid and can be read.\n\n @note OpenThread core internally enables or disables the Channel Monitoring operation when the IPv6 interface is\n brought up or down, for example in a call to `otIp6SetEnabled()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable/start Channel Monitoring operation, FALSE to disable/stop it.\n\n @retval OT_ERROR_NONE Channel Monitoring state changed successfully\n @retval OT_ERROR_ALREADY Channel Monitoring is already in the same state."]
5704 pub fn otChannelMonitorSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
5705}
5706unsafe extern "C" {
5707 #[doc = " Indicates whether the Channel Monitoring operation is enabled and running.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if the Channel Monitoring operation is enabled, FALSE otherwise."]
5708 pub fn otChannelMonitorIsEnabled(aInstance: *mut otInstance) -> bool;
5709}
5710unsafe extern "C" {
5711 #[doc = " Get channel monitoring sample interval in milliseconds.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The channel monitor sample interval in milliseconds."]
5712 pub fn otChannelMonitorGetSampleInterval(aInstance: *mut otInstance) -> u32;
5713}
5714unsafe extern "C" {
5715 #[doc = " Get channel monitoring RSSI threshold in dBm.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RSSI threshold in dBm."]
5716 pub fn otChannelMonitorGetRssiThreshold(aInstance: *mut otInstance) -> i8;
5717}
5718unsafe extern "C" {
5719 #[doc = " Get channel monitoring averaging sample window length (number of samples).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The averaging sample window."]
5720 pub fn otChannelMonitorGetSampleWindow(aInstance: *mut otInstance) -> u32;
5721}
5722unsafe extern "C" {
5723 #[doc = " Get channel monitoring total number of RSSI samples (per channel).\n\n The count indicates total number samples per channel by channel monitoring module since its start (since Thread\n network interface was enabled).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns Total number of RSSI samples (per channel) taken so far."]
5724 pub fn otChannelMonitorGetSampleCount(aInstance: *mut otInstance) -> u32;
5725}
5726unsafe extern "C" {
5727 #[doc = " Gets the current channel occupancy for a given channel.\n\n The channel occupancy value represents the average rate/percentage of RSSI samples that were above RSSI threshold\n (\"bad\" RSSI samples).\n\n For the first \"sample window\" samples, the average is maintained as the actual percentage (i.e., ratio of number\n of \"bad\" samples by total number of samples). After \"window\" samples, the averager uses an exponentially\n weighted moving average. Practically, this means the average is representative of up to `3 * window` last samples\n with highest weight given to the latest `kSampleWindow` samples.\n\n Max value of `0xffff` indicates all RSSI samples were above RSSI threshold (i.e. 100% of samples were \"bad\").\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The channel for which to get the link occupancy.\n\n @returns The current channel occupancy for the given channel."]
5728 pub fn otChannelMonitorGetChannelOccupancy(aInstance: *mut otInstance, aChannel: u8) -> u16;
5729}
5730unsafe extern "C" {
5731 #[doc = " Gets the Child Supervision interval (in seconds) on a child.\n\n Child Supervision feature provides a mechanism for parent to ensure that a message is sent to each sleepy child\n within the supervision interval. If there is no transmission to the child within the supervision interval, OpenThread\n enqueues and sends a Child Supervision Message to the child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The child supervision interval. Zero indicates that supervision is disabled."]
5732 pub fn otChildSupervisionGetInterval(aInstance: *mut otInstance) -> u16;
5733}
5734unsafe extern "C" {
5735 #[doc = " Sets the child supervision interval (in seconds) on the child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInterval The supervision interval (in seconds). Zero to disable supervision."]
5736 pub fn otChildSupervisionSetInterval(aInstance: *mut otInstance, aInterval: u16);
5737}
5738unsafe extern "C" {
5739 #[doc = " Gets the supervision check timeout interval (in seconds) on the child.\n\n If the device is a sleepy child and it does not hear from its parent within the specified check timeout, it initiates\n the re-attach process (MLE Child Update Request/Response exchange with its parent).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The supervision check timeout. Zero indicates that supervision check on the child is disabled."]
5740 pub fn otChildSupervisionGetCheckTimeout(aInstance: *mut otInstance) -> u16;
5741}
5742unsafe extern "C" {
5743 #[doc = " Sets the supervision check timeout interval (in seconds) on the child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTimeout The check timeout (in seconds). Zero to disable supervision check on the child."]
5744 pub fn otChildSupervisionSetCheckTimeout(aInstance: *mut otInstance, aTimeout: u16);
5745}
5746unsafe extern "C" {
5747 #[doc = " Get the value of supervision check timeout failure counter.\n\n The counter tracks the number of supervision check failures on the child. It is incremented when the child does\n not hear from its parent within the specified check timeout interval."]
5748 pub fn otChildSupervisionGetCheckFailureCounter(aInstance: *mut otInstance) -> u16;
5749}
5750unsafe extern "C" {
5751 #[doc = " Reset the supervision check timeout failure counter to zero."]
5752 pub fn otChildSupervisionResetCheckFailureCounter(aInstance: *mut otInstance);
5753}
5754pub type va_list = __builtin_va_list;
5755#[doc = " Represents the log level."]
5756pub type otLogLevel = ::std::os::raw::c_int;
5757#[doc = "< OpenThread API"]
5758pub const OT_LOG_REGION_API: otLogRegion = 1;
5759#[doc = "< MLE"]
5760pub const OT_LOG_REGION_MLE: otLogRegion = 2;
5761#[doc = "< EID-to-RLOC mapping."]
5762pub const OT_LOG_REGION_ARP: otLogRegion = 3;
5763#[doc = "< Network Data"]
5764pub const OT_LOG_REGION_NET_DATA: otLogRegion = 4;
5765#[doc = "< ICMPv6"]
5766pub const OT_LOG_REGION_ICMP: otLogRegion = 5;
5767#[doc = "< IPv6"]
5768pub const OT_LOG_REGION_IP6: otLogRegion = 6;
5769#[doc = "< TCP"]
5770pub const OT_LOG_REGION_TCP: otLogRegion = 7;
5771#[doc = "< IEEE 802.15.4 MAC"]
5772pub const OT_LOG_REGION_MAC: otLogRegion = 8;
5773#[doc = "< Memory"]
5774pub const OT_LOG_REGION_MEM: otLogRegion = 9;
5775#[doc = "< NCP"]
5776pub const OT_LOG_REGION_NCP: otLogRegion = 10;
5777#[doc = "< Mesh Commissioning Protocol"]
5778pub const OT_LOG_REGION_MESH_COP: otLogRegion = 11;
5779#[doc = "< Network Diagnostic"]
5780pub const OT_LOG_REGION_NET_DIAG: otLogRegion = 12;
5781#[doc = "< Platform"]
5782pub const OT_LOG_REGION_PLATFORM: otLogRegion = 13;
5783#[doc = "< CoAP"]
5784pub const OT_LOG_REGION_COAP: otLogRegion = 14;
5785#[doc = "< CLI"]
5786pub const OT_LOG_REGION_CLI: otLogRegion = 15;
5787#[doc = "< OpenThread Core"]
5788pub const OT_LOG_REGION_CORE: otLogRegion = 16;
5789#[doc = "< Utility module"]
5790pub const OT_LOG_REGION_UTIL: otLogRegion = 17;
5791#[doc = "< Backbone Router (available since Thread 1.2)"]
5792pub const OT_LOG_REGION_BBR: otLogRegion = 18;
5793#[doc = "< Multicast Listener Registration (available since Thread 1.2)"]
5794pub const OT_LOG_REGION_MLR: otLogRegion = 19;
5795#[doc = "< Domain Unicast Address (available since Thread 1.2)"]
5796pub const OT_LOG_REGION_DUA: otLogRegion = 20;
5797#[doc = "< Border Router"]
5798pub const OT_LOG_REGION_BR: otLogRegion = 21;
5799#[doc = "< Service Registration Protocol (SRP)"]
5800pub const OT_LOG_REGION_SRP: otLogRegion = 22;
5801#[doc = "< DNS"]
5802pub const OT_LOG_REGION_DNS: otLogRegion = 23;
5803#[doc = " Represents log regions.\n\n The support for log region is removed and instead each core module can define its own name to appended to the logs.\n However, the `otLogRegion` enumeration is still defined as before to help with platforms which we may be using it\n in their `otPlatLog()` implementation. The OT core will always emit all logs with `OT_LOG_REGION_CORE`."]
5804pub type otLogRegion = ::std::os::raw::c_uint;
5805unsafe extern "C" {
5806 #[doc = " Outputs logs.\n\n Note that the support for log region is removed. The OT core will always emit all logs with `OT_LOG_REGION_CORE`\n as @p aLogRegion.\n\n @param[in] aLogLevel The log level.\n @param[in] aLogRegion The log region.\n @param[in] aFormat A pointer to the format string.\n @param[in] ... Arguments for the format specification."]
5807 pub fn otPlatLog(
5808 aLogLevel: otLogLevel,
5809 aLogRegion: otLogRegion,
5810 aFormat: *const ::std::os::raw::c_char,
5811 ...
5812 );
5813}
5814unsafe extern "C" {
5815 #[doc = " This function handles OpenThread log level changes.\n\n This platform function is called whenever the OpenThread log level changes.\n This platform function is optional since an empty weak implementation has been provided.\n\n @note Only applicable when `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n @param[in] aLogLevel The new OpenThread log level."]
5816 pub fn otPlatLogHandleLevelChanged(aLogLevel: otLogLevel);
5817}
5818#[doc = " Represents a CLI command."]
5819#[repr(C)]
5820#[derive(Debug, Copy, Clone)]
5821pub struct otCliCommand {
5822 #[doc = "< A pointer to the command string."]
5823 pub mName: *const ::std::os::raw::c_char,
5824 pub mCommand: ::std::option::Option<
5825 unsafe extern "C" fn(
5826 aContext: *mut ::std::os::raw::c_void,
5827 aArgsLength: u8,
5828 aArgs: *mut *mut ::std::os::raw::c_char,
5829 ) -> otError,
5830 >,
5831}
5832impl Default for otCliCommand {
5833 fn default() -> Self {
5834 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5835 unsafe {
5836 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5837 s.assume_init()
5838 }
5839 }
5840}
5841#[doc = " Pointer is called to notify about Console output.\n\n @param[out] aContext A user context pointer.\n @param[in] aFormat The format string.\n @param[in] aArguments The format string arguments.\n\n @returns Number of bytes written by the callback."]
5842pub type otCliOutputCallback = ::std::option::Option<
5843 unsafe extern "C" fn(
5844 aContext: *mut ::std::os::raw::c_void,
5845 aFormat: *const ::std::os::raw::c_char,
5846 aArguments: *mut __va_list_tag,
5847 ) -> ::std::os::raw::c_int,
5848>;
5849unsafe extern "C" {
5850 #[doc = " Initialize the CLI module.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCallback A callback method called to process CLI output.\n @param[in] aContext A user context pointer."]
5851 pub fn otCliInit(
5852 aInstance: *mut otInstance,
5853 aCallback: otCliOutputCallback,
5854 aContext: *mut ::std::os::raw::c_void,
5855 );
5856}
5857unsafe extern "C" {
5858 #[doc = " Is called to feed in a console input line.\n\n @param[in] aBuf A pointer to a null-terminated string."]
5859 pub fn otCliInputLine(aBuf: *mut ::std::os::raw::c_char);
5860}
5861unsafe extern "C" {
5862 #[doc = " Set a user command table.\n\n @param[in] aUserCommands A pointer to an array with user commands.\n @param[in] aLength @p aUserCommands length.\n @param[in] aContext @p The context passed to the handler.\n\n @retval OT_ERROR_NONE Successfully updated command table with commands from @p aUserCommands.\n @retval OT_ERROR_FAILED Maximum number of command entries have already been set."]
5863 pub fn otCliSetUserCommands(
5864 aUserCommands: *const otCliCommand,
5865 aLength: u8,
5866 aContext: *mut ::std::os::raw::c_void,
5867 ) -> otError;
5868}
5869unsafe extern "C" {
5870 #[doc = " Write a number of bytes to the CLI console as a hex string.\n\n @param[in] aBytes A pointer to data which should be printed.\n @param[in] aLength @p aBytes length."]
5871 pub fn otCliOutputBytes(aBytes: *const u8, aLength: u8);
5872}
5873unsafe extern "C" {
5874 #[doc = " Write formatted string to the CLI console\n\n @param[in] aFmt A pointer to the format string.\n @param[in] ... A matching list of arguments."]
5875 pub fn otCliOutputFormat(aFmt: *const ::std::os::raw::c_char, ...);
5876}
5877unsafe extern "C" {
5878 #[doc = " Write error code to the CLI console\n\n If the @p aError is `OT_ERROR_PENDING` nothing will be outputted.\n\n @param[in] aError Error code value."]
5879 pub fn otCliAppendResult(aError: otError);
5880}
5881unsafe extern "C" {
5882 #[doc = " Callback to write the OpenThread Log to the CLI console\n\n @param[in] aLogLevel The log level.\n @param[in] aLogRegion The log region.\n @param[in] aFormat A pointer to the format string.\n @param[in] aArgs va_list matching aFormat."]
5883 pub fn otCliPlatLogv(
5884 aLogLevel: otLogLevel,
5885 aLogRegion: otLogRegion,
5886 aFormat: *const ::std::os::raw::c_char,
5887 aArgs: *mut __va_list_tag,
5888 );
5889}
5890unsafe extern "C" {
5891 #[doc = " Callback to allow vendor specific commands to be added to the user command table.\n\n Available when `OPENTHREAD_CONFIG_CLI_VENDOR_COMMANDS_ENABLE` is enabled and\n `OPENTHREAD_CONFIG_CLI_MAX_USER_CMD_ENTRIES` is greater than 1."]
5892 pub fn otCliVendorSetUserCommands();
5893}
5894#[doc = "< Confirmable"]
5895pub const OT_COAP_TYPE_CONFIRMABLE: otCoapType = 0;
5896#[doc = "< Non-confirmable"]
5897pub const OT_COAP_TYPE_NON_CONFIRMABLE: otCoapType = 1;
5898#[doc = "< Acknowledgment"]
5899pub const OT_COAP_TYPE_ACKNOWLEDGMENT: otCoapType = 2;
5900#[doc = "< Reset"]
5901pub const OT_COAP_TYPE_RESET: otCoapType = 3;
5902#[doc = " CoAP Type values (2 bit unsigned integer)."]
5903pub type otCoapType = ::std::os::raw::c_uint;
5904#[doc = "< Empty message code"]
5905pub const OT_COAP_CODE_EMPTY: otCoapCode = 0;
5906#[doc = "< Get"]
5907pub const OT_COAP_CODE_GET: otCoapCode = 1;
5908#[doc = "< Post"]
5909pub const OT_COAP_CODE_POST: otCoapCode = 2;
5910#[doc = "< Put"]
5911pub const OT_COAP_CODE_PUT: otCoapCode = 3;
5912#[doc = "< Delete"]
5913pub const OT_COAP_CODE_DELETE: otCoapCode = 4;
5914#[doc = "< 2.00"]
5915pub const OT_COAP_CODE_RESPONSE_MIN: otCoapCode = 64;
5916#[doc = "< Created"]
5917pub const OT_COAP_CODE_CREATED: otCoapCode = 65;
5918#[doc = "< Deleted"]
5919pub const OT_COAP_CODE_DELETED: otCoapCode = 66;
5920#[doc = "< Valid"]
5921pub const OT_COAP_CODE_VALID: otCoapCode = 67;
5922#[doc = "< Changed"]
5923pub const OT_COAP_CODE_CHANGED: otCoapCode = 68;
5924#[doc = "< Content"]
5925pub const OT_COAP_CODE_CONTENT: otCoapCode = 69;
5926#[doc = "< RFC7959 Continue"]
5927pub const OT_COAP_CODE_CONTINUE: otCoapCode = 95;
5928#[doc = "< Bad Request"]
5929pub const OT_COAP_CODE_BAD_REQUEST: otCoapCode = 128;
5930#[doc = "< Unauthorized"]
5931pub const OT_COAP_CODE_UNAUTHORIZED: otCoapCode = 129;
5932#[doc = "< Bad Option"]
5933pub const OT_COAP_CODE_BAD_OPTION: otCoapCode = 130;
5934#[doc = "< Forbidden"]
5935pub const OT_COAP_CODE_FORBIDDEN: otCoapCode = 131;
5936#[doc = "< Not Found"]
5937pub const OT_COAP_CODE_NOT_FOUND: otCoapCode = 132;
5938#[doc = "< Method Not Allowed"]
5939pub const OT_COAP_CODE_METHOD_NOT_ALLOWED: otCoapCode = 133;
5940#[doc = "< Not Acceptable"]
5941pub const OT_COAP_CODE_NOT_ACCEPTABLE: otCoapCode = 134;
5942#[doc = "< RFC7959 Request Entity Incomplete"]
5943pub const OT_COAP_CODE_REQUEST_INCOMPLETE: otCoapCode = 136;
5944#[doc = "< Precondition Failed"]
5945pub const OT_COAP_CODE_PRECONDITION_FAILED: otCoapCode = 140;
5946#[doc = "< Request Entity Too Large"]
5947pub const OT_COAP_CODE_REQUEST_TOO_LARGE: otCoapCode = 141;
5948#[doc = "< Unsupported Content-Format"]
5949pub const OT_COAP_CODE_UNSUPPORTED_FORMAT: otCoapCode = 143;
5950#[doc = "< Internal Server Error"]
5951pub const OT_COAP_CODE_INTERNAL_ERROR: otCoapCode = 160;
5952#[doc = "< Not Implemented"]
5953pub const OT_COAP_CODE_NOT_IMPLEMENTED: otCoapCode = 161;
5954#[doc = "< Bad Gateway"]
5955pub const OT_COAP_CODE_BAD_GATEWAY: otCoapCode = 162;
5956#[doc = "< Service Unavailable"]
5957pub const OT_COAP_CODE_SERVICE_UNAVAILABLE: otCoapCode = 163;
5958#[doc = "< Gateway Timeout"]
5959pub const OT_COAP_CODE_GATEWAY_TIMEOUT: otCoapCode = 164;
5960#[doc = "< Proxying Not Supported"]
5961pub const OT_COAP_CODE_PROXY_NOT_SUPPORTED: otCoapCode = 165;
5962#[doc = " CoAP Code values."]
5963pub type otCoapCode = ::std::os::raw::c_uint;
5964#[doc = "< If-Match"]
5965pub const OT_COAP_OPTION_IF_MATCH: otCoapOptionType = 1;
5966#[doc = "< Uri-Host"]
5967pub const OT_COAP_OPTION_URI_HOST: otCoapOptionType = 3;
5968#[doc = "< ETag"]
5969pub const OT_COAP_OPTION_E_TAG: otCoapOptionType = 4;
5970#[doc = "< If-None-Match"]
5971pub const OT_COAP_OPTION_IF_NONE_MATCH: otCoapOptionType = 5;
5972#[doc = "< Observe [RFC7641]"]
5973pub const OT_COAP_OPTION_OBSERVE: otCoapOptionType = 6;
5974#[doc = "< Uri-Port"]
5975pub const OT_COAP_OPTION_URI_PORT: otCoapOptionType = 7;
5976#[doc = "< Location-Path"]
5977pub const OT_COAP_OPTION_LOCATION_PATH: otCoapOptionType = 8;
5978#[doc = "< Uri-Path"]
5979pub const OT_COAP_OPTION_URI_PATH: otCoapOptionType = 11;
5980#[doc = "< Content-Format"]
5981pub const OT_COAP_OPTION_CONTENT_FORMAT: otCoapOptionType = 12;
5982#[doc = "< Max-Age"]
5983pub const OT_COAP_OPTION_MAX_AGE: otCoapOptionType = 14;
5984#[doc = "< Uri-Query"]
5985pub const OT_COAP_OPTION_URI_QUERY: otCoapOptionType = 15;
5986#[doc = "< Accept"]
5987pub const OT_COAP_OPTION_ACCEPT: otCoapOptionType = 17;
5988#[doc = "< Location-Query"]
5989pub const OT_COAP_OPTION_LOCATION_QUERY: otCoapOptionType = 20;
5990#[doc = "< Block2 (RFC7959)"]
5991pub const OT_COAP_OPTION_BLOCK2: otCoapOptionType = 23;
5992#[doc = "< Block1 (RFC7959)"]
5993pub const OT_COAP_OPTION_BLOCK1: otCoapOptionType = 27;
5994#[doc = "< Size2 (RFC7959)"]
5995pub const OT_COAP_OPTION_SIZE2: otCoapOptionType = 28;
5996#[doc = "< Proxy-Uri"]
5997pub const OT_COAP_OPTION_PROXY_URI: otCoapOptionType = 35;
5998#[doc = "< Proxy-Scheme"]
5999pub const OT_COAP_OPTION_PROXY_SCHEME: otCoapOptionType = 39;
6000#[doc = "< Size1"]
6001pub const OT_COAP_OPTION_SIZE1: otCoapOptionType = 60;
6002#[doc = " CoAP Option Numbers"]
6003pub type otCoapOptionType = ::std::os::raw::c_uint;
6004#[doc = " Represents a CoAP option."]
6005#[repr(C)]
6006#[derive(Debug, Default, Copy, Clone)]
6007pub struct otCoapOption {
6008 #[doc = "< Option Number"]
6009 pub mNumber: u16,
6010 #[doc = "< Option Length"]
6011 pub mLength: u16,
6012}
6013#[doc = " Acts as an iterator for CoAP options"]
6014#[repr(C)]
6015#[derive(Debug, Copy, Clone)]
6016pub struct otCoapOptionIterator {
6017 #[doc = "< CoAP message"]
6018 pub mMessage: *const otMessage,
6019 #[doc = "< CoAP message option"]
6020 pub mOption: otCoapOption,
6021 #[doc = "< Byte offset of next option"]
6022 pub mNextOptionOffset: u16,
6023}
6024impl Default for otCoapOptionIterator {
6025 fn default() -> Self {
6026 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6027 unsafe {
6028 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6029 s.assume_init()
6030 }
6031 }
6032}
6033#[doc = "< txt/plain; charset=utf-8: [RFC2046][RFC3676][RFC5147]"]
6034pub const OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN: otCoapOptionContentFormat = 0;
6035#[doc = "< application/cose; cose-type=\"cose-encrypt0\": [RFC8152]"]
6036pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0: otCoapOptionContentFormat = 16;
6037#[doc = "< application/cose; cose-type=\"cose-mac0\": [RFC8152]"]
6038pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0: otCoapOptionContentFormat = 17;
6039#[doc = "< application/cose; cose-type=\"cose-sign1\": [RFC8152]"]
6040pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1: otCoapOptionContentFormat = 18;
6041#[doc = "< application/link-format: [RFC6690]"]
6042pub const OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT: otCoapOptionContentFormat = 40;
6043#[doc = "< application/xml: [RFC3023]"]
6044pub const OT_COAP_OPTION_CONTENT_FORMAT_XML: otCoapOptionContentFormat = 41;
6045#[doc = "< application/octet-stream: [RFC2045][RFC2046]"]
6046pub const OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM: otCoapOptionContentFormat = 42;
6047#[doc = "< application/exi: [\"Efficient XML Interchange (EXI)\"]"]
6048pub const OT_COAP_OPTION_CONTENT_FORMAT_EXI: otCoapOptionContentFormat = 47;
6049#[doc = "< application/json: [RFC7159]"]
6050pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON: otCoapOptionContentFormat = 50;
6051#[doc = "< application/json-patch+json: [RFC6902]"]
6052pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON: otCoapOptionContentFormat = 51;
6053#[doc = "< application/merge-patch+json: [RFC7396]"]
6054pub const OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON: otCoapOptionContentFormat = 52;
6055#[doc = "< application/cbor: [RFC7049]"]
6056pub const OT_COAP_OPTION_CONTENT_FORMAT_CBOR: otCoapOptionContentFormat = 60;
6057#[doc = "< application/cwt: [RFC8392]"]
6058pub const OT_COAP_OPTION_CONTENT_FORMAT_CWT: otCoapOptionContentFormat = 61;
6059#[doc = "< application/cose; cose-type=\"cose-encrypt\": [RFC8152]"]
6060pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT: otCoapOptionContentFormat = 96;
6061#[doc = "< application/cose; cose-type=\"cose-mac\": [RFC8152]"]
6062pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC: otCoapOptionContentFormat = 97;
6063#[doc = "< application/cose; cose-type=\"cose-sign\": [RFC8152]"]
6064pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN: otCoapOptionContentFormat = 98;
6065#[doc = "< application/cose-key: [RFC8152]"]
6066pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY: otCoapOptionContentFormat = 101;
6067#[doc = "< application/cose-key-set: [RFC8152]"]
6068pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET: otCoapOptionContentFormat = 102;
6069#[doc = "< application/senml+json: [RFC8428]"]
6070pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON: otCoapOptionContentFormat = 110;
6071#[doc = "< application/sensml+json: [RFC8428]"]
6072pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON: otCoapOptionContentFormat = 111;
6073#[doc = "< application/senml+cbor: [RFC8428]"]
6074pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR: otCoapOptionContentFormat = 112;
6075#[doc = "< application/sensml+cbor: [RFC8428]"]
6076pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR: otCoapOptionContentFormat = 113;
6077#[doc = "< application/senml-exi: [RFC8428]"]
6078pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI: otCoapOptionContentFormat = 114;
6079#[doc = "< application/sensml-exi: [RFC8428]"]
6080pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI: otCoapOptionContentFormat = 115;
6081#[doc = "< application/coap-group+json: [RFC7390]"]
6082pub const OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON: otCoapOptionContentFormat = 256;
6083#[doc = "< application/senml+xml: [RFC8428]"]
6084pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML: otCoapOptionContentFormat = 310;
6085#[doc = "< application/sensml+xml: [RFC8428]"]
6086pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML: otCoapOptionContentFormat = 311;
6087#[doc = " CoAP Content Format codes. The full list is documented at\n https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats"]
6088pub type otCoapOptionContentFormat = ::std::os::raw::c_uint;
6089pub const OT_COAP_OPTION_BLOCK_SZX_16: otCoapBlockSzx = 0;
6090pub const OT_COAP_OPTION_BLOCK_SZX_32: otCoapBlockSzx = 1;
6091pub const OT_COAP_OPTION_BLOCK_SZX_64: otCoapBlockSzx = 2;
6092pub const OT_COAP_OPTION_BLOCK_SZX_128: otCoapBlockSzx = 3;
6093pub const OT_COAP_OPTION_BLOCK_SZX_256: otCoapBlockSzx = 4;
6094pub const OT_COAP_OPTION_BLOCK_SZX_512: otCoapBlockSzx = 5;
6095pub const OT_COAP_OPTION_BLOCK_SZX_1024: otCoapBlockSzx = 6;
6096#[doc = " CoAP Block Size Exponents"]
6097pub type otCoapBlockSzx = ::std::os::raw::c_uint;
6098#[doc = " Pointer is called when a CoAP response is received or on the request timeout.\n\n @param[in] aContext A pointer to application-specific context.\n @param[in] aMessage A pointer to the message buffer containing the response. NULL if no response was received.\n @param[in] aMessageInfo A pointer to the message info for @p aMessage. NULL if no response was received.\n @param[in] aResult A result of the CoAP transaction.\n\n @retval OT_ERROR_NONE A response was received successfully.\n @retval OT_ERROR_ABORT A CoAP transaction was reset by peer.\n @retval OT_ERROR_RESPONSE_TIMEOUT No response or acknowledgment received during timeout period."]
6099pub type otCoapResponseHandler = ::std::option::Option<
6100 unsafe extern "C" fn(
6101 aContext: *mut ::std::os::raw::c_void,
6102 aMessage: *mut otMessage,
6103 aMessageInfo: *const otMessageInfo,
6104 aResult: otError,
6105 ),
6106>;
6107#[doc = " Pointer is called when a CoAP request with a given Uri-Path is received.\n\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aMessage A pointer to the message.\n @param[in] aMessageInfo A pointer to the message info for @p aMessage."]
6108pub type otCoapRequestHandler = ::std::option::Option<
6109 unsafe extern "C" fn(
6110 aContext: *mut ::std::os::raw::c_void,
6111 aMessage: *mut otMessage,
6112 aMessageInfo: *const otMessageInfo,
6113 ),
6114>;
6115#[doc = " Pointer is called as a fallback if a response did not match a stored CoAP request.\n\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aMessage A pointer to the message.\n @param[in] aMessageInfo A pointer to the message info for @p aMessage.\n\n @retval TRUE The fallback handled the response.\n @retval FALSE OpenThread takes default actions for response."]
6116pub type otCoapResponseFallback = ::std::option::Option<
6117 unsafe extern "C" fn(
6118 aContext: *mut ::std::os::raw::c_void,
6119 aMessage: *mut otMessage,
6120 aMessageInfo: *const otMessageInfo,
6121 ) -> bool,
6122>;
6123#[doc = " Represents a CoAP message token."]
6124#[repr(C)]
6125#[derive(Debug, Default, Copy, Clone)]
6126pub struct otCoapToken {
6127 #[doc = "< The token bytes."]
6128 pub m8: [u8; 8usize],
6129 #[doc = "< The token length in bytes."]
6130 pub mLength: u8,
6131}
6132#[doc = " Represents a CoAP resource."]
6133#[repr(C)]
6134#[derive(Debug, Copy, Clone)]
6135pub struct otCoapResource {
6136 #[doc = "< The URI Path string"]
6137 pub mUriPath: *const ::std::os::raw::c_char,
6138 #[doc = "< The callback for handling a received request"]
6139 pub mHandler: otCoapRequestHandler,
6140 #[doc = "< Application-specific context"]
6141 pub mContext: *mut ::std::os::raw::c_void,
6142 #[doc = "< The next CoAP resource in the list"]
6143 pub mNext: *mut otCoapResource,
6144}
6145impl Default for otCoapResource {
6146 fn default() -> Self {
6147 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6148 unsafe {
6149 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6150 s.assume_init()
6151 }
6152 }
6153}
6154#[doc = " Represents the CoAP transmission parameters.\n\n @note mAckTimeout * ((2 ** (mMaxRetransmit + 1)) - 1) * (mAckRandomFactorNumerator / mAckRandomFactorDenominator)\n must not exceed what can be represented by a uint32_t (0xffffffff). This limitation allows OpenThread to\n avoid 64-bit arithmetic."]
6155#[repr(C)]
6156#[derive(Debug, Default, Copy, Clone)]
6157pub struct otCoapTxParameters {
6158 #[doc = " Minimum spacing before first retransmission when ACK is not received, in milliseconds (RFC7252 default value is\n 2000ms)."]
6159 pub mAckTimeout: u32,
6160 #[doc = " Numerator of ACK_RANDOM_FACTOR used to calculate maximum spacing before first retransmission when ACK is not\n received (RFC7252 default value of ACK_RANDOM_FACTOR is 1.5; must not be decreased below 1)."]
6161 pub mAckRandomFactorNumerator: u8,
6162 #[doc = " Denominator of ACK_RANDOM_FACTOR used to calculate maximum spacing before first retransmission when ACK is not\n received (RFC7252 default value of ACK_RANDOM_FACTOR is 1.5; must not be decreased below 1)."]
6163 pub mAckRandomFactorDenominator: u8,
6164 #[doc = " Maximum number of retransmissions for CoAP Confirmable messages (RFC7252 default value is 4)."]
6165 pub mMaxRetransmit: u8,
6166}
6167unsafe extern "C" {
6168 #[doc = " Initializes a CoAP message.\n\n This function initializes the CoAP header, erasing any previously written content in the message. The Message ID is\n set to zero, and the token is empty (zero-length).\n\n @param[in,out] aMessage A pointer to the CoAP message to initialize.\n @param[in] aType The CoAP Type.\n @param[in] aCode The CoAP Code.\n\n @retval OT_ERROR_NONE Successfully initialized the message.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available to write the CoAP header."]
6169 pub fn otCoapMessageInit(
6170 aMessage: *mut otMessage,
6171 aType: otCoapType,
6172 aCode: otCoapCode,
6173 ) -> otError;
6174}
6175unsafe extern "C" {
6176 #[doc = " Initializes a CoAP message as a response to a request.\n\n This function initializes the CoAP header, erasing any previously written content in the message. The Message ID and\n Token are copied from the request message.\n\n @param[in,out] aResponse A pointer to the CoAP response message to initialize.\n @param[in] aRequest A pointer to the CoAP request message.\n @param[in] aType The CoAP Type for the response.\n @param[in] aCode The CoAP Code for the response.\n\n @retval OT_ERROR_NONE Successfully initialized the response message.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available to write the CoAP header."]
6177 pub fn otCoapMessageInitResponse(
6178 aResponse: *mut otMessage,
6179 aRequest: *const otMessage,
6180 aType: otCoapType,
6181 aCode: otCoapCode,
6182 ) -> otError;
6183}
6184unsafe extern "C" {
6185 #[doc = " Writes the Token in the CoAP message.\n\n @param[in,out] aMessage The CoAP message.\n @param[in] aToken The Token to write.\n\n @retval OT_ERROR_NONE Successfully wrote the Token.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to set the Token value."]
6186 pub fn otCoapMessageWriteToken(aMessage: *mut otMessage, aToken: *const otCoapToken)
6187 -> otError;
6188}
6189unsafe extern "C" {
6190 #[doc = " Writes a randomly generated Token of a given length in the CoAP message.\n\n @param[in,out] aMessage The CoAP message.\n @param[in] aTokenLength The Length of a Token (in bytes)."]
6191 pub fn otCoapMessageGenerateToken(aMessage: *mut otMessage, aTokenLength: u8);
6192}
6193unsafe extern "C" {
6194 #[doc = " Appends the Content Format CoAP option as specified in\n https://tools.ietf.org/html/rfc7252#page-92. This *must* be called before\n setting otCoapMessageSetPayloadMarker if a payload is to be included in the\n message.\n\n The function is a convenience wrapper around otCoapMessageAppendUintOption,\n and if the desired format type code isn't listed in otCoapOptionContentFormat,\n this base function should be used instead.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aContentFormat One of the content formats listed in\n otCoapOptionContentFormat above.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6195 pub fn otCoapMessageAppendContentFormatOption(
6196 aMessage: *mut otMessage,
6197 aContentFormat: otCoapOptionContentFormat,
6198 ) -> otError;
6199}
6200unsafe extern "C" {
6201 #[doc = " Appends a CoAP option in a header.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aNumber The CoAP Option number.\n @param[in] aLength The CoAP Option length.\n @param[in] aValue A pointer to the CoAP value.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6202 pub fn otCoapMessageAppendOption(
6203 aMessage: *mut otMessage,
6204 aNumber: u16,
6205 aLength: u16,
6206 aValue: *const ::std::os::raw::c_void,
6207 ) -> otError;
6208}
6209unsafe extern "C" {
6210 #[doc = " Appends an unsigned integer CoAP option as specified in\n https://tools.ietf.org/html/rfc7252#section-3.2\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aNumber The CoAP Option number.\n @param[in] aValue The CoAP Option unsigned integer value.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size.\n\n @see otCoapMessageGetOptionUintValue"]
6211 pub fn otCoapMessageAppendUintOption(
6212 aMessage: *mut otMessage,
6213 aNumber: u16,
6214 aValue: u32,
6215 ) -> otError;
6216}
6217unsafe extern "C" {
6218 #[doc = " Appends an Observe option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aObserve Observe field value.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6219 pub fn otCoapMessageAppendObserveOption(aMessage: *mut otMessage, aObserve: u32) -> otError;
6220}
6221unsafe extern "C" {
6222 #[doc = " Appends a Uri-Path option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aUriPath A pointer to a NULL-terminated string.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6223 pub fn otCoapMessageAppendUriPathOptions(
6224 aMessage: *mut otMessage,
6225 aUriPath: *const ::std::os::raw::c_char,
6226 ) -> otError;
6227}
6228unsafe extern "C" {
6229 #[doc = " Appends a Uri-Query option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aUriQuery A pointer to a NULL-terminated string.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6230 pub fn otCoapMessageAppendUriQueryOptions(
6231 aMessage: *mut otMessage,
6232 aUriQuery: *const ::std::os::raw::c_char,
6233 ) -> otError;
6234}
6235unsafe extern "C" {
6236 #[doc = " Converts a CoAP Block option SZX field to the actual block size\n\n @param[in] aSize Block size exponent.\n\n @returns The actual size exponent value."]
6237 pub fn otCoapBlockSizeFromExponent(aSize: otCoapBlockSzx) -> u16;
6238}
6239unsafe extern "C" {
6240 #[doc = " Appends a Block2 option\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aNum Current block number.\n @param[in] aMore Boolean to indicate more blocks are to be sent.\n @param[in] aSize Block Size Exponent.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6241 pub fn otCoapMessageAppendBlock2Option(
6242 aMessage: *mut otMessage,
6243 aNum: u32,
6244 aMore: bool,
6245 aSize: otCoapBlockSzx,
6246 ) -> otError;
6247}
6248unsafe extern "C" {
6249 #[doc = " Appends a Block1 option\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aNum Current block number.\n @param[in] aMore Boolean to indicate more blocks are to be sent.\n @param[in] aSize Block Size Exponent.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6250 pub fn otCoapMessageAppendBlock1Option(
6251 aMessage: *mut otMessage,
6252 aNum: u32,
6253 aMore: bool,
6254 aSize: otCoapBlockSzx,
6255 ) -> otError;
6256}
6257unsafe extern "C" {
6258 #[doc = " Appends a Proxy-Uri option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aUriPath A pointer to a NULL-terminated string.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6259 pub fn otCoapMessageAppendProxyUriOption(
6260 aMessage: *mut otMessage,
6261 aUriPath: *const ::std::os::raw::c_char,
6262 ) -> otError;
6263}
6264unsafe extern "C" {
6265 #[doc = " Appends a Max-Age option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aMaxAge The Max-Age value.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6266 pub fn otCoapMessageAppendMaxAgeOption(aMessage: *mut otMessage, aMaxAge: u32) -> otError;
6267}
6268unsafe extern "C" {
6269 #[doc = " Appends a single Uri-Query option.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aUriQuery A pointer to NULL-terminated string, which should contain a single key=value pair.\n\n @retval OT_ERROR_NONE Successfully appended the option.\n @retval OT_ERROR_INVALID_ARGS The option type is not equal or greater than the last option type.\n @retval OT_ERROR_NO_BUFS The option length exceeds the buffer size."]
6270 pub fn otCoapMessageAppendUriQueryOption(
6271 aMessage: *mut otMessage,
6272 aUriQuery: *const ::std::os::raw::c_char,
6273 ) -> otError;
6274}
6275unsafe extern "C" {
6276 #[doc = " Adds Payload Marker indicating beginning of the payload to the CoAP header.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n\n @retval OT_ERROR_NONE Payload Marker successfully added.\n @retval OT_ERROR_NO_BUFS Header Payload Marker exceeds the buffer size."]
6277 pub fn otCoapMessageSetPayloadMarker(aMessage: *mut otMessage) -> otError;
6278}
6279unsafe extern "C" {
6280 #[doc = " Returns the Type value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Type value."]
6281 pub fn otCoapMessageGetType(aMessage: *const otMessage) -> otCoapType;
6282}
6283unsafe extern "C" {
6284 #[doc = " Returns the Code value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Code value."]
6285 pub fn otCoapMessageGetCode(aMessage: *const otMessage) -> otCoapCode;
6286}
6287unsafe extern "C" {
6288 #[doc = " Sets the Code value.\n\n @param[in,out] aMessage A pointer to the CoAP message to initialize.\n @param[in] aCode CoAP message code."]
6289 pub fn otCoapMessageSetCode(aMessage: *mut otMessage, aCode: otCoapCode);
6290}
6291unsafe extern "C" {
6292 #[doc = " Returns the CoAP Code as human readable string.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @ returns The CoAP Code as string."]
6293 pub fn otCoapMessageCodeToString(aMessage: *const otMessage) -> *const ::std::os::raw::c_char;
6294}
6295unsafe extern "C" {
6296 #[doc = " Returns the Message ID value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Message ID value."]
6297 pub fn otCoapMessageGetMessageId(aMessage: *const otMessage) -> u16;
6298}
6299unsafe extern "C" {
6300 #[doc = " Reads the Token from the CoAP message.\n\n @param[in] aMessage The CoAP message.\n @param[out] aToken A pointer to a `otCoapToken` to output the read Token.\n\n @retval OT_ERROR_NONE Successfully read the Token. @p aToken is updated.\n @retval OT_ERROR_PARSE Failed to parse the header."]
6301 pub fn otCoapMessageReadToken(aMessage: *const otMessage, aToken: *mut otCoapToken) -> otError;
6302}
6303unsafe extern "C" {
6304 #[doc = " Indicates whether two given CoAP Tokens are equal.\n\n @param[in] aFirstToken The first Token to compare.\n @param[in] aSecondToken The second Token to compare.\n\n @retval TRUE If the two Tokens are equal.\n @retval FALSE If the two Tokens are not equal."]
6305 pub fn otCoapMessageAreTokensEqual(
6306 aFirstToken: *const otCoapToken,
6307 aSecondToken: *const otCoapToken,
6308 ) -> bool;
6309}
6310unsafe extern "C" {
6311 #[doc = " Initializes an iterator for the options in the given message.\n\n @param[in,out] aIterator A pointer to the CoAP message option iterator.\n @param[in] aMessage A pointer to the CoAP message.\n\n @retval OT_ERROR_NONE Successfully initialized.\n @retval OT_ERROR_PARSE Message state is inconsistent."]
6312 pub fn otCoapOptionIteratorInit(
6313 aIterator: *mut otCoapOptionIterator,
6314 aMessage: *const otMessage,
6315 ) -> otError;
6316}
6317unsafe extern "C" {
6318 #[doc = " Returns a pointer to the first option matching the specified option number.\n\n @param[in] aIterator A pointer to the CoAP message option iterator.\n @param[in] aOption The option number sought.\n\n @returns A pointer to the first matching option. If no matching option is present NULL pointer is returned."]
6319 pub fn otCoapOptionIteratorGetFirstOptionMatching(
6320 aIterator: *mut otCoapOptionIterator,
6321 aOption: u16,
6322 ) -> *const otCoapOption;
6323}
6324unsafe extern "C" {
6325 #[doc = " Returns a pointer to the first option.\n\n @param[in,out] aIterator A pointer to the CoAP message option iterator.\n\n @returns A pointer to the first option. If no option is present NULL pointer is returned."]
6326 pub fn otCoapOptionIteratorGetFirstOption(
6327 aIterator: *mut otCoapOptionIterator,
6328 ) -> *const otCoapOption;
6329}
6330unsafe extern "C" {
6331 #[doc = " Returns a pointer to the next option matching the specified option number.\n\n @param[in] aIterator A pointer to the CoAP message option iterator.\n @param[in] aOption The option number sought.\n\n @returns A pointer to the next matching option. If no further matching option is present NULL pointer is returned."]
6332 pub fn otCoapOptionIteratorGetNextOptionMatching(
6333 aIterator: *mut otCoapOptionIterator,
6334 aOption: u16,
6335 ) -> *const otCoapOption;
6336}
6337unsafe extern "C" {
6338 #[doc = " Returns a pointer to the next option.\n\n @param[in,out] aIterator A pointer to the CoAP message option iterator.\n\n @returns A pointer to the next option. If no more options are present NULL pointer is returned."]
6339 pub fn otCoapOptionIteratorGetNextOption(
6340 aIterator: *mut otCoapOptionIterator,
6341 ) -> *const otCoapOption;
6342}
6343unsafe extern "C" {
6344 #[doc = " Fills current option value into @p aValue assuming the current value is an unsigned integer encoded\n according to https://tools.ietf.org/html/rfc7252#section-3.2\n\n @param[in,out] aIterator A pointer to the CoAP message option iterator.\n @param[out] aValue A pointer to an unsigned integer to receive the option value.\n\n @retval OT_ERROR_NONE Successfully filled value.\n @retval OT_ERROR_NOT_FOUND No current option.\n @retval OT_ERROR_NO_BUFS Value is too long to fit in a uint64_t.\n\n @see otCoapMessageAppendUintOption"]
6345 pub fn otCoapOptionIteratorGetOptionUintValue(
6346 aIterator: *mut otCoapOptionIterator,
6347 aValue: *mut u64,
6348 ) -> otError;
6349}
6350unsafe extern "C" {
6351 #[doc = " Fills current option value into @p aValue.\n\n @param[in,out] aIterator A pointer to the CoAP message option iterator.\n @param[out] aValue A pointer to a buffer to receive the option value.\n\n @retval OT_ERROR_NONE Successfully filled value.\n @retval OT_ERROR_NOT_FOUND No current option."]
6352 pub fn otCoapOptionIteratorGetOptionValue(
6353 aIterator: *mut otCoapOptionIterator,
6354 aValue: *mut ::std::os::raw::c_void,
6355 ) -> otError;
6356}
6357unsafe extern "C" {
6358 #[doc = " Creates a new CoAP message.\n\n @note If @p aSettings is 'NULL', the link layer security is enabled and the message priority is set to\n OT_MESSAGE_PRIORITY_NORMAL by default.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSettings A pointer to the message settings or NULL to set default settings.\n\n @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid."]
6359 pub fn otCoapNewMessage(
6360 aInstance: *mut otInstance,
6361 aSettings: *const otMessageSettings,
6362 ) -> *mut otMessage;
6363}
6364unsafe extern "C" {
6365 #[doc = " Sends a CoAP request with custom transmission parameters.\n\n If a response for a request is expected, respective function and context information should be provided.\n If no response is expected, these arguments should be NULL pointers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aHandler A function pointer that shall be called on response reception or timeout.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTxParameters A pointer to transmission parameters for this request. Use NULL for defaults.\n Otherwise, parameters given must meet the following conditions:\n 1. mMaxRetransmit is no more than OT_COAP_MAX_RETRANSMIT.\n 2. mAckRandomFactorNumerator / mAckRandomFactorDenominator must not be below 1.0.\n 3. The calculated exchange life time must not overflow uint32_t.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given."]
6366 pub fn otCoapSendRequestWithParameters(
6367 aInstance: *mut otInstance,
6368 aMessage: *mut otMessage,
6369 aMessageInfo: *const otMessageInfo,
6370 aHandler: otCoapResponseHandler,
6371 aContext: *mut ::std::os::raw::c_void,
6372 aTxParameters: *const otCoapTxParameters,
6373 ) -> otError;
6374}
6375unsafe extern "C" {
6376 #[doc = " Sends a CoAP request.\n\n If a response for a request is expected, respective function and context information should be provided.\n If no response is expected, these arguments should be NULL pointers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aHandler A function pointer that shall be called on response reception or timeout.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data."]
6377 pub fn otCoapSendRequest(
6378 aInstance: *mut otInstance,
6379 aMessage: *mut otMessage,
6380 aMessageInfo: *const otMessageInfo,
6381 aHandler: otCoapResponseHandler,
6382 aContext: *mut ::std::os::raw::c_void,
6383 ) -> otError;
6384}
6385unsafe extern "C" {
6386 #[doc = " Starts the CoAP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPort The local UDP port to bind to.\n\n @retval OT_ERROR_NONE Successfully started the CoAP server.\n @retval OT_ERROR_FAILED Failed to start the CoAP server."]
6387 pub fn otCoapStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6388}
6389unsafe extern "C" {
6390 #[doc = " Stops the CoAP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully stopped the CoAP server."]
6391 pub fn otCoapStop(aInstance: *mut otInstance) -> otError;
6392}
6393unsafe extern "C" {
6394 #[doc = " Adds a resource to the CoAP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6395 pub fn otCoapAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6396}
6397unsafe extern "C" {
6398 #[doc = " Removes a resource from the CoAP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6399 pub fn otCoapRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6400}
6401unsafe extern "C" {
6402 #[doc = " Sets the default handler for unhandled CoAP requests.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHandler A function pointer that shall be called when an unhandled request arrives.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used."]
6403 pub fn otCoapSetDefaultHandler(
6404 aInstance: *mut otInstance,
6405 aHandler: otCoapRequestHandler,
6406 aContext: *mut ::std::os::raw::c_void,
6407 );
6408}
6409unsafe extern "C" {
6410 #[doc = " Sets a fallback handler for CoAP responses not matching any active/pending request.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHandler A function pointer that shall be called as a fallback for responses without matching\n active/pending CoAP requests.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used."]
6411 pub fn otCoapSetResponseFallback(
6412 aInstance: *mut otInstance,
6413 aHandler: otCoapResponseFallback,
6414 aContext: *mut ::std::os::raw::c_void,
6415 );
6416}
6417unsafe extern "C" {
6418 #[doc = " Sends a CoAP response from the server with custom transmission parameters.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aTxParameters A pointer to transmission parameters for this response. Use NULL for defaults.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given."]
6419 pub fn otCoapSendResponseWithParameters(
6420 aInstance: *mut otInstance,
6421 aMessage: *mut otMessage,
6422 aMessageInfo: *const otMessageInfo,
6423 aTxParameters: *const otCoapTxParameters,
6424 ) -> otError;
6425}
6426unsafe extern "C" {
6427 #[doc = " Sends a CoAP response from the server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response."]
6428 pub fn otCoapSendResponse(
6429 aInstance: *mut otInstance,
6430 aMessage: *mut otMessage,
6431 aMessageInfo: *const otMessageInfo,
6432 ) -> otError;
6433}
6434#[doc = " Pointer is called when a CoAP message with a block-wise transfer option is received.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n @param[in] aContext A pointer to application-specific context.\n @param[in] aBlock A pointer to the block segment.\n @param[in] aPosition The position of @p aBlock in a sequence in bytes.\n @param[in] aBlockLength The length of the block segment in bytes.\n @param[in] aMore Flag if more block segments are following.\n @param[in] aTotalLength The total length in bytes of the transferred information (indicated by a Size1 or Size2\n option).\n\n @retval OT_ERROR_NONE Block segment was stored successfully.\n @retval OT_ERROR_NO_BUFS No more memory to store blocks.\n @retval OT_ERROR_NO_FRAME_RECEIVED Block segment missing."]
6435pub type otCoapBlockwiseReceiveHook = ::std::option::Option<
6436 unsafe extern "C" fn(
6437 aContext: *mut ::std::os::raw::c_void,
6438 aBlock: *const u8,
6439 aPosition: u32,
6440 aBlockLength: u16,
6441 aMore: bool,
6442 aTotalLength: u32,
6443 ) -> otError,
6444>;
6445#[doc = " Pointer is called before the next block in a block-wise transfer is sent.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n @param[in] aContext A pointer to application-specific context.\n @param[in,out] aBlock A pointer to where the block segment can be written to.\n @param[in] aPosition The position in a sequence from which to obtain the block segment.\n @param[in,out] aBlockLength On entry, the maximum block segment length in bytes.\n @param[out] aMore A pointer to the flag if more block segments will follow.\n\n @warning By changing the value of aBlockLength, the block size of the whole exchange is\n renegotiated. It is recommended to do this after the first block has been received as\n later changes could cause problems with other CoAP implementations.\n\n @retval OT_ERROR_NONE No error occurred.\n @retval OT_ERROR_INVALID_ARGS Block at @p aPosition does not exist."]
6446pub type otCoapBlockwiseTransmitHook = ::std::option::Option<
6447 unsafe extern "C" fn(
6448 aContext: *mut ::std::os::raw::c_void,
6449 aBlock: *mut u8,
6450 aPosition: u32,
6451 aBlockLength: *mut u16,
6452 aMore: *mut bool,
6453 ) -> otError,
6454>;
6455#[doc = " Represents a CoAP resource with block-wise transfer."]
6456#[repr(C)]
6457#[derive(Debug, Copy, Clone)]
6458pub struct otCoapBlockwiseResource {
6459 #[doc = "< The URI Path string"]
6460 pub mUriPath: *const ::std::os::raw::c_char,
6461 #[doc = "< The callback for handling a received request"]
6462 pub mHandler: otCoapRequestHandler,
6463 #[doc = " The callback for handling incoming block-wise transfer.\n This callback is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE\n configuration is enabled."]
6464 pub mReceiveHook: otCoapBlockwiseReceiveHook,
6465 #[doc = " The callback for handling outgoing block-wise transfer.\n This callback is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE\n configuration is enabled."]
6466 pub mTransmitHook: otCoapBlockwiseTransmitHook,
6467 #[doc = "< Application-specific context"]
6468 pub mContext: *mut ::std::os::raw::c_void,
6469 #[doc = "< The next CoAP resource in the list"]
6470 pub mNext: *mut otCoapBlockwiseResource,
6471}
6472impl Default for otCoapBlockwiseResource {
6473 fn default() -> Self {
6474 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6475 unsafe {
6476 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6477 s.assume_init()
6478 }
6479 }
6480}
6481unsafe extern "C" {
6482 #[doc = " Adds a block-wise resource to the CoAP server.\n\n Requires `OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6483 pub fn otCoapAddBlockWiseResource(
6484 aInstance: *mut otInstance,
6485 aResource: *mut otCoapBlockwiseResource,
6486 );
6487}
6488unsafe extern "C" {
6489 #[doc = " Removes a block-wise resource from the CoAP server.\n\n Requires `OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6490 pub fn otCoapRemoveBlockWiseResource(
6491 aInstance: *mut otInstance,
6492 aResource: *mut otCoapBlockwiseResource,
6493 );
6494}
6495unsafe extern "C" {
6496 #[doc = " Sends a CoAP request block-wise with custom transmission parameters.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n If a response for a request is expected, respective function and context information should be provided.\n If the response is expected to be block-wise, a respective hook function should be provided.\n If no response is expected, these arguments should be NULL pointers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aHandler A function pointer that shall be called on response reception or timeout.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTxParameters A pointer to transmission parameters for this request. Use NULL for defaults.\n @param[in] aTransmitHook A pointer to a hook function for outgoing block-wise transfer.\n @param[in] aReceiveHook A pointer to a hook function for incoming block-wise transfer.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given."]
6497 pub fn otCoapSendRequestBlockWiseWithParameters(
6498 aInstance: *mut otInstance,
6499 aMessage: *mut otMessage,
6500 aMessageInfo: *const otMessageInfo,
6501 aHandler: otCoapResponseHandler,
6502 aContext: *mut ::std::os::raw::c_void,
6503 aTxParameters: *const otCoapTxParameters,
6504 aTransmitHook: otCoapBlockwiseTransmitHook,
6505 aReceiveHook: otCoapBlockwiseReceiveHook,
6506 ) -> otError;
6507}
6508unsafe extern "C" {
6509 #[doc = " Sends a CoAP request block-wise.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n If a response for a request is expected, respective function and context information should be provided.\n If the response is expected to be block-wise, a respective hook function should be provided.\n If no response is expected, these arguments should be NULL pointers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aHandler A function pointer that shall be called on response reception or timeout.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTransmitHook A pointer to a hook function for outgoing block-wise transfer.\n @param[in] aReceiveHook A pointer to a hook function for incoming block-wise transfer.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data."]
6510 pub fn otCoapSendRequestBlockWise(
6511 aInstance: *mut otInstance,
6512 aMessage: *mut otMessage,
6513 aMessageInfo: *const otMessageInfo,
6514 aHandler: otCoapResponseHandler,
6515 aContext: *mut ::std::os::raw::c_void,
6516 aTransmitHook: otCoapBlockwiseTransmitHook,
6517 aReceiveHook: otCoapBlockwiseReceiveHook,
6518 ) -> otError;
6519}
6520unsafe extern "C" {
6521 #[doc = " Sends a CoAP response block-wise from the server with custom transmission parameters.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aTxParameters A pointer to transmission parameters for this response. Use NULL for defaults.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTransmitHook A pointer to a hook function for outgoing block-wise transfer.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given."]
6522 pub fn otCoapSendResponseBlockWiseWithParameters(
6523 aInstance: *mut otInstance,
6524 aMessage: *mut otMessage,
6525 aMessageInfo: *const otMessageInfo,
6526 aTxParameters: *const otCoapTxParameters,
6527 aContext: *mut ::std::os::raw::c_void,
6528 aTransmitHook: otCoapBlockwiseTransmitHook,
6529 ) -> otError;
6530}
6531unsafe extern "C" {
6532 #[doc = " Sends a CoAP response block-wise from the server.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTransmitHook A pointer to a hook function for outgoing block-wise transfer.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response."]
6533 pub fn otCoapSendResponseBlockWise(
6534 aInstance: *mut otInstance,
6535 aMessage: *mut otMessage,
6536 aMessageInfo: *const otMessageInfo,
6537 aContext: *mut ::std::os::raw::c_void,
6538 aTransmitHook: otCoapBlockwiseTransmitHook,
6539 ) -> otError;
6540}
6541unsafe extern "C" {
6542 #[doc = " Sets the Token value and length in a CoAP message.\n\n @deprecated This function is deprecated. Use `otCoapMessageWriteToken()` instead.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aToken A pointer to the Token value.\n @param[in] aTokenLength The Length of @p aToken.\n\n @retval OT_ERROR_NONE Successfully set the Token value.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to set the Token value."]
6543 pub fn otCoapMessageSetToken(
6544 aMessage: *mut otMessage,
6545 aToken: *const u8,
6546 aTokenLength: u8,
6547 ) -> otError;
6548}
6549unsafe extern "C" {
6550 #[doc = " Returns the Token length.\n\n @deprecated This function is deprecated. Use `otCoapMessageReadToken()` instead.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Token length."]
6551 pub fn otCoapMessageGetTokenLength(aMessage: *const otMessage) -> u8;
6552}
6553unsafe extern "C" {
6554 #[doc = " Returns a pointer to the Token value.\n\n @deprecated This function is deprecated. Use `otCoapMessageReadToken()` instead.\n\n @note A previously returned pointer (`const uint8_t *`) will be invalidated upon the next call to this function.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns A pointer to the Token value."]
6555 pub fn otCoapMessageGetToken(aMessage: *const otMessage) -> *const u8;
6556}
6557#[doc = "< Connection established"]
6558pub const OT_COAP_SECURE_CONNECTED: otCoapSecureConnectEvent = 0;
6559#[doc = "< Disconnected by peer"]
6560pub const OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED: otCoapSecureConnectEvent = 1;
6561#[doc = "< Disconnected locally"]
6562pub const OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED: otCoapSecureConnectEvent = 2;
6563#[doc = "< Disconnected due to reaching the max connection attempts"]
6564pub const OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS: otCoapSecureConnectEvent = 3;
6565#[doc = "< Disconnected due to an error"]
6566pub const OT_COAP_SECURE_DISCONNECTED_ERROR: otCoapSecureConnectEvent = 4;
6567#[doc = "< Disconnected locally due to session timeout"]
6568pub const OT_COAP_SECURE_DISCONNECTED_TIMEOUT: otCoapSecureConnectEvent = 5;
6569#[doc = " CoAP secure connection event types."]
6570pub type otCoapSecureConnectEvent = ::std::os::raw::c_uint;
6571#[doc = " Pointer is called when the DTLS connection state changes.\n\n @param[in] aEvent The connection event.\n @param[in] aContext A pointer to arbitrary context information."]
6572pub type otHandleCoapSecureClientConnect = ::std::option::Option<
6573 unsafe extern "C" fn(aEvent: otCoapSecureConnectEvent, aContext: *mut ::std::os::raw::c_void),
6574>;
6575#[doc = " Callback function pointer to notify when the CoAP secure agent is automatically stopped due to reaching the maximum\n number of connection attempts.\n\n @param[in] aContext A pointer to arbitrary context information."]
6576pub type otCoapSecureAutoStopCallback =
6577 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
6578unsafe extern "C" {
6579 #[doc = " Starts the CoAP Secure service.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPort The local UDP port to bind to.\n\n @retval OT_ERROR_NONE Successfully started the CoAP Secure server."]
6580 pub fn otCoapSecureStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6581}
6582unsafe extern "C" {
6583 #[doc = " Starts the CoAP secure service and sets the maximum number of allowed connection attempts before stopping the\n agent automatically.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPort The local UDP port to bind to.\n @param[in] aMaxAttempts Maximum number of allowed connection request attempts. Zero indicates no limit.\n @param[in] aCallback Callback to notify if max number of attempts has reached and agent is stopped.\n @param[in] aContext A pointer to arbitrary context to use with @p aCallback.\n\n @retval OT_ERROR_NONE Successfully started the CoAP agent.\n @retval OT_ERROR_ALREADY Already started."]
6584 pub fn otCoapSecureStartWithMaxConnAttempts(
6585 aInstance: *mut otInstance,
6586 aPort: u16,
6587 aMaxAttempts: u16,
6588 aCallback: otCoapSecureAutoStopCallback,
6589 aContext: *mut ::std::os::raw::c_void,
6590 ) -> otError;
6591}
6592unsafe extern "C" {
6593 #[doc = " Stops the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6594 pub fn otCoapSecureStop(aInstance: *mut otInstance);
6595}
6596unsafe extern "C" {
6597 #[doc = " Sets the Pre-Shared Key (PSK) and cipher suite\n DTLS_PSK_WITH_AES_128_CCM_8.\n\n @note This function requires the build-time feature `MBEDTLS_KEY_EXCHANGE_PSK_ENABLED` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPsk A pointer to the PSK.\n @param[in] aPskLength The PSK length.\n @param[in] aPskIdentity The Identity Name for the PSK.\n @param[in] aPskIdLength The PSK Identity Length."]
6598 pub fn otCoapSecureSetPsk(
6599 aInstance: *mut otInstance,
6600 aPsk: *const u8,
6601 aPskLength: u16,
6602 aPskIdentity: *const u8,
6603 aPskIdLength: u16,
6604 );
6605}
6606unsafe extern "C" {
6607 #[doc = " Returns the peer x509 certificate base64 encoded.\n\n @note This function requires the build-time features `MBEDTLS_BASE64_C` and\n `MBEDTLS_SSL_KEEP_PEER_CERTIFICATE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPeerCert A pointer to the base64 encoded certificate buffer.\n @param[out] aCertLength The length of the base64 encoded peer certificate.\n @param[in] aCertBufferSize The buffer size of aPeerCert.\n\n @retval OT_ERROR_INVALID_STATE Not connected yet.\n @retval OT_ERROR_NONE Successfully get the peer certificate.\n @retval OT_ERROR_NO_BUFS Can't allocate memory for certificate."]
6608 pub fn otCoapSecureGetPeerCertificateBase64(
6609 aInstance: *mut otInstance,
6610 aPeerCert: *mut ::std::os::raw::c_uchar,
6611 aCertLength: *mut usize,
6612 aCertBufferSize: usize,
6613 ) -> otError;
6614}
6615unsafe extern "C" {
6616 #[doc = " Sets the authentication mode for the coap secure connection.\n\n Disable or enable the verification of peer certificate.\n Must be called before start.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVerifyPeerCertificate true, to verify the peer certificate."]
6617 pub fn otCoapSecureSetSslAuthMode(aInstance: *mut otInstance, aVerifyPeerCertificate: bool);
6618}
6619unsafe extern "C" {
6620 #[doc = " Sets the local device's X509 certificate with corresponding private key for\n DTLS session with DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8.\n\n @note This function requires `MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=1`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aX509Cert A pointer to the PEM formatted X509 certificate.\n @param[in] aX509Length The length of certificate.\n @param[in] aPrivateKey A pointer to the PEM formatted private key.\n @param[in] aPrivateKeyLength The length of the private key."]
6621 pub fn otCoapSecureSetCertificate(
6622 aInstance: *mut otInstance,
6623 aX509Cert: *const u8,
6624 aX509Length: u32,
6625 aPrivateKey: *const u8,
6626 aPrivateKeyLength: u32,
6627 );
6628}
6629unsafe extern "C" {
6630 #[doc = " Sets the trusted top level CAs. It is needed for validating the\n certificate of the peer.\n\n DTLS mode \"ECDHE ECDSA with AES 128 CCM 8\" for Application CoAPS.\n\n @note This function requires `MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=1`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aX509CaCertificateChain A pointer to the PEM formatted X509 CA chain.\n @param[in] aX509CaCertChainLength The length of chain."]
6631 pub fn otCoapSecureSetCaCertificateChain(
6632 aInstance: *mut otInstance,
6633 aX509CaCertificateChain: *const u8,
6634 aX509CaCertChainLength: u32,
6635 );
6636}
6637unsafe extern "C" {
6638 #[doc = " Initializes DTLS session with a peer.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSockAddr A pointer to the remote socket address.\n @param[in] aHandler A pointer to a function that will be called when the DTLS connection\n state changes.\n @param[in] aContext A pointer to arbitrary context information.\n\n @retval OT_ERROR_NONE Successfully started DTLS connection."]
6639 pub fn otCoapSecureConnect(
6640 aInstance: *mut otInstance,
6641 aSockAddr: *const otSockAddr,
6642 aHandler: otHandleCoapSecureClientConnect,
6643 aContext: *mut ::std::os::raw::c_void,
6644 ) -> otError;
6645}
6646unsafe extern "C" {
6647 #[doc = " Stops the DTLS connection.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6648 pub fn otCoapSecureDisconnect(aInstance: *mut otInstance);
6649}
6650unsafe extern "C" {
6651 #[doc = " Indicates whether or not the DTLS session is connected.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The DTLS session is connected.\n @retval FALSE The DTLS session is not connected."]
6652 pub fn otCoapSecureIsConnected(aInstance: *mut otInstance) -> bool;
6653}
6654unsafe extern "C" {
6655 #[doc = " Indicates whether or not the DTLS session is active.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If DTLS session is active.\n @retval FALSE If DTLS session is not active."]
6656 pub fn otCoapSecureIsConnectionActive(aInstance: *mut otInstance) -> bool;
6657}
6658unsafe extern "C" {
6659 #[doc = " Indicates whether or not the DTLS session is closed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The DTLS session is closed.\n @retval FALSE The DTLS session is not closed."]
6660 pub fn otCoapSecureIsClosed(aInstance: *mut otInstance) -> bool;
6661}
6662unsafe extern "C" {
6663 #[doc = " Sends a CoAP request block-wise over secure DTLS connection.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n If a response for a request is expected, respective function and context information should be provided.\n If no response is expected, these arguments should be NULL pointers.\n If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A reference to the message to send.\n @param[in] aHandler A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aTransmitHook A function pointer that is called on Block1 response reception.\n @param[in] aReceiveHook A function pointer that is called on Block2 response reception.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data.\n @retval OT_ERROR_INVALID_STATE DTLS connection was not initialized."]
6664 pub fn otCoapSecureSendRequestBlockWise(
6665 aInstance: *mut otInstance,
6666 aMessage: *mut otMessage,
6667 aHandler: otCoapResponseHandler,
6668 aContext: *mut ::std::os::raw::c_void,
6669 aTransmitHook: otCoapBlockwiseTransmitHook,
6670 aReceiveHook: otCoapBlockwiseReceiveHook,
6671 ) -> otError;
6672}
6673unsafe extern "C" {
6674 #[doc = " Sends a CoAP request over secure DTLS connection.\n\n If a response for a request is expected, respective function and context information should be provided.\n If no response is expected, these arguments should be NULL pointers.\n If Message Id was not set in the header (equal to 0), this function will assign unique Message Id to the message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A reference to the message to send.\n @param[in] aHandler A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n\n @retval OT_ERROR_NONE Successfully sent CoAP message.\n @retval OT_ERROR_NO_BUFS Failed to allocate retransmission data.\n @retval OT_ERROR_INVALID_STATE DTLS connection was not initialized."]
6675 pub fn otCoapSecureSendRequest(
6676 aInstance: *mut otInstance,
6677 aMessage: *mut otMessage,
6678 aHandler: otCoapResponseHandler,
6679 aContext: *mut ::std::os::raw::c_void,
6680 ) -> otError;
6681}
6682unsafe extern "C" {
6683 #[doc = " Adds a resource to the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6684 pub fn otCoapSecureAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6685}
6686unsafe extern "C" {
6687 #[doc = " Removes a resource from the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6688 pub fn otCoapSecureRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6689}
6690unsafe extern "C" {
6691 #[doc = " Adds a block-wise resource to the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6692 pub fn otCoapSecureAddBlockWiseResource(
6693 aInstance: *mut otInstance,
6694 aResource: *mut otCoapBlockwiseResource,
6695 );
6696}
6697unsafe extern "C" {
6698 #[doc = " Removes a block-wise resource from the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aResource A pointer to the resource."]
6699 pub fn otCoapSecureRemoveBlockWiseResource(
6700 aInstance: *mut otInstance,
6701 aResource: *mut otCoapBlockwiseResource,
6702 );
6703}
6704unsafe extern "C" {
6705 #[doc = " Sets the default handler for unhandled CoAP Secure requests.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHandler A function pointer that shall be called when an unhandled request arrives.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used."]
6706 pub fn otCoapSecureSetDefaultHandler(
6707 aInstance: *mut otInstance,
6708 aHandler: otCoapRequestHandler,
6709 aContext: *mut ::std::os::raw::c_void,
6710 );
6711}
6712unsafe extern "C" {
6713 #[doc = " Sets the connect event callback to indicate when\n a Client connection to the CoAP Secure server has changed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHandler A pointer to a function that will be called once DTLS connection has changed.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used."]
6714 pub fn otCoapSecureSetClientConnectEventCallback(
6715 aInstance: *mut otInstance,
6716 aHandler: otHandleCoapSecureClientConnect,
6717 aContext: *mut ::std::os::raw::c_void,
6718 );
6719}
6720unsafe extern "C" {
6721 #[doc = " Sends a CoAP response block-wise from the CoAP Secure server.\n\n Is available when OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE configuration\n is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n @param[in] aContext A pointer to arbitrary context information. May be NULL if not used.\n @param[in] aTransmitHook A function pointer that is called on Block1 request reception.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response."]
6722 pub fn otCoapSecureSendResponseBlockWise(
6723 aInstance: *mut otInstance,
6724 aMessage: *mut otMessage,
6725 aMessageInfo: *const otMessageInfo,
6726 aContext: *mut ::std::os::raw::c_void,
6727 aTransmitHook: otCoapBlockwiseTransmitHook,
6728 ) -> otError;
6729}
6730unsafe extern "C" {
6731 #[doc = " Sends a CoAP response from the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the CoAP response to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n\n @retval OT_ERROR_NONE Successfully enqueued the CoAP response message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers available to send the CoAP response."]
6732 pub fn otCoapSecureSendResponse(
6733 aInstance: *mut otInstance,
6734 aMessage: *mut otMessage,
6735 aMessageInfo: *const otMessageInfo,
6736 ) -> otError;
6737}
6738#[doc = " @struct otNetworkKey\n\n Represents a Thread Network Key."]
6739#[repr(C, packed)]
6740#[derive(Debug, Default, Copy, Clone)]
6741pub struct otNetworkKey {
6742 #[doc = "< Byte values"]
6743 pub m8: [u8; 16usize],
6744}
6745#[doc = " This datatype represents KeyRef to NetworkKey."]
6746pub type otNetworkKeyRef = otCryptoKeyRef;
6747#[doc = " Represents a Network Name.\n\n The `otNetworkName` is a null terminated C string (i.e., `m8` char array MUST end with null char `\\0`)."]
6748#[repr(C)]
6749#[derive(Debug, Default, Copy, Clone)]
6750pub struct otNetworkName {
6751 #[doc = "< Byte values. The `+ 1` is for null char."]
6752 pub m8: [::std::os::raw::c_char; 17usize],
6753}
6754#[doc = " Represents an Extended PAN ID."]
6755#[repr(C, packed)]
6756#[derive(Debug, Default, Copy, Clone)]
6757pub struct otExtendedPanId {
6758 #[doc = "< Byte values"]
6759 pub m8: [u8; 8usize],
6760}
6761#[doc = " Represents a Mesh Local Prefix."]
6762pub type otMeshLocalPrefix = otIp6NetworkPrefix;
6763#[doc = " Represents PSKc."]
6764#[repr(C, packed)]
6765#[derive(Debug, Default, Copy, Clone)]
6766pub struct otPskc {
6767 #[doc = "< Byte values"]
6768 pub m8: [u8; 16usize],
6769}
6770#[doc = " This datatype represents KeyRef to PSKc."]
6771pub type otPskcRef = otCryptoKeyRef;
6772#[doc = " Represent Security Policy."]
6773#[repr(C)]
6774#[derive(Debug, Default, Copy, Clone)]
6775pub struct otSecurityPolicy {
6776 #[doc = "< The value for thrKeyRotation in units of hours."]
6777 pub mRotationTime: u16,
6778 pub _bitfield_align_1: [u8; 0],
6779 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
6780}
6781impl otSecurityPolicy {
6782 #[inline]
6783 pub fn mObtainNetworkKeyEnabled(&self) -> bool {
6784 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
6785 }
6786 #[inline]
6787 pub fn set_mObtainNetworkKeyEnabled(&mut self, val: bool) {
6788 unsafe {
6789 let val: u8 = ::std::mem::transmute(val);
6790 self._bitfield_1.set(0usize, 1u8, val as u64)
6791 }
6792 }
6793 #[inline]
6794 pub unsafe fn mObtainNetworkKeyEnabled_raw(this: *const Self) -> bool {
6795 unsafe {
6796 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6797 ::std::ptr::addr_of!((*this)._bitfield_1),
6798 0usize,
6799 1u8,
6800 ) as u8)
6801 }
6802 }
6803 #[inline]
6804 pub unsafe fn set_mObtainNetworkKeyEnabled_raw(this: *mut Self, val: bool) {
6805 unsafe {
6806 let val: u8 = ::std::mem::transmute(val);
6807 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6808 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6809 0usize,
6810 1u8,
6811 val as u64,
6812 )
6813 }
6814 }
6815 #[inline]
6816 pub fn mNativeCommissioningEnabled(&self) -> bool {
6817 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
6818 }
6819 #[inline]
6820 pub fn set_mNativeCommissioningEnabled(&mut self, val: bool) {
6821 unsafe {
6822 let val: u8 = ::std::mem::transmute(val);
6823 self._bitfield_1.set(1usize, 1u8, val as u64)
6824 }
6825 }
6826 #[inline]
6827 pub unsafe fn mNativeCommissioningEnabled_raw(this: *const Self) -> bool {
6828 unsafe {
6829 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6830 ::std::ptr::addr_of!((*this)._bitfield_1),
6831 1usize,
6832 1u8,
6833 ) as u8)
6834 }
6835 }
6836 #[inline]
6837 pub unsafe fn set_mNativeCommissioningEnabled_raw(this: *mut Self, val: bool) {
6838 unsafe {
6839 let val: u8 = ::std::mem::transmute(val);
6840 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6841 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6842 1usize,
6843 1u8,
6844 val as u64,
6845 )
6846 }
6847 }
6848 #[inline]
6849 pub fn mRoutersEnabled(&self) -> bool {
6850 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
6851 }
6852 #[inline]
6853 pub fn set_mRoutersEnabled(&mut self, val: bool) {
6854 unsafe {
6855 let val: u8 = ::std::mem::transmute(val);
6856 self._bitfield_1.set(2usize, 1u8, val as u64)
6857 }
6858 }
6859 #[inline]
6860 pub unsafe fn mRoutersEnabled_raw(this: *const Self) -> bool {
6861 unsafe {
6862 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6863 ::std::ptr::addr_of!((*this)._bitfield_1),
6864 2usize,
6865 1u8,
6866 ) as u8)
6867 }
6868 }
6869 #[inline]
6870 pub unsafe fn set_mRoutersEnabled_raw(this: *mut Self, val: bool) {
6871 unsafe {
6872 let val: u8 = ::std::mem::transmute(val);
6873 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6874 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6875 2usize,
6876 1u8,
6877 val as u64,
6878 )
6879 }
6880 }
6881 #[inline]
6882 pub fn mExternalCommissioningEnabled(&self) -> bool {
6883 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
6884 }
6885 #[inline]
6886 pub fn set_mExternalCommissioningEnabled(&mut self, val: bool) {
6887 unsafe {
6888 let val: u8 = ::std::mem::transmute(val);
6889 self._bitfield_1.set(3usize, 1u8, val as u64)
6890 }
6891 }
6892 #[inline]
6893 pub unsafe fn mExternalCommissioningEnabled_raw(this: *const Self) -> bool {
6894 unsafe {
6895 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6896 ::std::ptr::addr_of!((*this)._bitfield_1),
6897 3usize,
6898 1u8,
6899 ) as u8)
6900 }
6901 }
6902 #[inline]
6903 pub unsafe fn set_mExternalCommissioningEnabled_raw(this: *mut Self, val: bool) {
6904 unsafe {
6905 let val: u8 = ::std::mem::transmute(val);
6906 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6907 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6908 3usize,
6909 1u8,
6910 val as u64,
6911 )
6912 }
6913 }
6914 #[inline]
6915 pub fn mCommercialCommissioningEnabled(&self) -> bool {
6916 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
6917 }
6918 #[inline]
6919 pub fn set_mCommercialCommissioningEnabled(&mut self, val: bool) {
6920 unsafe {
6921 let val: u8 = ::std::mem::transmute(val);
6922 self._bitfield_1.set(4usize, 1u8, val as u64)
6923 }
6924 }
6925 #[inline]
6926 pub unsafe fn mCommercialCommissioningEnabled_raw(this: *const Self) -> bool {
6927 unsafe {
6928 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6929 ::std::ptr::addr_of!((*this)._bitfield_1),
6930 4usize,
6931 1u8,
6932 ) as u8)
6933 }
6934 }
6935 #[inline]
6936 pub unsafe fn set_mCommercialCommissioningEnabled_raw(this: *mut Self, val: bool) {
6937 unsafe {
6938 let val: u8 = ::std::mem::transmute(val);
6939 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6940 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6941 4usize,
6942 1u8,
6943 val as u64,
6944 )
6945 }
6946 }
6947 #[inline]
6948 pub fn mAutonomousEnrollmentEnabled(&self) -> bool {
6949 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
6950 }
6951 #[inline]
6952 pub fn set_mAutonomousEnrollmentEnabled(&mut self, val: bool) {
6953 unsafe {
6954 let val: u8 = ::std::mem::transmute(val);
6955 self._bitfield_1.set(5usize, 1u8, val as u64)
6956 }
6957 }
6958 #[inline]
6959 pub unsafe fn mAutonomousEnrollmentEnabled_raw(this: *const Self) -> bool {
6960 unsafe {
6961 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6962 ::std::ptr::addr_of!((*this)._bitfield_1),
6963 5usize,
6964 1u8,
6965 ) as u8)
6966 }
6967 }
6968 #[inline]
6969 pub unsafe fn set_mAutonomousEnrollmentEnabled_raw(this: *mut Self, val: bool) {
6970 unsafe {
6971 let val: u8 = ::std::mem::transmute(val);
6972 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6973 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6974 5usize,
6975 1u8,
6976 val as u64,
6977 )
6978 }
6979 }
6980 #[inline]
6981 pub fn mNetworkKeyProvisioningEnabled(&self) -> bool {
6982 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
6983 }
6984 #[inline]
6985 pub fn set_mNetworkKeyProvisioningEnabled(&mut self, val: bool) {
6986 unsafe {
6987 let val: u8 = ::std::mem::transmute(val);
6988 self._bitfield_1.set(6usize, 1u8, val as u64)
6989 }
6990 }
6991 #[inline]
6992 pub unsafe fn mNetworkKeyProvisioningEnabled_raw(this: *const Self) -> bool {
6993 unsafe {
6994 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6995 ::std::ptr::addr_of!((*this)._bitfield_1),
6996 6usize,
6997 1u8,
6998 ) as u8)
6999 }
7000 }
7001 #[inline]
7002 pub unsafe fn set_mNetworkKeyProvisioningEnabled_raw(this: *mut Self, val: bool) {
7003 unsafe {
7004 let val: u8 = ::std::mem::transmute(val);
7005 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7006 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7007 6usize,
7008 1u8,
7009 val as u64,
7010 )
7011 }
7012 }
7013 #[inline]
7014 pub fn mTobleLinkEnabled(&self) -> bool {
7015 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
7016 }
7017 #[inline]
7018 pub fn set_mTobleLinkEnabled(&mut self, val: bool) {
7019 unsafe {
7020 let val: u8 = ::std::mem::transmute(val);
7021 self._bitfield_1.set(7usize, 1u8, val as u64)
7022 }
7023 }
7024 #[inline]
7025 pub unsafe fn mTobleLinkEnabled_raw(this: *const Self) -> bool {
7026 unsafe {
7027 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7028 ::std::ptr::addr_of!((*this)._bitfield_1),
7029 7usize,
7030 1u8,
7031 ) as u8)
7032 }
7033 }
7034 #[inline]
7035 pub unsafe fn set_mTobleLinkEnabled_raw(this: *mut Self, val: bool) {
7036 unsafe {
7037 let val: u8 = ::std::mem::transmute(val);
7038 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7039 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7040 7usize,
7041 1u8,
7042 val as u64,
7043 )
7044 }
7045 }
7046 #[inline]
7047 pub fn mNonCcmRoutersEnabled(&self) -> bool {
7048 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
7049 }
7050 #[inline]
7051 pub fn set_mNonCcmRoutersEnabled(&mut self, val: bool) {
7052 unsafe {
7053 let val: u8 = ::std::mem::transmute(val);
7054 self._bitfield_1.set(8usize, 1u8, val as u64)
7055 }
7056 }
7057 #[inline]
7058 pub unsafe fn mNonCcmRoutersEnabled_raw(this: *const Self) -> bool {
7059 unsafe {
7060 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7061 ::std::ptr::addr_of!((*this)._bitfield_1),
7062 8usize,
7063 1u8,
7064 ) as u8)
7065 }
7066 }
7067 #[inline]
7068 pub unsafe fn set_mNonCcmRoutersEnabled_raw(this: *mut Self, val: bool) {
7069 unsafe {
7070 let val: u8 = ::std::mem::transmute(val);
7071 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7072 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7073 8usize,
7074 1u8,
7075 val as u64,
7076 )
7077 }
7078 }
7079 #[inline]
7080 pub fn mVersionThresholdForRouting(&self) -> u8 {
7081 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 3u8) as u8) }
7082 }
7083 #[inline]
7084 pub fn set_mVersionThresholdForRouting(&mut self, val: u8) {
7085 unsafe {
7086 let val: u8 = ::std::mem::transmute(val);
7087 self._bitfield_1.set(9usize, 3u8, val as u64)
7088 }
7089 }
7090 #[inline]
7091 pub unsafe fn mVersionThresholdForRouting_raw(this: *const Self) -> u8 {
7092 unsafe {
7093 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7094 ::std::ptr::addr_of!((*this)._bitfield_1),
7095 9usize,
7096 3u8,
7097 ) as u8)
7098 }
7099 }
7100 #[inline]
7101 pub unsafe fn set_mVersionThresholdForRouting_raw(this: *mut Self, val: u8) {
7102 unsafe {
7103 let val: u8 = ::std::mem::transmute(val);
7104 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7105 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7106 9usize,
7107 3u8,
7108 val as u64,
7109 )
7110 }
7111 }
7112 #[inline]
7113 pub fn new_bitfield_1(
7114 mObtainNetworkKeyEnabled: bool,
7115 mNativeCommissioningEnabled: bool,
7116 mRoutersEnabled: bool,
7117 mExternalCommissioningEnabled: bool,
7118 mCommercialCommissioningEnabled: bool,
7119 mAutonomousEnrollmentEnabled: bool,
7120 mNetworkKeyProvisioningEnabled: bool,
7121 mTobleLinkEnabled: bool,
7122 mNonCcmRoutersEnabled: bool,
7123 mVersionThresholdForRouting: u8,
7124 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
7125 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
7126 __bindgen_bitfield_unit.set(0usize, 1u8, {
7127 let mObtainNetworkKeyEnabled: u8 =
7128 unsafe { ::std::mem::transmute(mObtainNetworkKeyEnabled) };
7129 mObtainNetworkKeyEnabled as u64
7130 });
7131 __bindgen_bitfield_unit.set(1usize, 1u8, {
7132 let mNativeCommissioningEnabled: u8 =
7133 unsafe { ::std::mem::transmute(mNativeCommissioningEnabled) };
7134 mNativeCommissioningEnabled as u64
7135 });
7136 __bindgen_bitfield_unit.set(2usize, 1u8, {
7137 let mRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mRoutersEnabled) };
7138 mRoutersEnabled as u64
7139 });
7140 __bindgen_bitfield_unit.set(3usize, 1u8, {
7141 let mExternalCommissioningEnabled: u8 =
7142 unsafe { ::std::mem::transmute(mExternalCommissioningEnabled) };
7143 mExternalCommissioningEnabled as u64
7144 });
7145 __bindgen_bitfield_unit.set(4usize, 1u8, {
7146 let mCommercialCommissioningEnabled: u8 =
7147 unsafe { ::std::mem::transmute(mCommercialCommissioningEnabled) };
7148 mCommercialCommissioningEnabled as u64
7149 });
7150 __bindgen_bitfield_unit.set(5usize, 1u8, {
7151 let mAutonomousEnrollmentEnabled: u8 =
7152 unsafe { ::std::mem::transmute(mAutonomousEnrollmentEnabled) };
7153 mAutonomousEnrollmentEnabled as u64
7154 });
7155 __bindgen_bitfield_unit.set(6usize, 1u8, {
7156 let mNetworkKeyProvisioningEnabled: u8 =
7157 unsafe { ::std::mem::transmute(mNetworkKeyProvisioningEnabled) };
7158 mNetworkKeyProvisioningEnabled as u64
7159 });
7160 __bindgen_bitfield_unit.set(7usize, 1u8, {
7161 let mTobleLinkEnabled: u8 = unsafe { ::std::mem::transmute(mTobleLinkEnabled) };
7162 mTobleLinkEnabled as u64
7163 });
7164 __bindgen_bitfield_unit.set(8usize, 1u8, {
7165 let mNonCcmRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mNonCcmRoutersEnabled) };
7166 mNonCcmRoutersEnabled as u64
7167 });
7168 __bindgen_bitfield_unit.set(9usize, 3u8, {
7169 let mVersionThresholdForRouting: u8 =
7170 unsafe { ::std::mem::transmute(mVersionThresholdForRouting) };
7171 mVersionThresholdForRouting as u64
7172 });
7173 __bindgen_bitfield_unit
7174 }
7175}
7176#[doc = " Represents a Channel Mask.\n\n The least significant bit (LSB), also referred to as bit 0, corresponds to channel number 0, and so on."]
7177pub type otChannelMask = u32;
7178#[doc = " Represents presence of different components in Active or Pending Operational Dataset."]
7179#[repr(C)]
7180#[derive(Debug, Default, Copy, Clone)]
7181pub struct otOperationalDatasetComponents {
7182 #[doc = "< TRUE if Active Timestamp is present, FALSE otherwise."]
7183 pub mIsActiveTimestampPresent: bool,
7184 #[doc = "< TRUE if Pending Timestamp is present, FALSE otherwise."]
7185 pub mIsPendingTimestampPresent: bool,
7186 #[doc = "< TRUE if Network Key is present, FALSE otherwise."]
7187 pub mIsNetworkKeyPresent: bool,
7188 #[doc = "< TRUE if Network Name is present, FALSE otherwise."]
7189 pub mIsNetworkNamePresent: bool,
7190 #[doc = "< TRUE if Extended PAN ID is present, FALSE otherwise."]
7191 pub mIsExtendedPanIdPresent: bool,
7192 #[doc = "< TRUE if Mesh Local Prefix is present, FALSE otherwise."]
7193 pub mIsMeshLocalPrefixPresent: bool,
7194 #[doc = "< TRUE if Delay Timer is present, FALSE otherwise."]
7195 pub mIsDelayPresent: bool,
7196 #[doc = "< TRUE if PAN ID is present, FALSE otherwise."]
7197 pub mIsPanIdPresent: bool,
7198 #[doc = "< TRUE if Channel is present, FALSE otherwise."]
7199 pub mIsChannelPresent: bool,
7200 #[doc = "< TRUE if PSKc is present, FALSE otherwise."]
7201 pub mIsPskcPresent: bool,
7202 #[doc = "< TRUE if Security Policy is present, FALSE otherwise."]
7203 pub mIsSecurityPolicyPresent: bool,
7204 #[doc = "< TRUE if Channel Mask is present, FALSE otherwise."]
7205 pub mIsChannelMaskPresent: bool,
7206 #[doc = "< TRUE if Wake-up Channel is present, FALSE otherwise."]
7207 pub mIsWakeupChannelPresent: bool,
7208}
7209#[doc = " Represents a Thread Dataset timestamp component."]
7210#[repr(C)]
7211#[derive(Debug, Default, Copy, Clone)]
7212pub struct otTimestamp {
7213 pub mSeconds: u64,
7214 pub mTicks: u16,
7215 pub mAuthoritative: bool,
7216}
7217#[doc = " Represents an Active or Pending Operational Dataset.\n\n Components in Dataset are optional. `mComponents` structure specifies which components are present in the Dataset."]
7218#[repr(C)]
7219#[derive(Debug, Default, Copy, Clone)]
7220pub struct otOperationalDataset {
7221 #[doc = "< Active Timestamp"]
7222 pub mActiveTimestamp: otTimestamp,
7223 #[doc = "< Pending Timestamp"]
7224 pub mPendingTimestamp: otTimestamp,
7225 #[doc = "< Network Key"]
7226 pub mNetworkKey: otNetworkKey,
7227 #[doc = "< Network Name"]
7228 pub mNetworkName: otNetworkName,
7229 #[doc = "< Extended PAN ID"]
7230 pub mExtendedPanId: otExtendedPanId,
7231 #[doc = "< Mesh Local Prefix"]
7232 pub mMeshLocalPrefix: otMeshLocalPrefix,
7233 #[doc = "< Delay Timer"]
7234 pub mDelay: u32,
7235 #[doc = "< PAN ID"]
7236 pub mPanId: otPanId,
7237 #[doc = "< Channel"]
7238 pub mChannel: u16,
7239 #[doc = "< Wake-up Channel"]
7240 pub mWakeupChannel: u16,
7241 #[doc = "< PSKc"]
7242 pub mPskc: otPskc,
7243 #[doc = "< Security Policy"]
7244 pub mSecurityPolicy: otSecurityPolicy,
7245 #[doc = "< Channel Mask"]
7246 pub mChannelMask: otChannelMask,
7247 #[doc = "< Specifies which components are set in the Dataset."]
7248 pub mComponents: otOperationalDatasetComponents,
7249}
7250#[doc = " Represents an Active or Pending Operational Dataset.\n\n The Operational Dataset is TLV encoded as specified by Thread."]
7251#[repr(C)]
7252#[derive(Debug, Copy, Clone)]
7253pub struct otOperationalDatasetTlvs {
7254 #[doc = "< Operational Dataset TLVs."]
7255 pub mTlvs: [u8; 254usize],
7256 #[doc = "< Size of Operational Dataset in bytes."]
7257 pub mLength: u8,
7258}
7259impl Default for otOperationalDatasetTlvs {
7260 fn default() -> Self {
7261 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7262 unsafe {
7263 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7264 s.assume_init()
7265 }
7266 }
7267}
7268#[doc = "< meshcop Channel TLV"]
7269pub const OT_MESHCOP_TLV_CHANNEL: otMeshcopTlvType = 0;
7270#[doc = "< meshcop Pan Id TLV"]
7271pub const OT_MESHCOP_TLV_PANID: otMeshcopTlvType = 1;
7272#[doc = "< meshcop Extended Pan Id TLV"]
7273pub const OT_MESHCOP_TLV_EXTPANID: otMeshcopTlvType = 2;
7274#[doc = "< meshcop Network Name TLV"]
7275pub const OT_MESHCOP_TLV_NETWORKNAME: otMeshcopTlvType = 3;
7276#[doc = "< meshcop PSKc TLV"]
7277pub const OT_MESHCOP_TLV_PSKC: otMeshcopTlvType = 4;
7278#[doc = "< meshcop Network Key TLV"]
7279pub const OT_MESHCOP_TLV_NETWORKKEY: otMeshcopTlvType = 5;
7280#[doc = "< meshcop Network Key Sequence TLV"]
7281pub const OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE: otMeshcopTlvType = 6;
7282#[doc = "< meshcop Mesh Local Prefix TLV"]
7283pub const OT_MESHCOP_TLV_MESHLOCALPREFIX: otMeshcopTlvType = 7;
7284#[doc = "< meshcop Steering Data TLV"]
7285pub const OT_MESHCOP_TLV_STEERING_DATA: otMeshcopTlvType = 8;
7286#[doc = "< meshcop Border Agent Locator TLV"]
7287pub const OT_MESHCOP_TLV_BORDER_AGENT_RLOC: otMeshcopTlvType = 9;
7288#[doc = "< meshcop Commissioner ID TLV"]
7289pub const OT_MESHCOP_TLV_COMMISSIONER_ID: otMeshcopTlvType = 10;
7290#[doc = "< meshcop Commissioner Session ID TLV"]
7291pub const OT_MESHCOP_TLV_COMM_SESSION_ID: otMeshcopTlvType = 11;
7292#[doc = "< meshcop Security Policy TLV"]
7293pub const OT_MESHCOP_TLV_SECURITYPOLICY: otMeshcopTlvType = 12;
7294#[doc = "< meshcop Get TLV"]
7295pub const OT_MESHCOP_TLV_GET: otMeshcopTlvType = 13;
7296#[doc = "< meshcop Active Timestamp TLV"]
7297pub const OT_MESHCOP_TLV_ACTIVETIMESTAMP: otMeshcopTlvType = 14;
7298#[doc = "< meshcop Commissioner UDP Port TLV"]
7299pub const OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT: otMeshcopTlvType = 15;
7300#[doc = "< meshcop State TLV"]
7301pub const OT_MESHCOP_TLV_STATE: otMeshcopTlvType = 16;
7302#[doc = "< meshcop Joiner DTLS Encapsulation TLV"]
7303pub const OT_MESHCOP_TLV_JOINER_DTLS: otMeshcopTlvType = 17;
7304#[doc = "< meshcop Joiner UDP Port TLV"]
7305pub const OT_MESHCOP_TLV_JOINER_UDP_PORT: otMeshcopTlvType = 18;
7306#[doc = "< meshcop Joiner IID TLV"]
7307pub const OT_MESHCOP_TLV_JOINER_IID: otMeshcopTlvType = 19;
7308#[doc = "< meshcop Joiner Router Locator TLV"]
7309pub const OT_MESHCOP_TLV_JOINER_RLOC: otMeshcopTlvType = 20;
7310#[doc = "< meshcop Joiner Router KEK TLV"]
7311pub const OT_MESHCOP_TLV_JOINER_ROUTER_KEK: otMeshcopTlvType = 21;
7312#[doc = "< meshcop Duration TLV"]
7313pub const OT_MESHCOP_TLV_DURATION: otMeshcopTlvType = 23;
7314#[doc = "< meshcop Provisioning URL TLV"]
7315pub const OT_MESHCOP_TLV_PROVISIONING_URL: otMeshcopTlvType = 32;
7316#[doc = "< meshcop Vendor Name TLV"]
7317pub const OT_MESHCOP_TLV_VENDOR_NAME_TLV: otMeshcopTlvType = 33;
7318#[doc = "< meshcop Vendor Model TLV"]
7319pub const OT_MESHCOP_TLV_VENDOR_MODEL_TLV: otMeshcopTlvType = 34;
7320#[doc = "< meshcop Vendor SW Version TLV"]
7321pub const OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV: otMeshcopTlvType = 35;
7322#[doc = "< meshcop Vendor Data TLV"]
7323pub const OT_MESHCOP_TLV_VENDOR_DATA_TLV: otMeshcopTlvType = 36;
7324#[doc = "< meshcop Vendor Stack Version TLV"]
7325pub const OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV: otMeshcopTlvType = 37;
7326#[doc = "< meshcop UDP encapsulation TLV"]
7327pub const OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV: otMeshcopTlvType = 48;
7328#[doc = "< meshcop IPv6 address TLV"]
7329pub const OT_MESHCOP_TLV_IPV6_ADDRESS_TLV: otMeshcopTlvType = 49;
7330#[doc = "< meshcop Pending Timestamp TLV"]
7331pub const OT_MESHCOP_TLV_PENDINGTIMESTAMP: otMeshcopTlvType = 51;
7332#[doc = "< meshcop Delay Timer TLV"]
7333pub const OT_MESHCOP_TLV_DELAYTIMER: otMeshcopTlvType = 52;
7334#[doc = "< meshcop Channel Mask TLV"]
7335pub const OT_MESHCOP_TLV_CHANNELMASK: otMeshcopTlvType = 53;
7336#[doc = "< meshcop Count TLV"]
7337pub const OT_MESHCOP_TLV_COUNT: otMeshcopTlvType = 54;
7338#[doc = "< meshcop Period TLV"]
7339pub const OT_MESHCOP_TLV_PERIOD: otMeshcopTlvType = 55;
7340#[doc = "< meshcop Scan Duration TLV"]
7341pub const OT_MESHCOP_TLV_SCAN_DURATION: otMeshcopTlvType = 56;
7342#[doc = "< meshcop Energy List TLV"]
7343pub const OT_MESHCOP_TLV_ENERGY_LIST: otMeshcopTlvType = 57;
7344#[doc = "< meshcop Thread Domain Name TLV"]
7345pub const OT_MESHCOP_TLV_THREAD_DOMAIN_NAME: otMeshcopTlvType = 59;
7346#[doc = "< meshcop Wake-up Channel TLV"]
7347pub const OT_MESHCOP_TLV_WAKEUP_CHANNEL: otMeshcopTlvType = 74;
7348#[doc = "< meshcop Admitter State TLV"]
7349pub const OT_MESHCOP_TLV_ADMITTER_STATE: otMeshcopTlvType = 90;
7350#[doc = "< meshcop Enroller ID TLV"]
7351pub const OT_MESHCOP_TLV_ENROLLER_ID: otMeshcopTlvType = 91;
7352#[doc = "< meshcop Enroller Mode TLV"]
7353pub const OT_MESHCOP_TLV_ENROLLER_MODE: otMeshcopTlvType = 92;
7354#[doc = "< meshcop Discovery Request TLV"]
7355pub const OT_MESHCOP_TLV_DISCOVERYREQUEST: otMeshcopTlvType = 128;
7356#[doc = "< meshcop Discovery Response TLV"]
7357pub const OT_MESHCOP_TLV_DISCOVERYRESPONSE: otMeshcopTlvType = 129;
7358#[doc = "< meshcop Joiner Advertisement TLV (experimental)"]
7359pub const OT_MESHCOP_TLV_JOINERADVERTISEMENT: otMeshcopTlvType = 241;
7360#[doc = " Represents meshcop TLV types."]
7361pub type otMeshcopTlvType = ::std::os::raw::c_uint;
7362#[doc = " Pointer is called when a response to a MGMT_SET request is received or times out.\n\n @param[in] aResult A result of the operation.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE The request was accepted by the leader.\n @retval OT_ERROR_REJECTED The request was rejected by the leader.\n @retval OT_ERROR_PARSE An error occurred during parsing the response.\n @retval OT_ERROR_ABORT The request was reset by peer.\n @retval OT_ERROR_RESPONSE_TIMEOUT No response or acknowledgment received during timeout period."]
7363pub type otDatasetMgmtSetCallback = ::std::option::Option<
7364 unsafe extern "C" fn(aResult: otError, aContext: *mut ::std::os::raw::c_void),
7365>;
7366unsafe extern "C" {
7367 #[doc = " Indicates whether a valid network is present in the Active Operational Dataset or not.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if a valid network is present in the Active Operational Dataset, FALSE otherwise."]
7368 pub fn otDatasetIsCommissioned(aInstance: *mut otInstance) -> bool;
7369}
7370unsafe extern "C" {
7371 #[doc = " Gets the Active Operational Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aDataset A pointer to where the Active Operational Dataset will be placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the Active Operational Dataset.\n @retval OT_ERROR_NOT_FOUND No corresponding value in the setting store."]
7372 pub fn otDatasetGetActive(
7373 aInstance: *mut otInstance,
7374 aDataset: *mut otOperationalDataset,
7375 ) -> otError;
7376}
7377unsafe extern "C" {
7378 #[doc = " Gets the Active Operational Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aDataset A pointer to where the Active Operational Dataset will be placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the Active Operational Dataset.\n @retval OT_ERROR_NOT_FOUND No corresponding value in the setting store."]
7379 pub fn otDatasetGetActiveTlvs(
7380 aInstance: *mut otInstance,
7381 aDataset: *mut otOperationalDatasetTlvs,
7382 ) -> otError;
7383}
7384unsafe extern "C" {
7385 #[doc = " Sets the Active Operational Dataset.\n\n If the dataset does not include an Active Timestamp, the dataset is only partially complete.\n\n If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to\n an existing Thread network using any existing information in the dataset. Only the Thread Network Key is needed to\n attach to a network.\n\n If channel is not included in the dataset, the device will send MLE Announce messages across different channels to\n find neighbors on other channels.\n\n If the device successfully attaches to a Thread network, the device will then retrieve the full Active Dataset from\n its Parent. Note that a router-capable device will not transition to the Router or Leader roles until it has a\n complete Active Dataset.\n\n This function consistently returns `OT_ERROR_NONE` and can effectively be treated as having a `void` return type.\n Previously, other errors (e.g., `OT_ERROR_NOT_IMPLEMENTED`) were allowed for legacy reasons. However, as\n non-volatile storage is now mandatory for Thread operation, any failure to save the dataset will trigger an\n assertion. The `otError` return type is retained for backward compatibility.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to the Active Operational Dataset.\n\n @retval OT_ERROR_NONE Successfully set the Active Operational Dataset."]
7386 pub fn otDatasetSetActive(
7387 aInstance: *mut otInstance,
7388 aDataset: *const otOperationalDataset,
7389 ) -> otError;
7390}
7391unsafe extern "C" {
7392 #[doc = " Sets the Active Operational Dataset.\n\n If the dataset does not include an Active Timestamp, the dataset is only partially complete.\n\n If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to\n an existing Thread network using any existing information in the dataset. Only the Thread Network Key is needed to\n attach to a network.\n\n If channel is not included in the dataset, the device will send MLE Announce messages across different channels to\n find neighbors on other channels.\n\n If the device successfully attaches to a Thread network, the device will then retrieve the full Active Dataset from\n its Parent. Note that a router-capable device will not transition to the Router or Leader roles until it has a\n complete Active Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to the Active Operational Dataset.\n\n @retval OT_ERROR_NONE Successfully set the Active Operational Dataset.\n @retval OT_ERROR_INVALID_ARGS The @p aDataset is invalid. It is too long or contains incorrect TLV formatting."]
7393 pub fn otDatasetSetActiveTlvs(
7394 aInstance: *mut otInstance,
7395 aDataset: *const otOperationalDatasetTlvs,
7396 ) -> otError;
7397}
7398unsafe extern "C" {
7399 #[doc = " Gets the Pending Operational Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aDataset A pointer to where the Pending Operational Dataset will be placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the Pending Operational Dataset.\n @retval OT_ERROR_NOT_FOUND No corresponding value in the setting store."]
7400 pub fn otDatasetGetPending(
7401 aInstance: *mut otInstance,
7402 aDataset: *mut otOperationalDataset,
7403 ) -> otError;
7404}
7405unsafe extern "C" {
7406 #[doc = " Gets the Pending Operational Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aDataset A pointer to where the Pending Operational Dataset will be placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the Pending Operational Dataset.\n @retval OT_ERROR_NOT_FOUND No corresponding value in the setting store."]
7407 pub fn otDatasetGetPendingTlvs(
7408 aInstance: *mut otInstance,
7409 aDataset: *mut otOperationalDatasetTlvs,
7410 ) -> otError;
7411}
7412unsafe extern "C" {
7413 #[doc = " Sets the Pending Operational Dataset.\n\n This function consistently returns `OT_ERROR_NONE` and can effectively be treated as having a `void` return type.\n Previously, other errors (e.g., `OT_ERROR_NOT_IMPLEMENTED`) were allowed for legacy reasons. However, as\n non-volatile storage is now mandatory for Thread operation, any failure to save the dataset will trigger an\n assertion. The `otError` return type is retained for backward compatibility.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to the Pending Operational Dataset.\n\n @retval OT_ERROR_NONE Successfully set the Pending Operational Dataset."]
7414 pub fn otDatasetSetPending(
7415 aInstance: *mut otInstance,
7416 aDataset: *const otOperationalDataset,
7417 ) -> otError;
7418}
7419unsafe extern "C" {
7420 #[doc = " Sets the Pending Operational Dataset.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to the Pending Operational Dataset.\n\n @retval OT_ERROR_NONE Successfully set the Pending Operational Dataset.\n @retval OT_ERROR_INVALID_ARGS The @p aDataset is invalid. It is too long or contains incorrect TLV formatting."]
7421 pub fn otDatasetSetPendingTlvs(
7422 aInstance: *mut otInstance,
7423 aDataset: *const otOperationalDatasetTlvs,
7424 ) -> otError;
7425}
7426unsafe extern "C" {
7427 #[doc = " Sends MGMT_ACTIVE_GET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.\n @param[in] aTlvTypes A pointer to array containing additional raw TLV types to be requested.\n @param[in] aLength The length of @p aTlvTypes.\n @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send."]
7428 pub fn otDatasetSendMgmtActiveGet(
7429 aInstance: *mut otInstance,
7430 aDatasetComponents: *const otOperationalDatasetComponents,
7431 aTlvTypes: *const u8,
7432 aLength: u8,
7433 aAddress: *const otIp6Address,
7434 ) -> otError;
7435}
7436unsafe extern "C" {
7437 #[doc = " Sends MGMT_ACTIVE_SET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to operational dataset.\n @param[in] aTlvs A pointer to TLVs.\n @param[in] aLength The length of TLVs.\n @param[in] aCallback A pointer to a function that is called on response reception or timeout.\n @param[in] aContext A pointer to application-specific context for @p aCallback.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.\n @retval OT_ERROR_BUSY A previous request is ongoing."]
7438 pub fn otDatasetSendMgmtActiveSet(
7439 aInstance: *mut otInstance,
7440 aDataset: *const otOperationalDataset,
7441 aTlvs: *const u8,
7442 aLength: u8,
7443 aCallback: otDatasetMgmtSetCallback,
7444 aContext: *mut ::std::os::raw::c_void,
7445 ) -> otError;
7446}
7447unsafe extern "C" {
7448 #[doc = " Sends MGMT_PENDING_GET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.\n @param[in] aTlvTypes A pointer to array containing additional raw TLV types to be requested.\n @param[in] aLength The length of @p aTlvTypes.\n @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send."]
7449 pub fn otDatasetSendMgmtPendingGet(
7450 aInstance: *mut otInstance,
7451 aDatasetComponents: *const otOperationalDatasetComponents,
7452 aTlvTypes: *const u8,
7453 aLength: u8,
7454 aAddress: *const otIp6Address,
7455 ) -> otError;
7456}
7457unsafe extern "C" {
7458 #[doc = " Sends MGMT_PENDING_SET.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to operational dataset.\n @param[in] aTlvs A pointer to TLVs.\n @param[in] aLength The length of TLVs.\n @param[in] aCallback A pointer to a function that is called on response reception or timeout.\n @param[in] aContext A pointer to application-specific context for @p aCallback.\n\n @retval OT_ERROR_NONE Successfully send the meshcop dataset command.\n @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.\n @retval OT_ERROR_BUSY A previous request is ongoing."]
7459 pub fn otDatasetSendMgmtPendingSet(
7460 aInstance: *mut otInstance,
7461 aDataset: *const otOperationalDataset,
7462 aTlvs: *const u8,
7463 aLength: u8,
7464 aCallback: otDatasetMgmtSetCallback,
7465 aContext: *mut ::std::os::raw::c_void,
7466 ) -> otError;
7467}
7468unsafe extern "C" {
7469 #[doc = " Generates PSKc from a given pass-phrase, network name, and extended PAN ID.\n\n PSKc is used to establish the Commissioner Session.\n\n @param[in] aPassPhrase The commissioning pass-phrase.\n @param[in] aNetworkName The network name for PSKc computation.\n @param[in] aExtPanId The extended PAN ID for PSKc computation.\n @param[out] aPskc A pointer to variable to output the generated PSKc.\n\n @retval OT_ERROR_NONE Successfully generate PSKc.\n @retval OT_ERROR_INVALID_ARGS If any of the input arguments is invalid."]
7470 pub fn otDatasetGeneratePskc(
7471 aPassPhrase: *const ::std::os::raw::c_char,
7472 aNetworkName: *const otNetworkName,
7473 aExtPanId: *const otExtendedPanId,
7474 aPskc: *mut otPskc,
7475 ) -> otError;
7476}
7477unsafe extern "C" {
7478 #[doc = " Sets an `otNetworkName` instance from a given null terminated C string.\n\n @p aNameString must follow UTF-8 encoding and the Network Name length must not be longer than\n `OT_NETWORK_NAME_MAX_SIZE`.\n\n @param[out] aNetworkName A pointer to the `otNetworkName` to set.\n @param[in] aNameString A name C string.\n\n @retval OT_ERROR_NONE Successfully set @p aNetworkName from @p aNameString.\n @retval OT_ERROR_INVALID_ARGS @p aNameStrng is invalid (too long or does not follow UTF-8 encoding)."]
7479 pub fn otNetworkNameFromString(
7480 aNetworkName: *mut otNetworkName,
7481 aNameString: *const ::std::os::raw::c_char,
7482 ) -> otError;
7483}
7484unsafe extern "C" {
7485 #[doc = " Parses an Operational Dataset from a given `otOperationalDatasetTlvs`.\n\n @param[in] aDatasetTlvs A pointer to dataset TLVs.\n @param[out] aDataset A pointer to where the dataset will be placed.\n\n @retval OT_ERROR_NONE Successfully set @p aDataset from @p aDatasetTlvs.\n @retval OT_ERROR_INVALID_ARGS @p aDatasetTlvs's length is longer than `OT_OPERATIONAL_DATASET_MAX_LENGTH`."]
7486 pub fn otDatasetParseTlvs(
7487 aDatasetTlvs: *const otOperationalDatasetTlvs,
7488 aDataset: *mut otOperationalDataset,
7489 ) -> otError;
7490}
7491unsafe extern "C" {
7492 #[doc = " Compares two Operational Dataset TLVs to determine if they contain the same set of TLVs.\n\n This function performs a deep comparison. It parses both @p aDatasetTlvsA and @p aDatasetTlvsB and checks if\n they contain the exact same set of TLVs (same type and same value). The order of TLVs within the\n `otOperationalDatasetTlvs` does not matter.\n\n @param[in] aDatasetTlvsA A pointer to dataset TLVs A. Must not be NULL.\n @param[in] aDatasetTlvsB A pointer to dataset TLVs B. Must not be NULL.\n\n @returns TRUE if the two Operational Dataset TLVs match, FALSE otherwise (e.g., if any TLV differs,\n is missing, or if the TLVs are not well-formed)."]
7493 pub fn otDatasetTlvsCompare(
7494 aDatasetTlvsA: *const otOperationalDatasetTlvs,
7495 aDatasetTlvsB: *const otOperationalDatasetTlvs,
7496 ) -> bool;
7497}
7498unsafe extern "C" {
7499 #[doc = " Converts a given Operational Dataset to `otOperationalDatasetTlvs`.\n\n @param[in] aDataset An Operational dataset to convert to TLVs.\n @param[out] aDatasetTlvs A pointer to dataset TLVs to return the result."]
7500 pub fn otDatasetConvertToTlvs(
7501 aDataset: *const otOperationalDataset,
7502 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7503 );
7504}
7505unsafe extern "C" {
7506 #[doc = " Updates a given Operational Dataset.\n\n @p aDataset contains the fields to be updated and their new value.\n\n @param[in] aDataset Specifies the set of types and values to update.\n @param[in,out] aDatasetTlvs A pointer to dataset TLVs to update.\n\n @retval OT_ERROR_NONE Successfully updated @p aDatasetTlvs.\n @retval OT_ERROR_INVALID_ARGS @p aDataset contains invalid values.\n @retval OT_ERROR_NO_BUFS Not enough space space in @p aDatasetTlvs to apply the update."]
7507 pub fn otDatasetUpdateTlvs(
7508 aDataset: *const otOperationalDataset,
7509 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7510 ) -> otError;
7511}
7512unsafe extern "C" {
7513 #[doc = " For FTD only, creates a new Operational Dataset to use when forming a new network.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aDataset The Operational Dataset.\n\n @retval OT_ERROR_NONE Successfully created a new Operational Dataset.\n @retval OT_ERROR_FAILED Failed to generate random values for new parameters."]
7514 pub fn otDatasetCreateNewNetwork(
7515 aInstance: *mut otInstance,
7516 aDataset: *mut otOperationalDataset,
7517 ) -> otError;
7518}
7519unsafe extern "C" {
7520 #[doc = " For FTD only, gets a minimal delay timer.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval the value of minimal delay timer (in ms)."]
7521 pub fn otDatasetGetDelayTimerMinimal(aInstance: *mut otInstance) -> u32;
7522}
7523unsafe extern "C" {
7524 #[doc = " For FTD only, sets a minimal delay timer.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDelayTimerMinimal The value of minimal delay timer (in ms).\n\n @retval OT_ERROR_NONE Successfully set minimal delay timer.\n @retval OT_ERROR_INVALID_ARGS If @p aDelayTimerMinimal is not valid."]
7525 pub fn otDatasetSetDelayTimerMinimal(
7526 aInstance: *mut otInstance,
7527 aDelayTimerMinimal: u32,
7528 ) -> otError;
7529}
7530#[doc = " This callback function pointer is called when a Dataset update request finishes, reporting success or failure status\n of the Dataset update request.\n\n Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.\n\n @param[in] aError The error status.\n OT_ERROR_NONE indicates successful Dataset update.\n OT_ERROR_INVALID_STATE indicates failure due invalid state (MLE being disabled).\n OT_ERROR_ALREADY indicates failure due to another device within network requesting\n a conflicting Dataset update.\n\n @param[in] aContext A pointer to the arbitrary context (provided by user in `otDatasetUpdaterRequestUpdate()`)."]
7531pub type otDatasetUpdaterCallback = ::std::option::Option<
7532 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
7533>;
7534unsafe extern "C" {
7535 #[doc = " Requests an update to Operational Dataset.\n\n Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.\n\n @p aDataset should contain the fields to be updated and their new value. It must not contain Active or Pending\n Timestamp fields. The Delay field is optional, if not provided a default value (1000 ms) would be used.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDataset A pointer to the Dataset containing the fields to change.\n @param[in] aCallback A callback to indicate when Dataset update request finishes.\n @param[in] aContext An arbitrary context passed to callback.\n\n @retval OT_ERROR_NONE Dataset update started successfully (@p aCallback will be invoked on completion).\n @retval OT_ERROR_INVALID_STATE Device is disabled or not fully configured (missing or incomplete Active Dataset).\n @retval OT_ERROR_ALREADY The @p aDataset fields already match the existing Active Dataset.\n @retval OT_ERROR_INVALID_ARGS The @p aDataset is not valid (contains Active or Pending Timestamp).\n @retval OT_ERROR_BUSY Cannot start update, a previous one is ongoing.\n @retval OT_ERROR_NO_BUFS Could not allocated buffer to save Dataset."]
7536 pub fn otDatasetUpdaterRequestUpdate(
7537 aInstance: *mut otInstance,
7538 aDataset: *const otOperationalDataset,
7539 aCallback: otDatasetUpdaterCallback,
7540 aContext: *mut ::std::os::raw::c_void,
7541 ) -> otError;
7542}
7543unsafe extern "C" {
7544 #[doc = " Cancels an ongoing (if any) Operational Dataset update request.\n\n Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
7545 pub fn otDatasetUpdaterCancelUpdate(aInstance: *mut otInstance);
7546}
7547unsafe extern "C" {
7548 #[doc = " Indicates whether there is an ongoing Operation Dataset update request.\n\n Available when `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE There is an ongoing update.\n @retval FALSE There is no ongoing update."]
7549 pub fn otDatasetUpdaterIsUpdateOngoing(aInstance: *mut otInstance) -> bool;
7550}
7551#[doc = "< Input mode without pull resistor."]
7552pub const OT_GPIO_MODE_INPUT: otGpioMode = 0;
7553#[doc = "< Output mode."]
7554pub const OT_GPIO_MODE_OUTPUT: otGpioMode = 1;
7555#[doc = " Defines the gpio modes."]
7556pub type otGpioMode = ::std::os::raw::c_uint;
7557#[doc = " Pointer to callback to output platform diag messages.\n\n @param[in] aFormat The format string.\n @param[in] aArguments The format string arguments.\n @param[out] aContext A pointer to the user context."]
7558pub type otPlatDiagOutputCallback = ::std::option::Option<
7559 unsafe extern "C" fn(
7560 aFormat: *const ::std::os::raw::c_char,
7561 aArguments: *mut __va_list_tag,
7562 aContext: *mut ::std::os::raw::c_void,
7563 ),
7564>;
7565unsafe extern "C" {
7566 #[doc = " Sets the platform diag output callback.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCallback A pointer to a function that is called on outputting diag messages.\n @param[in] aContext A pointer to the user context."]
7567 pub fn otPlatDiagSetOutputCallback(
7568 aInstance: *mut otInstance,
7569 aCallback: otPlatDiagOutputCallback,
7570 aContext: *mut ::std::os::raw::c_void,
7571 );
7572}
7573unsafe extern "C" {
7574 #[doc = " Processes a factory diagnostics command line.\n\n @param[in] aInstance The OpenThread instance for current request.\n @param[in] aArgsLength The number of arguments in @p aArgs.\n @param[in] aArgs The arguments of diagnostics command line.\n\n @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.\n @retval OT_ERROR_NONE The command is successfully process.\n @retval OT_ERROR_INVALID_COMMAND The command is not valid or not supported."]
7575 pub fn otPlatDiagProcess(
7576 aInstance: *mut otInstance,
7577 aArgsLength: u8,
7578 aArgs: *mut *mut ::std::os::raw::c_char,
7579 ) -> otError;
7580}
7581unsafe extern "C" {
7582 #[doc = " Enables/disables the factory diagnostics mode.\n\n @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise."]
7583 pub fn otPlatDiagModeSet(aMode: bool);
7584}
7585unsafe extern "C" {
7586 #[doc = " Indicates whether or not factory diagnostics mode is enabled.\n\n @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise."]
7587 pub fn otPlatDiagModeGet() -> bool;
7588}
7589unsafe extern "C" {
7590 #[doc = " Sets the channel to use for factory diagnostics.\n\n @param[in] aChannel The channel value."]
7591 pub fn otPlatDiagChannelSet(aChannel: u8);
7592}
7593unsafe extern "C" {
7594 #[doc = " Sets the transmit power to use for factory diagnostics.\n\n @param[in] aTxPower The transmit power value."]
7595 pub fn otPlatDiagTxPowerSet(aTxPower: i8);
7596}
7597unsafe extern "C" {
7598 #[doc = " Processes the received radio frame.\n\n @param[in] aInstance The OpenThread instance for current request.\n @param[in] aFrame The received radio frame.\n @param[in] aError The received radio frame status."]
7599 pub fn otPlatDiagRadioReceived(
7600 aInstance: *mut otInstance,
7601 aFrame: *mut otRadioFrame,
7602 aError: otError,
7603 );
7604}
7605unsafe extern "C" {
7606 #[doc = " Processes the alarm event.\n\n @param[in] aInstance The OpenThread instance for current request."]
7607 pub fn otPlatDiagAlarmCallback(aInstance: *mut otInstance);
7608}
7609unsafe extern "C" {
7610 #[doc = " Sets the gpio value.\n\n @param[in] aGpio The gpio number.\n @param[in] aValue true to set the gpio to high level, or false otherwise.\n\n @retval OT_ERROR_NONE Successfully set the gpio.\n @retval OT_ERROR_FAILED A platform error occurred while setting the gpio.\n @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported.\n @retval OT_ERROR_INVALID_STATE Diagnostic mode was not enabled or @p aGpio is not configured as output.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented or configured on the platform."]
7611 pub fn otPlatDiagGpioSet(aGpio: u32, aValue: bool) -> otError;
7612}
7613unsafe extern "C" {
7614 #[doc = " Gets the gpio value.\n\n @param[in] aGpio The gpio number.\n @param[out] aValue A pointer where to put gpio value.\n\n @retval OT_ERROR_NONE Successfully got the gpio value.\n @retval OT_ERROR_FAILED A platform error occurred while getting the gpio value.\n @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported or @p aValue is NULL.\n @retval OT_ERROR_INVALID_STATE Diagnostic mode was not enabled or @p aGpio is not configured as input.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented or configured on the platform."]
7615 pub fn otPlatDiagGpioGet(aGpio: u32, aValue: *mut bool) -> otError;
7616}
7617unsafe extern "C" {
7618 #[doc = " Sets the gpio mode.\n\n @param[in] aGpio The gpio number.\n @param[out] aMode The gpio mode.\n\n @retval OT_ERROR_NONE Successfully set the gpio mode.\n @retval OT_ERROR_FAILED A platform error occurred while setting the gpio mode.\n @retval OT_ERROR_INVALID_ARGS @p aGpio or @p aMode is not supported.\n @retval OT_ERROR_INVALID_STATE Diagnostic mode was not enabled.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented or configured on the platform."]
7619 pub fn otPlatDiagGpioSetMode(aGpio: u32, aMode: otGpioMode) -> otError;
7620}
7621unsafe extern "C" {
7622 #[doc = " Gets the gpio mode.\n\n @param[in] aGpio The gpio number.\n @param[out] aMode A pointer where to put gpio mode.\n\n @retval OT_ERROR_NONE Successfully got the gpio mode.\n @retval OT_ERROR_FAILED Mode returned by the platform is not implemented in OpenThread or a platform error\n occurred while getting the gpio mode.\n @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported or @p aMode is NULL.\n @retval OT_ERROR_INVALID_STATE Diagnostic mode was not enabled.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented or configured on the platform."]
7623 pub fn otPlatDiagGpioGetMode(aGpio: u32, aMode: *mut otGpioMode) -> otError;
7624}
7625unsafe extern "C" {
7626 #[doc = " Set the radio raw power setting for diagnostics module.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aRawPowerSetting A pointer to the raw power setting byte array.\n @param[in] aRawPowerSettingLength The length of the @p aRawPowerSetting.\n\n @retval OT_ERROR_NONE Successfully set the raw power setting.\n @retval OT_ERROR_INVALID_ARGS The @p aRawPowerSetting is NULL or the @p aRawPowerSettingLength is too long.\n @retval OT_ERROR_NOT_IMPLEMENTED This method is not implemented."]
7627 pub fn otPlatDiagRadioSetRawPowerSetting(
7628 aInstance: *mut otInstance,
7629 aRawPowerSetting: *const u8,
7630 aRawPowerSettingLength: u16,
7631 ) -> otError;
7632}
7633unsafe extern "C" {
7634 #[doc = " Get the radio raw power setting for diagnostics module.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aRawPowerSetting A pointer to the raw power setting byte array.\n @param[in,out] aRawPowerSettingLength On input, a pointer to the size of @p aRawPowerSetting.\n On output, a pointer to the length of the raw power setting data.\n\n @retval OT_ERROR_NONE Successfully set the raw power setting.\n @retval OT_ERROR_INVALID_ARGS The @p aRawPowerSetting or @p aRawPowerSettingLength is NULL or\n @aRawPowerSettingLength is too short.\n @retval OT_ERROR_NOT_FOUND The raw power setting is not set.\n @retval OT_ERROR_NOT_IMPLEMENTED This method is not implemented."]
7635 pub fn otPlatDiagRadioGetRawPowerSetting(
7636 aInstance: *mut otInstance,
7637 aRawPowerSetting: *mut u8,
7638 aRawPowerSettingLength: *mut u16,
7639 ) -> otError;
7640}
7641unsafe extern "C" {
7642 #[doc = " Enable/disable the platform layer to use the raw power setting set by `otPlatDiagRadioSetRawPowerSetting()`.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable TRUE to enable or FALSE to disable the raw power setting.\n\n @retval OT_ERROR_NONE Successfully enabled/disabled the raw power setting.\n @retval OT_ERROR_NOT_IMPLEMENTED This method is not implemented."]
7643 pub fn otPlatDiagRadioRawPowerSettingEnable(
7644 aInstance: *mut otInstance,
7645 aEnable: bool,
7646 ) -> otError;
7647}
7648unsafe extern "C" {
7649 #[doc = " Start/stop the platform layer to transmit continuous carrier wave.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable TRUE to enable or FALSE to disable the platform layer to transmit continuous carrier wave.\n\n @retval OT_ERROR_NONE Successfully enabled/disabled .\n @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state.\n @retval OT_ERROR_NOT_IMPLEMENTED This method is not implemented."]
7650 pub fn otPlatDiagRadioTransmitCarrier(aInstance: *mut otInstance, aEnable: bool) -> otError;
7651}
7652unsafe extern "C" {
7653 #[doc = " Start/stop the platform layer to transmit stream of characters.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aEnable TRUE to enable or FALSE to disable the platform layer to transmit stream.\n\n @retval OT_ERROR_NONE Successfully enabled/disabled.\n @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented."]
7654 pub fn otPlatDiagRadioTransmitStream(aInstance: *mut otInstance, aEnable: bool) -> otError;
7655}
7656unsafe extern "C" {
7657 #[doc = " Get the power settings for the given channel.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel.\n @param[out] aTargetPower The target power in 0.01 dBm.\n @param[out] aActualPower The actual power in 0.01 dBm.\n @param[out] aRawPowerSetting A pointer to the raw power setting byte array.\n @param[in,out] aRawPowerSettingLength On input, a pointer to the size of @p aRawPowerSetting.\n On output, a pointer to the length of the raw power setting data.\n\n @retval OT_ERROR_NONE Successfully got the target power.\n @retval OT_ERROR_INVALID_ARGS The @p aChannel is invalid, @aTargetPower, @p aActualPower, @p aRawPowerSetting or\n @p aRawPowerSettingLength is NULL or @aRawPowerSettingLength is too short.\n @retval OT_ERROR_NOT_FOUND The power settings for the @p aChannel was not found.\n @retval OT_ERROR_NOT_IMPLEMENTED This method is not implemented."]
7658 pub fn otPlatDiagRadioGetPowerSettings(
7659 aInstance: *mut otInstance,
7660 aChannel: u8,
7661 aTargetPower: *mut i16,
7662 aActualPower: *mut i16,
7663 aRawPowerSetting: *mut u8,
7664 aRawPowerSettingLength: *mut u16,
7665 ) -> otError;
7666}
7667#[doc = " @addtogroup api-factory-diagnostics\n\n @brief\n This module includes functions that control the Thread stack's execution.\n\n @{"]
7668pub type otDiagOutputCallback = otPlatDiagOutputCallback;
7669unsafe extern "C" {
7670 #[doc = " Sets the diag output callback.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCallback A pointer to a function that is called on outputting diag messages.\n @param[in] aContext A pointer to the user context."]
7671 pub fn otDiagSetOutputCallback(
7672 aInstance: *mut otInstance,
7673 aCallback: otDiagOutputCallback,
7674 aContext: *mut ::std::os::raw::c_void,
7675 );
7676}
7677unsafe extern "C" {
7678 #[doc = " Processes a factory diagnostics command line.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aArgsLength The number of elements in @p aArgs.\n @param[in] aArgs An array of arguments.\n\n @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.\n @retval OT_ERROR_NONE The command is successfully process.\n @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported."]
7679 pub fn otDiagProcessCmd(
7680 aInstance: *mut otInstance,
7681 aArgsLength: u8,
7682 aArgs: *mut *mut ::std::os::raw::c_char,
7683 ) -> otError;
7684}
7685unsafe extern "C" {
7686 #[doc = " Processes a factory diagnostics command line.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aString A NULL-terminated input string.\n\n @retval OT_ERROR_NONE The command is successfully process.\n @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.\n @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.\n @retval OT_ERROR_NO_BUFS The command string is too long."]
7687 pub fn otDiagProcessCmdLine(
7688 aInstance: *mut otInstance,
7689 aString: *const ::std::os::raw::c_char,
7690 ) -> otError;
7691}
7692unsafe extern "C" {
7693 #[doc = " Indicates whether or not the factory diagnostics mode is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE if factory diagnostics mode is enabled\n @retval FALSE if factory diagnostics mode is disabled."]
7694 pub fn otDiagIsEnabled(aInstance: *mut otInstance) -> bool;
7695}
7696#[doc = "< Indicates the flag is not specified."]
7697pub const OT_DNS_FLAG_UNSPECIFIED: otDnsRecursionFlag = 0;
7698#[doc = "< Indicates DNS name server can resolve the query recursively."]
7699pub const OT_DNS_FLAG_RECURSION_DESIRED: otDnsRecursionFlag = 1;
7700#[doc = "< Indicates DNS name server can not resolve the query recursively."]
7701pub const OT_DNS_FLAG_NO_RECURSION: otDnsRecursionFlag = 2;
7702#[doc = " Type represents the \"Recursion Desired\" (RD) flag in an `otDnsQueryConfig`."]
7703pub type otDnsRecursionFlag = ::std::os::raw::c_uint;
7704#[doc = "< NAT64 mode is not specified. Use default NAT64 mode."]
7705pub const OT_DNS_NAT64_UNSPECIFIED: otDnsNat64Mode = 0;
7706#[doc = "< Allow NAT64 address translation during DNS client address resolution."]
7707pub const OT_DNS_NAT64_ALLOW: otDnsNat64Mode = 1;
7708#[doc = "< Do not allow NAT64 address translation during DNS client address resolution."]
7709pub const OT_DNS_NAT64_DISALLOW: otDnsNat64Mode = 2;
7710#[doc = " Type represents the NAT64 mode in an `otDnsQueryConfig`.\n\n The NAT64 mode indicates whether to allow or disallow NAT64 address translation during DNS client address resolution.\n This mode is only used when `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` is enabled."]
7711pub type otDnsNat64Mode = ::std::os::raw::c_uint;
7712#[doc = "< Mode is not specified. Use default service mode."]
7713pub const OT_DNS_SERVICE_MODE_UNSPECIFIED: otDnsServiceMode = 0;
7714#[doc = "< Query for SRV record only."]
7715pub const OT_DNS_SERVICE_MODE_SRV: otDnsServiceMode = 1;
7716#[doc = "< Query for TXT record only."]
7717pub const OT_DNS_SERVICE_MODE_TXT: otDnsServiceMode = 2;
7718#[doc = "< Query for both SRV and TXT records in same message."]
7719pub const OT_DNS_SERVICE_MODE_SRV_TXT: otDnsServiceMode = 3;
7720#[doc = "< Query in parallel for SRV and TXT using separate messages."]
7721pub const OT_DNS_SERVICE_MODE_SRV_TXT_SEPARATE: otDnsServiceMode = 4;
7722#[doc = "< Query for TXT/SRV together first, if fails then query separately."]
7723pub const OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE: otDnsServiceMode = 5;
7724#[doc = " Type represents the service resolution mode in an `otDnsQueryConfig`.\n\n This is only used during DNS client service resolution `otDnsClientResolveService()`. It determines which\n record types to query."]
7725pub type otDnsServiceMode = ::std::os::raw::c_uint;
7726pub const OT_DNS_TRANSPORT_UNSPECIFIED: otDnsTransportProto = 0;
7727#[doc = " DNS transport is unspecified."]
7728pub const OT_DNS_TRANSPORT_UDP: otDnsTransportProto = 1;
7729#[doc = " DNS query should be sent via UDP."]
7730pub const OT_DNS_TRANSPORT_TCP: otDnsTransportProto = 2;
7731#[doc = " Type represents the DNS transport protocol in an `otDnsQueryConfig`.\n\n This `OT_DNS_TRANSPORT_TCP` is only supported when `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is enabled."]
7732pub type otDnsTransportProto = ::std::os::raw::c_uint;
7733#[doc = " Represents a DNS query configuration.\n\n Any of the fields in this structure can be set to zero to indicate that it is not specified. How the unspecified\n fields are treated is determined by the function which uses the instance of `otDnsQueryConfig`."]
7734#[repr(C)]
7735#[derive(Copy, Clone)]
7736pub struct otDnsQueryConfig {
7737 #[doc = "< Server address (IPv6 addr/port). All zero or zero port for unspecified."]
7738 pub mServerSockAddr: otSockAddr,
7739 #[doc = "< Wait time (in msec) to rx response. Zero indicates unspecified value."]
7740 pub mResponseTimeout: u32,
7741 #[doc = "< Maximum tx attempts before reporting failure. Zero for unspecified value."]
7742 pub mMaxTxAttempts: u8,
7743 #[doc = "< Indicates whether the server can resolve the query recursively or not."]
7744 pub mRecursionFlag: otDnsRecursionFlag,
7745 #[doc = "< Allow/Disallow NAT64 address translation during address resolution."]
7746 pub mNat64Mode: otDnsNat64Mode,
7747 #[doc = "< Determines which records to query during service resolution."]
7748 pub mServiceMode: otDnsServiceMode,
7749 #[doc = "< Select default transport protocol."]
7750 pub mTransportProto: otDnsTransportProto,
7751}
7752impl Default for otDnsQueryConfig {
7753 fn default() -> Self {
7754 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7755 unsafe {
7756 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7757 s.assume_init()
7758 }
7759 }
7760}
7761unsafe extern "C" {
7762 #[doc = " Gets the current default query config used by DNS client.\n\n When OpenThread stack starts, the default DNS query config is determined from a set of OT config options such as\n `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_IP6_ADDRESS`, `_DEFAULT_SERVER_PORT`, `_DEFAULT_RESPONSE_TIMEOUT`, etc.\n (see `config/dns_client.h` for all related config options).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the current default config being used by DNS client."]
7763 pub fn otDnsClientGetDefaultConfig(aInstance: *mut otInstance) -> *const otDnsQueryConfig;
7764}
7765unsafe extern "C" {
7766 #[doc = " Sets the default query config on DNS client.\n\n @note Any ongoing query will continue to use the config from when it was started. The new default config will be\n used for any future DNS queries.\n\n The @p aConfig can be NULL. In this case the default config will be set to the defaults from OT config options\n `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_{}`. This resets the default query config back to to the config when the\n OpenThread stack starts.\n\n In a non-NULL @p aConfig, caller can choose to leave some of the fields in `otDnsQueryConfig` instance unspecified\n (value zero). The unspecified fields are replaced by the corresponding OT config option definitions\n `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_{}` to form the default query config.\n\n When `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_SERVER_ADDRESS_AUTO_SET_ENABLE` is enabled, the server's IPv6 address in\n the default config is automatically set and updated by DNS client. This is done only when user does not explicitly\n set or specify it. This behavior requires SRP client and its auto-start feature to be enabled. SRP client will then\n monitor the Thread Network Data for DNS/SRP Service entries to select an SRP server. The selected SRP server address\n is also set as the DNS server address in the default config.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the new query config to use as default."]
7767 pub fn otDnsClientSetDefaultConfig(
7768 aInstance: *mut otInstance,
7769 aConfig: *const otDnsQueryConfig,
7770 );
7771}
7772#[repr(C)]
7773#[derive(Debug, Copy, Clone)]
7774pub struct otDnsAddressResponse {
7775 _unused: [u8; 0],
7776}
7777#[doc = " Pointer is called when a DNS response is received for an address resolution query.\n\n Within this callback the user can use `otDnsAddressResponseGet{Item}()` functions along with the @p aResponse\n pointer to get more info about the response.\n\n The @p aResponse pointer can only be used within this callback and after returning from this function it will not\n stay valid, so the user MUST NOT retain the @p aResponse pointer for later use.\n\n @param[in] aError The result of the DNS transaction.\n @param[in] aResponse A pointer to the response (it is always non-NULL).\n @param[in] aContext A pointer to application-specific context.\n\n The @p aError can have the following:\n\n - OT_ERROR_NONE A response was received successfully.\n - OT_ERROR_ABORT A DNS transaction was aborted by stack.\n - OT_ERROR_RESPONSE_TIMEOUT No DNS response has been received within timeout.\n\n If the server rejects the address resolution request the error code from server is mapped as follow:\n\n - (0) NOERROR Success (no error condition) -> OT_ERROR_NONE\n - (1) FORMERR Server unable to interpret due to format error -> OT_ERROR_PARSE\n - (2) SERVFAIL Server encountered an internal failure -> OT_ERROR_FAILED\n - (3) NXDOMAIN Name that ought to exist, does not exist -> OT_ERROR_NOT_FOUND\n - (4) NOTIMP Server does not support the query type (OpCode) -> OT_ERROR_NOT_IMPLEMENTED\n - (5) REFUSED Server refused for policy/security reasons -> OT_ERROR_SECURITY\n - (6) YXDOMAIN Some name that ought not to exist, does exist -> OT_ERROR_DUPLICATED\n - (7) YXRRSET Some RRset that ought not to exist, does exist -> OT_ERROR_DUPLICATED\n - (8) NXRRSET Some RRset that ought to exist, does not exist -> OT_ERROR_NOT_FOUND\n - (9) NOTAUTH Service is not authoritative for zone -> OT_ERROR_SECURITY\n - (10) NOTZONE A name is not in the zone -> OT_ERROR_PARSE\n - (20) BADNAME Bad name -> OT_ERROR_PARSE\n - (21) BADALG Bad algorithm -> OT_ERROR_SECURITY\n - (22) BADTRUN Bad truncation -> OT_ERROR_PARSE\n - Other response codes -> OT_ERROR_FAILED"]
7778pub type otDnsAddressCallback = ::std::option::Option<
7779 unsafe extern "C" fn(
7780 aError: otError,
7781 aResponse: *const otDnsAddressResponse,
7782 aContext: *mut ::std::os::raw::c_void,
7783 ),
7784>;
7785unsafe extern "C" {
7786 #[doc = " Sends an address resolution DNS query for AAAA (IPv6) record(s) for a given host name.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHostName The host name for which to query the address (MUST NOT be NULL).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.\n @retval OT_ERROR_INVALID_ARGS The host name is not valid format.\n @retval OT_ERROR_INVALID_STATE Cannot send query since Thread interface is not up."]
7787 pub fn otDnsClientResolveAddress(
7788 aInstance: *mut otInstance,
7789 aHostName: *const ::std::os::raw::c_char,
7790 aCallback: otDnsAddressCallback,
7791 aContext: *mut ::std::os::raw::c_void,
7792 aConfig: *const otDnsQueryConfig,
7793 ) -> otError;
7794}
7795unsafe extern "C" {
7796 #[doc = " Sends an address resolution DNS query for A (IPv4) record(s) for a given host name.\n\n Requires and is available when `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` is enabled.\n\n When a successful response is received, the addresses are returned from @p aCallback as NAT64 IPv6 translated\n versions of the IPv4 addresses from the query response.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHostName The host name for which to query the address (MUST NOT be NULL).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.\n @retval OT_ERROR_INVALID_ARGS The host name is not valid format or NAT64 is not enabled in config.\n @retval OT_ERROR_INVALID_STATE Cannot send query since Thread interface is not up."]
7797 pub fn otDnsClientResolveIp4Address(
7798 aInstance: *mut otInstance,
7799 aHostName: *const ::std::os::raw::c_char,
7800 aCallback: otDnsAddressCallback,
7801 aContext: *mut ::std::os::raw::c_void,
7802 aConfig: *const otDnsQueryConfig,
7803 ) -> otError;
7804}
7805unsafe extern "C" {
7806 #[doc = " Gets the full host name associated with an address resolution DNS response.\n\n MUST only be used from `otDnsAddressCallback`.\n\n @param[in] aResponse A pointer to the response.\n @param[out] aNameBuffer A buffer to char array to output the full host name (MUST NOT be NULL).\n @param[in] aNameBufferSize The size of @p aNameBuffer.\n\n @retval OT_ERROR_NONE The full host name was read successfully.\n @retval OT_ERROR_NO_BUFS The name does not fit in @p aNameBuffer."]
7807 pub fn otDnsAddressResponseGetHostName(
7808 aResponse: *const otDnsAddressResponse,
7809 aNameBuffer: *mut ::std::os::raw::c_char,
7810 aNameBufferSize: u16,
7811 ) -> otError;
7812}
7813unsafe extern "C" {
7814 #[doc = " Gets an IPv6 address associated with an address resolution DNS response.\n\n MUST only be used from `otDnsAddressCallback`.\n\n The response may include multiple IPv6 address records. @p aIndex can be used to iterate through the list of\n addresses. Index zero gets the first address and so on. When we reach end of the list, `OT_ERROR_NOT_FOUND` is\n returned.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aIndex The address record index to retrieve.\n @param[out] aAddress A pointer to a IPv6 address to output the address (MUST NOT be NULL).\n @param[out] aTtl A pointer to an `uint32_t` to output TTL for the address. It can be NULL if caller does not\n want to get the TTL.\n\n @retval OT_ERROR_NONE The address was read successfully.\n @retval OT_ERROR_NOT_FOUND No address record in @p aResponse at @p aIndex.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse.\n @retval OT_ERROR_INVALID_STATE No NAT64 prefix (applicable only when NAT64 is allowed)."]
7815 pub fn otDnsAddressResponseGetAddress(
7816 aResponse: *const otDnsAddressResponse,
7817 aIndex: u16,
7818 aAddress: *mut otIp6Address,
7819 aTtl: *mut u32,
7820 ) -> otError;
7821}
7822#[repr(C)]
7823#[derive(Debug, Copy, Clone)]
7824pub struct otDnsBrowseResponse {
7825 _unused: [u8; 0],
7826}
7827#[doc = " Pointer is called when a DNS response is received for a browse (service instance enumeration) query.\n\n Within this callback the user can use `otDnsBrowseResponseGet{Item}()` functions along with the @p aResponse\n pointer to get more info about the response.\n\n The @p aResponse pointer can only be used within this callback and after returning from this function it will not\n stay valid, so the user MUST NOT retain the @p aResponse pointer for later use.\n\n @param[in] aError The result of the DNS transaction.\n @param[in] aResponse A pointer to the response (it is always non-NULL).\n @param[in] aContext A pointer to application-specific context.\n\n For the full list of possible values for @p aError, please see `otDnsAddressCallback()`."]
7828pub type otDnsBrowseCallback = ::std::option::Option<
7829 unsafe extern "C" fn(
7830 aError: otError,
7831 aResponse: *const otDnsBrowseResponse,
7832 aContext: *mut ::std::os::raw::c_void,
7833 ),
7834>;
7835#[doc = " Provides info for a DNS service instance."]
7836#[repr(C)]
7837#[derive(Copy, Clone)]
7838pub struct otDnsServiceInfo {
7839 #[doc = "< Service record TTL (in seconds)."]
7840 pub mTtl: u32,
7841 #[doc = "< Service port number."]
7842 pub mPort: u16,
7843 #[doc = "< Service priority."]
7844 pub mPriority: u16,
7845 #[doc = "< Service weight."]
7846 pub mWeight: u16,
7847 #[doc = "< Buffer to output the service host name (can be NULL if not needed)."]
7848 pub mHostNameBuffer: *mut ::std::os::raw::c_char,
7849 #[doc = "< Size of `mHostNameBuffer`."]
7850 pub mHostNameBufferSize: u16,
7851 #[doc = "< The host IPv6 address. Set to all zero if not available."]
7852 pub mHostAddress: otIp6Address,
7853 #[doc = "< The host address TTL."]
7854 pub mHostAddressTtl: u32,
7855 #[doc = "< Buffer to output TXT data (can be NULL if not needed)."]
7856 pub mTxtData: *mut u8,
7857 #[doc = "< On input, size of `mTxtData` buffer. On output number bytes written."]
7858 pub mTxtDataSize: u16,
7859 #[doc = "< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated."]
7860 pub mTxtDataTruncated: bool,
7861 #[doc = "< The TXT data TTL."]
7862 pub mTxtDataTtl: u32,
7863}
7864impl Default for otDnsServiceInfo {
7865 fn default() -> Self {
7866 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7867 unsafe {
7868 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7869 s.assume_init()
7870 }
7871 }
7872}
7873unsafe extern "C" {
7874 #[doc = " Sends a DNS browse (service instance enumeration) query for a given service name.\n\n Is available when `OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE` is enabled.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aServiceName The service name to query for (MUST NOT be NULL).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query."]
7875 pub fn otDnsClientBrowse(
7876 aInstance: *mut otInstance,
7877 aServiceName: *const ::std::os::raw::c_char,
7878 aCallback: otDnsBrowseCallback,
7879 aContext: *mut ::std::os::raw::c_void,
7880 aConfig: *const otDnsQueryConfig,
7881 ) -> otError;
7882}
7883unsafe extern "C" {
7884 #[doc = " Gets the service name associated with a DNS browse (service instance enumeration) response.\n\n MUST only be used from `otDnsBrowseCallback`.\n\n @param[in] aResponse A pointer to the response.\n @param[out] aNameBuffer A buffer to char array to output the service name (MUST NOT be NULL).\n @param[in] aNameBufferSize The size of @p aNameBuffer.\n\n @retval OT_ERROR_NONE The service name was read successfully.\n @retval OT_ERROR_NO_BUFS The name does not fit in @p aNameBuffer."]
7885 pub fn otDnsBrowseResponseGetServiceName(
7886 aResponse: *const otDnsBrowseResponse,
7887 aNameBuffer: *mut ::std::os::raw::c_char,
7888 aNameBufferSize: u16,
7889 ) -> otError;
7890}
7891unsafe extern "C" {
7892 #[doc = " Gets a service instance associated with a DNS browse (service instance enumeration) response.\n\n MUST only be used from `otDnsBrowseCallback`.\n\n The response may include multiple service instance records. @p aIndex can be used to iterate through the list. Index\n zero gives the first record. When we reach end of the list, `OT_ERROR_NOT_FOUND` is returned.\n\n Note that this function gets the service instance label and not the full service instance name which is of the form\n `<Instance>.<Service>.<Domain>`.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aIndex The service instance record index to retrieve.\n @param[out] aLabelBuffer A buffer to char array to output the service instance label (MUST NOT be NULL).\n @param[in] aLabelBufferSize The size of @p aLabelBuffer.\n\n @retval OT_ERROR_NONE The service instance was read successfully.\n @retval OT_ERROR_NO_BUFS The name does not fit in @p aNameBuffer.\n @retval OT_ERROR_NOT_FOUND No service instance record in @p aResponse at @p aIndex.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse."]
7893 pub fn otDnsBrowseResponseGetServiceInstance(
7894 aResponse: *const otDnsBrowseResponse,
7895 aIndex: u16,
7896 aLabelBuffer: *mut ::std::os::raw::c_char,
7897 aLabelBufferSize: u8,
7898 ) -> otError;
7899}
7900unsafe extern "C" {
7901 #[doc = " Gets info for a service instance from a DNS browse (service instance enumeration) response.\n\n MUST only be used from `otDnsBrowseCallback`.\n\n A browse DNS response can include SRV, TXT, and AAAA records for the service instances that are enumerated. This is\n a SHOULD and not a MUST requirement, and servers/resolvers are not required to provide this. This function attempts\n to retrieve this info for a given service instance when available.\n\n - If no matching SRV record is found in @p aResponse, `OT_ERROR_NOT_FOUND` is returned. In this case, no additional\n records (no TXT and/or AAAA) are read.\n - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and `OT_ERROR_NONE` is returned.\n - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.\n - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.\n - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.\n - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The\n other addresses can be retrieved using `otDnsBrowseResponseGetHostAddress()`.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aInstanceLabel The service instance label (MUST NOT be NULL).\n @param[out] aServiceInfo A `ServiceInfo` to output the service instance information (MUST NOT be NULL).\n\n @retval OT_ERROR_NONE The service instance info was read. @p aServiceInfo is updated.\n @retval OT_ERROR_NOT_FOUND Could not find a matching SRV record for @p aInstanceLabel.\n @retval OT_ERROR_NO_BUFS The host name and/or TXT data could not fit in the given buffers.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse."]
7902 pub fn otDnsBrowseResponseGetServiceInfo(
7903 aResponse: *const otDnsBrowseResponse,
7904 aInstanceLabel: *const ::std::os::raw::c_char,
7905 aServiceInfo: *mut otDnsServiceInfo,
7906 ) -> otError;
7907}
7908unsafe extern "C" {
7909 #[doc = " Gets the host IPv6 address from a DNS browse (service instance enumeration) response.\n\n MUST only be used from `otDnsBrowseCallback`.\n\n The response can include zero or more IPv6 address records. @p aIndex can be used to iterate through the list of\n addresses. Index zero gets the first address and so on. When we reach end of the list, `OT_ERROR_NOT_FOUND` is\n returned.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aHostName The host name to get the address (MUST NOT be NULL).\n @param[in] aIndex The address record index to retrieve.\n @param[out] aAddress A pointer to a IPv6 address to output the address (MUST NOT be NULL).\n @param[out] aTtl A pointer to an `uint32_t` to output TTL for the address. It can be NULL if caller does\n not want to get the TTL.\n\n @retval OT_ERROR_NONE The address was read successfully.\n @retval OT_ERROR_NOT_FOUND No address record for @p aHostname in @p aResponse at @p aIndex.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse."]
7910 pub fn otDnsBrowseResponseGetHostAddress(
7911 aResponse: *const otDnsBrowseResponse,
7912 aHostName: *const ::std::os::raw::c_char,
7913 aIndex: u16,
7914 aAddress: *mut otIp6Address,
7915 aTtl: *mut u32,
7916 ) -> otError;
7917}
7918#[repr(C)]
7919#[derive(Debug, Copy, Clone)]
7920pub struct otDnsServiceResponse {
7921 _unused: [u8; 0],
7922}
7923#[doc = " Pointer is called when a DNS response is received for a service instance resolution query.\n\n Within this callback the user can use `otDnsServiceResponseGet{Item}()` functions along with the @p aResponse\n pointer to get more info about the response.\n\n The @p aResponse pointer can only be used within this callback and after returning from this function it will not\n stay valid, so the user MUST NOT retain the @p aResponse pointer for later use.\n\n @param[in] aError The result of the DNS transaction.\n @param[in] aResponse A pointer to the response (it is always non-NULL).\n @param[in] aContext A pointer to application-specific context.\n\n For the full list of possible values for @p aError, please see `otDnsAddressCallback()`."]
7924pub type otDnsServiceCallback = ::std::option::Option<
7925 unsafe extern "C" fn(
7926 aError: otError,
7927 aResponse: *const otDnsServiceResponse,
7928 aContext: *mut ::std::os::raw::c_void,
7929 ),
7930>;
7931unsafe extern "C" {
7932 #[doc = " Starts a DNS service instance resolution for a given service instance.\n\n Is available when `OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE` is enabled.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config.\n\n The function sends queries for SRV and/or TXT records for the given service instance. The `mServiceMode` field in\n `otDnsQueryConfig` determines which records to query (SRV only, TXT only, or both SRV and TXT) and how to perform\n the query (together in the same message, separately in parallel, or in optimized mode where client will try in the\n same message first and then separately if it fails to get a response).\n\n The SRV record provides information about service port, priority, and weight along with the host name associated\n with the service instance. This function DOES NOT perform address resolution for the host name discovered from SRV\n record. The server/resolver may provide AAAA/A record(s) for the host name in the Additional Data section of the\n response to SRV/TXT query and this information can be retrieved using `otDnsServiceResponseGetServiceInfo()` in\n `otDnsServiceCallback`. Users of this API MUST NOT assume that host address will always be available from\n `otDnsServiceResponseGetServiceInfo()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInstanceLabel The service instance label.\n @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.\n @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is NULL."]
7933 pub fn otDnsClientResolveService(
7934 aInstance: *mut otInstance,
7935 aInstanceLabel: *const ::std::os::raw::c_char,
7936 aServiceName: *const ::std::os::raw::c_char,
7937 aCallback: otDnsServiceCallback,
7938 aContext: *mut ::std::os::raw::c_void,
7939 aConfig: *const otDnsQueryConfig,
7940 ) -> otError;
7941}
7942unsafe extern "C" {
7943 #[doc = " Starts a DNS service instance resolution for a given service instance, with a potential follow-up\n address resolution for the host name discovered for the service instance.\n\n Is available when `OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE` is enabled.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config. This function cannot be used with\n `mServiceMode` in DNS config set to `OT_DNS_SERVICE_MODE_TXT` (i.e., querying for TXT record only) and will return\n `OT_ERROR_INVALID_ARGS`.\n\n Behaves similarly to `otDnsClientResolveService()` sending queries for SRV and TXT records. However,\n if the server/resolver does not provide AAAA/A records for the host name in the response to SRV query (in the\n Additional Data section), it will perform host name resolution (sending an AAAA query) for the discovered host name\n from the SRV record. The callback @p aCallback is invoked when responses for all queries are received (i.e., both\n service and host address resolutions are finished).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInstanceLabel The service instance label.\n @param[in] aServiceName The service name (together with @p aInstanceLabel form full instance name).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the status.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.\n @retval OT_ERROR_INVALID_ARGS @p aInstanceLabel is NULL, or @p aConfig is invalid."]
7944 pub fn otDnsClientResolveServiceAndHostAddress(
7945 aInstance: *mut otInstance,
7946 aInstanceLabel: *const ::std::os::raw::c_char,
7947 aServiceName: *const ::std::os::raw::c_char,
7948 aCallback: otDnsServiceCallback,
7949 aContext: *mut ::std::os::raw::c_void,
7950 aConfig: *const otDnsQueryConfig,
7951 ) -> otError;
7952}
7953unsafe extern "C" {
7954 #[doc = " Gets the service instance name associated with a DNS service instance resolution response.\n\n MUST only be used from `otDnsServiceCallback`.\n\n @param[in] aResponse A pointer to the response.\n @param[out] aLabelBuffer A buffer to char array to output the service instance label (MUST NOT be NULL).\n @param[in] aLabelBufferSize The size of @p aLabelBuffer.\n @param[out] aNameBuffer A buffer to char array to output the rest of service name (can be NULL if user is\n not interested in getting the name.\n @param[in] aNameBufferSize The size of @p aNameBuffer.\n\n @retval OT_ERROR_NONE The service name was read successfully.\n @retval OT_ERROR_NO_BUFS Either the label or name does not fit in the given buffers."]
7955 pub fn otDnsServiceResponseGetServiceName(
7956 aResponse: *const otDnsServiceResponse,
7957 aLabelBuffer: *mut ::std::os::raw::c_char,
7958 aLabelBufferSize: u8,
7959 aNameBuffer: *mut ::std::os::raw::c_char,
7960 aNameBufferSize: u16,
7961 ) -> otError;
7962}
7963unsafe extern "C" {
7964 #[doc = " Gets info for a service instance from a DNS service instance resolution response.\n\n MUST only be used from a `otDnsServiceCallback` triggered from `otDnsClientResolveService()` or\n `otDnsClientResolveServiceAndHostAddress()`.\n\n When this is is used from a `otDnsClientResolveService()` callback, the DNS response from server/resolver may\n include AAAA records in its Additional Data section for the host name associated with the service instance that is\n resolved. This is a SHOULD and not a MUST requirement so servers/resolvers are not required to provide this. This\n function attempts to parse AAAA record(s) if included in the response. If it is not included `mHostAddress` is set\n to all zeros (unspecified address). To also resolve the host address, user can use the DNS client API function\n `otDnsClientResolveServiceAndHostAddress()` which will perform service resolution followed up by a host name\n address resolution query (when AAAA records are not provided by server/resolver in the SRV query response).\n\n - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated.\n - If no matching SRV record is found, `OT_ERROR_NOT_FOUND` is returned unless the query config for this query\n used `OT_DNS_SERVICE_MODE_TXT` for `mServiceMode` (meaning the request was only for TXT record). In this case, we\n still try to parse the SRV record from Additional Data Section of response (in case server provided the info).\n - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.\n - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.\n - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.\n - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The\n other addresses can be retrieved using `otDnsServiceResponseGetHostAddress()`.\n\n @param[in] aResponse A pointer to the response.\n @param[out] aServiceInfo A `ServiceInfo` to output the service instance information (MUST NOT be NULL).\n\n @retval OT_ERROR_NONE The service instance info was read. @p aServiceInfo is updated.\n @retval OT_ERROR_NOT_FOUND Could not find a required record in @p aResponse.\n @retval OT_ERROR_NO_BUFS The host name and/or TXT data could not fit in the given buffers.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse."]
7965 pub fn otDnsServiceResponseGetServiceInfo(
7966 aResponse: *const otDnsServiceResponse,
7967 aServiceInfo: *mut otDnsServiceInfo,
7968 ) -> otError;
7969}
7970unsafe extern "C" {
7971 #[doc = " Gets the host IPv6 address from a DNS service instance resolution response.\n\n MUST only be used from `otDnsServiceCallback`.\n\n The response can include zero or more IPv6 address records. @p aIndex can be used to iterate through the list of\n addresses. Index zero gets the first address and so on. When we reach end of the list, `OT_ERROR_NOT_FOUND` is\n returned.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aHostName The host name to get the address (MUST NOT be NULL).\n @param[in] aIndex The address record index to retrieve.\n @param[out] aAddress A pointer to a IPv6 address to output the address (MUST NOT be NULL).\n @param[out] aTtl A pointer to an `uint32_t` to output TTL for the address. It can be NULL if caller does\n not want to get the TTL.\n\n @retval OT_ERROR_NONE The address was read successfully.\n @retval OT_ERROR_NOT_FOUND No address record for @p aHostname in @p aResponse at @p aIndex.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse."]
7972 pub fn otDnsServiceResponseGetHostAddress(
7973 aResponse: *const otDnsServiceResponse,
7974 aHostName: *const ::std::os::raw::c_char,
7975 aIndex: u16,
7976 aAddress: *mut otIp6Address,
7977 aTtl: *mut u32,
7978 ) -> otError;
7979}
7980#[repr(C)]
7981#[derive(Debug, Copy, Clone)]
7982pub struct otDnsRecordResponse {
7983 _unused: [u8; 0],
7984}
7985#[doc = " Pointer is called when a DNS response is received for a DNS query to an arbitrary record type.\n\n Within this callback the user can use `otDnsRecordResponseGet{Item}()` functions along with the @p aResponse\n pointer to get more info about the response.\n\n The @p aResponse pointer can only be used within this callback and after returning from this function it will not\n stay valid, so the user MUST NOT retain the @p aResponse pointer for later use.\n\n @param[in] aError The result of the DNS transaction.\n @param[in] aResponse A pointer to the response (it is always non-NULL).\n @param[in] aContext A pointer to application-specific context.\n\n The @p aError can have the following:\n\n - OT_ERROR_NONE A response was received successfully.\n - OT_ERROR_ABORT A DNS transaction was aborted by the stack.\n - OT_ERROR_RESPONSE_TIMEOUT No DNS response has been received within timeout."]
7986pub type otDnsRecordCallback = ::std::option::Option<
7987 unsafe extern "C" fn(
7988 aError: otError,
7989 aResponse: *const otDnsRecordResponse,
7990 aContext: *mut ::std::os::raw::c_void,
7991 ),
7992>;
7993#[doc = "< Answer section."]
7994pub const OT_DNS_SECTION_ANSWER: otDnsRecordSection = 0;
7995#[doc = "< Authority section."]
7996pub const OT_DNS_SECTION_AUTHORITY: otDnsRecordSection = 1;
7997#[doc = "< Additional section."]
7998pub const OT_DNS_SECTION_ADDITIONAL: otDnsRecordSection = 2;
7999#[doc = " Represents a section in a DNS query/response message."]
8000pub type otDnsRecordSection = ::std::os::raw::c_uint;
8001#[doc = " Represents info for a record in an `otDnsRecordResponse`.\n\n This struct is used as input to `otDnsRecordResponseGetRecordInfo()`."]
8002#[repr(C)]
8003#[derive(Debug, Copy, Clone)]
8004pub struct otDnsRecordInfo {
8005 #[doc = "< Buffer to output the name (MUST NOT be NULL)."]
8006 pub mNameBuffer: *mut ::std::os::raw::c_char,
8007 #[doc = "< Size of `mNameBuffer`."]
8008 pub mNameBufferSize: u16,
8009 #[doc = "< The record type."]
8010 pub mRecordType: u16,
8011 #[doc = "< The record data length (in bytes)."]
8012 pub mRecordLength: u16,
8013 #[doc = "< Record TTL (in seconds)."]
8014 pub mTtl: u32,
8015 #[doc = "< Buffer to output the data (Can be NULL if data not needed)."]
8016 pub mDataBuffer: *mut u8,
8017 #[doc = "< On input, size of `mDataBuffer`. On output number of bytes written."]
8018 pub mDataBufferSize: u16,
8019 #[doc = "< Indicates the section of the record."]
8020 pub mSection: otDnsRecordSection,
8021}
8022impl Default for otDnsRecordInfo {
8023 fn default() -> Self {
8024 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8025 unsafe {
8026 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8027 s.assume_init()
8028 }
8029 }
8030}
8031unsafe extern "C" {
8032 #[doc = " Sends a DNS query for a given record type and name.\n\n Requires `OPENTHREAD_CONFIG_DNS_CLIENT_ARBITRARY_RECORD_QUERY_ENABLE`.\n\n The @p aConfig can be NULL. In this case the default config (from `otDnsClientGetDefaultConfig()`) will be used as\n the config for this query. In a non-NULL @p aConfig, some of the fields can be left unspecified (value zero). The\n unspecified fields are then replaced by the values from the default config.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRecordType The resource record type to query.\n @param[in] aFirstLabel The first label of the name to be queried (can be NULL if not needed).\n @param[in] aNextLabels The next labels of the name to be queried (MUST NOT be NULL).\n @param[in] aCallback A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information used when @p aCallback is invoked.\n @param[in] aConfig A pointer to the config to use for this query.\n\n @retval OT_ERROR_NONE Query sent successfully. @p aCallback will be invoked to report the outcome.\n @retval OT_ERROR_NO_BUFS Insufficient buffer to prepare and send query.\n @retval OT_ERROR_INVALID_STATE Cannot send query since Thread interface is not up."]
8033 pub fn otDnsClientQueryRecord(
8034 aInstance: *mut otInstance,
8035 aRecordType: u16,
8036 aFirstLabel: *const ::std::os::raw::c_char,
8037 aNextLabels: *const ::std::os::raw::c_char,
8038 aCallback: otDnsRecordCallback,
8039 aContext: *mut ::std::os::raw::c_void,
8040 aConfig: *const otDnsQueryConfig,
8041 ) -> otError;
8042}
8043unsafe extern "C" {
8044 #[doc = " Gets the query name associated with a record query DNS response.\n\n MUST only be used from `otDnsRecordCallback`.\n\n @param[in] aResponse A pointer to the response.\n @param[out] aNameBuffer A buffer to char array to output the full query name (MUST NOT be NULL).\n @param[in] aNameBufferSize The size of @p aNameBuffer.\n\n @retval OT_ERROR_NONE The full query name was read successfully.\n @retval OT_ERROR_NO_BUFS The name does not fit in @p aNameBuffer."]
8045 pub fn otDnsRecordResponseGetQueryName(
8046 aResponse: *const otDnsRecordResponse,
8047 aNameBuffer: *mut ::std::os::raw::c_char,
8048 aNameBufferSize: u16,
8049 ) -> otError;
8050}
8051unsafe extern "C" {
8052 #[doc = " Reads the records from a DNS query response.\n\n MUST only be used from `otDnsRecordCallback`.\n\n The response may include multiple records. @p aIndex can be used to iterate through the list. Index zero gets the\n first record and so on. When we reach the end of the list, `OT_ERROR_NOT_FOUND` is returned.\n\n Upon successful retrieval (`OT_ERROR_NONE`):\n - `mRecordLength` is set to the actual length of the record's data.\n - The data is copied into `mDataBuffer` (if not `NULL`) up to its capacity specified by `mDataBufferSize`.\n - `mDataBufferSize` is then updated to reflect the number of bytes actually written into `mDataBuffer`.\n\n If the retrieved record type is NS, CNAME, SOA, PTR, MX, RP, AFSDB, RT, PX, SRV, KX, DNAME, or NSEC, the record\n data in the received response contains a DNS name which may use DNS name compression. For these specific record\n types, the record data is first decompressed such that it contains the full uncompressed DNS name. This decompressed\n data is then provided in `mDataBuffer`, and `mRecordDataLength` will indicate the length of this decompressed data.\n For all other record types, the record data is read and provided as it appears in the received response message.\n\n @param[in] aResponse A pointer to the response.\n @param[in] aIndex The record index to retrieve.\n @param[out] aRecordInfo A pointer to a `otDnsRecordInfo` to populate with read record info.\n\n @retval OT_ERROR_NONE The record was read successfully.\n @retval OT_ERROR_NOT_FOUND No record in @p aResponse at @p aIndex.\n @retval OT_ERROR_PARSE Could not parse the records in the @p aResponse.\n @retval OT_ERROR_NO_BUFS The record name does not fit in the provided `mNameBufferSize` in @p aRecordInfo, or\n failed to allocate buffer to decompress a compressed DNS name."]
8053 pub fn otDnsRecordResponseGetRecordInfo(
8054 aResponse: *const otDnsRecordResponse,
8055 aIndex: u16,
8056 aRecordInfo: *mut otDnsRecordInfo,
8057 ) -> otError;
8058}
8059#[doc = " Is called when a DNS-SD query subscribes one of:\n 1. a service name.\n 2. a service instance name.\n 3. a host name.\n\n The DNS-SD query implementation is responsible for identifying what @p aFullName is.\n If @p aFullName is a service name or service instance name, the DNS-SD query implementation should discover\n corresponding service instance information and notify the DNS-SD server using\n `otDnssdQueryHandleDiscoveredServiceInstance`.\n If @p aFullName is a host name, the DNS-SD query implementation should\n discover the host information and notify the DNS-SD server using `otDnssdQueryHandleDiscoveredHost`.\n\n @note There can be multiple subscription to the same name. DNS-SD query implementation should record the number of\n active subscriptions and stop notifying when there is no active subscription for @p aFullName.\n\n @param[in] aContext A pointer to the application-specific context.\n @param[in] aFullName The null-terminated full service name (e.g. \"_ipps._tcp.default.service.arpa.\"),\n or full service instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\"),\n or full host name (e.g. \"ot-host.default.service.arpa.\").\n\n @sa otDnssdQueryHandleDiscoveredServiceInstance\n @sa otDnssdQueryHandleDiscoveredHost"]
8060pub type otDnssdQuerySubscribeCallback = ::std::option::Option<
8061 unsafe extern "C" fn(
8062 aContext: *mut ::std::os::raw::c_void,
8063 aFullName: *const ::std::os::raw::c_char,
8064 ),
8065>;
8066#[doc = " Is called when a DNS-SD query unsubscribes one of:\n 1. a service name.\n 2. a service instance name.\n 3. a host name.\n\n The DNS-SD query implementation is responsible for identifying what @p aFullName is.\n\n @note There can be multiple subscription to the same name. DNS-SD query implementation should record the number of\n active subscriptions and stop notifying when there is no active subscription for @p aFullName.\n\n @param[in] aContext A pointer to the application-specific context.\n @param[in] aFullName The null-terminated full service name (e.g. \"_ipps._tcp.default.service.arpa.\"), or\n full service instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
8067pub type otDnssdQueryUnsubscribeCallback = ::std::option::Option<
8068 unsafe extern "C" fn(
8069 aContext: *mut ::std::os::raw::c_void,
8070 aFullName: *const ::std::os::raw::c_char,
8071 ),
8072>;
8073#[doc = " This opaque type represents a DNS-SD query."]
8074pub type otDnssdQuery = ::std::os::raw::c_void;
8075#[doc = " Represents information of a discovered service instance for a DNS-SD query."]
8076#[repr(C)]
8077#[derive(Debug, Copy, Clone)]
8078pub struct otDnssdServiceInstanceInfo {
8079 #[doc = "< Full instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
8080 pub mFullName: *const ::std::os::raw::c_char,
8081 #[doc = "< Host name (e.g. \"ot-host.default.service.arpa.\")."]
8082 pub mHostName: *const ::std::os::raw::c_char,
8083 #[doc = "< Number of host IPv6 addresses."]
8084 pub mAddressNum: u8,
8085 #[doc = "< Host IPv6 addresses."]
8086 pub mAddresses: *const otIp6Address,
8087 #[doc = "< Service port."]
8088 pub mPort: u16,
8089 #[doc = "< Service priority."]
8090 pub mPriority: u16,
8091 #[doc = "< Service weight."]
8092 pub mWeight: u16,
8093 #[doc = "< Service TXT RDATA length."]
8094 pub mTxtLength: u16,
8095 #[doc = "< Service TXT RDATA."]
8096 pub mTxtData: *const u8,
8097 #[doc = "< Service TTL (in seconds)."]
8098 pub mTtl: u32,
8099}
8100impl Default for otDnssdServiceInstanceInfo {
8101 fn default() -> Self {
8102 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8103 unsafe {
8104 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8105 s.assume_init()
8106 }
8107 }
8108}
8109#[doc = " Represents information of a discovered host for a DNS-SD query."]
8110#[repr(C)]
8111#[derive(Debug, Copy, Clone)]
8112pub struct otDnssdHostInfo {
8113 #[doc = "< Number of host IPv6 addresses."]
8114 pub mAddressNum: u8,
8115 #[doc = "< Host IPv6 addresses."]
8116 pub mAddresses: *const otIp6Address,
8117 #[doc = "< Service TTL (in seconds)."]
8118 pub mTtl: u32,
8119}
8120impl Default for otDnssdHostInfo {
8121 fn default() -> Self {
8122 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8123 unsafe {
8124 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8125 s.assume_init()
8126 }
8127 }
8128}
8129#[doc = "< Service type unspecified."]
8130pub const OT_DNSSD_QUERY_TYPE_NONE: otDnssdQueryType = 0;
8131#[doc = "< Service type browse service."]
8132pub const OT_DNSSD_QUERY_TYPE_BROWSE: otDnssdQueryType = 1;
8133#[doc = "< Service type resolve service instance."]
8134pub const OT_DNSSD_QUERY_TYPE_RESOLVE: otDnssdQueryType = 2;
8135#[doc = "< Service type resolve hostname."]
8136pub const OT_DNSSD_QUERY_TYPE_RESOLVE_HOST: otDnssdQueryType = 3;
8137#[doc = " Specifies a DNS-SD query type."]
8138pub type otDnssdQueryType = ::std::os::raw::c_uint;
8139#[doc = " Represents the count of queries, responses, failures handled by upstream DNS server.\n\n Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`."]
8140#[repr(C)]
8141#[derive(Debug, Default, Copy, Clone)]
8142pub struct otUpstreamDnsCounters {
8143 #[doc = "< The number of queries forwarded."]
8144 pub mQueries: u32,
8145 #[doc = "< The number of responses forwarded."]
8146 pub mResponses: u32,
8147 #[doc = "< The number of upstream DNS failures."]
8148 pub mFailures: u32,
8149}
8150#[doc = " Contains the counters of DNS-SD server."]
8151#[repr(C)]
8152#[derive(Debug, Default, Copy, Clone)]
8153pub struct otDnssdCounters {
8154 #[doc = "< The number of successful responses."]
8155 pub mSuccessResponse: u32,
8156 #[doc = "< The number of server failure responses."]
8157 pub mServerFailureResponse: u32,
8158 #[doc = "< The number of format error responses."]
8159 pub mFormatErrorResponse: u32,
8160 #[doc = "< The number of name error responses."]
8161 pub mNameErrorResponse: u32,
8162 #[doc = "< The number of 'not implemented' responses."]
8163 pub mNotImplementedResponse: u32,
8164 #[doc = "< The number of other responses."]
8165 pub mOtherResponse: u32,
8166 #[doc = "< The number of queries resolved by the local SRP server."]
8167 pub mResolvedBySrp: u32,
8168 #[doc = "< The number of queries, responses,\n< failures handled by upstream DNS server."]
8169 pub mUpstreamDnsCounters: otUpstreamDnsCounters,
8170}
8171unsafe extern "C" {
8172 #[doc = " Sets DNS-SD server query callbacks.\n\n The DNS-SD server calls @p aSubscribe to subscribe to a service or service instance to resolve a DNS-SD query and @p\n aUnsubscribe to unsubscribe when the query is resolved or timeout.\n\n @note @p aSubscribe and @p aUnsubscribe must be both set or unset.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSubscribe A pointer to the callback function to subscribe a service or service instance.\n @param[in] aUnsubscribe A pointer to the callback function to unsubscribe a service or service instance.\n @param[in] aContext A pointer to the application-specific context."]
8173 pub fn otDnssdQuerySetCallbacks(
8174 aInstance: *mut otInstance,
8175 aSubscribe: otDnssdQuerySubscribeCallback,
8176 aUnsubscribe: otDnssdQueryUnsubscribeCallback,
8177 aContext: *mut ::std::os::raw::c_void,
8178 );
8179}
8180unsafe extern "C" {
8181 #[doc = " Notifies a discovered service instance.\n\n The external query resolver (e.g. Discovery Proxy) should call this function to notify OpenThread core of the\n subscribed services or service instances.\n\n @note @p aInstanceInfo must not contain unspecified or link-local or loop-back or multicast IP addresses.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aServiceFullName The null-terminated full service name.\n @param[in] aInstanceInfo A pointer to the discovered service instance information."]
8182 pub fn otDnssdQueryHandleDiscoveredServiceInstance(
8183 aInstance: *mut otInstance,
8184 aServiceFullName: *const ::std::os::raw::c_char,
8185 aInstanceInfo: *mut otDnssdServiceInstanceInfo,
8186 );
8187}
8188unsafe extern "C" {
8189 #[doc = " Notifies a discovered host.\n\n The external query resolver (e.g. Discovery Proxy) should call this function to notify OpenThread core of the\n subscribed hosts.\n\n @note @p aHostInfo must not contain unspecified or link-local or loop-back or multicast IP addresses.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aHostFullName The null-terminated full host name.\n @param[in] aHostInfo A pointer to the discovered service instance information."]
8190 pub fn otDnssdQueryHandleDiscoveredHost(
8191 aInstance: *mut otInstance,
8192 aHostFullName: *const ::std::os::raw::c_char,
8193 aHostInfo: *mut otDnssdHostInfo,
8194 );
8195}
8196unsafe extern "C" {
8197 #[doc = " Acquires the next query in the DNS-SD server.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aQuery The query pointer. Pass NULL to get the first query.\n\n @returns A pointer to the query or NULL if no more queries."]
8198 pub fn otDnssdGetNextQuery(
8199 aInstance: *mut otInstance,
8200 aQuery: *const otDnssdQuery,
8201 ) -> *const otDnssdQuery;
8202}
8203unsafe extern "C" {
8204 #[doc = " Acquires the DNS-SD query type and name for a specific query.\n\n @param[in] aQuery The query pointer acquired from `otDnssdGetNextQuery`.\n @param[out] aNameOutput The name output buffer, which should be `OT_DNS_MAX_NAME_SIZE` bytes long.\n\n @returns The DNS-SD query type."]
8205 pub fn otDnssdGetQueryTypeAndName(
8206 aQuery: *const otDnssdQuery,
8207 aNameOutput: *mut [::std::os::raw::c_char; 255usize],
8208 ) -> otDnssdQueryType;
8209}
8210unsafe extern "C" {
8211 #[doc = " Returns the counters of the DNS-SD server.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns A pointer to the counters of the DNS-SD server."]
8212 pub fn otDnssdGetCounters(aInstance: *mut otInstance) -> *const otDnssdCounters;
8213}
8214unsafe extern "C" {
8215 #[doc = " Enable or disable forwarding DNS queries to platform DNS upstream API.\n\n Available when `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled A boolean to enable/disable forwarding DNS queries to upstream.\n\n @sa otPlatDnsStartUpstreamQuery\n @sa otPlatDnsCancelUpstreamQuery\n @sa otPlatDnsUpstreamQueryDone"]
8216 pub fn otDnssdUpstreamQuerySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8217}
8218unsafe extern "C" {
8219 #[doc = " Returns whether the DNSSD server will forward DNS queries to the platform DNS upstream API.\n\n Available when `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @retval TRUE If the DNSSD server will forward DNS queries.\n @retval FALSE If the DNSSD server will not forward DNS queries.\n\n @sa otDnssdUpstreamQuerySetEnabled"]
8220 pub fn otDnssdUpstreamQueryIsEnabled(aInstance: *mut otInstance) -> bool;
8221}
8222unsafe extern "C" {
8223 #[doc = " @note This API is deprecated and use of it is discouraged."]
8224 pub fn otHeapCAlloc(aCount: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
8225}
8226unsafe extern "C" {
8227 #[doc = " @note This API is deprecated and use of it is discouraged."]
8228 pub fn otHeapFree(aPointer: *mut ::std::os::raw::c_void);
8229}
8230#[doc = " A callback function pointer called when the multi-AIL detection state changes.\n\n This callback function is invoked by the OpenThread stack whenever the detector determines a change in whether\n Border Routers on the Thread mesh might be connected to different Adjacent Infrastructure Links (AILs).\n\n See `otBorderRoutingIsMultiAilDetected()` for more details.\n\n @param[in] aDetected `TRUE` if multiple AILs are now detected, `FALSE` otherwise.\n @param[in] aContext A pointer to arbitrary context information provided when the callback was registered\n using `otBorderRoutingSetMultiAilCallback()`."]
8231pub type otBorderRoutingMultiAilCallback = ::std::option::Option<
8232 unsafe extern "C" fn(aDetected: bool, aContext: *mut ::std::os::raw::c_void),
8233>;
8234unsafe extern "C" {
8235 #[doc = " Enables or disables the Multi-AIL Detector.\n\n If `OPENTHREAD_CONFIG_BORDER_ROUTING_MULTI_AIL_DETECTION_AUTO_ENABLE_MODE` is enabled, the detector is enabled\n by default and starts running when the infra-if network is initialized and becomes active (running).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aEnable TRUE to enable the detector, FALSE to disable."]
8236 pub fn otBorderRoutingSetMultiAilDetectionEnabled(aInstance: *mut otInstance, aEnable: bool);
8237}
8238unsafe extern "C" {
8239 #[doc = " Checks if the Multi-AIL Detector is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @retval TRUE If the detector is enabled.\n @retval FALSE If the detector is disabled."]
8240 pub fn otBorderRoutingIsMultiAilDetectionEnabled(aInstance: *mut otInstance) -> bool;
8241}
8242unsafe extern "C" {
8243 #[doc = " Checks if the Multi-AIL Detector is running.\n\n The detector runs when it is enabled and the infrastructure interface is also active.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @retval TRUE If the detector is running.\n @retval FALSE If the detector is not running."]
8244 pub fn otBorderRoutingIsMultiAilDetectionRunning(aInstance: *mut otInstance) -> bool;
8245}
8246unsafe extern "C" {
8247 #[doc = " Gets the current detected state regarding multiple Adjacent Infrastructure Links (AILs).\n\n It returns whether the detector currently believes that Border Routers (BRs) on the Thread mesh may be connected to\n different AILs.\n\n The detection mechanism operates as follows: The detector monitors the number of peer BRs listed in the\n Thread Network Data (see `otBorderRoutingCountPeerBrs()`) and compares this count with the number of peer BRs\n discovered by processing received Router Advertisement (RA) messages on its connected AIL. If the count derived from\n Network Data consistently exceeds the count derived from RAs for a detection duration of 10 minutes, it concludes\n that BRs are likely connected to different AILs. To clear state a shorter window of 1 minute is used.\n\n The detection window of 10 minutes helps to avoid false positives due to transient changes. The detector uses\n 200 seconds for reachability checks of peer BRs (sending Neighbor Solicitation). Stale Network Data entries are\n also expected to age out within a few minutes. So a 10-minute detection time accommodates both cases.\n\n While generally effective, this detection mechanism may get less reliable in scenarios with a large number of\n BRs, particularly exceeding ten. This is related to the \"Network Data Publisher\" mechanism, where BRs might refrain\n from publishing their external route information in the Network Data to conserve its limited size, potentially\n skewing the Network Data BR count.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @retval TRUE Has detected that BRs are likely connected to multiple AILs.\n @retval FALSE Has not detected (or no longer detects) that BRs are connected to multiple AILs."]
8248 pub fn otBorderRoutingIsMultiAilDetected(aInstance: *mut otInstance) -> bool;
8249}
8250unsafe extern "C" {
8251 #[doc = " Sets a callback function to be notified of changes in the multi-AIL detection state.\n\n Subsequent calls to this function will overwrite the previous callback setting. Using `NULL` for @p aCallback will\n disable the callback.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aCallback A pointer to the function (`otBorderRoutingMultiAilCallback`) to be called\n upon state changes, or `NULL` to unregister a previously set callback.\n @param[in] aContext A pointer to application-specific context that will be passed back\n in the `aCallback` function. This can be `NULL` if no context is needed."]
8252 pub fn otBorderRoutingSetMultiAilCallback(
8253 aInstance: *mut otInstance,
8254 aCallback: otBorderRoutingMultiAilCallback,
8255 aContext: *mut ::std::os::raw::c_void,
8256 );
8257}
8258#[doc = " Represents an iterator to iterate through the Border Router's discovered prefix table.\n\n The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be\n accessed or used by caller.\n\n Before using an iterator, it MUST be initialized using `otBorderRoutingPrefixTableInitIterator()`."]
8259#[repr(C)]
8260#[derive(Debug, Copy, Clone)]
8261pub struct otBorderRoutingPrefixTableIterator {
8262 pub mPtr1: *const ::std::os::raw::c_void,
8263 pub mPtr2: *const ::std::os::raw::c_void,
8264 pub mData0: u32,
8265 pub mData1: u32,
8266 pub mData2: u8,
8267 pub mData3: u8,
8268}
8269impl Default for otBorderRoutingPrefixTableIterator {
8270 fn default() -> Self {
8271 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8272 unsafe {
8273 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8274 s.assume_init()
8275 }
8276 }
8277}
8278#[doc = " Represents a discovered router on the infrastructure link.\n\n The `mIsPeerBr` field requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`. Routing Manager\n determines whether the router is a peer BR (connected to the same Thread mesh network) by comparing its advertised\n PIO/RIO prefixes with the entries in the Thread Network Data. While this method is generally effective, it may not\n be 100% accurate in all scenarios, so the `mIsPeerBr` flag should be used with caution."]
8279#[repr(C)]
8280#[derive(Copy, Clone)]
8281pub struct otBorderRoutingRouterEntry {
8282 #[doc = "< IPv6 address of the router."]
8283 pub mAddress: otIp6Address,
8284 #[doc = "< Milliseconds since last update (any message rx) from this router."]
8285 pub mMsecSinceLastUpdate: u32,
8286 #[doc = "< The router's age in seconds (duration since its first discovery)."]
8287 pub mAge: u32,
8288 pub _bitfield_align_1: [u8; 0],
8289 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8290 pub __bindgen_padding_0: [u8; 3usize],
8291}
8292impl Default for otBorderRoutingRouterEntry {
8293 fn default() -> Self {
8294 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8295 unsafe {
8296 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8297 s.assume_init()
8298 }
8299 }
8300}
8301impl otBorderRoutingRouterEntry {
8302 #[inline]
8303 pub fn mManagedAddressConfigFlag(&self) -> bool {
8304 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
8305 }
8306 #[inline]
8307 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
8308 unsafe {
8309 let val: u8 = ::std::mem::transmute(val);
8310 self._bitfield_1.set(0usize, 1u8, val as u64)
8311 }
8312 }
8313 #[inline]
8314 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
8315 unsafe {
8316 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8317 ::std::ptr::addr_of!((*this)._bitfield_1),
8318 0usize,
8319 1u8,
8320 ) as u8)
8321 }
8322 }
8323 #[inline]
8324 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
8325 unsafe {
8326 let val: u8 = ::std::mem::transmute(val);
8327 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8328 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8329 0usize,
8330 1u8,
8331 val as u64,
8332 )
8333 }
8334 }
8335 #[inline]
8336 pub fn mOtherConfigFlag(&self) -> bool {
8337 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
8338 }
8339 #[inline]
8340 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
8341 unsafe {
8342 let val: u8 = ::std::mem::transmute(val);
8343 self._bitfield_1.set(1usize, 1u8, val as u64)
8344 }
8345 }
8346 #[inline]
8347 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
8348 unsafe {
8349 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8350 ::std::ptr::addr_of!((*this)._bitfield_1),
8351 1usize,
8352 1u8,
8353 ) as u8)
8354 }
8355 }
8356 #[inline]
8357 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
8358 unsafe {
8359 let val: u8 = ::std::mem::transmute(val);
8360 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8361 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8362 1usize,
8363 1u8,
8364 val as u64,
8365 )
8366 }
8367 }
8368 #[inline]
8369 pub fn mSnacRouterFlag(&self) -> bool {
8370 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
8371 }
8372 #[inline]
8373 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
8374 unsafe {
8375 let val: u8 = ::std::mem::transmute(val);
8376 self._bitfield_1.set(2usize, 1u8, val as u64)
8377 }
8378 }
8379 #[inline]
8380 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
8381 unsafe {
8382 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8383 ::std::ptr::addr_of!((*this)._bitfield_1),
8384 2usize,
8385 1u8,
8386 ) as u8)
8387 }
8388 }
8389 #[inline]
8390 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
8391 unsafe {
8392 let val: u8 = ::std::mem::transmute(val);
8393 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8394 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8395 2usize,
8396 1u8,
8397 val as u64,
8398 )
8399 }
8400 }
8401 #[inline]
8402 pub fn mIsLocalDevice(&self) -> bool {
8403 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
8404 }
8405 #[inline]
8406 pub fn set_mIsLocalDevice(&mut self, val: bool) {
8407 unsafe {
8408 let val: u8 = ::std::mem::transmute(val);
8409 self._bitfield_1.set(3usize, 1u8, val as u64)
8410 }
8411 }
8412 #[inline]
8413 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
8414 unsafe {
8415 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8416 ::std::ptr::addr_of!((*this)._bitfield_1),
8417 3usize,
8418 1u8,
8419 ) as u8)
8420 }
8421 }
8422 #[inline]
8423 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
8424 unsafe {
8425 let val: u8 = ::std::mem::transmute(val);
8426 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8427 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8428 3usize,
8429 1u8,
8430 val as u64,
8431 )
8432 }
8433 }
8434 #[inline]
8435 pub fn mIsReachable(&self) -> bool {
8436 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
8437 }
8438 #[inline]
8439 pub fn set_mIsReachable(&mut self, val: bool) {
8440 unsafe {
8441 let val: u8 = ::std::mem::transmute(val);
8442 self._bitfield_1.set(4usize, 1u8, val as u64)
8443 }
8444 }
8445 #[inline]
8446 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
8447 unsafe {
8448 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8449 ::std::ptr::addr_of!((*this)._bitfield_1),
8450 4usize,
8451 1u8,
8452 ) as u8)
8453 }
8454 }
8455 #[inline]
8456 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
8457 unsafe {
8458 let val: u8 = ::std::mem::transmute(val);
8459 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8460 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8461 4usize,
8462 1u8,
8463 val as u64,
8464 )
8465 }
8466 }
8467 #[inline]
8468 pub fn mIsPeerBr(&self) -> bool {
8469 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
8470 }
8471 #[inline]
8472 pub fn set_mIsPeerBr(&mut self, val: bool) {
8473 unsafe {
8474 let val: u8 = ::std::mem::transmute(val);
8475 self._bitfield_1.set(5usize, 1u8, val as u64)
8476 }
8477 }
8478 #[inline]
8479 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
8480 unsafe {
8481 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8482 ::std::ptr::addr_of!((*this)._bitfield_1),
8483 5usize,
8484 1u8,
8485 ) as u8)
8486 }
8487 }
8488 #[inline]
8489 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
8490 unsafe {
8491 let val: u8 = ::std::mem::transmute(val);
8492 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8493 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8494 5usize,
8495 1u8,
8496 val as u64,
8497 )
8498 }
8499 }
8500 #[inline]
8501 pub fn new_bitfield_1(
8502 mManagedAddressConfigFlag: bool,
8503 mOtherConfigFlag: bool,
8504 mSnacRouterFlag: bool,
8505 mIsLocalDevice: bool,
8506 mIsReachable: bool,
8507 mIsPeerBr: bool,
8508 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8509 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8510 __bindgen_bitfield_unit.set(0usize, 1u8, {
8511 let mManagedAddressConfigFlag: u8 =
8512 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
8513 mManagedAddressConfigFlag as u64
8514 });
8515 __bindgen_bitfield_unit.set(1usize, 1u8, {
8516 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
8517 mOtherConfigFlag as u64
8518 });
8519 __bindgen_bitfield_unit.set(2usize, 1u8, {
8520 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
8521 mSnacRouterFlag as u64
8522 });
8523 __bindgen_bitfield_unit.set(3usize, 1u8, {
8524 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
8525 mIsLocalDevice as u64
8526 });
8527 __bindgen_bitfield_unit.set(4usize, 1u8, {
8528 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
8529 mIsReachable as u64
8530 });
8531 __bindgen_bitfield_unit.set(5usize, 1u8, {
8532 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
8533 mIsPeerBr as u64
8534 });
8535 __bindgen_bitfield_unit
8536 }
8537}
8538#[doc = " Represents an entry from the discovered prefix table.\n\n The entries in the discovered table track the Prefix/Route Info Options in the received Router Advertisement messages\n from other routers on the infrastructure link."]
8539#[repr(C)]
8540#[derive(Copy, Clone)]
8541pub struct otBorderRoutingPrefixTableEntry {
8542 #[doc = "< Information about the router advertising this prefix."]
8543 pub mRouter: otBorderRoutingRouterEntry,
8544 #[doc = "< The discovered IPv6 prefix."]
8545 pub mPrefix: otIp6Prefix,
8546 #[doc = "< Indicates whether the prefix is on-link or route prefix."]
8547 pub mIsOnLink: bool,
8548 #[doc = "< Milliseconds since last update of this prefix."]
8549 pub mMsecSinceLastUpdate: u32,
8550 #[doc = "< Valid lifetime of the prefix (in seconds)."]
8551 pub mValidLifetime: u32,
8552 #[doc = "< Route preference when `mIsOnlink` is false."]
8553 pub mRoutePreference: otRoutePreference,
8554 #[doc = "< Preferred lifetime of the on-link prefix when `mIsOnLink`."]
8555 pub mPreferredLifetime: u32,
8556}
8557impl Default for otBorderRoutingPrefixTableEntry {
8558 fn default() -> Self {
8559 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8560 unsafe {
8561 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8562 s.assume_init()
8563 }
8564 }
8565}
8566#[doc = " Represents an entry from the discovered NAT64 prefix table.\n\n The entries in the discovered table track the NAT64 Prefix Options in the received Router Advertisement messages from\n other routers on the infrastructure link."]
8567#[repr(C)]
8568#[derive(Copy, Clone)]
8569pub struct otBorderRoutingNat64PrefixEntry {
8570 #[doc = "< Information about the router advertising this NAT64 prefix."]
8571 pub mRouter: otBorderRoutingRouterEntry,
8572 #[doc = "< The discovered IPv6 prefix."]
8573 pub mPrefix: otIp6Prefix,
8574 #[doc = "< Milliseconds since last update of this prefix."]
8575 pub mMsecSinceLastUpdate: u32,
8576 #[doc = "< Lifetime of the prefix (in seconds)."]
8577 pub mLifetime: u32,
8578}
8579impl Default for otBorderRoutingNat64PrefixEntry {
8580 fn default() -> Self {
8581 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8582 unsafe {
8583 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8584 s.assume_init()
8585 }
8586 }
8587}
8588#[doc = " Represents a discovered Recursive DNS Server (RDNSS) address entry.\n\n Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from\n routers on infrastructure link."]
8589#[repr(C)]
8590#[derive(Copy, Clone)]
8591pub struct otBorderRoutingRdnssAddrEntry {
8592 #[doc = "< Information about the router advertising this address."]
8593 pub mRouter: otBorderRoutingRouterEntry,
8594 #[doc = "< The DNS Server IPv6 address."]
8595 pub mAddress: otIp6Address,
8596 #[doc = "< Milliseconds since last update of this address."]
8597 pub mMsecSinceLastUpdate: u32,
8598 #[doc = "< Lifetime of the address (in seconds)."]
8599 pub mLifetime: u32,
8600}
8601impl Default for otBorderRoutingRdnssAddrEntry {
8602 fn default() -> Self {
8603 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8604 unsafe {
8605 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8606 s.assume_init()
8607 }
8608 }
8609}
8610#[doc = " Represents information about a peer Border Router found in the Network Data."]
8611#[repr(C)]
8612#[derive(Debug, Default, Copy, Clone)]
8613pub struct otBorderRoutingPeerBorderRouterEntry {
8614 #[doc = "< The RLOC16 of BR."]
8615 pub mRloc16: u16,
8616 #[doc = "< Seconds since the BR appeared in the Network Data."]
8617 pub mAge: u32,
8618}
8619#[doc = " Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL)."]
8620#[repr(C)]
8621#[derive(Copy, Clone)]
8622pub struct otBorderRoutingIfAddrEntry {
8623 #[doc = "< The IPv6 address."]
8624 pub mAddress: otIp6Address,
8625 #[doc = "< Seconds since the last RA was sent from this BR using this address."]
8626 pub mSecSinceLastUse: u32,
8627}
8628impl Default for otBorderRoutingIfAddrEntry {
8629 fn default() -> Self {
8630 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8631 unsafe {
8632 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8633 s.assume_init()
8634 }
8635 }
8636}
8637#[doc = " Represents a group of data of platform-generated RA messages processed."]
8638#[repr(C)]
8639#[derive(Debug, Default, Copy, Clone)]
8640pub struct otPdProcessedRaInfo {
8641 #[doc = "< The number of platform generated RA handled by ProcessPlatformGeneratedRa."]
8642 pub mNumPlatformRaReceived: u32,
8643 #[doc = "< The number of PIO processed for adding OMR prefixes."]
8644 pub mNumPlatformPioProcessed: u32,
8645 #[doc = "< The timestamp of last processed RA message."]
8646 pub mLastPlatformRaMsec: u32,
8647}
8648#[doc = "< BR auto-generates the local OMR prefix."]
8649pub const OT_BORDER_ROUTING_OMR_CONFIG_AUTO: otBorderRoutingOmrConfig = 0;
8650#[doc = "< BR uses a given custom OMR prefix."]
8651pub const OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM: otBorderRoutingOmrConfig = 1;
8652#[doc = "< BR does not add local/PD OMR prefix in Network Data."]
8653pub const OT_BORDER_ROUTING_OMR_CONFIG_DISABLED: otBorderRoutingOmrConfig = 2;
8654#[doc = " Represents the configuration options related to the OMR prefix.\n\n This is used in `otBorderRoutingSetOmrConfig()` to offer manual administration options to explicitly configure\n the OMR prefix or to disable it."]
8655pub type otBorderRoutingOmrConfig = ::std::os::raw::c_uint;
8656#[doc = "< Routing Manager is uninitialized."]
8657pub const OT_BORDER_ROUTING_STATE_UNINITIALIZED: otBorderRoutingState = 0;
8658#[doc = "< Routing Manager is initialized but disabled."]
8659pub const OT_BORDER_ROUTING_STATE_DISABLED: otBorderRoutingState = 1;
8660#[doc = "< Routing Manager in initialized and enabled but currently stopped."]
8661pub const OT_BORDER_ROUTING_STATE_STOPPED: otBorderRoutingState = 2;
8662#[doc = "< Routing Manager is initialized, enabled, and running."]
8663pub const OT_BORDER_ROUTING_STATE_RUNNING: otBorderRoutingState = 3;
8664#[doc = " Represents the state of Border Routing Manager."]
8665pub type otBorderRoutingState = ::std::os::raw::c_uint;
8666#[doc = "< DHCPv6 PD is disabled on the border router."]
8667pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED: otBorderRoutingDhcp6PdState = 0;
8668#[doc = "< DHCPv6 PD in enabled but won't try to request and publish a prefix."]
8669pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED: otBorderRoutingDhcp6PdState = 1;
8670#[doc = "< DHCPv6 PD is enabled and will try to request and publish a prefix."]
8671pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING: otBorderRoutingDhcp6PdState = 2;
8672#[doc = "< DHCPv6 PD is idle; Higher-prf prefix published by other BRs."]
8673pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE: otBorderRoutingDhcp6PdState = 3;
8674#[doc = " This enumeration represents the state of DHCPv6 Prefix Delegation State."]
8675pub type otBorderRoutingDhcp6PdState = ::std::os::raw::c_uint;
8676unsafe extern "C" {
8677 #[doc = " Initializes the Border Routing Manager on given infrastructure interface.\n\n This function MUST be called before any other otBorderRouting* APIs.\n\n This function can also be used to re-initialize and switch the infrastructure interface index to a new one.\n Switching the interface index will trigger all components running on the previous interface (Border Routing,\n mDNS, etc) to be stopped (as if the previous if-index is no longer running) before restarting operations on the\n new interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInfraIfIndex The infrastructure interface index.\n @param[in] aInfraIfIsRunning A boolean that indicates whether the infrastructure\n\n @retval OT_ERROR_NONE Successfully started the Border Routing Manager on given infrastructure.\n\n @sa otPlatInfraIfStateChanged.\n @sa otBorderRoutingSetEnabled."]
8678 pub fn otBorderRoutingInit(
8679 aInstance: *mut otInstance,
8680 aInfraIfIndex: u32,
8681 aInfraIfIsRunning: bool,
8682 ) -> otError;
8683}
8684unsafe extern "C" {
8685 #[doc = " Gets the interface index and running state of the configured infrastructure interface.\n\n @note The running state in @p aInfraIfIsRunning reflects the Border Routing Manager's perspective. This state is set\n when `otBorderRoutingInit()` is called and is subsequently updated by the platform signaling changes via\n `otPlatInfraIfStateChanged()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aInfraIfIndex A pointer to output the interface index. MUST NOT be NULL.\n @param[out] aInfraIfIsRunning A pointer to output whether the interface is running. Can be NULL if not needed.\n\n @retval OT_ERROR_NONE Successfully retrieved the interface information.\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized.\n\n @sa otBorderRoutingInit\n @sa otPlatInfraIfStateChanged"]
8686 pub fn otBorderRoutingGetInfraIfInfo(
8687 aInstance: *mut otInstance,
8688 aInfraIfIndex: *mut u32,
8689 aInfraIfIsRunning: *mut bool,
8690 ) -> otError;
8691}
8692unsafe extern "C" {
8693 #[doc = " Enables or disables the Border Routing Manager.\n\n @note The Border Routing Manager is disabled by default.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled A boolean to enable/disable the routing manager.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully enabled/disabled the Border Routing Manager."]
8694 pub fn otBorderRoutingSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
8695}
8696unsafe extern "C" {
8697 #[doc = " Gets the current state of Border Routing Manager.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current state of Border Routing Manager."]
8698 pub fn otBorderRoutingGetState(aInstance: *mut otInstance) -> otBorderRoutingState;
8699}
8700unsafe extern "C" {
8701 #[doc = " Configures the OMR prefix handling in the Border Routing Manager.\n\n This function offers manual administration options to explicitly configure the OMR prefix or to disable it.\n\n By default, `OT_BORDER_ROUTING_OMR_CONFIG_AUTO` is used. In this mode, the Border Routing Manager automatically\n selects and manages the OMR prefix. This can involve auto-generating a local prefix or utilizing a prefix obtained\n through DHCPv6 PD (Prefix Delegation), if the feature is enabled.\n\n The `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM` option enables the use of a user-specified OMR prefix. When this option\n is selected, the @p aOmrPrefix and @p aPreference parameters are used to define the custom OMR prefix and its\n associated preference. These parameters are ignored for other configuration modes, and @p aOmrPrefix can be `NULL`.\n\n The `OT_BORDER_ROUTING_OMR_CONFIG_DISABLED` option disables the Border Routing Manager's management of the OMR\n prefix. The Routing Manager module itself will not add any local or DHCPv6 PD OMR prefixes to the Network Data.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aConfig The desired OMR configuration.\n @param[in] aOmrPrefix A pointer to the custom OMR prefix. Required only when @p aConfig is\n `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM`. Otherwise, it can be `NULL`.\n @param[in] aPreference The preference associated with the custom OMR prefix.\n\n @retval OT_ERROR_NONE The OMR configuration was successfully set to @p aConfig.\n @retval OT_ERROR_INVALID_ARGS The provided custom OMR prefix (@p aOmrPrefix) is invalid."]
8702 pub fn otBorderRoutingSetOmrConfig(
8703 aInstance: *mut otInstance,
8704 aConfig: otBorderRoutingOmrConfig,
8705 aOmrPrefix: *const otIp6Prefix,
8706 aPreference: otRoutePreference,
8707 ) -> otError;
8708}
8709unsafe extern "C" {
8710 #[doc = " Gets the current OMR prefix configuration mode.\n\n This function retrieves the current OMR configuration and, if a custom OMR prefix is configured, the custom prefix\n and its associated preference.\n\n If the caller does not require the custom OMR prefix and preference, the @p aOmrPrefix and @p aPreference parameters\n can be set to `NULL`.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aOmrPrefix A pointer to an `otIp6Prefix` to return the custom OMR prefix, if the configuration is\n `OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM`.\n @param[out] aPreference A pointer to return the preference associated with the custom OMR prefix.\n\n @return The current OMR prefix configuration mode."]
8711 pub fn otBorderRoutingGetOmrConfig(
8712 aInstance: *mut otInstance,
8713 aOmrPrefix: *mut otIp6Prefix,
8714 aPreference: *mut otRoutePreference,
8715 ) -> otBorderRoutingOmrConfig;
8716}
8717unsafe extern "C" {
8718 #[doc = " Gets the current preference used when advertising Route Info Options (RIO) in Router Advertisement\n messages sent over the infrastructure link.\n\n The RIO preference is determined as follows:\n\n - If explicitly set by user by calling `otBorderRoutingSetRouteInfoOptionPreference()`, the given preference is\n used.\n - Otherwise, it is determined based on device's current role: Medium preference when in router/leader role and\n low preference when in child role.\n\n @returns The current Route Info Option preference."]
8719 pub fn otBorderRoutingGetRouteInfoOptionPreference(
8720 aInstance: *mut otInstance,
8721 ) -> otRoutePreference;
8722}
8723unsafe extern "C" {
8724 #[doc = " Explicitly sets the preference to use when advertising Route Info Options (RIO) in Router\n Advertisement messages sent over the infrastructure link.\n\n After a call to this function, BR will use the given preference for all its advertised RIOs. The preference can be\n cleared by calling `otBorderRoutingClearRouteInfoOptionPreference()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPreference The route preference to use."]
8725 pub fn otBorderRoutingSetRouteInfoOptionPreference(
8726 aInstance: *mut otInstance,
8727 aPreference: otRoutePreference,
8728 );
8729}
8730unsafe extern "C" {
8731 #[doc = " Clears a previously set preference value for advertised Route Info Options.\n\n After a call to this function, BR will use device's role to determine the RIO preference: Medium preference when\n in router/leader role and low preference when in child role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
8732 pub fn otBorderRoutingClearRouteInfoOptionPreference(aInstance: *mut otInstance);
8733}
8734unsafe extern "C" {
8735 #[doc = " Sets additional options to append at the end of emitted Router Advertisement (RA) messages.\n\n The content of @p aOptions is copied internally, so it can be a temporary buffer (e.g., a stack allocated array).\n\n Subsequent calls to this function overwrite the previously set value.\n\n @param[in] aOptions A pointer to the encoded options. Can be `NULL` to clear.\n @param[in] aLength Number of bytes in @p aOptions.\n\n @retval OT_ERROR_NONE Successfully set the extra option bytes.\n @retval OT_ERROR_NO_BUFS Could not allocate buffer to save the buffer."]
8736 pub fn otBorderRoutingSetExtraRouterAdvertOptions(
8737 aInstance: *mut otInstance,
8738 aOptions: *const u8,
8739 aLength: u16,
8740 ) -> otError;
8741}
8742unsafe extern "C" {
8743 #[doc = " Gets the current preference used for published routes in Network Data.\n\n The preference is determined as follows:\n\n - If explicitly set by user by calling `otBorderRoutingSetRoutePreference()`, the given preference is used.\n - Otherwise, it is determined automatically by `RoutingManager` based on the device's role and link quality.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current published route preference."]
8744 pub fn otBorderRoutingGetRoutePreference(aInstance: *mut otInstance) -> otRoutePreference;
8745}
8746unsafe extern "C" {
8747 #[doc = " Explicitly sets the preference of published routes in Network Data.\n\n After a call to this function, BR will use the given preference. The preference can be cleared by calling\n `otBorderRoutingClearRoutePreference()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPreference The route preference to use."]
8748 pub fn otBorderRoutingSetRoutePreference(
8749 aInstance: *mut otInstance,
8750 aPreference: otRoutePreference,
8751 );
8752}
8753unsafe extern "C" {
8754 #[doc = " Clears a previously set preference value for published routes in Network Data.\n\n After a call to this function, BR will determine the preference automatically based on the device's role and\n link quality (to the parent when acting as end-device).\n\n @param[in] aInstance A pointer to an OpenThread instance."]
8755 pub fn otBorderRoutingClearRoutePreference(aInstance: *mut otInstance);
8756}
8757unsafe extern "C" {
8758 #[doc = " Gets the local Off-Mesh-Routable (OMR) Prefix, for example `fdfc:1ff5:1512:5622::/64`.\n\n An OMR Prefix is a randomly generated 64-bit prefix that's published in the\n Thread network if there isn't already an OMR prefix. This prefix can be reached\n from the local Wi-Fi or Ethernet network.\n\n Note: When DHCPv6 PD is enabled, the border router may publish the prefix from\n DHCPv6 PD.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to where the prefix will be output to.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully retrieved the OMR prefix.\n\n @sa otBorderRoutingGetPdOmrPrefix"]
8759 pub fn otBorderRoutingGetOmrPrefix(
8760 aInstance: *mut otInstance,
8761 aPrefix: *mut otIp6Prefix,
8762 ) -> otError;
8763}
8764unsafe extern "C" {
8765 #[doc = " Gets the DHCPv6 Prefix Delegation (PD) provided off-mesh-routable (OMR) prefix.\n\n Only mPrefix, mValidLifetime and mPreferredLifetime fields are used in the returned prefix info.\n\n `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefixInfo A pointer to where the prefix info will be output to.\n\n @retval OT_ERROR_NONE Successfully retrieved the OMR prefix.\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NOT_FOUND There are no valid PD prefix on this BR.\n\n @sa otBorderRoutingGetOmrPrefix\n @sa otPlatBorderRoutingProcessIcmp6Ra"]
8766 pub fn otBorderRoutingGetPdOmrPrefix(
8767 aInstance: *mut otInstance,
8768 aPrefixInfo: *mut otBorderRoutingPrefixTableEntry,
8769 ) -> otError;
8770}
8771unsafe extern "C" {
8772 #[doc = " Gets the data of platform generated RA message processed..\n\n `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefixInfo A pointer to where the prefix info will be output to.\n\n @retval OT_ERROR_NONE Successfully retrieved the Info.\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NOT_FOUND There are no valid Info on this BR."]
8773 pub fn otBorderRoutingGetPdProcessedRaInfo(
8774 aInstance: *mut otInstance,
8775 aPdProcessedRaInfo: *mut otPdProcessedRaInfo,
8776 ) -> otError;
8777}
8778unsafe extern "C" {
8779 #[doc = " Gets the currently favored Off-Mesh-Routable (OMR) Prefix.\n\n The favored OMR prefix can be discovered from Network Data or can be this device's local OMR prefix.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to output the favored OMR prefix.\n @param[out] aPreference A pointer to output the preference associated the favored prefix.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not running yet.\n @retval OT_ERROR_NONE Successfully retrieved the favored OMR prefix."]
8780 pub fn otBorderRoutingGetFavoredOmrPrefix(
8781 aInstance: *mut otInstance,
8782 aPrefix: *mut otIp6Prefix,
8783 aPreference: *mut otRoutePreference,
8784 ) -> otError;
8785}
8786unsafe extern "C" {
8787 #[doc = " Gets the local On-Link Prefix for the adjacent infrastructure link.\n\n The local On-Link Prefix is a 64-bit prefix that's advertised on the infrastructure link if there isn't already a\n usable on-link prefix being advertised on the link.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to where the prefix will be output to.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully retrieved the local on-link prefix."]
8788 pub fn otBorderRoutingGetOnLinkPrefix(
8789 aInstance: *mut otInstance,
8790 aPrefix: *mut otIp6Prefix,
8791 ) -> otError;
8792}
8793unsafe extern "C" {
8794 #[doc = " Gets the currently favored On-Link Prefix.\n\n The favored prefix is either a discovered on-link prefix on the infrastructure link or the local on-link prefix.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to where the prefix will be output to.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully retrieved the favored on-link prefix."]
8795 pub fn otBorderRoutingGetFavoredOnLinkPrefix(
8796 aInstance: *mut otInstance,
8797 aPrefix: *mut otIp6Prefix,
8798 ) -> otError;
8799}
8800unsafe extern "C" {
8801 #[doc = " Gets the local NAT64 Prefix of the Border Router.\n\n NAT64 Prefix might not be advertised in the Thread network.\n\n `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to where the prefix will be output to.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully retrieved the NAT64 prefix."]
8802 pub fn otBorderRoutingGetNat64Prefix(
8803 aInstance: *mut otInstance,
8804 aPrefix: *mut otIp6Prefix,
8805 ) -> otError;
8806}
8807unsafe extern "C" {
8808 #[doc = " Gets the currently favored NAT64 prefix.\n\n The favored NAT64 prefix can be discovered from infrastructure link or can be this device's local NAT64 prefix.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPrefix A pointer to output the favored NAT64 prefix.\n @param[out] aPreference A pointer to output the preference associated the favored prefix.\n\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.\n @retval OT_ERROR_NONE Successfully retrieved the favored NAT64 prefix."]
8809 pub fn otBorderRoutingGetFavoredNat64Prefix(
8810 aInstance: *mut otInstance,
8811 aPrefix: *mut otIp6Prefix,
8812 aPreference: *mut otRoutePreference,
8813 ) -> otError;
8814}
8815unsafe extern "C" {
8816 #[doc = " Initializes an `otBorderRoutingPrefixTableIterator`.\n\n An iterator MUST be initialized before it is used.\n\n An iterator can be initialized again to restart from the beginning of the table.\n\n When iterating over entries in the table, to ensure the update times `mMsecSinceLastUpdate` of entries are\n consistent, they are given relative to the time the iterator was initialized.\n\n @param[in] aInstance The OpenThread instance.\n @param[out] aIterator A pointer to the iterator to initialize."]
8817 pub fn otBorderRoutingPrefixTableInitIterator(
8818 aInstance: *mut otInstance,
8819 aIterator: *mut otBorderRoutingPrefixTableIterator,
8820 );
8821}
8822unsafe extern "C" {
8823 #[doc = " Iterates over the entries in the Border Router's discovered prefix table.\n\n Prefix entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped\n together (retrieved back-to-back).\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries in the table."]
8824 pub fn otBorderRoutingGetNextPrefixTableEntry(
8825 aInstance: *mut otInstance,
8826 aIterator: *mut otBorderRoutingPrefixTableIterator,
8827 aEntry: *mut otBorderRoutingPrefixTableEntry,
8828 ) -> otError;
8829}
8830unsafe extern "C" {
8831 #[doc = " Iterates over the discovered router entries on the infrastructure link.\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next router, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more router entries."]
8832 pub fn otBorderRoutingGetNextRouterEntry(
8833 aInstance: *mut otInstance,
8834 aIterator: *mut otBorderRoutingPrefixTableIterator,
8835 aEntry: *mut otBorderRoutingRouterEntry,
8836 ) -> otError;
8837}
8838unsafe extern "C" {
8839 #[doc = " Iterates over the peer BRs found in the Network Data.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.\n\n Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered\n to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data\n entries:\n\n - It has added at least one external route entry.\n - It has added at least one prefix entry with both the default-route and on-mesh flags set.\n - It has added at least one domain prefix (with both the domain and on-mesh flags set).\n\n The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries."]
8840 pub fn otBorderRoutingGetNextPeerBrEntry(
8841 aInstance: *mut otInstance,
8842 aIterator: *mut otBorderRoutingPrefixTableIterator,
8843 aEntry: *mut otBorderRoutingPeerBorderRouterEntry,
8844 ) -> otError;
8845}
8846unsafe extern "C" {
8847 #[doc = " Returns the number of peer BRs found in the Network Data.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.\n\n Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered\n to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data\n entries:\n\n - It has added at least one external route entry.\n - It has added at least one prefix entry with both the default-route and on-mesh flags set.\n - It has added at least one domain prefix (with both the domain and on-mesh flags set).\n\n The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.\n\n @param[in] aInstance The OpenThread instance.\n @param[out] aMinAge Pointer to an `uint32_t` to return the minimum age among all peer BRs.\n Can be NULL if the caller does not need this information.\n Age is represented as seconds since appearance of the BR entry in the Network Data.\n\n @returns The number of peer BRs."]
8848 pub fn otBorderRoutingCountPeerBrs(aInstance: *mut otInstance, aMinAge: *mut u32) -> u16;
8849}
8850unsafe extern "C" {
8851 #[doc = " Iterates over the Recursive DNS Server (RDNSS) address entries.\n\n Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from\n routers on infrastructure link.\n\n Address entries associated with the same discovered router on an infrastructure link are guaranteed to be grouped\n together (retrieved back-to-back).\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next address entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries in the table.\n @retval OT_ERROR_INVALID_ARGS The iterator is invalid (used to iterate over other entry types, e.g. prefix)."]
8852 pub fn otBorderRoutingGetNextRdnssAddrEntry(
8853 aInstance: *mut otInstance,
8854 aIterator: *mut otBorderRoutingPrefixTableIterator,
8855 aEntry: *mut otBorderRoutingRdnssAddrEntry,
8856 ) -> otError;
8857}
8858unsafe extern "C" {
8859 #[doc = " Iterates through the RA-discovered NAT64 prefix table.\n\n Requires `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE`.\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next NAT64 prefix entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries in the table.\n @retval OT_ERROR_INVALID_ARGS The iterator is invalid (used to iterate over other entry types).\n"]
8860 pub fn otBorderRoutingGetNextNat64PrefixEntry(
8861 aInstance: *mut otInstance,
8862 aIterator: *mut otBorderRoutingPrefixTableIterator,
8863 aEntry: *mut otBorderRoutingNat64PrefixEntry,
8864 ) -> otError;
8865}
8866#[doc = " Callback function pointer to notify of changes to discovered Recursive DNS Server (RDNSS) address entries.\n\n Address entries are discovered by processing the RDNSS options within received Router Advertisement messages from\n routers on infrastructure link.\n\n The `otBorderRoutingGetNextRdnssAddrEntry()` function can be used to iterate over the discovered RDNSS address\n entries.\n\n This callback is invoked when any of the following changes occur to the address entries associated with a discovered\n router:\n - A new RDNSS address is advertised by the router.\n - A previously discovered address is removed due to the router advertising it with a zero lifetime.\n - A previously discovered address has aged out (its lifetime expired without being re-advertised).\n - We determine that the router that advertised the address is now unreachable, and therefore all its associated\n entries are removed.\n\n @param[in] aContext A pointer to arbitrary context information."]
8867pub type otBorderRoutingRdnssAddrCallback =
8868 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
8869unsafe extern "C" {
8870 #[doc = " Sets the callback to be notified of changes to discovered Recursive DNS Server (RDNSS) address entries.\n\n A subsequent call to this function, replaces a previously set callback.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aCallback The callback function pointer. Can be `NULL` if no callback is required.\n @param[in] aConext An arbitrary context information (used when invoking the callback)."]
8871 pub fn otBorderRoutingSetRdnssAddrCallback(
8872 aInstance: *mut otInstance,
8873 aCallback: otBorderRoutingRdnssAddrCallback,
8874 aContext: *mut ::std::os::raw::c_void,
8875 );
8876}
8877unsafe extern "C" {
8878 #[doc = " Iterates over the infrastructure interface address entries.\n\n These are addresses used by the BR itself, for example, when sending Router Advertisements.\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next address entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries in the table.\n @retval OT_ERROR_INVALID_ARGS The iterator is invalid (used to iterate over other entry types, e.g., prefix)."]
8879 pub fn otBorderRoutingGetNextIfAddrEntry(
8880 aInstance: *mut otInstance,
8881 aIterator: *mut otBorderRoutingPrefixTableIterator,
8882 aEntry: *mut otBorderRoutingIfAddrEntry,
8883 ) -> otError;
8884}
8885unsafe extern "C" {
8886 #[doc = " Enables / Disables DHCPv6 Prefix Delegation.\n\n `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled Whether to accept platform generated RA messages."]
8887 pub fn otBorderRoutingDhcp6PdSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8888}
8889unsafe extern "C" {
8890 #[doc = " Gets the current state of DHCPv6 Prefix Delegation.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current state of DHCPv6 Prefix Delegation."]
8891 pub fn otBorderRoutingDhcp6PdGetState(
8892 aInstance: *mut otInstance,
8893 ) -> otBorderRoutingDhcp6PdState;
8894}
8895#[doc = " When the state of a DHCPv6 Prefix Delegation (PD) on the Thread interface changes, this callback notifies processes\n in the OS of this changed state.\n\n @param[in] aState The state of DHCPv6 Prefix Delegation State.\n @param[in] aContext A pointer to arbitrary context information."]
8896pub type otBorderRoutingRequestDhcp6PdCallback = ::std::option::Option<
8897 unsafe extern "C" fn(
8898 aState: otBorderRoutingDhcp6PdState,
8899 aContext: *mut ::std::os::raw::c_void,
8900 ),
8901>;
8902unsafe extern "C" {
8903 #[doc = " Sets the callback whenever the DHCPv6 PD state changes on the Thread interface.\n\n Subsequent calls to this function replace the previously set callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called whenever the DHCPv6 PD state changes.\n @param[in] aContext A pointer to arbitrary context information."]
8904 pub fn otBorderRoutingDhcp6PdSetRequestCallback(
8905 aInstance: *mut otInstance,
8906 aCallback: otBorderRoutingRequestDhcp6PdCallback,
8907 aContext: *mut ::std::os::raw::c_void,
8908 );
8909}
8910unsafe extern "C" {
8911 #[doc = " Sets the local on-link prefix.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE`.\n\n This is intended for testing only and using it will make the BR non-compliant with the Thread Specification.\n\n @param[in] aPrefix The on-link prefix to use."]
8912 pub fn otBorderRoutingSetOnLinkPrefix(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix);
8913}
8914pub type otMacFilterIterator = u8;
8915#[doc = "< Address filter is disabled."]
8916pub const OT_MAC_FILTER_ADDRESS_MODE_DISABLED: otMacFilterAddressMode = 0;
8917#[doc = "< Allowlist address filter mode is enabled."]
8918pub const OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST: otMacFilterAddressMode = 1;
8919#[doc = "< Denylist address filter mode is enabled."]
8920pub const OT_MAC_FILTER_ADDRESS_MODE_DENYLIST: otMacFilterAddressMode = 2;
8921#[doc = " Defines address mode of the mac filter."]
8922pub type otMacFilterAddressMode = ::std::os::raw::c_uint;
8923#[doc = " Represents a Mac Filter entry."]
8924#[repr(C)]
8925#[derive(Debug, Default, Copy, Clone)]
8926pub struct otMacFilterEntry {
8927 #[doc = "< IEEE 802.15.4 Extended Address"]
8928 pub mExtAddress: otExtAddress,
8929 #[doc = "< Received signal strength"]
8930 pub mRssIn: i8,
8931}
8932#[doc = " Represents the MAC layer counters."]
8933#[repr(C)]
8934#[derive(Debug, Default, Copy, Clone)]
8935pub struct otMacCounters {
8936 #[doc = " The total number of unique MAC frame transmission requests.\n\n Note that this counter is incremented for each MAC transmission request only by one,\n regardless of the amount of CCA failures, CSMA-CA attempts, or retransmissions.\n\n This increment rule applies to the following counters:\n - @p mTxUnicast\n - @p mTxBroadcast\n - @p mTxAckRequested\n - @p mTxNoAckRequested\n - @p mTxData\n - @p mTxDataPoll\n - @p mTxBeacon\n - @p mTxBeaconRequest\n - @p mTxOther\n - @p mTxErrAbort\n - @p mTxErrBusyChannel\n\n The following equations are valid:\n - @p mTxTotal = @p mTxUnicast + @p mTxBroadcast\n - @p mTxTotal = @p mTxAckRequested + @p mTxNoAckRequested\n - @p mTxTotal = @p mTxData + @p mTxDataPoll + @p mTxBeacon + @p mTxBeaconRequest + @p mTxOther"]
8937 pub mTxTotal: u32,
8938 #[doc = " The total number of unique unicast MAC frame transmission requests."]
8939 pub mTxUnicast: u32,
8940 #[doc = " The total number of unique broadcast MAC frame transmission requests."]
8941 pub mTxBroadcast: u32,
8942 #[doc = " The total number of unique MAC frame transmission requests with requested acknowledgment."]
8943 pub mTxAckRequested: u32,
8944 #[doc = " The total number of unique MAC frame transmission requests that were acked."]
8945 pub mTxAcked: u32,
8946 #[doc = " The total number of unique MAC frame transmission requests without requested acknowledgment."]
8947 pub mTxNoAckRequested: u32,
8948 #[doc = " The total number of unique MAC Data frame transmission requests."]
8949 pub mTxData: u32,
8950 #[doc = " The total number of unique MAC Data Poll frame transmission requests."]
8951 pub mTxDataPoll: u32,
8952 #[doc = " The total number of unique MAC Beacon frame transmission requests."]
8953 pub mTxBeacon: u32,
8954 #[doc = " The total number of unique MAC Beacon Request frame transmission requests."]
8955 pub mTxBeaconRequest: u32,
8956 #[doc = " The total number of unique other MAC frame transmission requests.\n\n This counter is currently used for counting out-of-band frames."]
8957 pub mTxOther: u32,
8958 #[doc = " The total number of MAC retransmission attempts.\n\n Note that this counter is incremented by one for each retransmission attempt that may be\n triggered by lack of acknowledgement, CSMA/CA failure, or other type of transmission error.\n The @p mTxRetry counter is incremented both for unicast and broadcast MAC frames.\n\n Modify the following configuration parameters to control the amount of retransmissions in the system:\n\n - OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT\n - OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT\n - OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST\n - OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT\n - OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_INDIRECT\n\n Currently, this counter is invalid if the platform's radio driver capability includes\n @ref OT_RADIO_CAPS_TRANSMIT_RETRIES."]
8959 pub mTxRetry: u32,
8960 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for direct packets."]
8961 pub mTxDirectMaxRetryExpiry: u32,
8962 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets."]
8963 pub mTxIndirectMaxRetryExpiry: u32,
8964 #[doc = " The total number of CCA failures.\n\n The meaning of this counter can be different and it depends on the platform's radio driver capabilities.\n\n If @ref OT_RADIO_CAPS_CSMA_BACKOFF is enabled, this counter represents the total number of full CSMA/CA\n failed attempts and it is incremented by one also for each retransmission (in case of a CSMA/CA fail).\n\n If @ref OT_RADIO_CAPS_TRANSMIT_RETRIES is enabled, this counter represents the total number of full CSMA/CA\n failed attempts and it is incremented by one for each individual data frame request (regardless of the\n amount of retransmissions)."]
8965 pub mTxErrCca: u32,
8966 #[doc = " The total number of unique MAC transmission request failures cause by an abort error."]
8967 pub mTxErrAbort: u32,
8968 #[doc = " The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail)."]
8969 pub mTxErrBusyChannel: u32,
8970 #[doc = " The total number of received frames.\n\n This counter counts all frames reported by the platform's radio driver, including frames\n that were dropped, for example because of an FCS error."]
8971 pub mRxTotal: u32,
8972 #[doc = " The total number of unicast frames received."]
8973 pub mRxUnicast: u32,
8974 #[doc = " The total number of broadcast frames received."]
8975 pub mRxBroadcast: u32,
8976 #[doc = " The total number of MAC Data frames received."]
8977 pub mRxData: u32,
8978 #[doc = " The total number of MAC Data Poll frames received."]
8979 pub mRxDataPoll: u32,
8980 #[doc = " The total number of MAC Beacon frames received."]
8981 pub mRxBeacon: u32,
8982 #[doc = " The total number of MAC Beacon Request frames received."]
8983 pub mRxBeaconRequest: u32,
8984 #[doc = " The total number of other types of frames received."]
8985 pub mRxOther: u32,
8986 #[doc = " The total number of frames dropped by MAC Filter module, for example received from denylisted node."]
8987 pub mRxAddressFiltered: u32,
8988 #[doc = " The total number of frames dropped by destination address check, for example received frame for other node."]
8989 pub mRxDestAddrFiltered: u32,
8990 #[doc = " The total number of frames dropped due to duplication, that is when the frame has been already received.\n\n This counter may be incremented, for example when ACK frame generated by the receiver hasn't reached\n transmitter node which performed retransmission."]
8991 pub mRxDuplicated: u32,
8992 #[doc = " The total number of frames dropped because of missing or malformed content."]
8993 pub mRxErrNoFrame: u32,
8994 #[doc = " The total number of frames dropped due to unknown neighbor."]
8995 pub mRxErrUnknownNeighbor: u32,
8996 #[doc = " The total number of frames dropped due to invalid source address."]
8997 pub mRxErrInvalidSrcAddr: u32,
8998 #[doc = " The total number of frames dropped due to security error.\n\n This counter may be incremented, for example when lower than expected Frame Counter is used\n to encrypt the frame."]
8999 pub mRxErrSec: u32,
9000 #[doc = " The total number of frames dropped due to invalid FCS."]
9001 pub mRxErrFcs: u32,
9002 #[doc = " The total number of frames dropped due to other error."]
9003 pub mRxErrOther: u32,
9004}
9005#[doc = " Represents a received IEEE 802.15.4 Beacon."]
9006#[repr(C)]
9007#[repr(align(4))]
9008#[derive(Debug, Default, Copy, Clone)]
9009pub struct otActiveScanResult {
9010 #[doc = "< IEEE 802.15.4 Extended Address"]
9011 pub mExtAddress: otExtAddress,
9012 #[doc = "< Thread Network Name"]
9013 pub mNetworkName: otNetworkName,
9014 #[doc = "< Thread Extended PAN ID"]
9015 pub mExtendedPanId: otExtendedPanId,
9016 #[doc = "< Steering Data"]
9017 pub mSteeringData: otSteeringData,
9018 #[doc = "< IEEE 802.15.4 PAN ID"]
9019 pub mPanId: u16,
9020 #[doc = "< Joiner UDP Port"]
9021 pub mJoinerUdpPort: u16,
9022 #[doc = "< IEEE 802.15.4 Channel"]
9023 pub mChannel: u8,
9024 #[doc = "< RSSI (dBm)"]
9025 pub mRssi: i8,
9026 #[doc = "< LQI"]
9027 pub mLqi: u8,
9028 pub _bitfield_align_1: [u8; 0],
9029 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9030 pub __bindgen_padding_0: u16,
9031}
9032impl otActiveScanResult {
9033 #[inline]
9034 pub fn mVersion(&self) -> ::std::os::raw::c_uint {
9035 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) }
9036 }
9037 #[inline]
9038 pub fn set_mVersion(&mut self, val: ::std::os::raw::c_uint) {
9039 unsafe {
9040 let val: u32 = ::std::mem::transmute(val);
9041 self._bitfield_1.set(0usize, 4u8, val as u64)
9042 }
9043 }
9044 #[inline]
9045 pub unsafe fn mVersion_raw(this: *const Self) -> ::std::os::raw::c_uint {
9046 unsafe {
9047 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9048 ::std::ptr::addr_of!((*this)._bitfield_1),
9049 0usize,
9050 4u8,
9051 ) as u32)
9052 }
9053 }
9054 #[inline]
9055 pub unsafe fn set_mVersion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
9056 unsafe {
9057 let val: u32 = ::std::mem::transmute(val);
9058 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9059 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9060 0usize,
9061 4u8,
9062 val as u64,
9063 )
9064 }
9065 }
9066 #[inline]
9067 pub fn mIsNative(&self) -> bool {
9068 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
9069 }
9070 #[inline]
9071 pub fn set_mIsNative(&mut self, val: bool) {
9072 unsafe {
9073 let val: u8 = ::std::mem::transmute(val);
9074 self._bitfield_1.set(4usize, 1u8, val as u64)
9075 }
9076 }
9077 #[inline]
9078 pub unsafe fn mIsNative_raw(this: *const Self) -> bool {
9079 unsafe {
9080 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9081 ::std::ptr::addr_of!((*this)._bitfield_1),
9082 4usize,
9083 1u8,
9084 ) as u8)
9085 }
9086 }
9087 #[inline]
9088 pub unsafe fn set_mIsNative_raw(this: *mut Self, val: bool) {
9089 unsafe {
9090 let val: u8 = ::std::mem::transmute(val);
9091 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9092 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9093 4usize,
9094 1u8,
9095 val as u64,
9096 )
9097 }
9098 }
9099 #[inline]
9100 pub fn mDiscover(&self) -> bool {
9101 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
9102 }
9103 #[inline]
9104 pub fn set_mDiscover(&mut self, val: bool) {
9105 unsafe {
9106 let val: u8 = ::std::mem::transmute(val);
9107 self._bitfield_1.set(5usize, 1u8, val as u64)
9108 }
9109 }
9110 #[inline]
9111 pub unsafe fn mDiscover_raw(this: *const Self) -> bool {
9112 unsafe {
9113 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9114 ::std::ptr::addr_of!((*this)._bitfield_1),
9115 5usize,
9116 1u8,
9117 ) as u8)
9118 }
9119 }
9120 #[inline]
9121 pub unsafe fn set_mDiscover_raw(this: *mut Self, val: bool) {
9122 unsafe {
9123 let val: u8 = ::std::mem::transmute(val);
9124 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9125 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9126 5usize,
9127 1u8,
9128 val as u64,
9129 )
9130 }
9131 }
9132 #[inline]
9133 pub fn mIsJoinable(&self) -> bool {
9134 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
9135 }
9136 #[inline]
9137 pub fn set_mIsJoinable(&mut self, val: bool) {
9138 unsafe {
9139 let val: u8 = ::std::mem::transmute(val);
9140 self._bitfield_1.set(6usize, 1u8, val as u64)
9141 }
9142 }
9143 #[inline]
9144 pub unsafe fn mIsJoinable_raw(this: *const Self) -> bool {
9145 unsafe {
9146 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9147 ::std::ptr::addr_of!((*this)._bitfield_1),
9148 6usize,
9149 1u8,
9150 ) as u8)
9151 }
9152 }
9153 #[inline]
9154 pub unsafe fn set_mIsJoinable_raw(this: *mut Self, val: bool) {
9155 unsafe {
9156 let val: u8 = ::std::mem::transmute(val);
9157 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9158 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9159 6usize,
9160 1u8,
9161 val as u64,
9162 )
9163 }
9164 }
9165 #[inline]
9166 pub fn new_bitfield_1(
9167 mVersion: ::std::os::raw::c_uint,
9168 mIsNative: bool,
9169 mDiscover: bool,
9170 mIsJoinable: bool,
9171 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9172 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9173 __bindgen_bitfield_unit.set(0usize, 4u8, {
9174 let mVersion: u32 = unsafe { ::std::mem::transmute(mVersion) };
9175 mVersion as u64
9176 });
9177 __bindgen_bitfield_unit.set(4usize, 1u8, {
9178 let mIsNative: u8 = unsafe { ::std::mem::transmute(mIsNative) };
9179 mIsNative as u64
9180 });
9181 __bindgen_bitfield_unit.set(5usize, 1u8, {
9182 let mDiscover: u8 = unsafe { ::std::mem::transmute(mDiscover) };
9183 mDiscover as u64
9184 });
9185 __bindgen_bitfield_unit.set(6usize, 1u8, {
9186 let mIsJoinable: u8 = unsafe { ::std::mem::transmute(mIsJoinable) };
9187 mIsJoinable as u64
9188 });
9189 __bindgen_bitfield_unit
9190 }
9191}
9192#[doc = " Represents an energy scan result."]
9193#[repr(C)]
9194#[derive(Debug, Default, Copy, Clone)]
9195pub struct otEnergyScanResult {
9196 #[doc = "< IEEE 802.15.4 Channel"]
9197 pub mChannel: u8,
9198 #[doc = "< The max RSSI (dBm)"]
9199 pub mMaxRssi: i8,
9200}
9201#[doc = " Pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or\n the scan completes.\n\n @param[in] aResult A valid pointer to the beacon information or NULL when the active scan completes.\n @param[in] aContext A pointer to application-specific context."]
9202pub type otHandleActiveScanResult = ::std::option::Option<
9203 unsafe extern "C" fn(aResult: *mut otActiveScanResult, aContext: *mut ::std::os::raw::c_void),
9204>;
9205unsafe extern "C" {
9206 #[doc = " Starts an IEEE 802.15.4 Active Scan\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).\n @param[in] aScanDuration The time in milliseconds to spend scanning each channel.\n @param[in] aCallback A pointer to a function called on receiving a beacon or scan completes.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Accepted the Active Scan request.\n @retval OT_ERROR_BUSY Already performing an Active Scan."]
9207 pub fn otLinkActiveScan(
9208 aInstance: *mut otInstance,
9209 aScanChannels: u32,
9210 aScanDuration: u16,
9211 aCallback: otHandleActiveScanResult,
9212 aCallbackContext: *mut ::std::os::raw::c_void,
9213 ) -> otError;
9214}
9215unsafe extern "C" {
9216 #[doc = " Indicates whether or not an IEEE 802.15.4 Active Scan is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns true if an IEEE 802.15.4 Active Scan is in progress, false otherwise."]
9217 pub fn otLinkIsActiveScanInProgress(aInstance: *mut otInstance) -> bool;
9218}
9219#[doc = " Pointer is called during an IEEE 802.15.4 Energy Scan when the result for a channel is ready or the\n scan completes.\n\n @param[in] aResult A valid pointer to the energy scan result information or NULL when the energy scan completes.\n @param[in] aContext A pointer to application-specific context."]
9220pub type otHandleEnergyScanResult = ::std::option::Option<
9221 unsafe extern "C" fn(aResult: *mut otEnergyScanResult, aContext: *mut ::std::os::raw::c_void),
9222>;
9223unsafe extern "C" {
9224 #[doc = " Starts an IEEE 802.15.4 Energy Scan\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aScanChannels A bit vector indicating on which channels to perform energy scan.\n @param[in] aScanDuration The time in milliseconds to spend scanning each channel.\n @param[in] aCallback A pointer to a function called to pass on scan result on indicate scan completion.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Accepted the Energy Scan request.\n @retval OT_ERROR_BUSY Could not start the energy scan."]
9225 pub fn otLinkEnergyScan(
9226 aInstance: *mut otInstance,
9227 aScanChannels: u32,
9228 aScanDuration: u16,
9229 aCallback: otHandleEnergyScanResult,
9230 aCallbackContext: *mut ::std::os::raw::c_void,
9231 ) -> otError;
9232}
9233unsafe extern "C" {
9234 #[doc = " Indicates whether or not an IEEE 802.15.4 Energy Scan is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns true if an IEEE 802.15.4 Energy Scan is in progress, false otherwise."]
9235 pub fn otLinkIsEnergyScanInProgress(aInstance: *mut otInstance) -> bool;
9236}
9237unsafe extern "C" {
9238 #[doc = " Enqueues an IEEE 802.15.4 Data Request message for transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully enqueued an IEEE 802.15.4 Data Request message.\n @retval OT_ERROR_INVALID_STATE Device is not in rx-off-when-idle mode.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available."]
9239 pub fn otLinkSendDataRequest(aInstance: *mut otInstance) -> otError;
9240}
9241unsafe extern "C" {
9242 #[doc = " Indicates whether or not an IEEE 802.15.4 MAC is in the transmit state.\n\n MAC module is in the transmit state during CSMA/CA procedure, CCA, Data, Beacon or Data Request frame transmission\n and receiving an ACK of a transmitted frame. MAC module is not in the transmit state during transmission of an ACK\n frame or a Beacon Request frame.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns true if an IEEE 802.15.4 MAC is in the transmit state, false otherwise."]
9243 pub fn otLinkIsInTransmitState(aInstance: *mut otInstance) -> bool;
9244}
9245unsafe extern "C" {
9246 #[doc = " Get the IEEE 802.15.4 channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The IEEE 802.15.4 channel.\n\n @sa otLinkSetChannel"]
9247 pub fn otLinkGetChannel(aInstance: *mut otInstance) -> u8;
9248}
9249unsafe extern "C" {
9250 #[doc = " Set the IEEE 802.15.4 channel\n\n Succeeds only when Thread protocols are disabled. A successful call to this function invalidates the\n Active and Pending Operational Datasets in non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The IEEE 802.15.4 channel.\n\n @retval OT_ERROR_NONE Successfully set the channel.\n @retval OT_ERROR_INVALID_ARGS If @p aChannel is not in the range [11, 26] or is not in the supported channel mask.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otLinkGetChannel"]
9251 pub fn otLinkSetChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9252}
9253unsafe extern "C" {
9254 #[doc = " Get the supported channel mask of MAC layer.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The supported channel mask as `uint32_t` with bit 0 (lsb) mapping to channel 0, bit 1 to channel 1, so on."]
9255 pub fn otLinkGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
9256}
9257unsafe extern "C" {
9258 #[doc = " Set the supported channel mask of MAC layer.\n\n Succeeds only when Thread protocols are disabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask The supported channel mask (bit 0 or lsb mapping to channel 0, and so on).\n\n @retval OT_ERROR_NONE Successfully set the supported channel mask.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
9259 pub fn otLinkSetSupportedChannelMask(aInstance: *mut otInstance, aChannelMask: u32) -> otError;
9260}
9261unsafe extern "C" {
9262 #[doc = " Gets the IEEE 802.15.4 Extended Address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the IEEE 802.15.4 Extended Address."]
9263 pub fn otLinkGetExtendedAddress(aInstance: *mut otInstance) -> *const otExtAddress;
9264}
9265unsafe extern "C" {
9266 #[doc = " Sets the IEEE 802.15.4 Extended Address.\n\n @note Only succeeds when Thread protocols are disabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address.\n\n @retval OT_ERROR_NONE Successfully set the IEEE 802.15.4 Extended Address.\n @retval OT_ERROR_INVALID_ARGS @p aExtAddress was NULL.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
9267 pub fn otLinkSetExtendedAddress(
9268 aInstance: *mut otInstance,
9269 aExtAddress: *const otExtAddress,
9270 ) -> otError;
9271}
9272unsafe extern "C" {
9273 #[doc = " Get the factory-assigned IEEE EUI-64.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aEui64 A pointer to where the factory-assigned IEEE EUI-64 is placed."]
9274 pub fn otLinkGetFactoryAssignedIeeeEui64(aInstance: *mut otInstance, aEui64: *mut otExtAddress);
9275}
9276unsafe extern "C" {
9277 #[doc = " Get the IEEE 802.15.4 PAN ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The IEEE 802.15.4 PAN ID.\n\n @sa otLinkSetPanId"]
9278 pub fn otLinkGetPanId(aInstance: *mut otInstance) -> otPanId;
9279}
9280unsafe extern "C" {
9281 #[doc = " Set the IEEE 802.15.4 PAN ID.\n\n Succeeds only when Thread protocols are disabled. A successful call to this function also invalidates\n the Active and Pending Operational Datasets in non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPanId The IEEE 802.15.4 PAN ID.\n\n @retval OT_ERROR_NONE Successfully set the PAN ID.\n @retval OT_ERROR_INVALID_ARGS If aPanId is not in the range [0, 65534].\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otLinkGetPanId"]
9282 pub fn otLinkSetPanId(aInstance: *mut otInstance, aPanId: otPanId) -> otError;
9283}
9284unsafe extern "C" {
9285 #[doc = " Get the data poll period of sleepy end device.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The data poll period of sleepy end device in milliseconds.\n\n @sa otLinkSetPollPeriod"]
9286 pub fn otLinkGetPollPeriod(aInstance: *mut otInstance) -> u32;
9287}
9288unsafe extern "C" {
9289 #[doc = " Set/clear user-specified/external data poll period for sleepy end device.\n\n @note This function updates only poll period of sleepy end device. To update child timeout the function\n `otThreadSetChildTimeout()` shall be called.\n\n @note Minimal non-zero value should be `OPENTHREAD_CONFIG_MAC_MINIMUM_POLL_PERIOD` (10ms).\n Or zero to clear user-specified poll period.\n\n @note User-specified value should be no more than the maximal value 0x3FFFFFF ((1 << 26) - 1) allowed,\n otherwise it would be clipped by the maximal value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPollPeriod data poll period in milliseconds.\n\n @retval OT_ERROR_NONE Successfully set/cleared user-specified poll period.\n @retval OT_ERROR_INVALID_ARGS If aPollPeriod is invalid.\n\n @sa otLinkGetPollPeriod"]
9290 pub fn otLinkSetPollPeriod(aInstance: *mut otInstance, aPollPeriod: u32) -> otError;
9291}
9292unsafe extern "C" {
9293 #[doc = " Get the IEEE 802.15.4 Short Address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The IEEE 802.15.4 Short Address."]
9294 pub fn otLinkGetShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9295}
9296unsafe extern "C" {
9297 #[doc = " Get the IEEE 802.15.4 alternate short address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The alternate short address, or `OT_RADIO_INVALID_SHORT_ADDR` (0xfffe) if there is no alternate address."]
9298 pub fn otLinkGetAlternateShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9299}
9300unsafe extern "C" {
9301 #[doc = " Returns the maximum number of frame retries during direct transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum number of retries during direct transmission."]
9302 pub fn otLinkGetMaxFrameRetriesDirect(aInstance: *mut otInstance) -> u8;
9303}
9304unsafe extern "C" {
9305 #[doc = " Sets the maximum number of frame retries during direct transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMaxFrameRetriesDirect The maximum number of retries during direct transmission."]
9306 pub fn otLinkSetMaxFrameRetriesDirect(aInstance: *mut otInstance, aMaxFrameRetriesDirect: u8);
9307}
9308unsafe extern "C" {
9309 #[doc = " Returns the maximum number of frame retries during indirect transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum number of retries during indirect transmission."]
9310 pub fn otLinkGetMaxFrameRetriesIndirect(aInstance: *mut otInstance) -> u8;
9311}
9312unsafe extern "C" {
9313 #[doc = " Sets the maximum number of frame retries during indirect transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMaxFrameRetriesIndirect The maximum number of retries during indirect transmission."]
9314 pub fn otLinkSetMaxFrameRetriesIndirect(
9315 aInstance: *mut otInstance,
9316 aMaxFrameRetriesIndirect: u8,
9317 );
9318}
9319unsafe extern "C" {
9320 #[doc = " Gets the current MAC frame counter value.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The current MAC frame counter value."]
9321 pub fn otLinkGetFrameCounter(aInstance: *mut otInstance) -> u32;
9322}
9323unsafe extern "C" {
9324 #[doc = " Gets the address mode of MAC filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns the address mode."]
9325 pub fn otLinkFilterGetAddressMode(aInstance: *mut otInstance) -> otMacFilterAddressMode;
9326}
9327unsafe extern "C" {
9328 #[doc = " Sets the address mode of MAC filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMode The address mode to set."]
9329 pub fn otLinkFilterSetAddressMode(aInstance: *mut otInstance, aMode: otMacFilterAddressMode);
9330}
9331unsafe extern "C" {
9332 #[doc = " Adds an Extended Address to MAC filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the Extended Address (MUST NOT be NULL).\n\n @retval OT_ERROR_NONE Successfully added @p aExtAddress to MAC filter.\n @retval OT_ERROR_NO_BUFS No available entry exists."]
9333 pub fn otLinkFilterAddAddress(
9334 aInstance: *mut otInstance,
9335 aExtAddress: *const otExtAddress,
9336 ) -> otError;
9337}
9338unsafe extern "C" {
9339 #[doc = " Removes an Extended Address from MAC filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n No action is performed if there is no existing entry in Filter matching the given Extended Address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the Extended Address (MUST NOT be NULL)."]
9340 pub fn otLinkFilterRemoveAddress(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9341}
9342unsafe extern "C" {
9343 #[doc = " Clears all the Extended Addresses from MAC filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9344 pub fn otLinkFilterClearAddresses(aInstance: *mut otInstance);
9345}
9346unsafe extern "C" {
9347 #[doc = " Gets an in-use address filter entry.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the MAC filter iterator context. To get the first in-use address filter\n entry, it should be set to OT_MAC_FILTER_ITERATOR_INIT. MUST NOT be NULL.\n @param[out] aEntry A pointer to where the information is placed. MUST NOT be NULL.\n\n @retval OT_ERROR_NONE Successfully retrieved an in-use address filter entry.\n @retval OT_ERROR_NOT_FOUND No subsequent entry exists."]
9348 pub fn otLinkFilterGetNextAddress(
9349 aInstance: *mut otInstance,
9350 aIterator: *mut otMacFilterIterator,
9351 aEntry: *mut otMacFilterEntry,
9352 ) -> otError;
9353}
9354unsafe extern "C" {
9355 #[doc = " Adds the specified Extended Address to the `RssIn` list (or modifies an existing\n address in the `RssIn` list) and sets the received signal strength (in dBm) entry\n for messages from that address. The Extended Address does not necessarily have\n to be in the `address allowlist/denylist` filter to set the `rss`.\n @note The `RssIn` list contains Extended Addresses whose `rss` or link quality indicator (`lqi`)\n values have been set to be different from the defaults.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address. MUST NOT be NULL.\n @param[in] aRss A received signal strength (in dBm).\n\n @retval OT_ERROR_NONE Successfully added an entry for @p aExtAddress and @p aRss.\n @retval OT_ERROR_NO_BUFS No available entry exists."]
9356 pub fn otLinkFilterAddRssIn(
9357 aInstance: *mut otInstance,
9358 aExtAddress: *const otExtAddress,
9359 aRss: i8,
9360 ) -> otError;
9361}
9362unsafe extern "C" {
9363 #[doc = " Removes the specified Extended Address from the `RssIn` list. Once removed\n from the `RssIn` list, this MAC address will instead use the default `rss`\n and `lqi` settings, assuming defaults have been set.\n (If no defaults have been set, the over-air signal is used.)\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n No action is performed if there is no existing entry in the `RssIn` list matching the specified Extended Address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the IEEE 802.15.4 Extended Address. MUST NOT be NULL."]
9364 pub fn otLinkFilterRemoveRssIn(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9365}
9366unsafe extern "C" {
9367 #[doc = " Sets the default received signal strength (in dBm) on MAC Filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n The default RSS value is used for all received frames from addresses for which there is no explicit RSS-IN entry\n in the Filter list (added using `otLinkFilterAddRssIn()`).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRss The default received signal strength (in dBm) to set."]
9368 pub fn otLinkFilterSetDefaultRssIn(aInstance: *mut otInstance, aRss: i8);
9369}
9370unsafe extern "C" {
9371 #[doc = " Clears any previously set default received signal strength (in dBm) on MAC Filter.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9372 pub fn otLinkFilterClearDefaultRssIn(aInstance: *mut otInstance);
9373}
9374unsafe extern "C" {
9375 #[doc = " Clears all the received signal strength (`rss`) and link quality\n indicator (`lqi`) entries (including defaults) from the `RssIn` list.\n Performing this action means that all Extended Addresses will use the on-air signal.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9376 pub fn otLinkFilterClearAllRssIn(aInstance: *mut otInstance);
9377}
9378unsafe extern "C" {
9379 #[doc = " Gets an in-use RssIn filter entry.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the MAC filter iterator context. MUST NOT be NULL.\n To get the first entry, it should be set to OT_MAC_FILTER_ITERATOR_INIT.\n @param[out] aEntry A pointer to where the information is placed. The last entry would have the extended\n address as all 0xff to indicate the default received signal strength if it was set.\n@p aEntry MUST NOT be NULL.\n\n @retval OT_ERROR_NONE Successfully retrieved the next entry.\n @retval OT_ERROR_NOT_FOUND No subsequent entry exists."]
9380 pub fn otLinkFilterGetNextRssIn(
9381 aInstance: *mut otInstance,
9382 aIterator: *mut otMacFilterIterator,
9383 aEntry: *mut otMacFilterEntry,
9384 ) -> otError;
9385}
9386unsafe extern "C" {
9387 #[doc = " Enables/disables IEEE 802.15.4 radio filter mode.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the 802.15.4 radio.\n When radio filter is enabled, radio is put to sleep instead of receive (to ensure device does not receive any frame\n and/or potentially send ack). Also the frame transmission requests return immediately without sending the frame over\n the air (return \"no ack\" error if ack is requested, otherwise return success).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aFilterEnabled TRUE to enable radio filter, FALSE to disable"]
9388 pub fn otLinkSetRadioFilterEnabled(aInstance: *mut otInstance, aFilterEnabled: bool);
9389}
9390unsafe extern "C" {
9391 #[doc = " Indicates whether the IEEE 802.15.4 radio filter is enabled or not.\n\n Is available when `OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` configuration is enabled.\n\n @retval TRUE If the radio filter is enabled.\n @retval FALSE If the radio filter is disabled."]
9392 pub fn otLinkIsRadioFilterEnabled(aInstance: *mut otInstance) -> bool;
9393}
9394unsafe extern "C" {
9395 #[doc = " Converts received signal strength to link quality.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRss The received signal strength value to be converted.\n\n @return Link quality value mapping to @p aRss."]
9396 pub fn otLinkConvertRssToLinkQuality(aInstance: *mut otInstance, aRss: i8) -> u8;
9397}
9398unsafe extern "C" {
9399 #[doc = " Converts link quality to typical received signal strength.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aLinkQuality LinkQuality value, should be in range [0,3].\n\n @return Typical platform received signal strength mapping to @p aLinkQuality."]
9400 pub fn otLinkConvertLinkQualityToRss(aInstance: *mut otInstance, aLinkQuality: u8) -> i8;
9401}
9402unsafe extern "C" {
9403 #[doc = " Gets histogram of retries for a single direct packet until success.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumberOfEntries A pointer to where the size of returned histogram array is placed.\n\n @returns A pointer to the histogram of retries (in a form of an array).\n The n-th element indicates that the packet has been sent with n-th retry."]
9404 pub fn otLinkGetTxDirectRetrySuccessHistogram(
9405 aInstance: *mut otInstance,
9406 aNumberOfEntries: *mut u8,
9407 ) -> *const u32;
9408}
9409unsafe extern "C" {
9410 #[doc = " Gets histogram of retries for a single indirect packet until success.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumberOfEntries A pointer to where the size of returned histogram array is placed.\n\n @returns A pointer to the histogram of retries (in a form of an array).\n The n-th element indicates that the packet has been sent with n-th retry."]
9411 pub fn otLinkGetTxIndirectRetrySuccessHistogram(
9412 aInstance: *mut otInstance,
9413 aNumberOfEntries: *mut u8,
9414 ) -> *const u32;
9415}
9416unsafe extern "C" {
9417 #[doc = " Clears histogram statistics for direct and indirect transmissions.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9418 pub fn otLinkResetTxRetrySuccessHistogram(aInstance: *mut otInstance);
9419}
9420unsafe extern "C" {
9421 #[doc = " Get the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the MAC layer counters."]
9422 pub fn otLinkGetCounters(aInstance: *mut otInstance) -> *const otMacCounters;
9423}
9424unsafe extern "C" {
9425 #[doc = " Resets the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9426 pub fn otLinkResetCounters(aInstance: *mut otInstance);
9427}
9428#[doc = " Pointer is called when an IEEE 802.15.4 frame is received.\n\n @note This callback is called after FCS processing and @p aFrame may not contain the actual FCS that was received.\n\n @note This callback is called before IEEE 802.15.4 security processing.\n\n @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.\n @param[in] aIsTx Whether this frame is transmitted, not received.\n @param[in] aContext A pointer to application-specific context."]
9429pub type otLinkPcapCallback = ::std::option::Option<
9430 unsafe extern "C" fn(
9431 aFrame: *const otRadioFrame,
9432 aIsTx: bool,
9433 aContext: *mut ::std::os::raw::c_void,
9434 ),
9435>;
9436unsafe extern "C" {
9437 #[doc = " Registers a callback to provide received raw IEEE 802.15.4 frames.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or\n NULL to disable the callback.\n @param[in] aCallbackContext A pointer to application-specific context."]
9438 pub fn otLinkSetPcapCallback(
9439 aInstance: *mut otInstance,
9440 aPcapCallback: otLinkPcapCallback,
9441 aCallbackContext: *mut ::std::os::raw::c_void,
9442 );
9443}
9444unsafe extern "C" {
9445 #[doc = " Indicates whether or not promiscuous mode is enabled at the link layer.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE Promiscuous mode is enabled.\n @retval FALSE Promiscuous mode is not enabled."]
9446 pub fn otLinkIsPromiscuous(aInstance: *mut otInstance) -> bool;
9447}
9448unsafe extern "C" {
9449 #[doc = " Enables or disables the link layer promiscuous mode.\n\n @note Promiscuous mode may only be enabled when the Thread interface is disabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPromiscuous true to enable promiscuous mode, or false otherwise.\n\n @retval OT_ERROR_NONE Successfully enabled promiscuous mode.\n @retval OT_ERROR_INVALID_STATE Could not enable promiscuous mode because\n the Thread interface is enabled."]
9450 pub fn otLinkSetPromiscuous(aInstance: *mut otInstance, aPromiscuous: bool) -> otError;
9451}
9452unsafe extern "C" {
9453 #[doc = " Gets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL channel."]
9454 pub fn otLinkGetCslChannel(aInstance: *mut otInstance) -> u8;
9455}
9456unsafe extern "C" {
9457 #[doc = " Sets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The CSL sample channel. Channel value should be `0` (Set CSL Channel unspecified) or\n within the range [1, 10] (if 915-MHz supported) and [11, 26] (if 2.4 GHz supported).\n\n @retval OT_ERROR_NONE Successfully set the CSL parameters.\n @retval OT_ERROR_INVALID_ARGS Invalid @p aChannel."]
9458 pub fn otLinkSetCslChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9459}
9460unsafe extern "C" {
9461 #[doc = " Gets the CSL period in microseconds\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL period in microseconds."]
9462 pub fn otLinkGetCslPeriod(aInstance: *mut otInstance) -> u32;
9463}
9464unsafe extern "C" {
9465 #[doc = " Sets the CSL period in microseconds. Disable CSL by setting this parameter to `0`.\n\n The CSL period MUST be a multiple of `OT_LINK_CSL_PERIOD_TEN_SYMBOLS_UNIT_IN_USEC`, otherwise `OT_ERROR_INVALID_ARGS`\n is returned.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPeriod The CSL period in microseconds.\n\n @retval OT_ERROR_NONE Successfully set the CSL period.\n @retval OT_ERROR_INVALID_ARGS Invalid CSL period"]
9466 pub fn otLinkSetCslPeriod(aInstance: *mut otInstance, aPeriod: u32) -> otError;
9467}
9468unsafe extern "C" {
9469 #[doc = " Gets the CSL timeout.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL timeout in seconds."]
9470 pub fn otLinkGetCslTimeout(aInstance: *mut otInstance) -> u32;
9471}
9472unsafe extern "C" {
9473 #[doc = " Sets the CSL timeout in seconds.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTimeout The CSL timeout in seconds.\n\n @retval OT_ERROR_NONE Successfully set the CSL timeout.\n @retval OT_ERROR_INVALID_ARGS Invalid CSL timeout."]
9474 pub fn otLinkSetCslTimeout(aInstance: *mut otInstance, aTimeout: u32) -> otError;
9475}
9476unsafe extern "C" {
9477 #[doc = " Returns the current CCA (Clear Channel Assessment) failure rate.\n\n The rate is maintained over a window of (roughly) last `OPENTHREAD_CONFIG_CCA_FAILURE_RATE_AVERAGING_WINDOW`\n frame transmissions.\n\n @returns The CCA failure rate with maximum value `0xffff` corresponding to 100% failure rate."]
9478 pub fn otLinkGetCcaFailureRate(aInstance: *mut otInstance) -> u16;
9479}
9480unsafe extern "C" {
9481 #[doc = " Enables or disables the link layer.\n\n @note The link layer may only be enabled / disabled when the Thread Interface is disabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable true to enable the link layer, or false otherwise.\n\n @retval OT_ERROR_NONE Successfully enabled / disabled the link layer.\n @retval OT_ERROR_INVALID_STATE Could not disable the link layer because\n the Thread interface is enabled."]
9482 pub fn otLinkSetEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9483}
9484unsafe extern "C" {
9485 #[doc = " Indicates whether or not the link layer is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE Link layer is enabled.\n @retval FALSE Link layer is not enabled."]
9486 pub fn otLinkIsEnabled(aInstance: *mut otInstance) -> bool;
9487}
9488unsafe extern "C" {
9489 #[doc = " Indicates whether or not CSL is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE Link layer is CSL enabled.\n @retval FALSE Link layer is not CSL enabled."]
9490 pub fn otLinkIsCslEnabled(aInstance: *mut otInstance) -> bool;
9491}
9492unsafe extern "C" {
9493 #[doc = " Indicates whether the device is connected to a parent which supports CSL.\n\n @retval TRUE If parent supports CSL.\n @retval FALSE If parent does not support CSL."]
9494 pub fn otLinkIsCslSupported(aInstance: *mut otInstance) -> bool;
9495}
9496unsafe extern "C" {
9497 #[doc = " Instructs the device to send an empty IEEE 802.15.4 data frame.\n\n Is only supported on an Rx-Off-When-Idle device to send an empty data frame to its parent.\n Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully enqueued an empty message.\n @retval OT_ERROR_INVALID_STATE Device is not in Rx-Off-When-Idle mode.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available."]
9498 pub fn otLinkSendEmptyData(aInstance: *mut otInstance) -> otError;
9499}
9500unsafe extern "C" {
9501 #[doc = " Sets the region code.\n\n The radio region format is the 2-bytes ascii representation of the ISO 3166 alpha-2 code.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aRegionCode The radio region code. The `aRegionCode >> 8` is first ascii char\n and the `aRegionCode & 0xff` is the second ascii char.\n\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully set region code.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
9502 pub fn otLinkSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
9503}
9504unsafe extern "C" {
9505 #[doc = " Get the region code.\n\n The radio region format is the 2-bytes ascii representation of the ISO 3166 alpha-2 code.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[out] aRegionCode The radio region code. The `aRegionCode >> 8` is first ascii char\n and the `aRegionCode & 0xff` is the second ascii char.\n\n @retval OT_ERROR_INVALID_ARGS @p aRegionCode is NULL.\n @retval OT_ERROR_FAILED Other platform specific errors.\n @retval OT_ERROR_NONE Successfully got region code.\n @retval OT_ERROR_NOT_IMPLEMENTED The feature is not implemented."]
9506 pub fn otLinkGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
9507}
9508unsafe extern "C" {
9509 #[doc = " Gets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Wake-up channel."]
9510 pub fn otLinkGetWakeupChannel(aInstance: *mut otInstance) -> u8;
9511}
9512unsafe extern "C" {
9513 #[doc = " Sets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The Wake-up sample channel. Channel value should be `0` (Set Wake-up Channel unspecified,\n which means the device will use the PAN channel) or within the range [1, 10] (if 915-MHz\n supported) and [11, 26] (if 2.4 GHz supported).\n\n @retval OT_ERROR_NONE Successfully set the Wake-up channel.\n @retval OT_ERROR_INVALID_ARGS Invalid @p aChannel."]
9514 pub fn otLinkSetWakeupChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9515}
9516unsafe extern "C" {
9517 #[doc = " Enables or disables listening for wake-up frames.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable true to enable listening for wake-up frames, or false otherwise.\n\n @retval OT_ERROR_NONE Successfully enabled / disabled the listening for wake-up frames.\n @retval OT_ERROR_INVALID_ARGS The listen duration is greater than the listen interval.\n @retval OT_ERROR_INVALID_STATE Could not enable listening for wake-up frames due to bad configuration."]
9518 pub fn otLinkSetWakeUpListenEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9519}
9520unsafe extern "C" {
9521 #[doc = " Returns whether listening for wake-up frames is enabled.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If listening for wake-up frames is enabled.\n @retval FALSE If listening for wake-up frames is not enabled."]
9522 pub fn otLinkIsWakeupListenEnabled(aInstance: *mut otInstance) -> bool;
9523}
9524unsafe extern "C" {
9525 #[doc = " Get the wake-up listen parameters.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aInterval A pointer to return the wake-up listen interval in microseconds.\n @param[out] aDuration A pointer to return the wake-up listen duration in microseconds."]
9526 pub fn otLinkGetWakeupListenParameters(
9527 aInstance: *mut otInstance,
9528 aInterval: *mut u32,
9529 aDuration: *mut u32,
9530 );
9531}
9532unsafe extern "C" {
9533 #[doc = " Set the wake-up listen parameters.\n\n The listen interval must be greater than the listen duration.\n The listen duration must be greater or equal than the minimum supported.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInterval The wake-up listen interval in microseconds.\n @param[in] aDuration The wake-up listen duration in microseconds.\n\n @retval OT_ERROR_NONE Successfully set the wake-up listen parameters.\n @retval OT_ERROR_INVALID_ARGS Invalid wake-up listen parameters."]
9534 pub fn otLinkSetWakeupListenParameters(
9535 aInstance: *mut otInstance,
9536 aInterval: u32,
9537 aDuration: u32,
9538 ) -> otError;
9539}
9540unsafe extern "C" {
9541 #[doc = " Sets the rx-on-when-idle state.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRxOnWhenIdle TRUE to keep radio in Receive state, FALSE to put to Sleep state during idle periods.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
9542 pub fn otLinkSetRxOnWhenIdle(aInstance: *mut otInstance, aRxOnWhenIdle: bool) -> otError;
9543}
9544#[doc = "< The Thread stack is disabled."]
9545pub const OT_DEVICE_ROLE_DISABLED: otDeviceRole = 0;
9546#[doc = "< Not currently participating in a Thread network/partition."]
9547pub const OT_DEVICE_ROLE_DETACHED: otDeviceRole = 1;
9548#[doc = "< The Thread Child role."]
9549pub const OT_DEVICE_ROLE_CHILD: otDeviceRole = 2;
9550#[doc = "< The Thread Router role."]
9551pub const OT_DEVICE_ROLE_ROUTER: otDeviceRole = 3;
9552#[doc = "< The Thread Leader role."]
9553pub const OT_DEVICE_ROLE_LEADER: otDeviceRole = 4;
9554#[doc = " Represents a Thread device role."]
9555pub type otDeviceRole = ::std::os::raw::c_uint;
9556#[doc = " Represents an MLE Link Mode configuration."]
9557#[repr(C)]
9558#[derive(Debug, Default, Copy, Clone)]
9559pub struct otLinkModeConfig {
9560 pub _bitfield_align_1: [u8; 0],
9561 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9562}
9563impl otLinkModeConfig {
9564 #[inline]
9565 pub fn mRxOnWhenIdle(&self) -> bool {
9566 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9567 }
9568 #[inline]
9569 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9570 unsafe {
9571 let val: u8 = ::std::mem::transmute(val);
9572 self._bitfield_1.set(0usize, 1u8, val as u64)
9573 }
9574 }
9575 #[inline]
9576 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9577 unsafe {
9578 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9579 ::std::ptr::addr_of!((*this)._bitfield_1),
9580 0usize,
9581 1u8,
9582 ) as u8)
9583 }
9584 }
9585 #[inline]
9586 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9587 unsafe {
9588 let val: u8 = ::std::mem::transmute(val);
9589 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9590 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9591 0usize,
9592 1u8,
9593 val as u64,
9594 )
9595 }
9596 }
9597 #[inline]
9598 pub fn mDeviceType(&self) -> bool {
9599 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9600 }
9601 #[inline]
9602 pub fn set_mDeviceType(&mut self, val: bool) {
9603 unsafe {
9604 let val: u8 = ::std::mem::transmute(val);
9605 self._bitfield_1.set(1usize, 1u8, val as u64)
9606 }
9607 }
9608 #[inline]
9609 pub unsafe fn mDeviceType_raw(this: *const Self) -> bool {
9610 unsafe {
9611 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9612 ::std::ptr::addr_of!((*this)._bitfield_1),
9613 1usize,
9614 1u8,
9615 ) as u8)
9616 }
9617 }
9618 #[inline]
9619 pub unsafe fn set_mDeviceType_raw(this: *mut Self, val: bool) {
9620 unsafe {
9621 let val: u8 = ::std::mem::transmute(val);
9622 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9623 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9624 1usize,
9625 1u8,
9626 val as u64,
9627 )
9628 }
9629 }
9630 #[inline]
9631 pub fn mNetworkData(&self) -> bool {
9632 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9633 }
9634 #[inline]
9635 pub fn set_mNetworkData(&mut self, val: bool) {
9636 unsafe {
9637 let val: u8 = ::std::mem::transmute(val);
9638 self._bitfield_1.set(2usize, 1u8, val as u64)
9639 }
9640 }
9641 #[inline]
9642 pub unsafe fn mNetworkData_raw(this: *const Self) -> bool {
9643 unsafe {
9644 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9645 ::std::ptr::addr_of!((*this)._bitfield_1),
9646 2usize,
9647 1u8,
9648 ) as u8)
9649 }
9650 }
9651 #[inline]
9652 pub unsafe fn set_mNetworkData_raw(this: *mut Self, val: bool) {
9653 unsafe {
9654 let val: u8 = ::std::mem::transmute(val);
9655 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9656 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9657 2usize,
9658 1u8,
9659 val as u64,
9660 )
9661 }
9662 }
9663 #[inline]
9664 pub fn new_bitfield_1(
9665 mRxOnWhenIdle: bool,
9666 mDeviceType: bool,
9667 mNetworkData: bool,
9668 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9669 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9670 __bindgen_bitfield_unit.set(0usize, 1u8, {
9671 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9672 mRxOnWhenIdle as u64
9673 });
9674 __bindgen_bitfield_unit.set(1usize, 1u8, {
9675 let mDeviceType: u8 = unsafe { ::std::mem::transmute(mDeviceType) };
9676 mDeviceType as u64
9677 });
9678 __bindgen_bitfield_unit.set(2usize, 1u8, {
9679 let mNetworkData: u8 = unsafe { ::std::mem::transmute(mNetworkData) };
9680 mNetworkData as u64
9681 });
9682 __bindgen_bitfield_unit
9683 }
9684}
9685#[doc = " Holds diagnostic information for a neighboring Thread node"]
9686#[repr(C)]
9687#[derive(Debug, Default, Copy, Clone)]
9688pub struct otNeighborInfo {
9689 #[doc = "< IEEE 802.15.4 Extended Address"]
9690 pub mExtAddress: otExtAddress,
9691 #[doc = "< Seconds since last heard"]
9692 pub mAge: u32,
9693 #[doc = "< Seconds since link establishment (requires `CONFIG_UPTIME_ENABLE`)"]
9694 pub mConnectionTime: u32,
9695 #[doc = "< RLOC16"]
9696 pub mRloc16: u16,
9697 #[doc = "< Link Frame Counter"]
9698 pub mLinkFrameCounter: u32,
9699 #[doc = "< MLE Frame Counter"]
9700 pub mMleFrameCounter: u32,
9701 #[doc = "< Link Quality In"]
9702 pub mLinkQualityIn: u8,
9703 #[doc = "< Average RSSI"]
9704 pub mAverageRssi: i8,
9705 #[doc = "< Last observed RSSI"]
9706 pub mLastRssi: i8,
9707 #[doc = "< Link Margin"]
9708 pub mLinkMargin: u8,
9709 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
9710 pub mFrameErrorRate: u16,
9711 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
9712 pub mMessageErrorRate: u16,
9713 #[doc = "< Thread version of the neighbor"]
9714 pub mVersion: u16,
9715 pub _bitfield_align_1: [u8; 0],
9716 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9717 pub __bindgen_padding_0: u8,
9718}
9719impl otNeighborInfo {
9720 #[inline]
9721 pub fn mRxOnWhenIdle(&self) -> bool {
9722 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9723 }
9724 #[inline]
9725 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9726 unsafe {
9727 let val: u8 = ::std::mem::transmute(val);
9728 self._bitfield_1.set(0usize, 1u8, val as u64)
9729 }
9730 }
9731 #[inline]
9732 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9733 unsafe {
9734 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9735 ::std::ptr::addr_of!((*this)._bitfield_1),
9736 0usize,
9737 1u8,
9738 ) as u8)
9739 }
9740 }
9741 #[inline]
9742 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9743 unsafe {
9744 let val: u8 = ::std::mem::transmute(val);
9745 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9746 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9747 0usize,
9748 1u8,
9749 val as u64,
9750 )
9751 }
9752 }
9753 #[inline]
9754 pub fn mFullThreadDevice(&self) -> bool {
9755 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9756 }
9757 #[inline]
9758 pub fn set_mFullThreadDevice(&mut self, val: bool) {
9759 unsafe {
9760 let val: u8 = ::std::mem::transmute(val);
9761 self._bitfield_1.set(1usize, 1u8, val as u64)
9762 }
9763 }
9764 #[inline]
9765 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
9766 unsafe {
9767 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9768 ::std::ptr::addr_of!((*this)._bitfield_1),
9769 1usize,
9770 1u8,
9771 ) as u8)
9772 }
9773 }
9774 #[inline]
9775 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
9776 unsafe {
9777 let val: u8 = ::std::mem::transmute(val);
9778 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9779 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9780 1usize,
9781 1u8,
9782 val as u64,
9783 )
9784 }
9785 }
9786 #[inline]
9787 pub fn mFullNetworkData(&self) -> bool {
9788 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9789 }
9790 #[inline]
9791 pub fn set_mFullNetworkData(&mut self, val: bool) {
9792 unsafe {
9793 let val: u8 = ::std::mem::transmute(val);
9794 self._bitfield_1.set(2usize, 1u8, val as u64)
9795 }
9796 }
9797 #[inline]
9798 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
9799 unsafe {
9800 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9801 ::std::ptr::addr_of!((*this)._bitfield_1),
9802 2usize,
9803 1u8,
9804 ) as u8)
9805 }
9806 }
9807 #[inline]
9808 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
9809 unsafe {
9810 let val: u8 = ::std::mem::transmute(val);
9811 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9812 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9813 2usize,
9814 1u8,
9815 val as u64,
9816 )
9817 }
9818 }
9819 #[inline]
9820 pub fn mIsChild(&self) -> bool {
9821 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
9822 }
9823 #[inline]
9824 pub fn set_mIsChild(&mut self, val: bool) {
9825 unsafe {
9826 let val: u8 = ::std::mem::transmute(val);
9827 self._bitfield_1.set(3usize, 1u8, val as u64)
9828 }
9829 }
9830 #[inline]
9831 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
9832 unsafe {
9833 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9834 ::std::ptr::addr_of!((*this)._bitfield_1),
9835 3usize,
9836 1u8,
9837 ) as u8)
9838 }
9839 }
9840 #[inline]
9841 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
9842 unsafe {
9843 let val: u8 = ::std::mem::transmute(val);
9844 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9845 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9846 3usize,
9847 1u8,
9848 val as u64,
9849 )
9850 }
9851 }
9852 #[inline]
9853 pub fn new_bitfield_1(
9854 mRxOnWhenIdle: bool,
9855 mFullThreadDevice: bool,
9856 mFullNetworkData: bool,
9857 mIsChild: bool,
9858 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9859 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9860 __bindgen_bitfield_unit.set(0usize, 1u8, {
9861 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9862 mRxOnWhenIdle as u64
9863 });
9864 __bindgen_bitfield_unit.set(1usize, 1u8, {
9865 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
9866 mFullThreadDevice as u64
9867 });
9868 __bindgen_bitfield_unit.set(2usize, 1u8, {
9869 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
9870 mFullNetworkData as u64
9871 });
9872 __bindgen_bitfield_unit.set(3usize, 1u8, {
9873 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
9874 mIsChild as u64
9875 });
9876 __bindgen_bitfield_unit
9877 }
9878}
9879pub type otNeighborInfoIterator = i16;
9880#[doc = " Represents the Thread Leader Data."]
9881#[repr(C)]
9882#[derive(Debug, Default, Copy, Clone)]
9883pub struct otLeaderData {
9884 #[doc = "< Partition ID"]
9885 pub mPartitionId: u32,
9886 #[doc = "< Leader Weight"]
9887 pub mWeighting: u8,
9888 #[doc = "< Full Network Data Version"]
9889 pub mDataVersion: u8,
9890 #[doc = "< Stable Network Data Version"]
9891 pub mStableDataVersion: u8,
9892 #[doc = "< Leader Router ID"]
9893 pub mLeaderRouterId: u8,
9894}
9895#[doc = " Holds diagnostic information for a Thread Router"]
9896#[repr(C)]
9897#[derive(Debug, Default, Copy, Clone)]
9898pub struct otRouterInfo {
9899 #[doc = "< IEEE 802.15.4 Extended Address"]
9900 pub mExtAddress: otExtAddress,
9901 #[doc = "< RLOC16"]
9902 pub mRloc16: u16,
9903 #[doc = "< Router ID"]
9904 pub mRouterId: u8,
9905 #[doc = "< Next hop to router"]
9906 pub mNextHop: u8,
9907 #[doc = "< Path cost to router"]
9908 pub mPathCost: u8,
9909 #[doc = "< Link Quality In"]
9910 pub mLinkQualityIn: u8,
9911 #[doc = "< Link Quality Out"]
9912 pub mLinkQualityOut: u8,
9913 #[doc = "< Time last heard"]
9914 pub mAge: u8,
9915 pub _bitfield_align_1: [u8; 0],
9916 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9917 #[doc = "< Thread version"]
9918 pub mVersion: u8,
9919 #[doc = "< CSL clock accuracy, in ± ppm"]
9920 pub mCslClockAccuracy: u8,
9921 #[doc = "< CSL uncertainty, in ±10 us"]
9922 pub mCslUncertainty: u8,
9923}
9924impl otRouterInfo {
9925 #[inline]
9926 pub fn mAllocated(&self) -> bool {
9927 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9928 }
9929 #[inline]
9930 pub fn set_mAllocated(&mut self, val: bool) {
9931 unsafe {
9932 let val: u8 = ::std::mem::transmute(val);
9933 self._bitfield_1.set(0usize, 1u8, val as u64)
9934 }
9935 }
9936 #[inline]
9937 pub unsafe fn mAllocated_raw(this: *const Self) -> bool {
9938 unsafe {
9939 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9940 ::std::ptr::addr_of!((*this)._bitfield_1),
9941 0usize,
9942 1u8,
9943 ) as u8)
9944 }
9945 }
9946 #[inline]
9947 pub unsafe fn set_mAllocated_raw(this: *mut Self, val: bool) {
9948 unsafe {
9949 let val: u8 = ::std::mem::transmute(val);
9950 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9951 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9952 0usize,
9953 1u8,
9954 val as u64,
9955 )
9956 }
9957 }
9958 #[inline]
9959 pub fn mLinkEstablished(&self) -> bool {
9960 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9961 }
9962 #[inline]
9963 pub fn set_mLinkEstablished(&mut self, val: bool) {
9964 unsafe {
9965 let val: u8 = ::std::mem::transmute(val);
9966 self._bitfield_1.set(1usize, 1u8, val as u64)
9967 }
9968 }
9969 #[inline]
9970 pub unsafe fn mLinkEstablished_raw(this: *const Self) -> bool {
9971 unsafe {
9972 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9973 ::std::ptr::addr_of!((*this)._bitfield_1),
9974 1usize,
9975 1u8,
9976 ) as u8)
9977 }
9978 }
9979 #[inline]
9980 pub unsafe fn set_mLinkEstablished_raw(this: *mut Self, val: bool) {
9981 unsafe {
9982 let val: u8 = ::std::mem::transmute(val);
9983 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9984 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9985 1usize,
9986 1u8,
9987 val as u64,
9988 )
9989 }
9990 }
9991 #[inline]
9992 pub fn new_bitfield_1(
9993 mAllocated: bool,
9994 mLinkEstablished: bool,
9995 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9996 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9997 __bindgen_bitfield_unit.set(0usize, 1u8, {
9998 let mAllocated: u8 = unsafe { ::std::mem::transmute(mAllocated) };
9999 mAllocated as u64
10000 });
10001 __bindgen_bitfield_unit.set(1usize, 1u8, {
10002 let mLinkEstablished: u8 = unsafe { ::std::mem::transmute(mLinkEstablished) };
10003 mLinkEstablished as u64
10004 });
10005 __bindgen_bitfield_unit
10006 }
10007}
10008#[doc = " Represents the IP level counters."]
10009#[repr(C)]
10010#[derive(Debug, Default, Copy, Clone)]
10011pub struct otIpCounters {
10012 #[doc = "< The number of IPv6 packets successfully transmitted."]
10013 pub mTxSuccess: u32,
10014 #[doc = "< The number of IPv6 packets successfully received."]
10015 pub mRxSuccess: u32,
10016 #[doc = "< The number of IPv6 packets failed to transmit."]
10017 pub mTxFailure: u32,
10018 #[doc = "< The number of IPv6 packets failed to receive."]
10019 pub mRxFailure: u32,
10020}
10021#[doc = " Represents the Thread MLE counters."]
10022#[repr(C)]
10023#[derive(Debug, Default, Copy, Clone)]
10024pub struct otMleCounters {
10025 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DISABLED role."]
10026 pub mDisabledRole: u16,
10027 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DETACHED role."]
10028 pub mDetachedRole: u16,
10029 #[doc = "< Number of times device entered OT_DEVICE_ROLE_CHILD role."]
10030 pub mChildRole: u16,
10031 #[doc = "< Number of times device entered OT_DEVICE_ROLE_ROUTER role."]
10032 pub mRouterRole: u16,
10033 #[doc = "< Number of times device entered OT_DEVICE_ROLE_LEADER role."]
10034 pub mLeaderRole: u16,
10035 #[doc = "< Number of attach attempts while device was detached."]
10036 pub mAttachAttempts: u16,
10037 #[doc = "< Number of changes to partition ID."]
10038 pub mPartitionIdChanges: u16,
10039 #[doc = "< Number of attempts to attach to a better partition."]
10040 pub mBetterPartitionAttachAttempts: u16,
10041 #[doc = "< Number of attempts to attach to find a better parent (parent search)."]
10042 pub mBetterParentAttachAttempts: u16,
10043 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role."]
10044 pub mDisabledTime: u64,
10045 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role."]
10046 pub mDetachedTime: u64,
10047 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role."]
10048 pub mChildTime: u64,
10049 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role."]
10050 pub mRouterTime: u64,
10051 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role."]
10052 pub mLeaderTime: u64,
10053 #[doc = "< Number of milliseconds tracked by previous counters."]
10054 pub mTrackedTime: u64,
10055 #[doc = " Number of times device changed its parent.\n\n A parent change can happen if device detaches from its current parent and attaches to a different one, or even\n while device is attached when the periodic parent search feature is enabled (please see option\n OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE)."]
10056 pub mParentChanges: u16,
10057}
10058#[doc = " Represents the MLE Parent Response data."]
10059#[repr(C)]
10060#[derive(Debug, Default, Copy, Clone)]
10061pub struct otThreadParentResponseInfo {
10062 #[doc = "< IEEE 802.15.4 Extended Address of the Parent"]
10063 pub mExtAddr: otExtAddress,
10064 #[doc = "< Short address of the Parent"]
10065 pub mRloc16: u16,
10066 #[doc = "< Rssi of the Parent"]
10067 pub mRssi: i8,
10068 #[doc = "< Parent priority"]
10069 pub mPriority: i8,
10070 #[doc = "< Parent Link Quality 3"]
10071 pub mLinkQuality3: u8,
10072 #[doc = "< Parent Link Quality 2"]
10073 pub mLinkQuality2: u8,
10074 #[doc = "< Parent Link Quality 1"]
10075 pub mLinkQuality1: u8,
10076 #[doc = "< Is the node receiving parent response attached"]
10077 pub mIsAttached: bool,
10078}
10079#[doc = " This callback informs the application that the detaching process has finished.\n\n @param[in] aContext A pointer to application-specific context."]
10080pub type otDetachGracefullyCallback =
10081 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
10082#[doc = " Informs the application about the result of waking a Wake-up End Device.\n\n @param[in] aError OT_ERROR_NONE Indicates that the Wake-up End Device has been added as a neighbor.\n OT_ERROR_FAILED Indicates that the Wake-up End Device has not received a wake-up frame, or it\n has failed the MLE procedure.\n @param[in] aContext A pointer to application-specific context."]
10083pub type otWakeupCallback = ::std::option::Option<
10084 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
10085>;
10086unsafe extern "C" {
10087 #[doc = " Starts Thread protocol operation.\n\n The interface must be up when calling this function.\n\n Calling this function with @p aEnabled set to FALSE stops any ongoing processes of detaching started by\n otThreadDetachGracefully(). Its callback will be called.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE if Thread is enabled, FALSE otherwise.\n\n @retval OT_ERROR_NONE Successfully started Thread protocol operation.\n @retval OT_ERROR_INVALID_STATE The network interface was not up."]
10088 pub fn otThreadSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
10089}
10090unsafe extern "C" {
10091 #[doc = " Gets the Thread protocol version.\n\n The constants `OT_THREAD_VERSION_*` define the numerical version values.\n\n @returns the Thread protocol version."]
10092 pub fn otThreadGetVersion() -> u16;
10093}
10094unsafe extern "C" {
10095 #[doc = " Indicates whether a node is the only router on the network.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE It is the only router in the network.\n @retval FALSE It is a child or is not a single router in the network."]
10096 pub fn otThreadIsSingleton(aInstance: *mut otInstance) -> bool;
10097}
10098unsafe extern "C" {
10099 #[doc = " Starts a Thread Discovery scan.\n\n @note A successful call to this function enables the rx-on-when-idle mode for the entire scan procedure.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).\n @param[in] aPanId The PAN ID filter (set to Broadcast PAN to disable filter).\n @param[in] aJoiner Value of the Joiner Flag in the Discovery Request TLV.\n @param[in] aEnableEui64Filtering TRUE to filter responses on EUI-64, FALSE otherwise.\n @param[in] aCallback A pointer to a function called on receiving an MLE Discovery Response or\n scan completes.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully started a Thread Discovery Scan.\n @retval OT_ERROR_INVALID_STATE The IPv6 interface is not enabled (netif is not up).\n @retval OT_ERROR_NO_BUFS Could not allocate message for Discovery Request.\n @retval OT_ERROR_BUSY Thread Discovery Scan is already in progress."]
10100 pub fn otThreadDiscover(
10101 aInstance: *mut otInstance,
10102 aScanChannels: u32,
10103 aPanId: u16,
10104 aJoiner: bool,
10105 aEnableEui64Filtering: bool,
10106 aCallback: otHandleActiveScanResult,
10107 aCallbackContext: *mut ::std::os::raw::c_void,
10108 ) -> otError;
10109}
10110unsafe extern "C" {
10111 #[doc = " Determines if an MLE Thread Discovery is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10112 pub fn otThreadIsDiscoverInProgress(aInstance: *mut otInstance) -> bool;
10113}
10114unsafe extern "C" {
10115 #[doc = " Sets the Thread Joiner Advertisement used when discovering a Thread network.\n\n Requires `OPENTHREAD_CONFIG_JOINER_ADV_EXPERIMENTAL_ENABLE`.\n\n @note This is an experimental feature and is not part of the Thread specification. OpenThread's implementation is\n partial: it provides the mechanism for a Joiner to include a new Joiner Adv TLV in its emitted Discovery Scan\n Request messages, but does not include the corresponding logic for the receiver of Scan Request to read or\n parse this TLV.\n\n A Joiner can use this to advertise its own application-specific information (such as Vendor ID, Product ID,\n Discriminator, etc.) using a newly proposed Joiner Advertisement TLV (`OT_MESHCOP_TLV_JOINERADVERTISEMENT`).\n This TLV is appended as a sub-TLV within the MLE Discovery TLV in an MLE Discovery Scan Request message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aOui The Vendor IEEE OUI value that will be included in the Joiner Advertisement. Only the\n least significant 3 bytes will be used, and the most significant byte will be ignored.\n @param[in] aAdvData A pointer to the AdvData that will be included in the Joiner Advertisement.\n @param[in] aAdvDataLength The length of AdvData in bytes. Must not exceed `OT_JOINER_ADVDATA_MAX_LENGTH`.\n\n @retval OT_ERROR_NONE Successfully set Joiner Advertisement.\n @retval OT_ERROR_INVALID_ARGS Invalid AdvData."]
10116 pub fn otThreadSetJoinerAdvertisement(
10117 aInstance: *mut otInstance,
10118 aOui: u32,
10119 aAdvData: *const u8,
10120 aAdvDataLength: u8,
10121 ) -> otError;
10122}
10123unsafe extern "C" {
10124 #[doc = " Gets the Thread Child Timeout (in seconds) used when operating in the Child role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Thread Child Timeout value in seconds.\n\n @sa otThreadSetChildTimeout"]
10125 pub fn otThreadGetChildTimeout(aInstance: *mut otInstance) -> u32;
10126}
10127unsafe extern "C" {
10128 #[doc = " Sets the Thread Child Timeout (in seconds) used when operating in the Child role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTimeout The timeout value in seconds.\n\n @sa otThreadGetChildTimeout"]
10129 pub fn otThreadSetChildTimeout(aInstance: *mut otInstance, aTimeout: u32);
10130}
10131unsafe extern "C" {
10132 #[doc = " Gets the IEEE 802.15.4 Extended PAN ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the IEEE 802.15.4 Extended PAN ID.\n\n @sa otThreadSetExtendedPanId"]
10133 pub fn otThreadGetExtendedPanId(aInstance: *mut otInstance) -> *const otExtendedPanId;
10134}
10135unsafe extern "C" {
10136 #[doc = " Sets the IEEE 802.15.4 Extended PAN ID.\n\n @note Can only be called while Thread protocols are disabled. A successful\n call to this function invalidates the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtendedPanId A pointer to the IEEE 802.15.4 Extended PAN ID.\n\n @retval OT_ERROR_NONE Successfully set the Extended PAN ID.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetExtendedPanId"]
10137 pub fn otThreadSetExtendedPanId(
10138 aInstance: *mut otInstance,
10139 aExtendedPanId: *const otExtendedPanId,
10140 ) -> otError;
10141}
10142unsafe extern "C" {
10143 #[doc = " Returns a pointer to the Leader's RLOC.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aLeaderRloc A pointer to the Leader's RLOC.\n\n @retval OT_ERROR_NONE The Leader's RLOC was successfully written to @p aLeaderRloc.\n @retval OT_ERROR_INVALID_ARGS @p aLeaderRloc was NULL.\n @retval OT_ERROR_DETACHED Not currently attached to a Thread Partition."]
10144 pub fn otThreadGetLeaderRloc(
10145 aInstance: *mut otInstance,
10146 aLeaderRloc: *mut otIp6Address,
10147 ) -> otError;
10148}
10149unsafe extern "C" {
10150 #[doc = " Get the MLE Link Mode configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The MLE Link Mode configuration.\n\n @sa otThreadSetLinkMode"]
10151 pub fn otThreadGetLinkMode(aInstance: *mut otInstance) -> otLinkModeConfig;
10152}
10153unsafe extern "C" {
10154 #[doc = " Set the MLE Link Mode configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the Link Mode configuration.\n\n @retval OT_ERROR_NONE Successfully set the MLE Link Mode configuration.\n\n @sa otThreadGetLinkMode"]
10155 pub fn otThreadSetLinkMode(aInstance: *mut otInstance, aConfig: otLinkModeConfig) -> otError;
10156}
10157unsafe extern "C" {
10158 #[doc = " Get the Thread Network Key.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNetworkKey A pointer to an `otNetworkKey` to return the Thread Network Key.\n\n @sa otThreadSetNetworkKey"]
10159 pub fn otThreadGetNetworkKey(aInstance: *mut otInstance, aNetworkKey: *mut otNetworkKey);
10160}
10161unsafe extern "C" {
10162 #[doc = " Get the `otNetworkKeyRef` for Thread Network Key.\n\n Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns Reference to the Thread Network Key stored in memory.\n\n @sa otThreadSetNetworkKeyRef"]
10163 pub fn otThreadGetNetworkKeyRef(aInstance: *mut otInstance) -> otNetworkKeyRef;
10164}
10165unsafe extern "C" {
10166 #[doc = " Set the Thread Network Key.\n\n Succeeds only when Thread protocols are disabled. A successful\n call to this function invalidates the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKey A pointer to a buffer containing the Thread Network Key.\n\n @retval OT_ERROR_NONE Successfully set the Thread Network Key.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetNetworkKey"]
10167 pub fn otThreadSetNetworkKey(aInstance: *mut otInstance, aKey: *const otNetworkKey) -> otError;
10168}
10169unsafe extern "C" {
10170 #[doc = " Set the Thread Network Key as a `otNetworkKeyRef`.\n\n Succeeds only when Thread protocols are disabled. A successful\n call to this function invalidates the Active and Pending Operational Datasets in\n non-volatile memory.\n\n Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyRef Reference to the Thread Network Key.\n\n @retval OT_ERROR_NONE Successfully set the Thread Network Key.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetNetworkKeyRef"]
10171 pub fn otThreadSetNetworkKeyRef(
10172 aInstance: *mut otInstance,
10173 aKeyRef: otNetworkKeyRef,
10174 ) -> otError;
10175}
10176unsafe extern "C" {
10177 #[doc = " Gets the Thread Routing Locator (RLOC) address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Thread Routing Locator (RLOC) address."]
10178 pub fn otThreadGetRloc(aInstance: *mut otInstance) -> *const otIp6Address;
10179}
10180unsafe extern "C" {
10181 #[doc = " Gets the Mesh Local EID address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Mesh Local EID address."]
10182 pub fn otThreadGetMeshLocalEid(aInstance: *mut otInstance) -> *const otIp6Address;
10183}
10184unsafe extern "C" {
10185 #[doc = " Returns a pointer to the Mesh Local Prefix.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Mesh Local Prefix."]
10186 pub fn otThreadGetMeshLocalPrefix(aInstance: *mut otInstance) -> *const otMeshLocalPrefix;
10187}
10188unsafe extern "C" {
10189 #[doc = " Sets the Mesh Local Prefix.\n\n Succeeds only when Thread protocols are disabled. A successful\n call to this function invalidates the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMeshLocalPrefix A pointer to the Mesh Local Prefix.\n\n @retval OT_ERROR_NONE Successfully set the Mesh Local Prefix.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
10190 pub fn otThreadSetMeshLocalPrefix(
10191 aInstance: *mut otInstance,
10192 aMeshLocalPrefix: *const otMeshLocalPrefix,
10193 ) -> otError;
10194}
10195unsafe extern "C" {
10196 #[doc = " Gets the Thread link-local IPv6 address.\n\n The Thread link local address is derived using IEEE802.15.4 Extended Address as Interface Identifier.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to Thread link-local IPv6 address."]
10197 pub fn otThreadGetLinkLocalIp6Address(aInstance: *mut otInstance) -> *const otIp6Address;
10198}
10199unsafe extern "C" {
10200 #[doc = " Gets the Thread Link-Local All Thread Nodes multicast address.\n\n The address is a link-local Unicast Prefix-Based Multicast Address [RFC 3306], with:\n - flgs set to 3 (P = 1 and T = 1)\n - scop set to 2\n - plen set to 64\n - network prefix set to the Mesh Local Prefix\n - group ID set to 1\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to Thread Link-Local All Thread Nodes multicast address."]
10201 pub fn otThreadGetLinkLocalAllThreadNodesMulticastAddress(
10202 aInstance: *mut otInstance,
10203 ) -> *const otIp6Address;
10204}
10205unsafe extern "C" {
10206 #[doc = " Gets the Thread Realm-Local All Thread Nodes multicast address.\n\n The address is a realm-local Unicast Prefix-Based Multicast Address [RFC 3306], with:\n - flgs set to 3 (P = 1 and T = 1)\n - scop set to 3\n - plen set to 64\n - network prefix set to the Mesh Local Prefix\n - group ID set to 1\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to Thread Realm-Local All Thread Nodes multicast address."]
10207 pub fn otThreadGetRealmLocalAllThreadNodesMulticastAddress(
10208 aInstance: *mut otInstance,
10209 ) -> *const otIp6Address;
10210}
10211unsafe extern "C" {
10212 #[doc = " Retrieves the Service ALOC for given Service ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aServiceId Service ID to get ALOC for.\n @param[out] aServiceAloc A pointer to output the Service ALOC. MUST NOT BE NULL.\n\n @retval OT_ERROR_NONE Successfully retrieved the Service ALOC.\n @retval OT_ERROR_DETACHED The Thread interface is not currently attached to a Thread Partition."]
10213 pub fn otThreadGetServiceAloc(
10214 aInstance: *mut otInstance,
10215 aServiceId: u8,
10216 aServiceAloc: *mut otIp6Address,
10217 ) -> otError;
10218}
10219unsafe extern "C" {
10220 #[doc = " Get the Thread Network Name.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Thread Network Name.\n\n @sa otThreadSetNetworkName"]
10221 pub fn otThreadGetNetworkName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10222}
10223unsafe extern "C" {
10224 #[doc = " Set the Thread Network Name.\n\n Succeeds only when Thread protocols are disabled. A successful\n call to this function invalidates the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aNetworkName A pointer to the Thread Network Name.\n\n @retval OT_ERROR_NONE Successfully set the Thread Network Name.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetNetworkName"]
10225 pub fn otThreadSetNetworkName(
10226 aInstance: *mut otInstance,
10227 aNetworkName: *const ::std::os::raw::c_char,
10228 ) -> otError;
10229}
10230unsafe extern "C" {
10231 #[doc = " Gets the Thread Domain Name.\n\n @note Available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Thread Domain Name.\n\n @sa otThreadSetDomainName"]
10232 pub fn otThreadGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10233}
10234unsafe extern "C" {
10235 #[doc = " Sets the Thread Domain Name. Only succeeds when Thread protocols are disabled.\n\n @note Available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDomainName A pointer to the Thread Domain Name.\n\n @retval OT_ERROR_NONE Successfully set the Thread Domain Name.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetDomainName"]
10236 pub fn otThreadSetDomainName(
10237 aInstance: *mut otInstance,
10238 aDomainName: *const ::std::os::raw::c_char,
10239 ) -> otError;
10240}
10241unsafe extern "C" {
10242 #[doc = " Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.\n\n Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.\n\n @note Only available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.\n\n @retval OT_ERROR_NONE Successfully set/cleared the Interface Identifier.\n @retval OT_ERROR_INVALID_ARGS The specified Interface Identifier is reserved.\n\n @sa otThreadGetFixedDuaInterfaceIdentifier"]
10243 pub fn otThreadSetFixedDuaInterfaceIdentifier(
10244 aInstance: *mut otInstance,
10245 aIid: *const otIp6InterfaceIdentifier,
10246 ) -> otError;
10247}
10248unsafe extern "C" {
10249 #[doc = " Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.\n\n Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.\n\n @note Only available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Interface Identifier which was set manually, or NULL if none was set.\n\n @sa otThreadSetFixedDuaInterfaceIdentifier"]
10250 pub fn otThreadGetFixedDuaInterfaceIdentifier(
10251 aInstance: *mut otInstance,
10252 ) -> *const otIp6InterfaceIdentifier;
10253}
10254unsafe extern "C" {
10255 #[doc = " Gets the thrKeySequenceCounter.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The thrKeySequenceCounter value.\n\n @sa otThreadSetKeySequenceCounter"]
10256 pub fn otThreadGetKeySequenceCounter(aInstance: *mut otInstance) -> u32;
10257}
10258unsafe extern "C" {
10259 #[doc = " Sets the thrKeySequenceCounter.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeySequenceCounter The thrKeySequenceCounter value.\n\n @sa otThreadGetKeySequenceCounter"]
10260 pub fn otThreadSetKeySequenceCounter(aInstance: *mut otInstance, aKeySequenceCounter: u32);
10261}
10262unsafe extern "C" {
10263 #[doc = " Gets the thrKeySwitchGuardTime (in hours).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The thrKeySwitchGuardTime value (in hours).\n\n @sa otThreadSetKeySwitchGuardTime"]
10264 pub fn otThreadGetKeySwitchGuardTime(aInstance: *mut otInstance) -> u16;
10265}
10266unsafe extern "C" {
10267 #[doc = " Sets the thrKeySwitchGuardTime (in hours).\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeySwitchGuardTime The thrKeySwitchGuardTime value (in hours).\n\n @sa otThreadGetKeySwitchGuardTime"]
10268 pub fn otThreadSetKeySwitchGuardTime(aInstance: *mut otInstance, aKeySwitchGuardTime: u16);
10269}
10270unsafe extern "C" {
10271 #[doc = " Detach from the Thread network.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully detached from the Thread network.\n @retval OT_ERROR_INVALID_STATE Thread is disabled."]
10272 pub fn otThreadBecomeDetached(aInstance: *mut otInstance) -> otError;
10273}
10274unsafe extern "C" {
10275 #[doc = " Attempt to reattach as a child.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully begin attempt to become a child.\n @retval OT_ERROR_INVALID_STATE Thread is disabled."]
10276 pub fn otThreadBecomeChild(aInstance: *mut otInstance) -> otError;
10277}
10278unsafe extern "C" {
10279 #[doc = " Gets the next neighbor information. It is used to go through the entries of\n the neighbor table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator context. To get the first neighbor entry\nit should be set to OT_NEIGHBOR_INFO_ITERATOR_INIT.\n @param[out] aInfo A pointer to the neighbor information.\n\n @retval OT_ERROR_NONE Successfully found the next neighbor entry in table.\n @retval OT_ERROR_NOT_FOUND No subsequent neighbor entry exists in the table.\n @retval OT_ERROR_INVALID_ARGS @p aIterator or @p aInfo was NULL."]
10280 pub fn otThreadGetNextNeighborInfo(
10281 aInstance: *mut otInstance,
10282 aIterator: *mut otNeighborInfoIterator,
10283 aInfo: *mut otNeighborInfo,
10284 ) -> otError;
10285}
10286unsafe extern "C" {
10287 #[doc = " Get the device role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_DEVICE_ROLE_DISABLED The Thread stack is disabled.\n @retval OT_DEVICE_ROLE_DETACHED The device is not currently participating in a Thread network/partition.\n @retval OT_DEVICE_ROLE_CHILD The device is currently operating as a Thread Child.\n @retval OT_DEVICE_ROLE_ROUTER The device is currently operating as a Thread Router.\n @retval OT_DEVICE_ROLE_LEADER The device is currently operating as a Thread Leader."]
10288 pub fn otThreadGetDeviceRole(aInstance: *mut otInstance) -> otDeviceRole;
10289}
10290unsafe extern "C" {
10291 #[doc = " Convert the device role to human-readable string.\n\n @param[in] aRole The device role to convert.\n\n @returns A string representing @p aRole."]
10292 pub fn otThreadDeviceRoleToString(aRole: otDeviceRole) -> *const ::std::os::raw::c_char;
10293}
10294unsafe extern "C" {
10295 #[doc = " Get the Thread Leader Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aLeaderData A pointer to where the leader data is placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the leader data.\n @retval OT_ERROR_DETACHED Not currently attached."]
10296 pub fn otThreadGetLeaderData(
10297 aInstance: *mut otInstance,
10298 aLeaderData: *mut otLeaderData,
10299 ) -> otError;
10300}
10301unsafe extern "C" {
10302 #[doc = " Get the Leader's Router ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Router ID."]
10303 pub fn otThreadGetLeaderRouterId(aInstance: *mut otInstance) -> u8;
10304}
10305unsafe extern "C" {
10306 #[doc = " Get the Leader's Weight.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Weight."]
10307 pub fn otThreadGetLeaderWeight(aInstance: *mut otInstance) -> u8;
10308}
10309unsafe extern "C" {
10310 #[doc = " Get the Partition ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Partition ID."]
10311 pub fn otThreadGetPartitionId(aInstance: *mut otInstance) -> u32;
10312}
10313unsafe extern "C" {
10314 #[doc = " Get the RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RLOC16."]
10315 pub fn otThreadGetRloc16(aInstance: *mut otInstance) -> u16;
10316}
10317unsafe extern "C" {
10318 #[doc = " The function retrieves diagnostic information for a Thread Router as parent.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aParentInfo A pointer to where the parent router information is placed."]
10319 pub fn otThreadGetParentInfo(
10320 aInstance: *mut otInstance,
10321 aParentInfo: *mut otRouterInfo,
10322 ) -> otError;
10323}
10324unsafe extern "C" {
10325 #[doc = " The function retrieves the average RSSI for the Thread Parent.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aParentRssi A pointer to where the parent RSSI should be placed."]
10326 pub fn otThreadGetParentAverageRssi(
10327 aInstance: *mut otInstance,
10328 aParentRssi: *mut i8,
10329 ) -> otError;
10330}
10331unsafe extern "C" {
10332 #[doc = " The function retrieves the RSSI of the last packet from the Thread Parent.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aLastRssi A pointer to where the last RSSI should be placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the RSSI data.\n @retval OT_ERROR_FAILED Unable to get RSSI data.\n @retval OT_ERROR_INVALID_ARGS @p aLastRssi is NULL."]
10333 pub fn otThreadGetParentLastRssi(aInstance: *mut otInstance, aLastRssi: *mut i8) -> otError;
10334}
10335unsafe extern "C" {
10336 #[doc = " Starts the process for child to search for a better parent while staying attached to its current parent.\n\n Must be used when device is attached as a child.\n\n @retval OT_ERROR_NONE Successfully started the process to search for a better parent.\n @retval OT_ERROR_INVALID_STATE Device role is not child."]
10337 pub fn otThreadSearchForBetterParent(aInstance: *mut otInstance) -> otError;
10338}
10339unsafe extern "C" {
10340 #[doc = " Gets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the IPv6 counters."]
10341 pub fn otThreadGetIp6Counters(aInstance: *mut otInstance) -> *const otIpCounters;
10342}
10343unsafe extern "C" {
10344 #[doc = " Resets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10345 pub fn otThreadResetIp6Counters(aInstance: *mut otInstance);
10346}
10347unsafe extern "C" {
10348 #[doc = " Gets the time-in-queue histogram for messages in the TX queue.\n\n Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.\n\n Histogram of the time-in-queue of messages in the transmit queue is collected. The time-in-queue is tracked for\n direct transmissions only and is measured as the duration from when a message is added to the transmit queue until\n it is passed to the MAC layer for transmission or dropped.\n\n The histogram is returned as an array of `uint32_t` values with `aNumBins` entries. The first entry in the array\n (at index 0) represents the number of messages with a time-in-queue less than `aBinInterval`. The second entry\n represents the number of messages with a time-in-queue greater than or equal to `aBinInterval`, but less than\n `2 * aBinInterval`. And so on. The last entry represents the number of messages with time-in-queue greater than or\n equal to `(aNumBins - 1) * aBinInterval`.\n\n The collected statistics can be reset by calling `otThreadResetTimeInQueueStat()`. The histogram information is\n collected since the OpenThread instance was initialized or since the last time statistics collection was reset by\n calling the `otThreadResetTimeInQueueStat()`.\n\n Pointers @p aNumBins and @p aBinInterval MUST NOT be NULL.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumBins Pointer to return the number of bins in histogram (array length).\n @param[out] aBinInterval Pointer to return the histogram bin interval length in milliseconds.\n\n @returns A pointer to an array of @p aNumBins entries representing the collected histogram info."]
10349 pub fn otThreadGetTimeInQueueHistogram(
10350 aInstance: *mut otInstance,
10351 aNumBins: *mut u16,
10352 aBinInterval: *mut u32,
10353 ) -> *const u32;
10354}
10355unsafe extern "C" {
10356 #[doc = " Gets the maximum time-in-queue for messages in the TX queue.\n\n Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.\n\n The time-in-queue is tracked for direct transmissions only and is measured as the duration from when a message is\n added to the transmit queue until it is passed to the MAC layer for transmission or dropped.\n\n The collected statistics can be reset by calling `otThreadResetTimeInQueueStat()`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum time-in-queue in milliseconds for all messages in the TX queue (so far)."]
10357 pub fn otThreadGetMaxTimeInQueue(aInstance: *mut otInstance) -> u32;
10358}
10359unsafe extern "C" {
10360 #[doc = " Resets the TX queue time-in-queue statistics.\n\n Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10361 pub fn otThreadResetTimeInQueueStat(aInstance: *mut otInstance);
10362}
10363unsafe extern "C" {
10364 #[doc = " Gets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Thread MLE counters."]
10365 pub fn otThreadGetMleCounters(aInstance: *mut otInstance) -> *const otMleCounters;
10366}
10367unsafe extern "C" {
10368 #[doc = " Resets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10369 pub fn otThreadResetMleCounters(aInstance: *mut otInstance);
10370}
10371unsafe extern "C" {
10372 #[doc = " Gets the current attach duration (number of seconds since the device last attached).\n\n If the device is not currently attached, zero will be returned.\n\n Unlike the role-tracking variables in `otMleCounters`, which track the cumulative time the device is in each role,\n this function tracks the time since the last successful attachment, indicating how long the device has been\n connected to the Thread mesh (regardless of its role, whether acting as a child, router, or leader).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The number of seconds since last attached."]
10373 pub fn otThreadGetCurrentAttachDuration(aInstance: *mut otInstance) -> u32;
10374}
10375#[doc = " Pointer is called every time an MLE Parent Response message is received.\n\n This is used in `otThreadRegisterParentResponseCallback()`.\n\n @param[in] aInfo A pointer to a location on stack holding the stats data.\n @param[in] aContext A pointer to callback client-specific context."]
10376pub type otThreadParentResponseCallback = ::std::option::Option<
10377 unsafe extern "C" fn(
10378 aInfo: *mut otThreadParentResponseInfo,
10379 aContext: *mut ::std::os::raw::c_void,
10380 ),
10381>;
10382unsafe extern "C" {
10383 #[doc = " Registers a callback to receive MLE Parent Response data.\n\n Requires `OPENTHREAD_CONFIG_MLE_PARENT_RESPONSE_CALLBACK_API_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called upon receiving an MLE Parent Response message.\n @param[in] aContext A pointer to callback client-specific context."]
10384 pub fn otThreadRegisterParentResponseCallback(
10385 aInstance: *mut otInstance,
10386 aCallback: otThreadParentResponseCallback,
10387 aContext: *mut ::std::os::raw::c_void,
10388 );
10389}
10390#[doc = " Represents the Thread Discovery Request data."]
10391#[repr(C)]
10392#[derive(Debug, Default, Copy, Clone)]
10393pub struct otThreadDiscoveryRequestInfo {
10394 #[doc = "< IEEE 802.15.4 Extended Address of the requester"]
10395 pub mExtAddress: otExtAddress,
10396 pub _bitfield_align_1: [u8; 0],
10397 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10398}
10399impl otThreadDiscoveryRequestInfo {
10400 #[inline]
10401 pub fn mVersion(&self) -> u8 {
10402 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10403 }
10404 #[inline]
10405 pub fn set_mVersion(&mut self, val: u8) {
10406 unsafe {
10407 let val: u8 = ::std::mem::transmute(val);
10408 self._bitfield_1.set(0usize, 4u8, val as u64)
10409 }
10410 }
10411 #[inline]
10412 pub unsafe fn mVersion_raw(this: *const Self) -> u8 {
10413 unsafe {
10414 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10415 ::std::ptr::addr_of!((*this)._bitfield_1),
10416 0usize,
10417 4u8,
10418 ) as u8)
10419 }
10420 }
10421 #[inline]
10422 pub unsafe fn set_mVersion_raw(this: *mut Self, val: u8) {
10423 unsafe {
10424 let val: u8 = ::std::mem::transmute(val);
10425 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10426 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10427 0usize,
10428 4u8,
10429 val as u64,
10430 )
10431 }
10432 }
10433 #[inline]
10434 pub fn mIsJoiner(&self) -> bool {
10435 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10436 }
10437 #[inline]
10438 pub fn set_mIsJoiner(&mut self, val: bool) {
10439 unsafe {
10440 let val: u8 = ::std::mem::transmute(val);
10441 self._bitfield_1.set(4usize, 1u8, val as u64)
10442 }
10443 }
10444 #[inline]
10445 pub unsafe fn mIsJoiner_raw(this: *const Self) -> bool {
10446 unsafe {
10447 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10448 ::std::ptr::addr_of!((*this)._bitfield_1),
10449 4usize,
10450 1u8,
10451 ) as u8)
10452 }
10453 }
10454 #[inline]
10455 pub unsafe fn set_mIsJoiner_raw(this: *mut Self, val: bool) {
10456 unsafe {
10457 let val: u8 = ::std::mem::transmute(val);
10458 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10459 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10460 4usize,
10461 1u8,
10462 val as u64,
10463 )
10464 }
10465 }
10466 #[inline]
10467 pub fn new_bitfield_1(mVersion: u8, mIsJoiner: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10468 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10469 __bindgen_bitfield_unit.set(0usize, 4u8, {
10470 let mVersion: u8 = unsafe { ::std::mem::transmute(mVersion) };
10471 mVersion as u64
10472 });
10473 __bindgen_bitfield_unit.set(4usize, 1u8, {
10474 let mIsJoiner: u8 = unsafe { ::std::mem::transmute(mIsJoiner) };
10475 mIsJoiner as u64
10476 });
10477 __bindgen_bitfield_unit
10478 }
10479}
10480#[doc = " Pointer is called every time an MLE Discovery Request message is received.\n\n @param[in] aInfo A pointer to the Discovery Request info data.\n @param[in] aContext A pointer to callback application-specific context."]
10481pub type otThreadDiscoveryRequestCallback = ::std::option::Option<
10482 unsafe extern "C" fn(
10483 aInfo: *const otThreadDiscoveryRequestInfo,
10484 aContext: *mut ::std::os::raw::c_void,
10485 ),
10486>;
10487unsafe extern "C" {
10488 #[doc = " Sets a callback to receive MLE Discovery Request data.\n\n Requires `OPENTHREAD_CONFIG_MLE_DISCOVERY_SCAN_REQUEST_CALLBACK_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called upon receiving an MLE Discovery Request message.\n @param[in] aContext A pointer to callback application-specific context."]
10489 pub fn otThreadSetDiscoveryRequestCallback(
10490 aInstance: *mut otInstance,
10491 aCallback: otThreadDiscoveryRequestCallback,
10492 aContext: *mut ::std::os::raw::c_void,
10493 );
10494}
10495#[doc = " Pointer type defines the callback to notify the outcome of a `otThreadLocateAnycastDestination()`\n request.\n\n @param[in] aContext A pointer to an arbitrary context (provided when callback is registered).\n @param[in] aError The error when handling the request. OT_ERROR_NONE indicates success.\n OT_ERROR_RESPONSE_TIMEOUT indicates a destination could not be found.\n OT_ERROR_ABORT indicates the request was aborted.\n @param[in] aMeshLocalAddress A pointer to the mesh-local EID of the closest destination of the anycast address\n when @p aError is OT_ERROR_NONE, NULL otherwise.\n @param[in] aRloc16 The RLOC16 of the destination if found, otherwise invalid RLOC16 (0xfffe)."]
10496pub type otThreadAnycastLocatorCallback = ::std::option::Option<
10497 unsafe extern "C" fn(
10498 aContext: *mut ::std::os::raw::c_void,
10499 aError: otError,
10500 aMeshLocalAddress: *const otIp6Address,
10501 aRloc16: u16,
10502 ),
10503>;
10504unsafe extern "C" {
10505 #[doc = " Requests the closest destination of a given anycast address to be located.\n\n Is only available when `OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is enabled.\n\n If a previous request is ongoing, a subsequent call to this function will cancel and replace the earlier request.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAnycastAddress The anycast address to locate. MUST NOT be NULL.\n @param[in] aCallback The callback function to report the result.\n @param[in] aContext An arbitrary context used with @p aCallback.\n\n @retval OT_ERROR_NONE The request started successfully. @p aCallback will be invoked to report the result.\n @retval OT_ERROR_INVALID_ARGS The @p aAnycastAddress is not a valid anycast address or @p aCallback is NULL.\n @retval OT_ERROR_NO_BUFS Out of buffer to prepare and send the request message."]
10506 pub fn otThreadLocateAnycastDestination(
10507 aInstance: *mut otInstance,
10508 aAnycastAddress: *const otIp6Address,
10509 aCallback: otThreadAnycastLocatorCallback,
10510 aContext: *mut ::std::os::raw::c_void,
10511 ) -> otError;
10512}
10513unsafe extern "C" {
10514 #[doc = " Indicates whether an anycast locate request is currently in progress.\n\n Is only available when `OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns TRUE if an anycast locate request is currently in progress, FALSE otherwise."]
10515 pub fn otThreadIsAnycastLocateInProgress(aInstance: *mut otInstance) -> bool;
10516}
10517unsafe extern "C" {
10518 #[doc = " Sends a Proactive Address Notification (ADDR_NTF.ntf) message.\n\n Is only available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination The destination to send the ADDR_NTF.ntf message.\n @param[in] aTarget The target address of the ADDR_NTF.ntf message.\n @param[in] aMlIid The ML-IID of the ADDR_NTF.ntf message."]
10519 pub fn otThreadSendAddressNotification(
10520 aInstance: *mut otInstance,
10521 aDestination: *mut otIp6Address,
10522 aTarget: *mut otIp6Address,
10523 aMlIid: *mut otIp6InterfaceIdentifier,
10524 );
10525}
10526unsafe extern "C" {
10527 #[doc = " Sends a Proactive Backbone Notification (PRO_BB.ntf) message on the Backbone link.\n\n Is only available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTarget The target address of the PRO_BB.ntf message.\n @param[in] aMlIid The ML-IID of the PRO_BB.ntf message.\n @param[in] aTimeSinceLastTransaction Time since last transaction (in seconds).\n\n @retval OT_ERROR_NONE Successfully sent PRO_BB.ntf on backbone link.\n @retval OT_ERROR_NO_BUFS If insufficient message buffers available."]
10528 pub fn otThreadSendProactiveBackboneNotification(
10529 aInstance: *mut otInstance,
10530 aTarget: *mut otIp6Address,
10531 aMlIid: *mut otIp6InterfaceIdentifier,
10532 aTimeSinceLastTransaction: u32,
10533 ) -> otError;
10534}
10535unsafe extern "C" {
10536 #[doc = " Notifies other nodes in the network (if any) and then stops Thread protocol operation.\n\n It sends an Address Release if it's a router, or sets its child timeout to 0 if it's a child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called upon finishing detaching.\n @param[in] aContext A pointer to callback application-specific context.\n\n @retval OT_ERROR_NONE Successfully started detaching.\n @retval OT_ERROR_BUSY Detaching is already in progress."]
10537 pub fn otThreadDetachGracefully(
10538 aInstance: *mut otInstance,
10539 aCallback: otDetachGracefullyCallback,
10540 aContext: *mut ::std::os::raw::c_void,
10541 ) -> otError;
10542}
10543unsafe extern "C" {
10544 #[doc = " Converts an `uint32_t` duration (in seconds) to a human-readable string.\n\n Requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.\n\n The string follows the format \"<hh>:<mm>:<ss>\" for hours, minutes, seconds (if duration is shorter than one day) or\n \"<dd>d.<hh>:<mm>:<ss>\" (if longer than a day).\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n Is intended for use with `mAge` or `mConnectionTime` in `otNeighborInfo` or `otChildInfo` structures.\n\n @param[in] aDuration A duration interval in seconds.\n @param[out] aBuffer A pointer to a char array to output the string.\n @param[in] aSize The size of @p aBuffer (in bytes). Recommended to use `OT_DURATION_STRING_SIZE`."]
10545 pub fn otConvertDurationInSecondsToString(
10546 aDuration: u32,
10547 aBuffer: *mut ::std::os::raw::c_char,
10548 aSize: u16,
10549 );
10550}
10551unsafe extern "C" {
10552 #[doc = " Sets the store frame counter ahead.\n\n Requires `OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE` to be enabled.\n\n The OpenThread stack stores the MLE and MAC security frame counter values in non-volatile storage,\n ensuring they persist across device resets. These saved values are set to be ahead of their current\n values by the \"frame counter ahead\" value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStoreFrameCounterAhead The store frame counter ahead to set."]
10553 pub fn otThreadSetStoreFrameCounterAhead(
10554 aInstance: *mut otInstance,
10555 aStoreFrameCounterAhead: u32,
10556 );
10557}
10558unsafe extern "C" {
10559 #[doc = " Gets the store frame counter ahead.\n\n Requires `OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current store frame counter ahead."]
10560 pub fn otThreadGetStoreFrameCounterAhead(aInstance: *mut otInstance) -> u32;
10561}
10562unsafe extern "C" {
10563 #[doc = " Attempts to wake a Wake-up End Device.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` to be enabled.\n\n The wake-up starts with transmitting a wake-up frame sequence to the Wake-up End Device.\n During the wake-up sequence, and for a short time after the last wake-up frame is sent, the Wake-up Coordinator keeps\n its receiver on to be able to receive an initial mesh link establishment message from the WED.\n\n @warning The functionality implemented by this function is still in the design phase.\n Consequently, the prototype and semantics of this function are subject to change.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aWedAddress The extended address of the Wake-up End Device.\n @param[in] aWakeupIntervalUs An interval between consecutive wake-up frames (in microseconds).\n @param[in] aWakeupDurationMs Duration of the wake-up sequence (in milliseconds).\n @param[in] aCallback A pointer to function that is called when the wake-up succeeds or fails.\n @param[in] aCallbackContext A pointer to callback application-specific context.\n\n @retval OT_ERROR_NONE Successfully started the wake-up.\n @retval OT_ERROR_INVALID_STATE Another attachment request is still in progress.\n @retval OT_ERROR_INVALID_ARGS The wake-up interval or duration are invalid."]
10564 pub fn otThreadWakeup(
10565 aInstance: *mut otInstance,
10566 aWedAddress: *const otExtAddress,
10567 aWakeupIntervalUs: u16,
10568 aWakeupDurationMs: u16,
10569 aCallback: otWakeupCallback,
10570 aCallbackContext: *mut ::std::os::raw::c_void,
10571 ) -> otError;
10572}
10573#[doc = " Represents an iterator to iterate through a history list.\n\n The fields in this type are opaque (intended for use by OpenThread core) and therefore should not be accessed/used\n by caller.\n\n Before using an iterator, it MUST be initialized using `otHistoryTrackerInitIterator()`,"]
10574#[repr(C)]
10575#[derive(Debug, Default, Copy, Clone)]
10576pub struct otHistoryTrackerIterator {
10577 pub mData32: u32,
10578 pub mData16: u16,
10579}
10580#[doc = " Represents Thread network info."]
10581#[repr(C)]
10582#[derive(Debug, Copy, Clone)]
10583pub struct otHistoryTrackerNetworkInfo {
10584 #[doc = "< Device Role."]
10585 pub mRole: otDeviceRole,
10586 #[doc = "< Device Mode."]
10587 pub mMode: otLinkModeConfig,
10588 #[doc = "< Device RLOC16."]
10589 pub mRloc16: u16,
10590 #[doc = "< Partition ID (valid when attached)."]
10591 pub mPartitionId: u32,
10592}
10593impl Default for otHistoryTrackerNetworkInfo {
10594 fn default() -> Self {
10595 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10596 unsafe {
10597 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10598 s.assume_init()
10599 }
10600 }
10601}
10602#[doc = "< Address is added."]
10603pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_ADDED: otHistoryTrackerAddressEvent = 0;
10604#[doc = "< Address is removed."]
10605pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_REMOVED: otHistoryTrackerAddressEvent = 1;
10606#[doc = " Defines the events for an IPv6 (unicast or multicast) address info (i.e., whether address is added\n or removed)."]
10607pub type otHistoryTrackerAddressEvent = ::std::os::raw::c_uint;
10608#[doc = " Represent a unicast IPv6 address info."]
10609#[repr(C)]
10610#[derive(Copy, Clone)]
10611pub struct otHistoryTrackerUnicastAddressInfo {
10612 #[doc = "< The unicast IPv6 address."]
10613 pub mAddress: otIp6Address,
10614 #[doc = "< The Prefix length (in bits)."]
10615 pub mPrefixLength: u8,
10616 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10617 pub mAddressOrigin: u8,
10618 #[doc = "< Indicates the event (address is added/removed)."]
10619 pub mEvent: otHistoryTrackerAddressEvent,
10620 pub _bitfield_align_1: [u8; 0],
10621 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10622 pub __bindgen_padding_0: [u8; 3usize],
10623}
10624impl Default for otHistoryTrackerUnicastAddressInfo {
10625 fn default() -> Self {
10626 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10627 unsafe {
10628 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10629 s.assume_init()
10630 }
10631 }
10632}
10633impl otHistoryTrackerUnicastAddressInfo {
10634 #[inline]
10635 pub fn mScope(&self) -> u8 {
10636 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10637 }
10638 #[inline]
10639 pub fn set_mScope(&mut self, val: u8) {
10640 unsafe {
10641 let val: u8 = ::std::mem::transmute(val);
10642 self._bitfield_1.set(0usize, 4u8, val as u64)
10643 }
10644 }
10645 #[inline]
10646 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
10647 unsafe {
10648 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10649 ::std::ptr::addr_of!((*this)._bitfield_1),
10650 0usize,
10651 4u8,
10652 ) as u8)
10653 }
10654 }
10655 #[inline]
10656 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
10657 unsafe {
10658 let val: u8 = ::std::mem::transmute(val);
10659 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10660 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10661 0usize,
10662 4u8,
10663 val as u64,
10664 )
10665 }
10666 }
10667 #[inline]
10668 pub fn mPreferred(&self) -> bool {
10669 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10670 }
10671 #[inline]
10672 pub fn set_mPreferred(&mut self, val: bool) {
10673 unsafe {
10674 let val: u8 = ::std::mem::transmute(val);
10675 self._bitfield_1.set(4usize, 1u8, val as u64)
10676 }
10677 }
10678 #[inline]
10679 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
10680 unsafe {
10681 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10682 ::std::ptr::addr_of!((*this)._bitfield_1),
10683 4usize,
10684 1u8,
10685 ) as u8)
10686 }
10687 }
10688 #[inline]
10689 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
10690 unsafe {
10691 let val: u8 = ::std::mem::transmute(val);
10692 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10693 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10694 4usize,
10695 1u8,
10696 val as u64,
10697 )
10698 }
10699 }
10700 #[inline]
10701 pub fn mValid(&self) -> bool {
10702 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
10703 }
10704 #[inline]
10705 pub fn set_mValid(&mut self, val: bool) {
10706 unsafe {
10707 let val: u8 = ::std::mem::transmute(val);
10708 self._bitfield_1.set(5usize, 1u8, val as u64)
10709 }
10710 }
10711 #[inline]
10712 pub unsafe fn mValid_raw(this: *const Self) -> bool {
10713 unsafe {
10714 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10715 ::std::ptr::addr_of!((*this)._bitfield_1),
10716 5usize,
10717 1u8,
10718 ) as u8)
10719 }
10720 }
10721 #[inline]
10722 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
10723 unsafe {
10724 let val: u8 = ::std::mem::transmute(val);
10725 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10726 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10727 5usize,
10728 1u8,
10729 val as u64,
10730 )
10731 }
10732 }
10733 #[inline]
10734 pub fn mRloc(&self) -> bool {
10735 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
10736 }
10737 #[inline]
10738 pub fn set_mRloc(&mut self, val: bool) {
10739 unsafe {
10740 let val: u8 = ::std::mem::transmute(val);
10741 self._bitfield_1.set(6usize, 1u8, val as u64)
10742 }
10743 }
10744 #[inline]
10745 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
10746 unsafe {
10747 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10748 ::std::ptr::addr_of!((*this)._bitfield_1),
10749 6usize,
10750 1u8,
10751 ) as u8)
10752 }
10753 }
10754 #[inline]
10755 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
10756 unsafe {
10757 let val: u8 = ::std::mem::transmute(val);
10758 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10759 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10760 6usize,
10761 1u8,
10762 val as u64,
10763 )
10764 }
10765 }
10766 #[inline]
10767 pub fn new_bitfield_1(
10768 mScope: u8,
10769 mPreferred: bool,
10770 mValid: bool,
10771 mRloc: bool,
10772 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10773 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10774 __bindgen_bitfield_unit.set(0usize, 4u8, {
10775 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
10776 mScope as u64
10777 });
10778 __bindgen_bitfield_unit.set(4usize, 1u8, {
10779 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
10780 mPreferred as u64
10781 });
10782 __bindgen_bitfield_unit.set(5usize, 1u8, {
10783 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
10784 mValid as u64
10785 });
10786 __bindgen_bitfield_unit.set(6usize, 1u8, {
10787 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
10788 mRloc as u64
10789 });
10790 __bindgen_bitfield_unit
10791 }
10792}
10793#[doc = " Represent an IPv6 multicast address info."]
10794#[repr(C)]
10795#[derive(Copy, Clone)]
10796pub struct otHistoryTrackerMulticastAddressInfo {
10797 #[doc = "< The IPv6 multicast address."]
10798 pub mAddress: otIp6Address,
10799 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10800 pub mAddressOrigin: u8,
10801 #[doc = "< Indicates the event (address is added/removed)."]
10802 pub mEvent: otHistoryTrackerAddressEvent,
10803}
10804impl Default for otHistoryTrackerMulticastAddressInfo {
10805 fn default() -> Self {
10806 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10807 unsafe {
10808 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10809 s.assume_init()
10810 }
10811 }
10812}
10813#[doc = "< Low priority level."]
10814pub const OT_HISTORY_TRACKER_MSG_PRIORITY_LOW: _bindgen_ty_10 = 0;
10815#[doc = "< Normal priority level."]
10816pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NORMAL: _bindgen_ty_10 = 1;
10817#[doc = "< High priority level."]
10818pub const OT_HISTORY_TRACKER_MSG_PRIORITY_HIGH: _bindgen_ty_10 = 2;
10819#[doc = "< Network Control priority level."]
10820pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NET: _bindgen_ty_10 = 3;
10821#[doc = " Constants representing message priority used in `otHistoryTrackerMessageInfo` struct."]
10822pub type _bindgen_ty_10 = ::std::os::raw::c_uint;
10823#[doc = " Represents a RX/TX IPv6 message info.\n\n Some of the fields in this struct are applicable to a RX message or a TX message only, e.g., `mAveRxRss` is the\n average RSS of all fragment frames that form a received message and is only applicable for a RX message."]
10824#[repr(C)]
10825#[derive(Copy, Clone)]
10826pub struct otHistoryTrackerMessageInfo {
10827 #[doc = "< IPv6 payload length (exclude IP6 header itself)."]
10828 pub mPayloadLength: u16,
10829 #[doc = "< RLOC16 of neighbor which sent/received the msg (`0xfffe` if no RLOC16)."]
10830 pub mNeighborRloc16: u16,
10831 #[doc = "< Source IPv6 address and port (if UDP/TCP)"]
10832 pub mSource: otSockAddr,
10833 #[doc = "< Destination IPv6 address and port (if UDP/TCP)."]
10834 pub mDestination: otSockAddr,
10835 #[doc = "< Message checksum (valid only for UDP/TCP/ICMP6)."]
10836 pub mChecksum: u16,
10837 #[doc = "< IP Protocol number (`OT_IP6_PROTO_*` enumeration)."]
10838 pub mIpProto: u8,
10839 #[doc = "< ICMP6 type if msg is ICMP6, zero otherwise (`OT_ICMP6_TYPE_*` enumeration)."]
10840 pub mIcmp6Type: u8,
10841 #[doc = "< RSS of received message or OT_RADIO_INVALID_RSSI if not known."]
10842 pub mAveRxRss: i8,
10843 pub _bitfield_align_1: [u8; 0],
10844 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10845}
10846impl Default for otHistoryTrackerMessageInfo {
10847 fn default() -> Self {
10848 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10849 unsafe {
10850 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10851 s.assume_init()
10852 }
10853 }
10854}
10855impl otHistoryTrackerMessageInfo {
10856 #[inline]
10857 pub fn mLinkSecurity(&self) -> bool {
10858 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10859 }
10860 #[inline]
10861 pub fn set_mLinkSecurity(&mut self, val: bool) {
10862 unsafe {
10863 let val: u8 = ::std::mem::transmute(val);
10864 self._bitfield_1.set(0usize, 1u8, val as u64)
10865 }
10866 }
10867 #[inline]
10868 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
10869 unsafe {
10870 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10871 ::std::ptr::addr_of!((*this)._bitfield_1),
10872 0usize,
10873 1u8,
10874 ) as u8)
10875 }
10876 }
10877 #[inline]
10878 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
10879 unsafe {
10880 let val: u8 = ::std::mem::transmute(val);
10881 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10882 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10883 0usize,
10884 1u8,
10885 val as u64,
10886 )
10887 }
10888 }
10889 #[inline]
10890 pub fn mTxSuccess(&self) -> bool {
10891 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10892 }
10893 #[inline]
10894 pub fn set_mTxSuccess(&mut self, val: bool) {
10895 unsafe {
10896 let val: u8 = ::std::mem::transmute(val);
10897 self._bitfield_1.set(1usize, 1u8, val as u64)
10898 }
10899 }
10900 #[inline]
10901 pub unsafe fn mTxSuccess_raw(this: *const Self) -> bool {
10902 unsafe {
10903 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10904 ::std::ptr::addr_of!((*this)._bitfield_1),
10905 1usize,
10906 1u8,
10907 ) as u8)
10908 }
10909 }
10910 #[inline]
10911 pub unsafe fn set_mTxSuccess_raw(this: *mut Self, val: bool) {
10912 unsafe {
10913 let val: u8 = ::std::mem::transmute(val);
10914 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10915 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10916 1usize,
10917 1u8,
10918 val as u64,
10919 )
10920 }
10921 }
10922 #[inline]
10923 pub fn mPriority(&self) -> u8 {
10924 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
10925 }
10926 #[inline]
10927 pub fn set_mPriority(&mut self, val: u8) {
10928 unsafe {
10929 let val: u8 = ::std::mem::transmute(val);
10930 self._bitfield_1.set(2usize, 2u8, val as u64)
10931 }
10932 }
10933 #[inline]
10934 pub unsafe fn mPriority_raw(this: *const Self) -> u8 {
10935 unsafe {
10936 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10937 ::std::ptr::addr_of!((*this)._bitfield_1),
10938 2usize,
10939 2u8,
10940 ) as u8)
10941 }
10942 }
10943 #[inline]
10944 pub unsafe fn set_mPriority_raw(this: *mut Self, val: u8) {
10945 unsafe {
10946 let val: u8 = ::std::mem::transmute(val);
10947 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10948 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10949 2usize,
10950 2u8,
10951 val as u64,
10952 )
10953 }
10954 }
10955 #[inline]
10956 pub fn mRadioIeee802154(&self) -> bool {
10957 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10958 }
10959 #[inline]
10960 pub fn set_mRadioIeee802154(&mut self, val: bool) {
10961 unsafe {
10962 let val: u8 = ::std::mem::transmute(val);
10963 self._bitfield_1.set(4usize, 1u8, val as u64)
10964 }
10965 }
10966 #[inline]
10967 pub unsafe fn mRadioIeee802154_raw(this: *const Self) -> bool {
10968 unsafe {
10969 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10970 ::std::ptr::addr_of!((*this)._bitfield_1),
10971 4usize,
10972 1u8,
10973 ) as u8)
10974 }
10975 }
10976 #[inline]
10977 pub unsafe fn set_mRadioIeee802154_raw(this: *mut Self, val: bool) {
10978 unsafe {
10979 let val: u8 = ::std::mem::transmute(val);
10980 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10981 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10982 4usize,
10983 1u8,
10984 val as u64,
10985 )
10986 }
10987 }
10988 #[inline]
10989 pub fn mRadioTrelUdp6(&self) -> bool {
10990 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
10991 }
10992 #[inline]
10993 pub fn set_mRadioTrelUdp6(&mut self, val: bool) {
10994 unsafe {
10995 let val: u8 = ::std::mem::transmute(val);
10996 self._bitfield_1.set(5usize, 1u8, val as u64)
10997 }
10998 }
10999 #[inline]
11000 pub unsafe fn mRadioTrelUdp6_raw(this: *const Self) -> bool {
11001 unsafe {
11002 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11003 ::std::ptr::addr_of!((*this)._bitfield_1),
11004 5usize,
11005 1u8,
11006 ) as u8)
11007 }
11008 }
11009 #[inline]
11010 pub unsafe fn set_mRadioTrelUdp6_raw(this: *mut Self, val: bool) {
11011 unsafe {
11012 let val: u8 = ::std::mem::transmute(val);
11013 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11014 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11015 5usize,
11016 1u8,
11017 val as u64,
11018 )
11019 }
11020 }
11021 #[inline]
11022 pub fn new_bitfield_1(
11023 mLinkSecurity: bool,
11024 mTxSuccess: bool,
11025 mPriority: u8,
11026 mRadioIeee802154: bool,
11027 mRadioTrelUdp6: bool,
11028 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11029 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11030 __bindgen_bitfield_unit.set(0usize, 1u8, {
11031 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
11032 mLinkSecurity as u64
11033 });
11034 __bindgen_bitfield_unit.set(1usize, 1u8, {
11035 let mTxSuccess: u8 = unsafe { ::std::mem::transmute(mTxSuccess) };
11036 mTxSuccess as u64
11037 });
11038 __bindgen_bitfield_unit.set(2usize, 2u8, {
11039 let mPriority: u8 = unsafe { ::std::mem::transmute(mPriority) };
11040 mPriority as u64
11041 });
11042 __bindgen_bitfield_unit.set(4usize, 1u8, {
11043 let mRadioIeee802154: u8 = unsafe { ::std::mem::transmute(mRadioIeee802154) };
11044 mRadioIeee802154 as u64
11045 });
11046 __bindgen_bitfield_unit.set(5usize, 1u8, {
11047 let mRadioTrelUdp6: u8 = unsafe { ::std::mem::transmute(mRadioTrelUdp6) };
11048 mRadioTrelUdp6 as u64
11049 });
11050 __bindgen_bitfield_unit
11051 }
11052}
11053#[doc = "< Neighbor is added."]
11054pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_ADDED: otHistoryTrackerNeighborEvent = 0;
11055#[doc = "< Neighbor is removed."]
11056pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_REMOVED: otHistoryTrackerNeighborEvent = 1;
11057#[doc = "< Neighbor changed (e.g., device mode flags changed)."]
11058pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_CHANGED: otHistoryTrackerNeighborEvent = 2;
11059#[doc = "< Neighbor is being restored (applicable to child only)."]
11060pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_RESTORING: otHistoryTrackerNeighborEvent = 3;
11061#[doc = " Defines the events in a neighbor info (i.e. whether neighbor is added, removed, or changed).\n\n Event `OT_HISTORY_TRACKER_NEIGHBOR_EVENT_RESTORING` is applicable to child neighbors only. It is triggered after\n the device (re)starts and when the previous children list is retrieved from non-volatile settings and the device\n tries to restore connection to them."]
11062pub type otHistoryTrackerNeighborEvent = ::std::os::raw::c_uint;
11063#[doc = " Represents a neighbor info."]
11064#[repr(C)]
11065#[derive(Debug, Default, Copy, Clone)]
11066pub struct otHistoryTrackerNeighborInfo {
11067 #[doc = "< Neighbor's Extended Address."]
11068 pub mExtAddress: otExtAddress,
11069 #[doc = "< Neighbor's RLOC16."]
11070 pub mRloc16: u16,
11071 #[doc = "< Average RSSI of rx frames from neighbor at the time of recording entry."]
11072 pub mAverageRssi: i8,
11073 pub _bitfield_align_1: [u8; 0],
11074 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11075}
11076impl otHistoryTrackerNeighborInfo {
11077 #[inline]
11078 pub fn mEvent(&self) -> u8 {
11079 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11080 }
11081 #[inline]
11082 pub fn set_mEvent(&mut self, val: u8) {
11083 unsafe {
11084 let val: u8 = ::std::mem::transmute(val);
11085 self._bitfield_1.set(0usize, 2u8, val as u64)
11086 }
11087 }
11088 #[inline]
11089 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11090 unsafe {
11091 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11092 ::std::ptr::addr_of!((*this)._bitfield_1),
11093 0usize,
11094 2u8,
11095 ) as u8)
11096 }
11097 }
11098 #[inline]
11099 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11100 unsafe {
11101 let val: u8 = ::std::mem::transmute(val);
11102 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11103 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11104 0usize,
11105 2u8,
11106 val as u64,
11107 )
11108 }
11109 }
11110 #[inline]
11111 pub fn mRxOnWhenIdle(&self) -> bool {
11112 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11113 }
11114 #[inline]
11115 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
11116 unsafe {
11117 let val: u8 = ::std::mem::transmute(val);
11118 self._bitfield_1.set(2usize, 1u8, val as u64)
11119 }
11120 }
11121 #[inline]
11122 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
11123 unsafe {
11124 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11125 ::std::ptr::addr_of!((*this)._bitfield_1),
11126 2usize,
11127 1u8,
11128 ) as u8)
11129 }
11130 }
11131 #[inline]
11132 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
11133 unsafe {
11134 let val: u8 = ::std::mem::transmute(val);
11135 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11136 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11137 2usize,
11138 1u8,
11139 val as u64,
11140 )
11141 }
11142 }
11143 #[inline]
11144 pub fn mFullThreadDevice(&self) -> bool {
11145 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11146 }
11147 #[inline]
11148 pub fn set_mFullThreadDevice(&mut self, val: bool) {
11149 unsafe {
11150 let val: u8 = ::std::mem::transmute(val);
11151 self._bitfield_1.set(3usize, 1u8, val as u64)
11152 }
11153 }
11154 #[inline]
11155 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
11156 unsafe {
11157 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11158 ::std::ptr::addr_of!((*this)._bitfield_1),
11159 3usize,
11160 1u8,
11161 ) as u8)
11162 }
11163 }
11164 #[inline]
11165 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
11166 unsafe {
11167 let val: u8 = ::std::mem::transmute(val);
11168 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11169 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11170 3usize,
11171 1u8,
11172 val as u64,
11173 )
11174 }
11175 }
11176 #[inline]
11177 pub fn mFullNetworkData(&self) -> bool {
11178 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11179 }
11180 #[inline]
11181 pub fn set_mFullNetworkData(&mut self, val: bool) {
11182 unsafe {
11183 let val: u8 = ::std::mem::transmute(val);
11184 self._bitfield_1.set(4usize, 1u8, val as u64)
11185 }
11186 }
11187 #[inline]
11188 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
11189 unsafe {
11190 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11191 ::std::ptr::addr_of!((*this)._bitfield_1),
11192 4usize,
11193 1u8,
11194 ) as u8)
11195 }
11196 }
11197 #[inline]
11198 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
11199 unsafe {
11200 let val: u8 = ::std::mem::transmute(val);
11201 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11202 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11203 4usize,
11204 1u8,
11205 val as u64,
11206 )
11207 }
11208 }
11209 #[inline]
11210 pub fn mIsChild(&self) -> bool {
11211 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11212 }
11213 #[inline]
11214 pub fn set_mIsChild(&mut self, val: bool) {
11215 unsafe {
11216 let val: u8 = ::std::mem::transmute(val);
11217 self._bitfield_1.set(5usize, 1u8, val as u64)
11218 }
11219 }
11220 #[inline]
11221 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
11222 unsafe {
11223 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11224 ::std::ptr::addr_of!((*this)._bitfield_1),
11225 5usize,
11226 1u8,
11227 ) as u8)
11228 }
11229 }
11230 #[inline]
11231 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
11232 unsafe {
11233 let val: u8 = ::std::mem::transmute(val);
11234 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11235 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11236 5usize,
11237 1u8,
11238 val as u64,
11239 )
11240 }
11241 }
11242 #[inline]
11243 pub fn new_bitfield_1(
11244 mEvent: u8,
11245 mRxOnWhenIdle: bool,
11246 mFullThreadDevice: bool,
11247 mFullNetworkData: bool,
11248 mIsChild: bool,
11249 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11250 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11251 __bindgen_bitfield_unit.set(0usize, 2u8, {
11252 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11253 mEvent as u64
11254 });
11255 __bindgen_bitfield_unit.set(2usize, 1u8, {
11256 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
11257 mRxOnWhenIdle as u64
11258 });
11259 __bindgen_bitfield_unit.set(3usize, 1u8, {
11260 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
11261 mFullThreadDevice as u64
11262 });
11263 __bindgen_bitfield_unit.set(4usize, 1u8, {
11264 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
11265 mFullNetworkData as u64
11266 });
11267 __bindgen_bitfield_unit.set(5usize, 1u8, {
11268 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
11269 mIsChild as u64
11270 });
11271 __bindgen_bitfield_unit
11272 }
11273}
11274#[doc = "< Router is added (router ID allocated)."]
11275pub const OT_HISTORY_TRACKER_ROUTER_EVENT_ADDED: otHistoryTrackerRouterEvent = 0;
11276#[doc = "< Router entry is removed (router ID released)."]
11277pub const OT_HISTORY_TRACKER_ROUTER_EVENT_REMOVED: otHistoryTrackerRouterEvent = 1;
11278#[doc = "< Router entry next hop and cost changed."]
11279pub const OT_HISTORY_TRACKER_ROUTER_EVENT_NEXT_HOP_CHANGED: otHistoryTrackerRouterEvent = 2;
11280#[doc = "< Router entry path cost changed (next hop as before)."]
11281pub const OT_HISTORY_TRACKER_ROUTER_EVENT_COST_CHANGED: otHistoryTrackerRouterEvent = 3;
11282#[doc = " Defines the events in a router info (i.e. whether router is added, removed, or changed)."]
11283pub type otHistoryTrackerRouterEvent = ::std::os::raw::c_uint;
11284#[doc = " Represents a router table entry event."]
11285#[repr(C)]
11286#[derive(Debug, Default, Copy, Clone)]
11287pub struct otHistoryTrackerRouterInfo {
11288 pub _bitfield_align_1: [u8; 0],
11289 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11290 #[doc = "< Next Hop Router ID - `OT_HISTORY_TRACKER_NO_NEXT_HOP` if no next hop."]
11291 pub mNextHop: u8,
11292 pub _bitfield_align_2: [u8; 0],
11293 pub _bitfield_2: __BindgenBitfieldUnit<[u8; 1usize]>,
11294}
11295impl otHistoryTrackerRouterInfo {
11296 #[inline]
11297 pub fn mEvent(&self) -> u8 {
11298 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11299 }
11300 #[inline]
11301 pub fn set_mEvent(&mut self, val: u8) {
11302 unsafe {
11303 let val: u8 = ::std::mem::transmute(val);
11304 self._bitfield_1.set(0usize, 2u8, val as u64)
11305 }
11306 }
11307 #[inline]
11308 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11309 unsafe {
11310 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11311 ::std::ptr::addr_of!((*this)._bitfield_1),
11312 0usize,
11313 2u8,
11314 ) as u8)
11315 }
11316 }
11317 #[inline]
11318 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11319 unsafe {
11320 let val: u8 = ::std::mem::transmute(val);
11321 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11322 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11323 0usize,
11324 2u8,
11325 val as u64,
11326 )
11327 }
11328 }
11329 #[inline]
11330 pub fn mRouterId(&self) -> u8 {
11331 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 6u8) as u8) }
11332 }
11333 #[inline]
11334 pub fn set_mRouterId(&mut self, val: u8) {
11335 unsafe {
11336 let val: u8 = ::std::mem::transmute(val);
11337 self._bitfield_1.set(2usize, 6u8, val as u64)
11338 }
11339 }
11340 #[inline]
11341 pub unsafe fn mRouterId_raw(this: *const Self) -> u8 {
11342 unsafe {
11343 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11344 ::std::ptr::addr_of!((*this)._bitfield_1),
11345 2usize,
11346 6u8,
11347 ) as u8)
11348 }
11349 }
11350 #[inline]
11351 pub unsafe fn set_mRouterId_raw(this: *mut Self, val: u8) {
11352 unsafe {
11353 let val: u8 = ::std::mem::transmute(val);
11354 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11355 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11356 2usize,
11357 6u8,
11358 val as u64,
11359 )
11360 }
11361 }
11362 #[inline]
11363 pub fn new_bitfield_1(mEvent: u8, mRouterId: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11364 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11365 __bindgen_bitfield_unit.set(0usize, 2u8, {
11366 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11367 mEvent as u64
11368 });
11369 __bindgen_bitfield_unit.set(2usize, 6u8, {
11370 let mRouterId: u8 = unsafe { ::std::mem::transmute(mRouterId) };
11371 mRouterId as u64
11372 });
11373 __bindgen_bitfield_unit
11374 }
11375 #[inline]
11376 pub fn mOldPathCost(&self) -> u8 {
11377 unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 4u8) as u8) }
11378 }
11379 #[inline]
11380 pub fn set_mOldPathCost(&mut self, val: u8) {
11381 unsafe {
11382 let val: u8 = ::std::mem::transmute(val);
11383 self._bitfield_2.set(0usize, 4u8, val as u64)
11384 }
11385 }
11386 #[inline]
11387 pub unsafe fn mOldPathCost_raw(this: *const Self) -> u8 {
11388 unsafe {
11389 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11390 ::std::ptr::addr_of!((*this)._bitfield_2),
11391 0usize,
11392 4u8,
11393 ) as u8)
11394 }
11395 }
11396 #[inline]
11397 pub unsafe fn set_mOldPathCost_raw(this: *mut Self, val: u8) {
11398 unsafe {
11399 let val: u8 = ::std::mem::transmute(val);
11400 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11401 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11402 0usize,
11403 4u8,
11404 val as u64,
11405 )
11406 }
11407 }
11408 #[inline]
11409 pub fn mPathCost(&self) -> u8 {
11410 unsafe { ::std::mem::transmute(self._bitfield_2.get(4usize, 4u8) as u8) }
11411 }
11412 #[inline]
11413 pub fn set_mPathCost(&mut self, val: u8) {
11414 unsafe {
11415 let val: u8 = ::std::mem::transmute(val);
11416 self._bitfield_2.set(4usize, 4u8, val as u64)
11417 }
11418 }
11419 #[inline]
11420 pub unsafe fn mPathCost_raw(this: *const Self) -> u8 {
11421 unsafe {
11422 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11423 ::std::ptr::addr_of!((*this)._bitfield_2),
11424 4usize,
11425 4u8,
11426 ) as u8)
11427 }
11428 }
11429 #[inline]
11430 pub unsafe fn set_mPathCost_raw(this: *mut Self, val: u8) {
11431 unsafe {
11432 let val: u8 = ::std::mem::transmute(val);
11433 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11434 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11435 4usize,
11436 4u8,
11437 val as u64,
11438 )
11439 }
11440 }
11441 #[inline]
11442 pub fn new_bitfield_2(mOldPathCost: u8, mPathCost: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11443 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11444 __bindgen_bitfield_unit.set(0usize, 4u8, {
11445 let mOldPathCost: u8 = unsafe { ::std::mem::transmute(mOldPathCost) };
11446 mOldPathCost as u64
11447 });
11448 __bindgen_bitfield_unit.set(4usize, 4u8, {
11449 let mPathCost: u8 = unsafe { ::std::mem::transmute(mPathCost) };
11450 mPathCost as u64
11451 });
11452 __bindgen_bitfield_unit
11453 }
11454}
11455#[doc = "< Network data entry is added."]
11456pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED: otHistoryTrackerNetDataEvent = 0;
11457#[doc = "< Network data entry is removed."]
11458pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED: otHistoryTrackerNetDataEvent = 1;
11459#[doc = " Defines the events for a Network Data entry (i.e., whether an entry is added or removed)."]
11460pub type otHistoryTrackerNetDataEvent = ::std::os::raw::c_uint;
11461#[doc = " Represent a Network Data on mesh prefix info."]
11462#[repr(C)]
11463#[derive(Copy, Clone)]
11464pub struct otHistoryTrackerOnMeshPrefixInfo {
11465 #[doc = "< The on mesh prefix entry."]
11466 pub mPrefix: otBorderRouterConfig,
11467 #[doc = "< Indicates the event (added/removed)."]
11468 pub mEvent: otHistoryTrackerNetDataEvent,
11469}
11470impl Default for otHistoryTrackerOnMeshPrefixInfo {
11471 fn default() -> Self {
11472 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11473 unsafe {
11474 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11475 s.assume_init()
11476 }
11477 }
11478}
11479#[doc = " Represent a Network Data extern route info."]
11480#[repr(C)]
11481#[derive(Copy, Clone)]
11482pub struct otHistoryTrackerExternalRouteInfo {
11483 #[doc = "< The external route entry."]
11484 pub mRoute: otExternalRouteConfig,
11485 #[doc = "< Indicates the event (added/removed)."]
11486 pub mEvent: otHistoryTrackerNetDataEvent,
11487}
11488impl Default for otHistoryTrackerExternalRouteInfo {
11489 fn default() -> Self {
11490 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11491 unsafe {
11492 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11493 s.assume_init()
11494 }
11495 }
11496}
11497#[doc = "< Unicast address type local (in server data)."]
11498pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_LOCAL: otHistoryTrackerDnsSrpAddrType = 0;
11499#[doc = "< Unicast address type infrastructure (in service data)."]
11500pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_INFRA: otHistoryTrackerDnsSrpAddrType = 1;
11501#[doc = "< Anycast address type."]
11502pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_ANYCAST: otHistoryTrackerDnsSrpAddrType = 2;
11503#[doc = " Represents the DNS/SRP server address type parsed from Network Data service entries."]
11504pub type otHistoryTrackerDnsSrpAddrType = ::std::os::raw::c_uint;
11505#[doc = " Represents DNS/SRP server address information parsed from a Network Data service entry.\n\n The `mType` field specifies the entry type. Some fields are only applicable to specific types.\n - The `mPort` field is only applicable for `OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_*` types.\n - The `mSequenceNumber` field is only applicable for the `OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_ANYCAST` type.\n - Other fields are common and used for all address types."]
11506#[repr(C)]
11507#[derive(Copy, Clone)]
11508pub struct otHistoryTrackerDnsSrpAddrInfo {
11509 #[doc = "< The server address."]
11510 pub mAddress: otIp6Address,
11511 #[doc = "< The RLOC16 of the Border Router adding/removing the entry."]
11512 pub mRloc16: u16,
11513 #[doc = "< Port number."]
11514 pub mPort: u16,
11515 #[doc = "< Anycast sequence number."]
11516 pub mSequenceNumber: u8,
11517 #[doc = "< Version number."]
11518 pub mVersion: u8,
11519 #[doc = "< Address type."]
11520 pub mType: otHistoryTrackerDnsSrpAddrType,
11521 #[doc = "< Indicates the event (added/removed)."]
11522 pub mEvent: otHistoryTrackerNetDataEvent,
11523}
11524impl Default for otHistoryTrackerDnsSrpAddrInfo {
11525 fn default() -> Self {
11526 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11527 unsafe {
11528 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11529 s.assume_init()
11530 }
11531 }
11532}
11533#[doc = "< ePSKc mode is activated."]
11534pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_ACTIVATED:
11535 otHistoryTrackerBorderAgentEpskcEvent = 0;
11536#[doc = "< Secure session is connected."]
11537pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_CONNECTED:
11538 otHistoryTrackerBorderAgentEpskcEvent = 1;
11539#[doc = "< Commissioner petition is received."]
11540pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_PETITIONED:
11541 otHistoryTrackerBorderAgentEpskcEvent = 2;
11542#[doc = "< Active dataset is retrieved."]
11543pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_ACTIVE_DATASET:
11544 otHistoryTrackerBorderAgentEpskcEvent = 3;
11545#[doc = "< Pending dataset is retrieved."]
11546pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_PENDING_DATASET:
11547 otHistoryTrackerBorderAgentEpskcEvent = 4;
11548#[doc = "< Keep alive message is received."]
11549pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_KEEP_ALIVE:
11550 otHistoryTrackerBorderAgentEpskcEvent = 5;
11551#[doc = "< Deactivated by a call to the API."]
11552pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_LOCAL_CLOSE:
11553 otHistoryTrackerBorderAgentEpskcEvent = 6;
11554#[doc = "< Disconnected by the peer."]
11555pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_REMOTE_CLOSE:
11556 otHistoryTrackerBorderAgentEpskcEvent = 7;
11557#[doc = "< Disconnected due to some error."]
11558pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_ERROR:
11559 otHistoryTrackerBorderAgentEpskcEvent = 8;
11560#[doc = "< Disconnected due to timeout."]
11561pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_TIMEOUT:
11562 otHistoryTrackerBorderAgentEpskcEvent = 9;
11563#[doc = "< Max allowed attempts reached."]
11564pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_MAX_ATTEMPTS:
11565 otHistoryTrackerBorderAgentEpskcEvent = 10;
11566#[doc = "< ePSKc mode timed out."]
11567pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_EPSKC_TIMEOUT:
11568 otHistoryTrackerBorderAgentEpskcEvent = 11;
11569#[doc = "< Deactivated for an unknown reason."]
11570pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_UNKNOWN:
11571 otHistoryTrackerBorderAgentEpskcEvent = 12;
11572#[doc = " Represents events during the Border Agent's ePSKc journey."]
11573pub type otHistoryTrackerBorderAgentEpskcEvent = ::std::os::raw::c_uint;
11574#[doc = " Represents a favored OMR prefix tracked by a device acting as a Border Router (BR).\n\n The `mIsLocal` field indicates whether the favored OMR prefix is the same as the local one maintained by this BR.\n The local OMR prefix can be either based on (random) ULA or a prefix delegated via DHCPv6-PD."]
11575#[repr(C)]
11576#[repr(align(4))]
11577#[derive(Copy, Clone)]
11578pub struct otHistoryTrackerFavoredOmrPrefix {
11579 #[doc = "< The OMR prefix."]
11580 pub mOmrPrefix: otIp6Prefix,
11581 pub _bitfield_align_1: [u8; 0],
11582 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11583 pub __bindgen_padding_0: u16,
11584}
11585impl Default for otHistoryTrackerFavoredOmrPrefix {
11586 fn default() -> Self {
11587 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11588 unsafe {
11589 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11590 s.assume_init()
11591 }
11592 }
11593}
11594impl otHistoryTrackerFavoredOmrPrefix {
11595 #[inline]
11596 pub fn mPreference(&self) -> ::std::os::raw::c_int {
11597 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
11598 }
11599 #[inline]
11600 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
11601 unsafe {
11602 let val: u32 = ::std::mem::transmute(val);
11603 self._bitfield_1.set(0usize, 2u8, val as u64)
11604 }
11605 }
11606 #[inline]
11607 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
11608 unsafe {
11609 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11610 ::std::ptr::addr_of!((*this)._bitfield_1),
11611 0usize,
11612 2u8,
11613 ) as u32)
11614 }
11615 }
11616 #[inline]
11617 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
11618 unsafe {
11619 let val: u32 = ::std::mem::transmute(val);
11620 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11621 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11622 0usize,
11623 2u8,
11624 val as u64,
11625 )
11626 }
11627 }
11628 #[inline]
11629 pub fn mIsLocal(&self) -> bool {
11630 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11631 }
11632 #[inline]
11633 pub fn set_mIsLocal(&mut self, val: bool) {
11634 unsafe {
11635 let val: u8 = ::std::mem::transmute(val);
11636 self._bitfield_1.set(2usize, 1u8, val as u64)
11637 }
11638 }
11639 #[inline]
11640 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11641 unsafe {
11642 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11643 ::std::ptr::addr_of!((*this)._bitfield_1),
11644 2usize,
11645 1u8,
11646 ) as u8)
11647 }
11648 }
11649 #[inline]
11650 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11651 unsafe {
11652 let val: u8 = ::std::mem::transmute(val);
11653 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11654 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11655 2usize,
11656 1u8,
11657 val as u64,
11658 )
11659 }
11660 }
11661 #[inline]
11662 pub fn new_bitfield_1(
11663 mPreference: ::std::os::raw::c_int,
11664 mIsLocal: bool,
11665 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11666 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11667 __bindgen_bitfield_unit.set(0usize, 2u8, {
11668 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
11669 mPreference as u64
11670 });
11671 __bindgen_bitfield_unit.set(2usize, 1u8, {
11672 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11673 mIsLocal as u64
11674 });
11675 __bindgen_bitfield_unit
11676 }
11677}
11678#[doc = " Represents a favored on-link prefix on AIL tracked by a device acting as a Border Router (BR).\n\n The `mIsLocal` field indicates whether the favored on-link prefix is the same as the local one maintained by this\n BR."]
11679#[repr(C)]
11680#[derive(Copy, Clone)]
11681pub struct otHistoryTrackerFavoredOnLinkPrefix {
11682 #[doc = "< The on-link prefix."]
11683 pub mOnLinkPrefix: otIp6Prefix,
11684 pub _bitfield_align_1: [u8; 0],
11685 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11686}
11687impl Default for otHistoryTrackerFavoredOnLinkPrefix {
11688 fn default() -> Self {
11689 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11690 unsafe {
11691 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11692 s.assume_init()
11693 }
11694 }
11695}
11696impl otHistoryTrackerFavoredOnLinkPrefix {
11697 #[inline]
11698 pub fn mIsLocal(&self) -> bool {
11699 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11700 }
11701 #[inline]
11702 pub fn set_mIsLocal(&mut self, val: bool) {
11703 unsafe {
11704 let val: u8 = ::std::mem::transmute(val);
11705 self._bitfield_1.set(0usize, 1u8, val as u64)
11706 }
11707 }
11708 #[inline]
11709 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11710 unsafe {
11711 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11712 ::std::ptr::addr_of!((*this)._bitfield_1),
11713 0usize,
11714 1u8,
11715 ) as u8)
11716 }
11717 }
11718 #[inline]
11719 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11720 unsafe {
11721 let val: u8 = ::std::mem::transmute(val);
11722 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11723 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11724 0usize,
11725 1u8,
11726 val as u64,
11727 )
11728 }
11729 }
11730 #[inline]
11731 pub fn new_bitfield_1(mIsLocal: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11732 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11733 __bindgen_bitfield_unit.set(0usize, 1u8, {
11734 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11735 mIsLocal as u64
11736 });
11737 __bindgen_bitfield_unit
11738 }
11739}
11740#[doc = " Represents the DHCPv6-PD state and delegated prefix (if any) by a device acting as Border Router (BR)."]
11741#[repr(C)]
11742#[derive(Copy, Clone)]
11743pub struct otHistoryTrackerDhcp6PdInfo {
11744 #[doc = "< The delegated prefix if any. If none, it is set to `::/0`."]
11745 pub mPrefix: otIp6Prefix,
11746 #[doc = "< The DHCPv6 state."]
11747 pub mState: otBorderRoutingDhcp6PdState,
11748}
11749impl Default for otHistoryTrackerDhcp6PdInfo {
11750 fn default() -> Self {
11751 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11752 unsafe {
11753 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11754 s.assume_init()
11755 }
11756 }
11757}
11758#[doc = "< A new AIL router is discovered."]
11759pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_ADDED: otHistoryTrackerAilRouterEvent = 0;
11760#[doc = "< A property in the router's information has changed."]
11761pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_CHANGED: otHistoryTrackerAilRouterEvent = 1;
11762#[doc = "< The AIL router is removed and no longer tracked."]
11763pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_REMOVED: otHistoryTrackerAilRouterEvent = 2;
11764#[doc = " Defines events for discovered routers on an Adjacent Infrastructure Link (AIL).\n\n This applies when a device is acting as a Border Router, processing received Router Advertisements and tracking\n AIL routers.\n\n `OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_CHANGED` is used if any of the properties in the `otHistoryTrackerAilRouter`\n structure associated with a specific router changes."]
11765pub type otHistoryTrackerAilRouterEvent = ::std::os::raw::c_uint;
11766#[doc = " Represents information about a discovered router on an Adjacent Infrastructure Link (AIL).\n\n This applies when a device is acting as a Border Router, processing received Router Advertisements and tracking\n information about discovered AIL routers.\n\n `mProvidesDefaultRoute` indicates whether the router provides a default route. If it does, `mDefRoutePreference`\n specifies the route preference.\n\n `mFavoredOnLinkPrefix` indicates the favored on-link prefix advertised by the router. If there is no on-link prefix,\n this will be an empty prefix (i.e., its length will be zero)."]
11767#[repr(C)]
11768#[derive(Copy, Clone)]
11769pub struct otHistoryTrackerAilRouter {
11770 #[doc = "< The event type (e.g., added, changed, removed)."]
11771 pub mEvent: otHistoryTrackerAilRouterEvent,
11772 #[doc = "< Def route preference."]
11773 pub mDefRoutePreference: i8,
11774 #[doc = "< The IPv6 address of the AIL router."]
11775 pub mAddress: otIp6Address,
11776 #[doc = "< The favored on-link prefix, if any."]
11777 pub mFavoredOnLinkPrefix: otIp6Prefix,
11778 pub _bitfield_align_1: [u8; 0],
11779 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11780 pub __bindgen_padding_0: u8,
11781}
11782impl Default for otHistoryTrackerAilRouter {
11783 fn default() -> Self {
11784 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11785 unsafe {
11786 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11787 s.assume_init()
11788 }
11789 }
11790}
11791impl otHistoryTrackerAilRouter {
11792 #[inline]
11793 pub fn mProvidesDefaultRoute(&self) -> bool {
11794 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11795 }
11796 #[inline]
11797 pub fn set_mProvidesDefaultRoute(&mut self, val: bool) {
11798 unsafe {
11799 let val: u8 = ::std::mem::transmute(val);
11800 self._bitfield_1.set(0usize, 1u8, val as u64)
11801 }
11802 }
11803 #[inline]
11804 pub unsafe fn mProvidesDefaultRoute_raw(this: *const Self) -> bool {
11805 unsafe {
11806 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11807 ::std::ptr::addr_of!((*this)._bitfield_1),
11808 0usize,
11809 1u8,
11810 ) as u8)
11811 }
11812 }
11813 #[inline]
11814 pub unsafe fn set_mProvidesDefaultRoute_raw(this: *mut Self, val: bool) {
11815 unsafe {
11816 let val: u8 = ::std::mem::transmute(val);
11817 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11818 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11819 0usize,
11820 1u8,
11821 val as u64,
11822 )
11823 }
11824 }
11825 #[inline]
11826 pub fn mManagedAddressConfigFlag(&self) -> bool {
11827 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
11828 }
11829 #[inline]
11830 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
11831 unsafe {
11832 let val: u8 = ::std::mem::transmute(val);
11833 self._bitfield_1.set(1usize, 1u8, val as u64)
11834 }
11835 }
11836 #[inline]
11837 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
11838 unsafe {
11839 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11840 ::std::ptr::addr_of!((*this)._bitfield_1),
11841 1usize,
11842 1u8,
11843 ) as u8)
11844 }
11845 }
11846 #[inline]
11847 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
11848 unsafe {
11849 let val: u8 = ::std::mem::transmute(val);
11850 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11851 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11852 1usize,
11853 1u8,
11854 val as u64,
11855 )
11856 }
11857 }
11858 #[inline]
11859 pub fn mOtherConfigFlag(&self) -> bool {
11860 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11861 }
11862 #[inline]
11863 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
11864 unsafe {
11865 let val: u8 = ::std::mem::transmute(val);
11866 self._bitfield_1.set(2usize, 1u8, val as u64)
11867 }
11868 }
11869 #[inline]
11870 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
11871 unsafe {
11872 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11873 ::std::ptr::addr_of!((*this)._bitfield_1),
11874 2usize,
11875 1u8,
11876 ) as u8)
11877 }
11878 }
11879 #[inline]
11880 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
11881 unsafe {
11882 let val: u8 = ::std::mem::transmute(val);
11883 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11884 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11885 2usize,
11886 1u8,
11887 val as u64,
11888 )
11889 }
11890 }
11891 #[inline]
11892 pub fn mSnacRouterFlag(&self) -> bool {
11893 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11894 }
11895 #[inline]
11896 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
11897 unsafe {
11898 let val: u8 = ::std::mem::transmute(val);
11899 self._bitfield_1.set(3usize, 1u8, val as u64)
11900 }
11901 }
11902 #[inline]
11903 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
11904 unsafe {
11905 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11906 ::std::ptr::addr_of!((*this)._bitfield_1),
11907 3usize,
11908 1u8,
11909 ) as u8)
11910 }
11911 }
11912 #[inline]
11913 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
11914 unsafe {
11915 let val: u8 = ::std::mem::transmute(val);
11916 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11917 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11918 3usize,
11919 1u8,
11920 val as u64,
11921 )
11922 }
11923 }
11924 #[inline]
11925 pub fn mIsLocalDevice(&self) -> bool {
11926 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11927 }
11928 #[inline]
11929 pub fn set_mIsLocalDevice(&mut self, val: bool) {
11930 unsafe {
11931 let val: u8 = ::std::mem::transmute(val);
11932 self._bitfield_1.set(4usize, 1u8, val as u64)
11933 }
11934 }
11935 #[inline]
11936 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
11937 unsafe {
11938 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11939 ::std::ptr::addr_of!((*this)._bitfield_1),
11940 4usize,
11941 1u8,
11942 ) as u8)
11943 }
11944 }
11945 #[inline]
11946 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
11947 unsafe {
11948 let val: u8 = ::std::mem::transmute(val);
11949 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11950 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11951 4usize,
11952 1u8,
11953 val as u64,
11954 )
11955 }
11956 }
11957 #[inline]
11958 pub fn mIsReachable(&self) -> bool {
11959 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11960 }
11961 #[inline]
11962 pub fn set_mIsReachable(&mut self, val: bool) {
11963 unsafe {
11964 let val: u8 = ::std::mem::transmute(val);
11965 self._bitfield_1.set(5usize, 1u8, val as u64)
11966 }
11967 }
11968 #[inline]
11969 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
11970 unsafe {
11971 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11972 ::std::ptr::addr_of!((*this)._bitfield_1),
11973 5usize,
11974 1u8,
11975 ) as u8)
11976 }
11977 }
11978 #[inline]
11979 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
11980 unsafe {
11981 let val: u8 = ::std::mem::transmute(val);
11982 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11983 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11984 5usize,
11985 1u8,
11986 val as u64,
11987 )
11988 }
11989 }
11990 #[inline]
11991 pub fn mIsPeerBr(&self) -> bool {
11992 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
11993 }
11994 #[inline]
11995 pub fn set_mIsPeerBr(&mut self, val: bool) {
11996 unsafe {
11997 let val: u8 = ::std::mem::transmute(val);
11998 self._bitfield_1.set(6usize, 1u8, val as u64)
11999 }
12000 }
12001 #[inline]
12002 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
12003 unsafe {
12004 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12005 ::std::ptr::addr_of!((*this)._bitfield_1),
12006 6usize,
12007 1u8,
12008 ) as u8)
12009 }
12010 }
12011 #[inline]
12012 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
12013 unsafe {
12014 let val: u8 = ::std::mem::transmute(val);
12015 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12016 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12017 6usize,
12018 1u8,
12019 val as u64,
12020 )
12021 }
12022 }
12023 #[inline]
12024 pub fn new_bitfield_1(
12025 mProvidesDefaultRoute: bool,
12026 mManagedAddressConfigFlag: bool,
12027 mOtherConfigFlag: bool,
12028 mSnacRouterFlag: bool,
12029 mIsLocalDevice: bool,
12030 mIsReachable: bool,
12031 mIsPeerBr: bool,
12032 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12033 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12034 __bindgen_bitfield_unit.set(0usize, 1u8, {
12035 let mProvidesDefaultRoute: u8 = unsafe { ::std::mem::transmute(mProvidesDefaultRoute) };
12036 mProvidesDefaultRoute as u64
12037 });
12038 __bindgen_bitfield_unit.set(1usize, 1u8, {
12039 let mManagedAddressConfigFlag: u8 =
12040 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
12041 mManagedAddressConfigFlag as u64
12042 });
12043 __bindgen_bitfield_unit.set(2usize, 1u8, {
12044 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
12045 mOtherConfigFlag as u64
12046 });
12047 __bindgen_bitfield_unit.set(3usize, 1u8, {
12048 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
12049 mSnacRouterFlag as u64
12050 });
12051 __bindgen_bitfield_unit.set(4usize, 1u8, {
12052 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
12053 mIsLocalDevice as u64
12054 });
12055 __bindgen_bitfield_unit.set(5usize, 1u8, {
12056 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
12057 mIsReachable as u64
12058 });
12059 __bindgen_bitfield_unit.set(6usize, 1u8, {
12060 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
12061 mIsPeerBr as u64
12062 });
12063 __bindgen_bitfield_unit
12064 }
12065}
12066unsafe extern "C" {
12067 #[doc = " Initializes an `otHistoryTrackerIterator`.\n\n An iterator MUST be initialized before it is used.\n\n An iterator can be initialized again to start from the beginning of the list.\n\n When iterating over entries in a list, to ensure the entry ages are consistent, the age is given relative to the\n time the iterator was initialized, i.e., the entry age is provided as the duration (in milliseconds) from the event\n (when entry was recorded) to the iterator initialization time.\n\n @param[in] aIterator A pointer to the iterator to initialize (MUST NOT be NULL)."]
12068 pub fn otHistoryTrackerInitIterator(aIterator: *mut otHistoryTrackerIterator);
12069}
12070unsafe extern "C" {
12071 #[doc = " Iterates over the entries in the network info history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns A pointer to `otHistoryTrackerNetworkInfo` entry or `NULL` if no more entries in the list."]
12072 pub fn otHistoryTrackerIterateNetInfoHistory(
12073 aInstance: *mut otInstance,
12074 aIterator: *mut otHistoryTrackerIterator,
12075 aEntryAge: *mut u32,
12076 ) -> *const otHistoryTrackerNetworkInfo;
12077}
12078unsafe extern "C" {
12079 #[doc = " Iterates over the entries in the unicast address history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns A pointer to `otHistoryTrackerUnicastAddressInfo` entry or `NULL` if no more entries in the list."]
12080 pub fn otHistoryTrackerIterateUnicastAddressHistory(
12081 aInstance: *mut otInstance,
12082 aIterator: *mut otHistoryTrackerIterator,
12083 aEntryAge: *mut u32,
12084 ) -> *const otHistoryTrackerUnicastAddressInfo;
12085}
12086unsafe extern "C" {
12087 #[doc = " Iterates over the entries in the multicast address history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns A pointer to `otHistoryTrackerMulticastAddressInfo` entry or `NULL` if no more entries in the list."]
12088 pub fn otHistoryTrackerIterateMulticastAddressHistory(
12089 aInstance: *mut otInstance,
12090 aIterator: *mut otHistoryTrackerIterator,
12091 aEntryAge: *mut u32,
12092 ) -> *const otHistoryTrackerMulticastAddressInfo;
12093}
12094unsafe extern "C" {
12095 #[doc = " Iterates over the entries in the RX message history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerMessageInfo` entry or `NULL` if no more entries in the list."]
12096 pub fn otHistoryTrackerIterateRxHistory(
12097 aInstance: *mut otInstance,
12098 aIterator: *mut otHistoryTrackerIterator,
12099 aEntryAge: *mut u32,
12100 ) -> *const otHistoryTrackerMessageInfo;
12101}
12102unsafe extern "C" {
12103 #[doc = " Iterates over the entries in the TX message history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerMessageInfo` entry or `NULL` if no more entries in the list."]
12104 pub fn otHistoryTrackerIterateTxHistory(
12105 aInstance: *mut otInstance,
12106 aIterator: *mut otHistoryTrackerIterator,
12107 aEntryAge: *mut u32,
12108 ) -> *const otHistoryTrackerMessageInfo;
12109}
12110unsafe extern "C" {
12111 #[doc = " Iterates over the entries in the neighbor history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerNeighborInfo` entry or `NULL` if no more entries in the list."]
12112 pub fn otHistoryTrackerIterateNeighborHistory(
12113 aInstance: *mut otInstance,
12114 aIterator: *mut otHistoryTrackerIterator,
12115 aEntryAge: *mut u32,
12116 ) -> *const otHistoryTrackerNeighborInfo;
12117}
12118unsafe extern "C" {
12119 #[doc = " Iterates over the entries in the router history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerRouterInfo` entry or `NULL` if no more entries in the list."]
12120 pub fn otHistoryTrackerIterateRouterHistory(
12121 aInstance: *mut otInstance,
12122 aIterator: *mut otHistoryTrackerIterator,
12123 aEntryAge: *mut u32,
12124 ) -> *const otHistoryTrackerRouterInfo;
12125}
12126unsafe extern "C" {
12127 #[doc = " Iterates over the entries in the Network Data on mesh prefix entry history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerOnMeshPrefixInfo` entry or `NULL` if no more entries in the list."]
12128 pub fn otHistoryTrackerIterateOnMeshPrefixHistory(
12129 aInstance: *mut otInstance,
12130 aIterator: *mut otHistoryTrackerIterator,
12131 aEntryAge: *mut u32,
12132 ) -> *const otHistoryTrackerOnMeshPrefixInfo;
12133}
12134unsafe extern "C" {
12135 #[doc = " Iterates over the entries in the Network Data external route entry history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerExternalRouteInfo` entry or `NULL` if no more entries in the list."]
12136 pub fn otHistoryTrackerIterateExternalRouteHistory(
12137 aInstance: *mut otInstance,
12138 aIterator: *mut otHistoryTrackerIterator,
12139 aEntryAge: *mut u32,
12140 ) -> *const otHistoryTrackerExternalRouteInfo;
12141}
12142unsafe extern "C" {
12143 #[doc = " Iterates over the entries in the Network Data SRP/DNS address history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerDnsSrpAddrInfo` entry or `NULL` if no more entries in the list."]
12144 pub fn otHistoryTrackerIterateDnsSrpAddrHistory(
12145 aInstance: *mut otInstance,
12146 aIterator: *mut otHistoryTrackerIterator,
12147 aEntryAge: *mut u32,
12148 ) -> *const otHistoryTrackerDnsSrpAddrInfo;
12149}
12150unsafe extern "C" {
12151 #[doc = " Iterates over the entries in the Border Agent ePSKc history list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerBorderAgentEpskcEvent` entry or `NULL` if no more entries in the list."]
12152 pub fn otHistoryTrackerIterateBorderAgentEpskcEventHistory(
12153 aInstance: *mut otInstance,
12154 aIterator: *mut otHistoryTrackerIterator,
12155 aEntryAge: *mut u32,
12156 ) -> *const otHistoryTrackerBorderAgentEpskcEvent;
12157}
12158unsafe extern "C" {
12159 #[doc = " Iterates over the entries in the favored OMR prefix history list.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` (device acting as Border Router).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerFavoredOmrPrefix` entry or `NULL` if no more entries in the list."]
12160 pub fn otHistoryTrackerIterateFavoredOmrPrefixHistory(
12161 aInstance: *mut otInstance,
12162 aIterator: *mut otHistoryTrackerIterator,
12163 aEntryAge: *mut u32,
12164 ) -> *const otHistoryTrackerFavoredOmrPrefix;
12165}
12166unsafe extern "C" {
12167 #[doc = " Iterates over the entries in the favored on-link prefix history list.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` (device acting as Border Router).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when the entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than the max age.\n\n @returns The `otHistoryTrackerFavoredOnLinkPrefix` entry or `NULL` if no more entries in the list."]
12168 pub fn otHistoryTrackerIterateFavoredOnLinkPrefixHistory(
12169 aInstance: *mut otInstance,
12170 aIterator: *mut otHistoryTrackerIterator,
12171 aEntryAge: *mut u32,
12172 ) -> *const otHistoryTrackerFavoredOnLinkPrefix;
12173}
12174unsafe extern "C" {
12175 #[doc = " Iterates over the entries in the DHCPv6-PD history list.\n\n Requires both `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` and `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE`.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than max age.\n\n @returns The `otHistoryTrackerDhcp6PdInfo` entry or `NULL` if no more entries in the list."]
12176 pub fn otHistoryTrackerIterateDhcp6PdHistory(
12177 aInstance: *mut otInstance,
12178 aIterator: *mut otHistoryTrackerIterator,
12179 aEntryAge: *mut u32,
12180 ) -> *const otHistoryTrackerDhcp6PdInfo;
12181}
12182unsafe extern "C" {
12183 #[doc = " Iterates over the entries in the BR AIL routers history list.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` (device acting as Border Router).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in,out] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.\n @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.\n Age is provided as the duration (in milliseconds) from when the entry was recorded to\n @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries\n older than the max age.\n\n @returns The `otHistoryTrackerAilRouter` entry or `NULL` if no more entries in the list."]
12184 pub fn otHistoryTrackerIterateAilRoutersHistory(
12185 aInstance: *mut otInstance,
12186 aIterator: *mut otHistoryTrackerIterator,
12187 aEntryAge: *mut u32,
12188 ) -> *const otHistoryTrackerAilRouter;
12189}
12190unsafe extern "C" {
12191 #[doc = " Converts a given entry age to a human-readable string.\n\n The entry age string follows the format `hours:minutes:seconds:milliseconds` (if\n shorter than one day) or `days:hours:minutes:seconds`(if longer than one day).\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated\n but the outputted string is always null-terminated.\n\n @param[in] aEntryAge The entry age (duration in msec).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer. Recommended to use `OT_HISTORY_TRACKER_ENTRY_AGE_STRING_SIZE`."]
12192 pub fn otHistoryTrackerEntryAgeToString(
12193 aEntryAge: u32,
12194 aBuffer: *mut ::std::os::raw::c_char,
12195 aSize: u16,
12196 );
12197}
12198#[doc = " Callback function pointer type to report the retrieved Network Info entries from a query to another device.\n\n Used when `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE` is enabled.\n\n @param[in] aError Indicates the status of the query and entries being reported:\n - `OT_ERROR_PENDING`: There are more entries to be reported.\n - `OT_ERROR_NONE`: This is the last entry, and the query is complete.\n - `OT_ERROR_RESPONSE_TIMEOUT`: Timed out waiting for a response.\n - `OT_ERROR_PARSE`: The received query answer does not follow the expected format.\n @param[in] aNetworkInfo The network information entry. This may be `NULL` if `aError` is `OT_ERROR_NONE`\n (indicating the end of the list) or on certain error conditions.\n @param[in] aEntryAge The entry age in milliseconds. Applicable only when @p aNetworkInfo is not `NULL`.\n @param[in] aContext An arbitrary callback context provided by the caller during the query."]
12199pub type otHistoryTrackerNetInfoCallback = ::std::option::Option<
12200 unsafe extern "C" fn(
12201 aError: otError,
12202 aNetworkInfo: *const otHistoryTrackerNetworkInfo,
12203 aEntryAge: u32,
12204 aContext: *mut ::std::os::raw::c_void,
12205 ),
12206>;
12207unsafe extern "C" {
12208 #[doc = " Queries for Network Info history entries from a specified RLOC16.\n\n Requires `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE`.\n\n Upon successful initiation of the query, the provided @p aCallback will be invoked to report the requested entries.\n\n The callback parameter `aError` indicates if any error occurs. If there are more entries to be provided, `aError`\n will be set to `OT_ERROR_PENDING`. The end of the list is indicated by `aError` being set to `OT_ERROR_NONE` with a\n null entry pointer. Any other errors, such as `OT_ERROR_RESPONSE_TIMEOUT` or `OT_ERROR_PARSE` (if the received\n response has an invalid format), will also be indicated by `aError`.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aRloc16 The RLOC16 of the device to query.\n @param[in] aMaxEntries The maximum number of entries to request (0 indicates all available entries).\n @param[in] aMaxEntryAge The maximum age (in milliseconds) of entries to request (0 indicates no age limit).\n @param[in] aCallback A pointer to a callback function to be called when the query response is received.\n @param[in] aContext A user-defined context pointer to be passed to the callback function.\n\n @retval OT_ERROR_NONE If the query was successfully sent.\n @retval OT_ERROR_BUSY If a query is already in progress.\n @retval OT_ERROR_NO_BUFS If there are insufficient message buffers to send the query.\n @retval OT_ERROR_INVALID_STATE If device is not attached."]
12209 pub fn otHistoryTrackerQueryNetInfo(
12210 aInstance: *mut otInstance,
12211 aRloc16: u16,
12212 aMaxEntries: u16,
12213 aMaxEntryAge: u32,
12214 aCallback: otHistoryTrackerNetInfoCallback,
12215 aContext: *mut ::std::os::raw::c_void,
12216 ) -> otError;
12217}
12218unsafe extern "C" {
12219 #[doc = " Cancels any ongoing query.\n\n Requires `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE`.\n\n @param[in] aInstance The OpenThread instance."]
12220 pub fn otHistoryTrackerCancelQuery(aInstance: *mut otInstance);
12221}
12222#[doc = "< Destination Unreachable"]
12223pub const OT_ICMP6_TYPE_DST_UNREACH: otIcmp6Type = 1;
12224#[doc = "< Packet To Big"]
12225pub const OT_ICMP6_TYPE_PACKET_TO_BIG: otIcmp6Type = 2;
12226#[doc = "< Time Exceeded"]
12227pub const OT_ICMP6_TYPE_TIME_EXCEEDED: otIcmp6Type = 3;
12228#[doc = "< Parameter Problem"]
12229pub const OT_ICMP6_TYPE_PARAMETER_PROBLEM: otIcmp6Type = 4;
12230#[doc = "< Echo Request"]
12231pub const OT_ICMP6_TYPE_ECHO_REQUEST: otIcmp6Type = 128;
12232#[doc = "< Echo Reply"]
12233pub const OT_ICMP6_TYPE_ECHO_REPLY: otIcmp6Type = 129;
12234#[doc = "< Router Solicitation"]
12235pub const OT_ICMP6_TYPE_ROUTER_SOLICIT: otIcmp6Type = 133;
12236#[doc = "< Router Advertisement"]
12237pub const OT_ICMP6_TYPE_ROUTER_ADVERT: otIcmp6Type = 134;
12238#[doc = "< Neighbor Solicitation"]
12239pub const OT_ICMP6_TYPE_NEIGHBOR_SOLICIT: otIcmp6Type = 135;
12240#[doc = "< Neighbor Advertisement"]
12241pub const OT_ICMP6_TYPE_NEIGHBOR_ADVERT: otIcmp6Type = 136;
12242#[doc = " ICMPv6 Message Types"]
12243pub type otIcmp6Type = ::std::os::raw::c_uint;
12244#[doc = "< Destination Unreachable (Type 1) - No Route"]
12245pub const OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE: otIcmp6Code = 0;
12246#[doc = "< Destination Unreachable (Type 1) - Administratively Prohibited"]
12247pub const OT_ICMP6_CODE_DST_UNREACH_PROHIBITED: otIcmp6Code = 1;
12248#[doc = "< Time Exceeded (Type 3) - Fragment Reassembly"]
12249pub const OT_ICMP6_CODE_FRAGM_REAS_TIME_EX: otIcmp6Code = 1;
12250#[doc = " ICMPv6 Message Codes"]
12251pub type otIcmp6Code = ::std::os::raw::c_uint;
12252#[doc = " @struct otIcmp6Header\n\n Represents an ICMPv6 header."]
12253#[repr(C, packed)]
12254#[derive(Copy, Clone)]
12255pub struct otIcmp6Header {
12256 #[doc = "< Type"]
12257 pub mType: u8,
12258 #[doc = "< Code"]
12259 pub mCode: u8,
12260 #[doc = "< Checksum"]
12261 pub mChecksum: u16,
12262 #[doc = "< Message-specific data"]
12263 pub mData: otIcmp6Header__bindgen_ty_1,
12264}
12265#[repr(C, packed)]
12266#[derive(Copy, Clone)]
12267pub union otIcmp6Header__bindgen_ty_1 {
12268 pub m8: [u8; 4usize],
12269 pub m16: [u16; 2usize],
12270 pub m32: [u32; 1usize],
12271}
12272impl Default for otIcmp6Header__bindgen_ty_1 {
12273 fn default() -> Self {
12274 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12275 unsafe {
12276 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12277 s.assume_init()
12278 }
12279 }
12280}
12281impl Default for otIcmp6Header {
12282 fn default() -> Self {
12283 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12284 unsafe {
12285 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12286 s.assume_init()
12287 }
12288 }
12289}
12290#[doc = " This callback allows OpenThread to inform the application of a received ICMPv6 message.\n\n @param[in] aContext A pointer to arbitrary context information.\n @param[in] aMessage A pointer to the received message.\n @param[in] aMessageInfo A pointer to message information associated with @p aMessage.\n @param[in] aIcmpHeader A pointer to the received ICMPv6 header."]
12291pub type otIcmp6ReceiveCallback = ::std::option::Option<
12292 unsafe extern "C" fn(
12293 aContext: *mut ::std::os::raw::c_void,
12294 aMessage: *mut otMessage,
12295 aMessageInfo: *const otMessageInfo,
12296 aIcmpHeader: *const otIcmp6Header,
12297 ),
12298>;
12299#[doc = " Implements ICMPv6 message handler."]
12300#[repr(C)]
12301#[derive(Debug, Copy, Clone)]
12302pub struct otIcmp6Handler {
12303 #[doc = "< The ICMPv6 received callback"]
12304 pub mReceiveCallback: otIcmp6ReceiveCallback,
12305 #[doc = "< A pointer to arbitrary context information."]
12306 pub mContext: *mut ::std::os::raw::c_void,
12307 #[doc = "< A pointer to the next handler in the list."]
12308 pub mNext: *mut otIcmp6Handler,
12309}
12310impl Default for otIcmp6Handler {
12311 fn default() -> Self {
12312 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12313 unsafe {
12314 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12315 s.assume_init()
12316 }
12317 }
12318}
12319#[doc = "< ICMPv6 Echo processing disabled"]
12320pub const OT_ICMP6_ECHO_HANDLER_DISABLED: otIcmp6EchoMode = 0;
12321#[doc = "< ICMPv6 Echo processing enabled only for unicast requests only"]
12322pub const OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: otIcmp6EchoMode = 1;
12323#[doc = "< ICMPv6 Echo processing enabled only for multicast requests only"]
12324pub const OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: otIcmp6EchoMode = 2;
12325#[doc = "< ICMPv6 Echo processing enabled for unicast and multicast requests"]
12326pub const OT_ICMP6_ECHO_HANDLER_ALL: otIcmp6EchoMode = 3;
12327#[doc = "< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only"]
12328pub const OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: otIcmp6EchoMode = 4;
12329#[doc = " ICMPv6 Echo Reply Modes"]
12330pub type otIcmp6EchoMode = ::std::os::raw::c_uint;
12331unsafe extern "C" {
12332 #[doc = " Indicates whether or not ICMPv6 Echo processing is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ICMP6_ECHO_HANDLER_DISABLED ICMPv6 Echo processing is disabled.\n @retval OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY ICMPv6 Echo processing enabled for unicast requests only\n @retval OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY ICMPv6 Echo processing enabled for multicast requests only\n @retval OT_ICMP6_ECHO_HANDLER_ALL ICMPv6 Echo processing enabled for unicast and multicast requests"]
12333 pub fn otIcmp6GetEchoMode(aInstance: *mut otInstance) -> otIcmp6EchoMode;
12334}
12335unsafe extern "C" {
12336 #[doc = " Sets whether or not ICMPv6 Echo processing is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMode The ICMPv6 Echo processing mode."]
12337 pub fn otIcmp6SetEchoMode(aInstance: *mut otInstance, aMode: otIcmp6EchoMode);
12338}
12339unsafe extern "C" {
12340 #[doc = " Registers a handler to provide received ICMPv6 messages.\n\n @note A handler structure @p aHandler has to be stored in persistent (static) memory.\n OpenThread does not make a copy of handler structure.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHandler A pointer to a handler containing callback that is called when\n an ICMPv6 message is received."]
12341 pub fn otIcmp6RegisterHandler(
12342 aInstance: *mut otInstance,
12343 aHandler: *mut otIcmp6Handler,
12344 ) -> otError;
12345}
12346unsafe extern "C" {
12347 #[doc = " Sends an ICMPv6 Echo Request via the Thread interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message buffer containing the ICMPv6 payload.\n @param[in] aMessageInfo A reference to message information associated with @p aMessage.\n @param[in] aIdentifier An identifier to aid in matching Echo Replies to this Echo Request.\n May be zero."]
12348 pub fn otIcmp6SendEchoRequest(
12349 aInstance: *mut otInstance,
12350 aMessage: *mut otMessage,
12351 aMessageInfo: *const otMessageInfo,
12352 aIdentifier: u16,
12353 ) -> otError;
12354}
12355#[doc = " Pointer is called if signal jam detection is enabled and a jam is detected.\n\n @param[in] aJamState Current jam state (`true` if jam is detected, `false` otherwise).\n @param[in] aContext A pointer to application-specific context."]
12356pub type otJamDetectionCallback = ::std::option::Option<
12357 unsafe extern "C" fn(aJamState: bool, aContext: *mut ::std::os::raw::c_void),
12358>;
12359unsafe extern "C" {
12360 #[doc = " Set the Jam Detection RSSI Threshold (in dBm).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRssiThreshold The RSSI threshold.\n\n @retval OT_ERROR_NONE Successfully set the threshold."]
12361 pub fn otJamDetectionSetRssiThreshold(
12362 aInstance: *mut otInstance,
12363 aRssiThreshold: i8,
12364 ) -> otError;
12365}
12366unsafe extern "C" {
12367 #[doc = " Get the Jam Detection RSSI Threshold (in dBm).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Jam Detection RSSI Threshold."]
12368 pub fn otJamDetectionGetRssiThreshold(aInstance: *mut otInstance) -> i8;
12369}
12370unsafe extern "C" {
12371 #[doc = " Set the Jam Detection Detection Window (in seconds).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aWindow The Jam Detection window (valid range is 1 to 63)\n\n @retval OT_ERROR_NONE Successfully set the window.\n @retval OT_ERROR_INVALID_ARGS The given input parameter not within valid range (1-63)"]
12372 pub fn otJamDetectionSetWindow(aInstance: *mut otInstance, aWindow: u8) -> otError;
12373}
12374unsafe extern "C" {
12375 #[doc = " Get the Jam Detection Detection Window (in seconds).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Jam Detection Window."]
12376 pub fn otJamDetectionGetWindow(aInstance: *mut otInstance) -> u8;
12377}
12378unsafe extern "C" {
12379 #[doc = " Set the Jam Detection Busy Period (in seconds).\n\n The number of aggregate seconds within the detection window where the RSSI must be above\n threshold to trigger detection.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aBusyPeriod The Jam Detection busy period (should be non-zero and\nless than or equal to Jam Detection Window)\n\n @retval OT_ERROR_NONE Successfully set the window.\n @retval OT_ERROR_INVALID_ARGS The given input is not within the valid range."]
12380 pub fn otJamDetectionSetBusyPeriod(aInstance: *mut otInstance, aBusyPeriod: u8) -> otError;
12381}
12382unsafe extern "C" {
12383 #[doc = " Get the Jam Detection Busy Period (in seconds)\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Jam Detection Busy Period."]
12384 pub fn otJamDetectionGetBusyPeriod(aInstance: *mut otInstance) -> u8;
12385}
12386unsafe extern "C" {
12387 #[doc = " Start the jamming detection.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function called to notify of jamming state change.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully started the jamming detection.\n @retval OT_ERROR_ALREADY Jam detection has been started before."]
12388 pub fn otJamDetectionStart(
12389 aInstance: *mut otInstance,
12390 aCallback: otJamDetectionCallback,
12391 aContext: *mut ::std::os::raw::c_void,
12392 ) -> otError;
12393}
12394unsafe extern "C" {
12395 #[doc = " Stop the jamming detection.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully stopped the jamming detection.\n @retval OT_ERROR_ALREADY Jam detection is already stopped."]
12396 pub fn otJamDetectionStop(aInstance: *mut otInstance) -> otError;
12397}
12398unsafe extern "C" {
12399 #[doc = " Get the Jam Detection Status (enabled/disabled)\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Jam Detection status (true if enabled, false otherwise)."]
12400 pub fn otJamDetectionIsEnabled(aInstance: *mut otInstance) -> bool;
12401}
12402unsafe extern "C" {
12403 #[doc = " Get the Jam Detection State\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Jam Detection state (`true` jam is detected, `false' otherwise)."]
12404 pub fn otJamDetectionGetState(aInstance: *mut otInstance) -> bool;
12405}
12406unsafe extern "C" {
12407 #[doc = " Get the current history bitmap.\n\n This value provides information about current state of jamming detection\n module for monitoring/debugging purpose. It returns a 64-bit value where\n each bit corresponds to one second interval starting with bit 0 for the\n most recent interval and bit 63 for the oldest intervals (63 sec earlier).\n The bit is set to 1 if the jamming detection module observed/detected\n high signal level during the corresponding one second interval.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current history bitmap."]
12408 pub fn otJamDetectionGetHistoryBitmap(aInstance: *mut otInstance) -> u64;
12409}
12410#[doc = " Represents the result (value) for a Link Metrics query."]
12411#[repr(C)]
12412#[derive(Debug, Default, Copy, Clone)]
12413pub struct otLinkMetricsValues {
12414 #[doc = "< Specifies which metrics values are present/included."]
12415 pub mMetrics: otLinkMetrics,
12416 #[doc = "< The value of Pdu Count."]
12417 pub mPduCountValue: u32,
12418 #[doc = "< The value LQI."]
12419 pub mLqiValue: u8,
12420 #[doc = "< The value of Link Margin."]
12421 pub mLinkMarginValue: u8,
12422 #[doc = "< The value of Rssi."]
12423 pub mRssiValue: i8,
12424}
12425#[doc = " Represents which frames are accounted in a Forward Tracking Series."]
12426#[repr(C)]
12427#[derive(Debug, Default, Copy, Clone)]
12428pub struct otLinkMetricsSeriesFlags {
12429 pub _bitfield_align_1: [u8; 0],
12430 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
12431}
12432impl otLinkMetricsSeriesFlags {
12433 #[inline]
12434 pub fn mLinkProbe(&self) -> bool {
12435 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
12436 }
12437 #[inline]
12438 pub fn set_mLinkProbe(&mut self, val: bool) {
12439 unsafe {
12440 let val: u8 = ::std::mem::transmute(val);
12441 self._bitfield_1.set(0usize, 1u8, val as u64)
12442 }
12443 }
12444 #[inline]
12445 pub unsafe fn mLinkProbe_raw(this: *const Self) -> bool {
12446 unsafe {
12447 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12448 ::std::ptr::addr_of!((*this)._bitfield_1),
12449 0usize,
12450 1u8,
12451 ) as u8)
12452 }
12453 }
12454 #[inline]
12455 pub unsafe fn set_mLinkProbe_raw(this: *mut Self, val: bool) {
12456 unsafe {
12457 let val: u8 = ::std::mem::transmute(val);
12458 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12459 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12460 0usize,
12461 1u8,
12462 val as u64,
12463 )
12464 }
12465 }
12466 #[inline]
12467 pub fn mMacData(&self) -> bool {
12468 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
12469 }
12470 #[inline]
12471 pub fn set_mMacData(&mut self, val: bool) {
12472 unsafe {
12473 let val: u8 = ::std::mem::transmute(val);
12474 self._bitfield_1.set(1usize, 1u8, val as u64)
12475 }
12476 }
12477 #[inline]
12478 pub unsafe fn mMacData_raw(this: *const Self) -> bool {
12479 unsafe {
12480 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12481 ::std::ptr::addr_of!((*this)._bitfield_1),
12482 1usize,
12483 1u8,
12484 ) as u8)
12485 }
12486 }
12487 #[inline]
12488 pub unsafe fn set_mMacData_raw(this: *mut Self, val: bool) {
12489 unsafe {
12490 let val: u8 = ::std::mem::transmute(val);
12491 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12492 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12493 1usize,
12494 1u8,
12495 val as u64,
12496 )
12497 }
12498 }
12499 #[inline]
12500 pub fn mMacDataRequest(&self) -> bool {
12501 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
12502 }
12503 #[inline]
12504 pub fn set_mMacDataRequest(&mut self, val: bool) {
12505 unsafe {
12506 let val: u8 = ::std::mem::transmute(val);
12507 self._bitfield_1.set(2usize, 1u8, val as u64)
12508 }
12509 }
12510 #[inline]
12511 pub unsafe fn mMacDataRequest_raw(this: *const Self) -> bool {
12512 unsafe {
12513 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12514 ::std::ptr::addr_of!((*this)._bitfield_1),
12515 2usize,
12516 1u8,
12517 ) as u8)
12518 }
12519 }
12520 #[inline]
12521 pub unsafe fn set_mMacDataRequest_raw(this: *mut Self, val: bool) {
12522 unsafe {
12523 let val: u8 = ::std::mem::transmute(val);
12524 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12525 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12526 2usize,
12527 1u8,
12528 val as u64,
12529 )
12530 }
12531 }
12532 #[inline]
12533 pub fn mMacAck(&self) -> bool {
12534 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
12535 }
12536 #[inline]
12537 pub fn set_mMacAck(&mut self, val: bool) {
12538 unsafe {
12539 let val: u8 = ::std::mem::transmute(val);
12540 self._bitfield_1.set(3usize, 1u8, val as u64)
12541 }
12542 }
12543 #[inline]
12544 pub unsafe fn mMacAck_raw(this: *const Self) -> bool {
12545 unsafe {
12546 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12547 ::std::ptr::addr_of!((*this)._bitfield_1),
12548 3usize,
12549 1u8,
12550 ) as u8)
12551 }
12552 }
12553 #[inline]
12554 pub unsafe fn set_mMacAck_raw(this: *mut Self, val: bool) {
12555 unsafe {
12556 let val: u8 = ::std::mem::transmute(val);
12557 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12558 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12559 3usize,
12560 1u8,
12561 val as u64,
12562 )
12563 }
12564 }
12565 #[inline]
12566 pub fn new_bitfield_1(
12567 mLinkProbe: bool,
12568 mMacData: bool,
12569 mMacDataRequest: bool,
12570 mMacAck: bool,
12571 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12572 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12573 __bindgen_bitfield_unit.set(0usize, 1u8, {
12574 let mLinkProbe: u8 = unsafe { ::std::mem::transmute(mLinkProbe) };
12575 mLinkProbe as u64
12576 });
12577 __bindgen_bitfield_unit.set(1usize, 1u8, {
12578 let mMacData: u8 = unsafe { ::std::mem::transmute(mMacData) };
12579 mMacData as u64
12580 });
12581 __bindgen_bitfield_unit.set(2usize, 1u8, {
12582 let mMacDataRequest: u8 = unsafe { ::std::mem::transmute(mMacDataRequest) };
12583 mMacDataRequest as u64
12584 });
12585 __bindgen_bitfield_unit.set(3usize, 1u8, {
12586 let mMacAck: u8 = unsafe { ::std::mem::transmute(mMacAck) };
12587 mMacAck as u64
12588 });
12589 __bindgen_bitfield_unit
12590 }
12591}
12592#[doc = "< Clear."]
12593pub const OT_LINK_METRICS_ENH_ACK_CLEAR: otLinkMetricsEnhAckFlags = 0;
12594#[doc = "< Register."]
12595pub const OT_LINK_METRICS_ENH_ACK_REGISTER: otLinkMetricsEnhAckFlags = 1;
12596#[doc = " Enhanced-ACK Flags.\n\n These are used in Enhanced-ACK Based Probing to indicate whether to register or clear the probing."]
12597pub type otLinkMetricsEnhAckFlags = ::std::os::raw::c_uint;
12598pub const OT_LINK_METRICS_STATUS_SUCCESS: otLinkMetricsStatus = 0;
12599pub const OT_LINK_METRICS_STATUS_CANNOT_SUPPORT_NEW_SERIES: otLinkMetricsStatus = 1;
12600pub const OT_LINK_METRICS_STATUS_SERIESID_ALREADY_REGISTERED: otLinkMetricsStatus = 2;
12601pub const OT_LINK_METRICS_STATUS_SERIESID_NOT_RECOGNIZED: otLinkMetricsStatus = 3;
12602pub const OT_LINK_METRICS_STATUS_NO_MATCHING_FRAMES_RECEIVED: otLinkMetricsStatus = 4;
12603pub const OT_LINK_METRICS_STATUS_OTHER_ERROR: otLinkMetricsStatus = 254;
12604#[doc = " Link Metrics Status values."]
12605pub type otLinkMetricsStatus = ::std::os::raw::c_uint;
12606#[doc = " Pointer is called when a Link Metrics report is received.\n\n @param[in] aSource A pointer to the source address.\n @param[in] aMetricsValues A pointer to the Link Metrics values (the query result).\n @param[in] aStatus The status code in the report (only useful when @p aMetricsValues is NULL).\n @param[in] aContext A pointer to application-specific context."]
12607pub type otLinkMetricsReportCallback = ::std::option::Option<
12608 unsafe extern "C" fn(
12609 aSource: *const otIp6Address,
12610 aMetricsValues: *const otLinkMetricsValues,
12611 aStatus: otLinkMetricsStatus,
12612 aContext: *mut ::std::os::raw::c_void,
12613 ),
12614>;
12615#[doc = " Pointer is called when a Link Metrics Management Response is received.\n\n @param[in] aSource A pointer to the source address.\n @param[in] aStatus The status code in the response.\n @param[in] aContext A pointer to application-specific context."]
12616pub type otLinkMetricsMgmtResponseCallback = ::std::option::Option<
12617 unsafe extern "C" fn(
12618 aSource: *const otIp6Address,
12619 aStatus: otLinkMetricsStatus,
12620 aContext: *mut ::std::os::raw::c_void,
12621 ),
12622>;
12623#[doc = " Pointer is called when Enh-ACK Probing IE is received.\n\n @param[in] aShortAddress The Mac short address of the Probing Subject.\n @param[in] aExtAddress A pointer to the Mac extended address of the Probing Subject.\n @param[in] aMetricsValues A pointer to the Link Metrics values obtained from the IE.\n @param[in] aContext A pointer to application-specific context."]
12624pub type otLinkMetricsEnhAckProbingIeReportCallback = ::std::option::Option<
12625 unsafe extern "C" fn(
12626 aShortAddress: otShortAddress,
12627 aExtAddress: *const otExtAddress,
12628 aMetricsValues: *const otLinkMetricsValues,
12629 aContext: *mut ::std::os::raw::c_void,
12630 ),
12631>;
12632unsafe extern "C" {
12633 #[doc = " Sends an MLE Data Request to query Link Metrics.\n\n It could be either Single Probe or Forward Tracking Series.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to the destination address.\n @param[in] aSeriesId The Series ID to query about, 0 for Single Probe.\n @param[in] aLinkMetricsFlags A pointer to flags specifying what metrics to query.\n @param[in] aCallback A pointer to a function that is called when Link Metrics report is received.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully sent a Link Metrics query message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate the MLE Data Request message.\n @retval OT_ERROR_UNKNOWN_NEIGHBOR @p aDestination is not link-local or the neighbor is not found.\n @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics."]
12634 pub fn otLinkMetricsQuery(
12635 aInstance: *mut otInstance,
12636 aDestination: *const otIp6Address,
12637 aSeriesId: u8,
12638 aLinkMetricsFlags: *const otLinkMetrics,
12639 aCallback: otLinkMetricsReportCallback,
12640 aCallbackContext: *mut ::std::os::raw::c_void,
12641 ) -> otError;
12642}
12643unsafe extern "C" {
12644 #[doc = " Sends an MLE Link Metrics Management Request to configure or clear a Forward Tracking Series.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to the destination address.\n @param[in] aSeriesId The Series ID to operate with.\n @param[in] aSeriesFlags The Series Flags that specifies which frames are to be accounted.\n @param[in] aLinkMetricsFlags A pointer to flags specifying what metrics to query. Should be `NULL` when\n `aSeriesFlags` is `0`.\n @param[in] aCallback A pointer to a function that is called when Link Metrics Management Response is\n received.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully sent a Link Metrics Management Request message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate the MLE Link Metrics Management Request message.\n @retval OT_ERROR_INVALID_ARGS @p aSeriesId is not within the valid range.\n @retval OT_ERROR_UNKNOWN_NEIGHBOR @p aDestination is not link-local or the neighbor is not found.\n @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics."]
12645 pub fn otLinkMetricsConfigForwardTrackingSeries(
12646 aInstance: *mut otInstance,
12647 aDestination: *const otIp6Address,
12648 aSeriesId: u8,
12649 aSeriesFlags: otLinkMetricsSeriesFlags,
12650 aLinkMetricsFlags: *const otLinkMetrics,
12651 aCallback: otLinkMetricsMgmtResponseCallback,
12652 aCallbackContext: *mut ::std::os::raw::c_void,
12653 ) -> otError;
12654}
12655unsafe extern "C" {
12656 #[doc = " Sends an MLE Link Metrics Management Request to configure/clear an Enhanced-ACK Based Probing.\n This functionality requires OT_LINK_METRICS_INITIATOR feature enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to the destination address.\n @param[in] aEnhAckFlags Enh-ACK Flags to indicate whether to register or clear the probing. `0` to clear and\n `1` to register. Other values are reserved.\n @param[in] aLinkMetricsFlags A pointer to flags specifying what metrics to query. Should be `NULL` when\n `aEnhAckFlags` is `0`.\n @param[in] aCallback A pointer to a function that is called when an Enhanced Ack with Link Metrics is\n received.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully sent a Link Metrics Management Request message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate the MLE Link Metrics Management Request message.\n @retval OT_ERROR_INVALID_ARGS @p aEnhAckFlags is not a valid value or @p aLinkMetricsFlags isn't correct.\n @retval OT_ERROR_UNKNOWN_NEIGHBOR @p aDestination is not link-local or the neighbor is not found.\n @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics."]
12657 pub fn otLinkMetricsConfigEnhAckProbing(
12658 aInstance: *mut otInstance,
12659 aDestination: *const otIp6Address,
12660 aEnhAckFlags: otLinkMetricsEnhAckFlags,
12661 aLinkMetricsFlags: *const otLinkMetrics,
12662 aCallback: otLinkMetricsMgmtResponseCallback,
12663 aCallbackContext: *mut ::std::os::raw::c_void,
12664 aEnhAckCallback: otLinkMetricsEnhAckProbingIeReportCallback,
12665 aEnhAckCallbackContext: *mut ::std::os::raw::c_void,
12666 ) -> otError;
12667}
12668unsafe extern "C" {
12669 #[doc = " Sends an MLE Link Probe message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to the destination address.\n @param[in] aSeriesId The Series ID [1, 254] which the Probe message aims at.\n @param[in] aLength The length of the data payload in Link Probe TLV, [0, 64] (per Thread 1.2 spec, 4.4.37).\n\n @retval OT_ERROR_NONE Successfully sent a Link Probe message.\n @retval OT_ERROR_NO_BUFS Insufficient buffers to generate the MLE Link Probe message.\n @retval OT_ERROR_INVALID_ARGS @p aSeriesId or @p aLength is not within the valid range.\n @retval OT_ERROR_UNKNOWN_NEIGHBOR @p aDestination is not link-local or the neighbor is not found.\n @retval OT_ERROR_NOT_CAPABLE The neighbor is not a Thread 1.2 device and does not support Link Metrics."]
12670 pub fn otLinkMetricsSendLinkProbe(
12671 aInstance: *mut otInstance,
12672 aDestination: *const otIp6Address,
12673 aSeriesId: u8,
12674 aLength: u8,
12675 ) -> otError;
12676}
12677unsafe extern "C" {
12678 #[doc = " If Link Metrics Manager is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE Link Metrics Manager is enabled.\n @retval FALSE Link Metrics Manager is not enabled."]
12679 pub fn otLinkMetricsManagerIsEnabled(aInstance: *mut otInstance) -> bool;
12680}
12681unsafe extern "C" {
12682 #[doc = " Enable or disable Link Metrics Manager.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable A boolean indicating to enable or disable."]
12683 pub fn otLinkMetricsManagerSetEnabled(aInstance: *mut otInstance, aEnable: bool);
12684}
12685unsafe extern "C" {
12686 #[doc = " Get Link Metrics data of a neighbor by its extended address.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress A pointer to the Mac extended address of the Probing Subject.\n @param[out] aLinkMetricsValues A pointer to the Link Metrics values of the subject.\n\n @retval OT_ERROR_NONE Successfully got the Link Metrics data.\n @retval OT_ERROR_INVALID_ARGS The arguments are invalid.\n @retval OT_ERROR_NOT_FOUND No neighbor with the given extended address is found."]
12687 pub fn otLinkMetricsManagerGetMetricsValueByExtAddr(
12688 aInstance: *mut otInstance,
12689 aExtAddress: *const otExtAddress,
12690 aLinkMetricsValues: *mut otLinkMetricsValues,
12691 ) -> otError;
12692}
12693#[doc = " Pointer on receipt of a IEEE 802.15.4 frame.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aFrame A pointer to the received frame or NULL if the receive operation was aborted.\n @param[in] aError OT_ERROR_NONE when successfully received a frame.\n OT_ERROR_ABORT when reception was aborted and a frame was not received."]
12694pub type otLinkRawReceiveDone = ::std::option::Option<
12695 unsafe extern "C" fn(aInstance: *mut otInstance, aFrame: *mut otRadioFrame, aError: otError),
12696>;
12697unsafe extern "C" {
12698 #[doc = " Enables/disables the raw link-layer.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function called on receipt of a IEEE 802.15.4 frame. NULL to disable the\n raw-link layer.\n\n @retval OT_ERROR_FAILED The radio could not be enabled/disabled.\n @retval OT_ERROR_INVALID_STATE If the OpenThread IPv6 interface is already enabled.\n @retval OT_ERROR_NONE If the enable state was successfully set."]
12699 pub fn otLinkRawSetReceiveDone(
12700 aInstance: *mut otInstance,
12701 aCallback: otLinkRawReceiveDone,
12702 ) -> otError;
12703}
12704unsafe extern "C" {
12705 #[doc = " Indicates whether or not the raw link-layer is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval true The raw link-layer is enabled.\n @retval false The raw link-layer is disabled."]
12706 pub fn otLinkRawIsEnabled(aInstance: *mut otInstance) -> bool;
12707}
12708unsafe extern "C" {
12709 #[doc = " Gets the status of promiscuous mode.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval true Promiscuous mode is enabled.\n @retval false Promiscuous mode is disabled."]
12710 pub fn otLinkRawGetPromiscuous(aInstance: *mut otInstance) -> bool;
12711}
12712unsafe extern "C" {
12713 #[doc = " Enables or disables promiscuous mode.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable A value to enable or disable promiscuous mode.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12714 pub fn otLinkRawSetPromiscuous(aInstance: *mut otInstance, aEnable: bool) -> otError;
12715}
12716unsafe extern "C" {
12717 #[doc = " Set the Short Address for address filtering.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aShortAddress The IEEE 802.15.4 Short Address.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12718 pub fn otLinkRawSetShortAddress(aInstance: *mut otInstance, aShortAddress: u16) -> otError;
12719}
12720unsafe extern "C" {
12721 #[doc = " Set the alternate short address.\n\n This is an optional API. Support for this is indicated by including the capability `OT_RADIO_CAPS_ALT_SHORT_ADDR` in\n `otLinkRawGetCaps()`.\n\n When supported, the radio will accept received frames destined to the specified alternate short address in addition\n to the short address provided in `otLinkRawSetShortAddress()`.\n\n The @p aShortAddress can be set to `OT_RADIO_INVALID_SHORT_ADDR` (0xfffe) to clear any previously set alternate\n short address.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aShortAddress The alternate short address. `OT_RADIO_INVALID_SHORT_ADDR` to clear.\n\n @retval OT_ERROR_NONE Successfully set the alternate short address.\n @retval OT_ERROR_INVALID_STATE The raw link-layer is not enabled."]
12722 pub fn otLinkRawSetAlternateShortAddress(
12723 aInstance: *mut otInstance,
12724 aShortAddress: otShortAddress,
12725 ) -> otError;
12726}
12727unsafe extern "C" {
12728 #[doc = " Transition the radio from Receive to Sleep.\n Turn off the radio.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully transitioned to Sleep.\n @retval OT_ERROR_BUSY The radio was transmitting\n @retval OT_ERROR_INVALID_STATE The radio was disabled"]
12729 pub fn otLinkRawSleep(aInstance: *mut otInstance) -> otError;
12730}
12731unsafe extern "C" {
12732 #[doc = " Transitioning the radio from Sleep to Receive.\n Turn on the radio.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully transitioned to Receive.\n @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting."]
12733 pub fn otLinkRawReceive(aInstance: *mut otInstance) -> otError;
12734}
12735unsafe extern "C" {
12736 #[doc = " The radio transitions from Transmit to Receive.\n Returns a pointer to the transmit buffer.\n\n The caller forms the IEEE 802.15.4 frame in this buffer then calls otLinkRawTransmit()\n to request transmission.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the transmit buffer or NULL if the raw link-layer isn't enabled."]
12737 pub fn otLinkRawGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
12738}
12739#[doc = " Pointer on receipt of a IEEE 802.15.4 frame.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aFrame A pointer to the frame that was transmitted.\n @param[in] aAckFrame A pointer to the ACK frame.\n @param[in] aError OT_ERROR_NONE when the frame was transmitted.\n OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received\n OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission could not take place\ndue to activity on the channel.\n OT_ERROR_ABORT when transmission was aborted for other reasons."]
12740pub type otLinkRawTransmitDone = ::std::option::Option<
12741 unsafe extern "C" fn(
12742 aInstance: *mut otInstance,
12743 aFrame: *mut otRadioFrame,
12744 aAckFrame: *mut otRadioFrame,
12745 aError: otError,
12746 ),
12747>;
12748unsafe extern "C" {
12749 #[doc = " Begins the transmit sequence on the radio.\n\n The caller must form the IEEE 802.15.4 frame in the buffer provided by otLinkRawGetTransmitBuffer() before\n requesting transmission. The channel and transmit power are also included in the otRadioFrame structure.\n\n The transmit sequence consists of:\n 1. Transitioning the radio to Transmit from Receive.\n 2. Transmits the PSDU on the given channel and at the given transmit power.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function called on completion of the transmission.\n\n @retval OT_ERROR_NONE Successfully transitioned to Transmit.\n @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state."]
12750 pub fn otLinkRawTransmit(
12751 aInstance: *mut otInstance,
12752 aCallback: otLinkRawTransmitDone,
12753 ) -> otError;
12754}
12755unsafe extern "C" {
12756 #[doc = " Get the most recent RSSI measurement.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid."]
12757 pub fn otLinkRawGetRssi(aInstance: *mut otInstance) -> i8;
12758}
12759unsafe extern "C" {
12760 #[doc = " Get the radio capabilities.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The radio capability bit vector. The stack enables or disables some functions based on this value."]
12761 pub fn otLinkRawGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
12762}
12763#[doc = " Pointer on receipt of a IEEE 802.15.4 frame.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel."]
12764pub type otLinkRawEnergyScanDone =
12765 ::std::option::Option<unsafe extern "C" fn(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8)>;
12766unsafe extern "C" {
12767 #[doc = " Begins the energy scan sequence on the radio.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aScanChannel The channel to perform the energy scan on.\n @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned.\n @param[in] aCallback A pointer to a function called on completion of a scanned channel.\n\n @retval OT_ERROR_NONE Successfully started scanning the channel.\n @retval OT_ERROR_BUSY The radio is performing energy scanning.\n @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12768 pub fn otLinkRawEnergyScan(
12769 aInstance: *mut otInstance,
12770 aScanChannel: u8,
12771 aScanDuration: u16,
12772 aCallback: otLinkRawEnergyScanDone,
12773 ) -> otError;
12774}
12775unsafe extern "C" {
12776 #[doc = " Enable/Disable source match for frame pending.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable Enable/disable source match for frame pending.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12777 pub fn otLinkRawSrcMatchEnable(aInstance: *mut otInstance, aEnable: bool) -> otError;
12778}
12779unsafe extern "C" {
12780 #[doc = " Adding short address to the source match table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aShortAddress The short address to be added.\n\n @retval OT_ERROR_NONE Successfully added short address to the source match table.\n @retval OT_ERROR_NO_BUFS No available entry in the source match table.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12781 pub fn otLinkRawSrcMatchAddShortEntry(
12782 aInstance: *mut otInstance,
12783 aShortAddress: u16,
12784 ) -> otError;
12785}
12786unsafe extern "C" {
12787 #[doc = " Adding extended address to the source match table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress The extended address to be added.\n\n @retval OT_ERROR_NONE Successfully added extended address to the source match table.\n @retval OT_ERROR_NO_BUFS No available entry in the source match table.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12788 pub fn otLinkRawSrcMatchAddExtEntry(
12789 aInstance: *mut otInstance,
12790 aExtAddress: *const otExtAddress,
12791 ) -> otError;
12792}
12793unsafe extern "C" {
12794 #[doc = " Removing short address to the source match table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aShortAddress The short address to be removed.\n\n @retval OT_ERROR_NONE Successfully removed short address from the source match table.\n @retval OT_ERROR_NO_ADDRESS The short address is not in source match table.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12795 pub fn otLinkRawSrcMatchClearShortEntry(
12796 aInstance: *mut otInstance,
12797 aShortAddress: u16,
12798 ) -> otError;
12799}
12800unsafe extern "C" {
12801 #[doc = " Removing extended address to the source match table of the radio.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress The extended address to be removed.\n\n @retval OT_ERROR_NONE Successfully removed the extended address from the source match table.\n @retval OT_ERROR_NO_ADDRESS The extended address is not in source match table.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12802 pub fn otLinkRawSrcMatchClearExtEntry(
12803 aInstance: *mut otInstance,
12804 aExtAddress: *const otExtAddress,
12805 ) -> otError;
12806}
12807unsafe extern "C" {
12808 #[doc = " Removing all the short addresses from the source match table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12809 pub fn otLinkRawSrcMatchClearShortEntries(aInstance: *mut otInstance) -> otError;
12810}
12811unsafe extern "C" {
12812 #[doc = " Removing all the extended addresses from the source match table.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12813 pub fn otLinkRawSrcMatchClearExtEntries(aInstance: *mut otInstance) -> otError;
12814}
12815unsafe extern "C" {
12816 #[doc = " Update MAC keys and key index.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyIdMode The key ID mode.\n @param[in] aKeyId The key index.\n @param[in] aPrevKey The previous MAC key.\n @param[in] aCurrKey The current MAC key.\n @param[in] aNextKey The next MAC key.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12817 pub fn otLinkRawSetMacKey(
12818 aInstance: *mut otInstance,
12819 aKeyIdMode: u8,
12820 aKeyId: u8,
12821 aPrevKey: *const otMacKey,
12822 aCurrKey: *const otMacKey,
12823 aNextKey: *const otMacKey,
12824 ) -> otError;
12825}
12826unsafe extern "C" {
12827 #[doc = " Sets the current MAC frame counter value.\n\n Always sets the MAC counter to the new given value @p aMacFrameCounter independent of the current\n value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMacFrameCounter The MAC frame counter value.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12828 pub fn otLinkRawSetMacFrameCounter(
12829 aInstance: *mut otInstance,
12830 aMacFrameCounter: u32,
12831 ) -> otError;
12832}
12833unsafe extern "C" {
12834 #[doc = " Sets the current MAC frame counter value only if the new value is larger than the current one.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMacFrameCounter The MAC frame counter value.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
12835 pub fn otLinkRawSetMacFrameCounterIfLarger(
12836 aInstance: *mut otInstance,
12837 aMacFrameCounter: u32,
12838 ) -> otError;
12839}
12840unsafe extern "C" {
12841 #[doc = " Get current platform time (64bits width) of the radio chip.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current radio time in microseconds."]
12842 pub fn otLinkRawGetRadioTime(aInstance: *mut otInstance) -> u64;
12843}
12844unsafe extern "C" {
12845 #[doc = " Returns the current log level.\n\n If dynamic log level feature `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is enabled, this function returns the\n currently set dynamic log level. Otherwise, this function returns the build-time configured log level.\n\n @returns The log level."]
12846 pub fn otLoggingGetLevel() -> otLogLevel;
12847}
12848unsafe extern "C" {
12849 #[doc = " Sets the log level.\n\n @note This function requires `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n @param[in] aLogLevel The log level.\n\n @retval OT_ERROR_NONE Successfully updated log level.\n @retval OT_ERROR_INVALID_ARGS Log level value is invalid."]
12850 pub fn otLoggingSetLevel(aLogLevel: otLogLevel) -> otError;
12851}
12852unsafe extern "C" {
12853 #[doc = " Emits a log message at critical log level.\n\n Is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below critical, this function does not emit any log message.\n\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12854 pub fn otLogCritPlat(aFormat: *const ::std::os::raw::c_char, ...);
12855}
12856unsafe extern "C" {
12857 #[doc = " Emits a log message at warning log level.\n\n Is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below warning, this function does not emit any log message.\n\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12858 pub fn otLogWarnPlat(aFormat: *const ::std::os::raw::c_char, ...);
12859}
12860unsafe extern "C" {
12861 #[doc = " Emits a log message at note log level.\n\n Is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below note, this function does not emit any log message.\n\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12862 pub fn otLogNotePlat(aFormat: *const ::std::os::raw::c_char, ...);
12863}
12864unsafe extern "C" {
12865 #[doc = " Emits a log message at info log level.\n\n Is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below info, this function does not emit any log message.\n\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12866 pub fn otLogInfoPlat(aFormat: *const ::std::os::raw::c_char, ...);
12867}
12868unsafe extern "C" {
12869 #[doc = " Emits a log message at debug log level.\n\n Is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below debug, this function does not emit any log message.\n\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12870 pub fn otLogDebgPlat(aFormat: *const ::std::os::raw::c_char, ...);
12871}
12872unsafe extern "C" {
12873 #[doc = " Generates a memory dump at critical log level.\n\n If `OPENTHREAD_CONFIG_LOG_PLATFORM` or `OPENTHREAD_CONFIG_LOG_PKT_DUMP` is not set or the current log level is below\n critical this function does not emit any log message.\n\n @param[in] aText A string that is printed before the bytes.\n @param[in] aData A pointer to the data buffer.\n @param[in] aDataLength Number of bytes in @p aData."]
12874 pub fn otDumpCritPlat(
12875 aText: *const ::std::os::raw::c_char,
12876 aData: *const ::std::os::raw::c_void,
12877 aDataLength: u16,
12878 );
12879}
12880unsafe extern "C" {
12881 #[doc = " Generates a memory dump at warning log level.\n\n If `OPENTHREAD_CONFIG_LOG_PLATFORM` or `OPENTHREAD_CONFIG_LOG_PKT_DUMP` is not set or the current log level is below\n warning this function does not emit any log message.\n\n @param[in] aText A string that is printed before the bytes.\n @param[in] aData A pointer to the data buffer.\n @param[in] aDataLength Number of bytes in @p aData."]
12882 pub fn otDumpWarnPlat(
12883 aText: *const ::std::os::raw::c_char,
12884 aData: *const ::std::os::raw::c_void,
12885 aDataLength: u16,
12886 );
12887}
12888unsafe extern "C" {
12889 #[doc = " Generates a memory dump at note log level.\n\n If `OPENTHREAD_CONFIG_LOG_PLATFORM` or `OPENTHREAD_CONFIG_LOG_PKT_DUMP` is not set or the current log level is below\n note this function does not emit any log message.\n\n @param[in] aText A string that is printed before the bytes.\n @param[in] aData A pointer to the data buffer.\n @param[in] aDataLength Number of bytes in @p aData."]
12890 pub fn otDumpNotePlat(
12891 aText: *const ::std::os::raw::c_char,
12892 aData: *const ::std::os::raw::c_void,
12893 aDataLength: u16,
12894 );
12895}
12896unsafe extern "C" {
12897 #[doc = " Generates a memory dump at info log level.\n\n If `OPENTHREAD_CONFIG_LOG_PLATFORM` or `OPENTHREAD_CONFIG_LOG_PKT_DUMP` is not set or the current log level is below\n info this function does not emit any log message.\n\n @param[in] aText A string that is printed before the bytes.\n @param[in] aData A pointer to the data buffer.\n @param[in] aDataLength Number of bytes in @p aData."]
12898 pub fn otDumpInfoPlat(
12899 aText: *const ::std::os::raw::c_char,
12900 aData: *const ::std::os::raw::c_void,
12901 aDataLength: u16,
12902 );
12903}
12904unsafe extern "C" {
12905 #[doc = " Generates a memory dump at debug log level.\n\n If `OPENTHREAD_CONFIG_LOG_PLATFORM` or `OPENTHREAD_CONFIG_LOG_PKT_DUMP` is not set or the current log level is below\n debug this function does not emit any log message.\n\n @param[in] aText A string that is printed before the bytes.\n @param[in] aData A pointer to the data buffer.\n @param[in] aDataLength Number of bytes in @p aData."]
12906 pub fn otDumpDebgPlat(
12907 aText: *const ::std::os::raw::c_char,
12908 aData: *const ::std::os::raw::c_void,
12909 aDataLength: u16,
12910 );
12911}
12912unsafe extern "C" {
12913 #[doc = " Emits a log message at given log level using a platform module name.\n\n This is is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below @p aLogLevel , this function does not emit any log message.\n\n The @p aPlatModuleName name is used to determine the log module name in the emitted log message, following the\n `P-{PlatModuleName}---` format. This means that the prefix string \"P-\" is added to indicate that this is a platform\n sub-module, followed by the next 12 characters of the @p PlatModuleName string, with padded hyphens `-` at the end\n to ensure that the region name is 14 characters long.\n\n @param[in] aLogLevel The log level.\n @param[in] aPlatModuleName The platform sub-module name.\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12914 pub fn otLogPlat(
12915 aLogLevel: otLogLevel,
12916 aPlatModuleName: *const ::std::os::raw::c_char,
12917 aFormat: *const ::std::os::raw::c_char,
12918 ...
12919 );
12920}
12921unsafe extern "C" {
12922 #[doc = " Emits a log message at given log level using a platform module name.\n\n This is is intended for use by platform. If `OPENTHREAD_CONFIG_LOG_PLATFORM` is not set or the current log\n level is below @p aLogLevel , this function does not emit any log message.\n\n The @p aPlatModuleName name is used to determine the log module name in the emitted log message, following the\n `P-{PlatModuleName}---` format. This means that the prefix string \"P-\" is added to indicate that this is a platform\n sub-module, followed by the next 12 characters of the @p PlatModuleName string, with padded hyphens `-` at the end\n to ensure that the region name is 14 characters long.\n\n @param[in] aLogLevel The log level.\n @param[in] aPlatModuleName The platform sub-module name.\n @param[in] aFormat The format string.\n @param[in] aArgs Arguments for the format specification."]
12923 pub fn otLogPlatArgs(
12924 aLogLevel: otLogLevel,
12925 aPlatModuleName: *const ::std::os::raw::c_char,
12926 aFormat: *const ::std::os::raw::c_char,
12927 aArgs: *mut __va_list_tag,
12928 );
12929}
12930unsafe extern "C" {
12931 #[doc = " Emits a log message at a given log level.\n\n Is intended for use by CLI only. If `OPENTHREAD_CONFIG_LOG_CLI` is not set or the current log\n level is below the given log level, this function does not emit any log message.\n\n @param[in] aLogLevel The log level.\n @param[in] aFormat The format string.\n @param[in] ... Arguments for the format specification."]
12932 pub fn otLogCli(aLogLevel: otLogLevel, aFormat: *const ::std::os::raw::c_char, ...);
12933}
12934#[doc = " Represents information used for generating hex dump output."]
12935#[repr(C)]
12936#[derive(Debug, Copy, Clone)]
12937pub struct otLogHexDumpInfo {
12938 #[doc = "< The data byes."]
12939 pub mDataBytes: *const u8,
12940 #[doc = "< The data length (number of bytes in @p mDataBytes)"]
12941 pub mDataLength: u16,
12942 #[doc = "< Title string to add table header (MUST NOT be `NULL`)."]
12943 pub mTitle: *const ::std::os::raw::c_char,
12944 #[doc = "< Buffer to output one line of generated hex dump."]
12945 pub mLine: [::std::os::raw::c_char; 73usize],
12946 #[doc = "< Iterator used by OT stack. MUST be initialized to zero."]
12947 pub mIterator: u16,
12948}
12949impl Default for otLogHexDumpInfo {
12950 fn default() -> Self {
12951 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12952 unsafe {
12953 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12954 s.assume_init()
12955 }
12956 }
12957}
12958unsafe extern "C" {
12959 #[doc = " Generates the next hex dump line.\n\n Can call this method back-to-back to generate the hex dump output line by line. On the first call the `mIterator`\n field in @p aInfo MUST be set to zero.\n\n Here is an example of the generated hex dump output:\n\n \"==========================[{mTitle} len=070]============================\"\n \"| 41 D8 87 34 12 FF FF 25 | 4C 57 DA F2 FB 2F 62 7F | A..4...%LW.../b. |\"\n \"| 3B 01 F0 4D 4C 4D 4C 54 | 4F 00 15 15 00 00 00 00 | ;..MLMLTO....... |\"\n \"| 00 00 00 01 80 DB 60 82 | 7E 33 72 3B CC B3 A1 84 | ......`.~3r;.... |\"\n \"| 3B E6 AD B2 0B 45 E7 45 | C5 B9 00 1A CB 2D 6D 1C | ;....E.E.....-m. |\"\n \"| 10 3E 3C F5 D3 70 | | .><..p |\"\n \"------------------------------------------------------------------------\"\n\n @param[in,out] aInfo A pointer to `otLogHexDumpInfo` to use to generate hex dump.\n\n @retval OT_ERROR_NONE Successfully generated the next line, `mLine` field in @p aInfo is updated.\n @retval OT_ERROR_NOT_FOUND Reached the end and no more line to generate."]
12960 pub fn otLogGenerateNextHexDumpLine(aInfo: *mut otLogHexDumpInfo) -> otError;
12961}
12962#[doc = " Represents information associated with a radio link."]
12963#[repr(C)]
12964#[derive(Debug, Default, Copy, Clone)]
12965pub struct otRadioLinkInfo {
12966 #[doc = "< Preference level of radio link"]
12967 pub mPreference: u8,
12968}
12969#[doc = " Represents multi radio link information associated with a neighbor."]
12970#[repr(C)]
12971#[derive(Debug, Default, Copy, Clone)]
12972pub struct otMultiRadioNeighborInfo {
12973 pub _bitfield_align_1: [u8; 0],
12974 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
12975 #[doc = "< Additional info for 15.4 radio link (applicable when supported)."]
12976 pub mIeee802154Info: otRadioLinkInfo,
12977 #[doc = "< Additional info for TREL radio link (applicable when supported)."]
12978 pub mTrelUdp6Info: otRadioLinkInfo,
12979}
12980impl otMultiRadioNeighborInfo {
12981 #[inline]
12982 pub fn mSupportsIeee802154(&self) -> bool {
12983 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
12984 }
12985 #[inline]
12986 pub fn set_mSupportsIeee802154(&mut self, val: bool) {
12987 unsafe {
12988 let val: u8 = ::std::mem::transmute(val);
12989 self._bitfield_1.set(0usize, 1u8, val as u64)
12990 }
12991 }
12992 #[inline]
12993 pub unsafe fn mSupportsIeee802154_raw(this: *const Self) -> bool {
12994 unsafe {
12995 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12996 ::std::ptr::addr_of!((*this)._bitfield_1),
12997 0usize,
12998 1u8,
12999 ) as u8)
13000 }
13001 }
13002 #[inline]
13003 pub unsafe fn set_mSupportsIeee802154_raw(this: *mut Self, val: bool) {
13004 unsafe {
13005 let val: u8 = ::std::mem::transmute(val);
13006 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13007 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13008 0usize,
13009 1u8,
13010 val as u64,
13011 )
13012 }
13013 }
13014 #[inline]
13015 pub fn mSupportsTrelUdp6(&self) -> bool {
13016 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13017 }
13018 #[inline]
13019 pub fn set_mSupportsTrelUdp6(&mut self, val: bool) {
13020 unsafe {
13021 let val: u8 = ::std::mem::transmute(val);
13022 self._bitfield_1.set(1usize, 1u8, val as u64)
13023 }
13024 }
13025 #[inline]
13026 pub unsafe fn mSupportsTrelUdp6_raw(this: *const Self) -> bool {
13027 unsafe {
13028 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13029 ::std::ptr::addr_of!((*this)._bitfield_1),
13030 1usize,
13031 1u8,
13032 ) as u8)
13033 }
13034 }
13035 #[inline]
13036 pub unsafe fn set_mSupportsTrelUdp6_raw(this: *mut Self, val: bool) {
13037 unsafe {
13038 let val: u8 = ::std::mem::transmute(val);
13039 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13040 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13041 1usize,
13042 1u8,
13043 val as u64,
13044 )
13045 }
13046 }
13047 #[inline]
13048 pub fn new_bitfield_1(
13049 mSupportsIeee802154: bool,
13050 mSupportsTrelUdp6: bool,
13051 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13052 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13053 __bindgen_bitfield_unit.set(0usize, 1u8, {
13054 let mSupportsIeee802154: u8 = unsafe { ::std::mem::transmute(mSupportsIeee802154) };
13055 mSupportsIeee802154 as u64
13056 });
13057 __bindgen_bitfield_unit.set(1usize, 1u8, {
13058 let mSupportsTrelUdp6: u8 = unsafe { ::std::mem::transmute(mSupportsTrelUdp6) };
13059 mSupportsTrelUdp6 as u64
13060 });
13061 __bindgen_bitfield_unit
13062 }
13063}
13064unsafe extern "C" {
13065 #[doc = " Gets the multi radio link information associated with a neighbor with a given Extended Address.\n\n `OPENTHREAD_CONFIG_MULTI_RADIO` must be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress The Extended Address of neighbor.\n @param[out] aNeighborInfo A pointer to `otMultiRadioNeighborInfo` to output the neighbor info (on success).\n\n @retval OT_ERROR_NONE Neighbor was found and @p aNeighborInfo was updated successfully.\n @retval OT_ERROR_NOT_FOUND Could not find a neighbor with @p aExtAddress."]
13066 pub fn otMultiRadioGetNeighborInfo(
13067 aInstance: *mut otInstance,
13068 aExtAddress: *const otExtAddress,
13069 aNeighborInfo: *mut otMultiRadioNeighborInfo,
13070 ) -> otError;
13071}
13072#[doc = " @struct otIp4Address\n\n Represents an IPv4 address."]
13073#[repr(C, packed)]
13074#[derive(Copy, Clone)]
13075pub struct otIp4Address {
13076 pub mFields: otIp4Address__bindgen_ty_1,
13077}
13078#[repr(C, packed)]
13079#[derive(Copy, Clone)]
13080pub union otIp4Address__bindgen_ty_1 {
13081 #[doc = "< 8-bit fields"]
13082 pub m8: [u8; 4usize],
13083 #[doc = "< 32-bit representation"]
13084 pub m32: u32,
13085}
13086impl Default for otIp4Address__bindgen_ty_1 {
13087 fn default() -> Self {
13088 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13089 unsafe {
13090 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13091 s.assume_init()
13092 }
13093 }
13094}
13095impl Default for otIp4Address {
13096 fn default() -> Self {
13097 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13098 unsafe {
13099 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13100 s.assume_init()
13101 }
13102 }
13103}
13104#[doc = " @struct otIp4Cidr\n\n Represents an IPv4 CIDR block."]
13105#[repr(C)]
13106#[derive(Copy, Clone)]
13107pub struct otIp4Cidr {
13108 pub mAddress: otIp4Address,
13109 pub mLength: u8,
13110}
13111impl Default for otIp4Cidr {
13112 fn default() -> Self {
13113 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13114 unsafe {
13115 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13116 s.assume_init()
13117 }
13118 }
13119}
13120#[doc = " Represents the counters for NAT64."]
13121#[repr(C)]
13122#[derive(Debug, Default, Copy, Clone)]
13123pub struct otNat64Counters {
13124 #[doc = "< Number of packets translated from IPv4 to IPv6."]
13125 pub m4To6Packets: u64,
13126 #[doc = "< Sum of size of packets translated from IPv4 to IPv6."]
13127 pub m4To6Bytes: u64,
13128 #[doc = "< Number of packets translated from IPv6 to IPv4."]
13129 pub m6To4Packets: u64,
13130 #[doc = "< Sum of size of packets translated from IPv6 to IPv4."]
13131 pub m6To4Bytes: u64,
13132}
13133#[doc = " Represents the counters for the protocols supported by NAT64."]
13134#[repr(C)]
13135#[derive(Debug, Default, Copy, Clone)]
13136pub struct otNat64ProtocolCounters {
13137 #[doc = "< Counters for sum of all protocols."]
13138 pub mTotal: otNat64Counters,
13139 #[doc = "< Counters for ICMP and ICMPv6."]
13140 pub mIcmp: otNat64Counters,
13141 #[doc = "< Counters for UDP."]
13142 pub mUdp: otNat64Counters,
13143 #[doc = "< Counters for TCP."]
13144 pub mTcp: otNat64Counters,
13145}
13146#[doc = "< Packet drop for unknown reasons."]
13147pub const OT_NAT64_DROP_REASON_UNKNOWN: otNat64DropReason = 0;
13148#[doc = "< Packet drop due to failed to parse the datagram."]
13149pub const OT_NAT64_DROP_REASON_ILLEGAL_PACKET: otNat64DropReason = 1;
13150#[doc = "< Packet drop due to unsupported IP protocol."]
13151pub const OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO: otNat64DropReason = 2;
13152#[doc = "< Packet drop due to no mappings found or mapping pool exhausted."]
13153pub const OT_NAT64_DROP_REASON_NO_MAPPING: otNat64DropReason = 3;
13154pub const OT_NAT64_DROP_REASON_COUNT: otNat64DropReason = 4;
13155#[doc = " Packet drop reasons."]
13156pub type otNat64DropReason = ::std::os::raw::c_uint;
13157#[doc = " Represents the counters of dropped packets due to errors when handling NAT64 packets."]
13158#[repr(C)]
13159#[derive(Debug, Default, Copy, Clone)]
13160pub struct otNat64ErrorCounters {
13161 #[doc = "< Errors translating IPv4 packets."]
13162 pub mCount4To6: [u64; 4usize],
13163 #[doc = "< Errors translating IPv6 packets."]
13164 pub mCount6To4: [u64; 4usize],
13165}
13166unsafe extern "C" {
13167 #[doc = " Gets NAT64 translator counters.\n\n The counter is counted since the instance initialized.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed."]
13168 pub fn otNat64GetCounters(aInstance: *mut otInstance, aCounters: *mut otNat64ProtocolCounters);
13169}
13170unsafe extern "C" {
13171 #[doc = " Gets the NAT64 translator error counters.\n\n The counters are initialized to zero when the OpenThread instance is initialized.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed."]
13172 pub fn otNat64GetErrorCounters(
13173 aInstance: *mut otInstance,
13174 aCounters: *mut otNat64ErrorCounters,
13175 );
13176}
13177#[doc = " Represents an address mapping record for NAT64.\n\n @note The counters will be reset for each mapping session even for the same address pair. Applications can use `mId`\n to identify different sessions to calculate the packets correctly."]
13178#[repr(C)]
13179#[derive(Copy, Clone)]
13180pub struct otNat64AddressMapping {
13181 #[doc = "< The unique id for a mapping session."]
13182 pub mId: u64,
13183 #[doc = "< The IPv4 address of the mapping."]
13184 pub mIp4: otIp4Address,
13185 #[doc = "< The IPv6 address of the mapping."]
13186 pub mIp6: otIp6Address,
13187 #[doc = " The source port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13188 pub mSrcPortOrId: u16,
13189 #[doc = " The translated port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13190 pub mTranslatedPortOrId: u16,
13191 #[doc = " Remaining time in milliseconds before the entry expires.\n\n The remaining time is relative to the initialization of the `otNat64AddressMappingIterator`, i.e., when\n `otNat64InitAddressMappingIterator()` was called."]
13192 pub mRemainingTimeMs: u32,
13193 #[doc = "< Counters."]
13194 pub mCounters: otNat64ProtocolCounters,
13195}
13196impl Default for otNat64AddressMapping {
13197 fn default() -> Self {
13198 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13199 unsafe {
13200 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13201 s.assume_init()
13202 }
13203 }
13204}
13205#[doc = " Used to iterate through NAT64 address mappings.\n\n The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be\n accessed or used by caller.\n\n Before using an iterator, it MUST be initialized using `otNat64InitAddressMappingIterator()`.\n\n The member fields in this struct are for internal OpenThread stack use and should not be accessed directly."]
13206#[repr(C)]
13207#[derive(Debug, Copy, Clone)]
13208pub struct otNat64AddressMappingIterator {
13209 pub mPtr: *const ::std::os::raw::c_void,
13210 pub mData32: u32,
13211}
13212impl Default for otNat64AddressMappingIterator {
13213 fn default() -> Self {
13214 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13215 unsafe {
13216 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13217 s.assume_init()
13218 }
13219 }
13220}
13221unsafe extern "C" {
13222 #[doc = " Initializes an `otNat64AddressMappingIterator`.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n An iterator MUST be initialized before it is used. An iterator can be initialized again to restart from the\n beginning of the mapping info list.\n\n The iterator initialization time is used to report the `mRemainingTimeMs` in the `otNat64AddressMapping` retrieved\n when calling `otNat64GetNextAddressMapping()` to iterate over the list. This ensures that all entry\n `mRemainingTimeMs` values are consistent and are from the same time origin, regardless of how or when\n `otNat64GetNextAddressMapping()` is called.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aIterator A pointer to the iterator to initialize."]
13223 pub fn otNat64InitAddressMappingIterator(
13224 aInstance: *mut otInstance,
13225 aIterator: *mut otNat64AddressMappingIterator,
13226 );
13227}
13228unsafe extern "C" {
13229 #[doc = " Gets the next AddressMapping info (using an iterator).\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next\n NAT64 address mapping record.\n @param[out] aMapping A pointer to an `otNat64AddressMapping` where information of next NAT64 address\n mapping record is placed (on success).\n\n @retval OT_ERROR_NONE Successfully found the next NAT64 address mapping info (@p aMapping was successfully\n updated).\n @retval OT_ERROR_NOT_FOUND No subsequent NAT64 address mapping info was found."]
13230 pub fn otNat64GetNextAddressMapping(
13231 aInstance: *mut otInstance,
13232 aIterator: *mut otNat64AddressMappingIterator,
13233 aMapping: *mut otNat64AddressMapping,
13234 ) -> otError;
13235}
13236#[doc = "< NAT64 is disabled."]
13237pub const OT_NAT64_STATE_DISABLED: otNat64State = 0;
13238#[doc = "< NAT64 is enabled, but one or more dependencies of NAT64 are not running."]
13239pub const OT_NAT64_STATE_NOT_RUNNING: otNat64State = 1;
13240#[doc = "< NAT64 is enabled, but this BR is not an active NAT64 BR."]
13241pub const OT_NAT64_STATE_IDLE: otNat64State = 2;
13242#[doc = "< The BR is publishing a NAT64 prefix and/or translating packets."]
13243pub const OT_NAT64_STATE_ACTIVE: otNat64State = 3;
13244#[doc = " States of NAT64."]
13245pub type otNat64State = ::std::os::raw::c_uint;
13246unsafe extern "C" {
13247 #[doc = " Gets the state of NAT64 translator.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_NAT64_STATE_DISABLED NAT64 translator is disabled.\n @retval OT_NAT64_STATE_NOT_RUNNING NAT64 translator is enabled, but the translator is not configured with a valid\n NAT64 prefix and a CIDR.\n @retval OT_NAT64_STATE_ACTIVE NAT64 translator is enabled, and is translating packets."]
13248 pub fn otNat64GetTranslatorState(aInstance: *mut otInstance) -> otNat64State;
13249}
13250unsafe extern "C" {
13251 #[doc = " Gets the state of NAT64 prefix manager.\n\n Available when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_NAT64_STATE_DISABLED NAT64 prefix manager is disabled.\n @retval OT_NAT64_STATE_NOT_RUNNING NAT64 prefix manager is enabled, but is not running (because the routing manager\n is not running).\n @retval OT_NAT64_STATE_IDLE NAT64 prefix manager is enabled, but is not publishing a NAT64 prefix. Usually\n when there is another border router publishing a NAT64 prefix with higher\n priority.\n @retval OT_NAT64_STATE_ACTIVE NAT64 prefix manager is enabled, and is publishing NAT64 prefix to the Thread\n network."]
13252 pub fn otNat64GetPrefixManagerState(aInstance: *mut otInstance) -> otNat64State;
13253}
13254unsafe extern "C" {
13255 #[doc = " Enable or disable NAT64 functions.\n\n Note: This includes the NAT64 Translator (when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled) and the NAT64\n Prefix Manager (when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled).\n\n When `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled, setting disabled to true resets the\n mapping table in the translator.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is\n enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled A boolean to enable/disable the NAT64 functions\n\n @sa otNat64GetTranslatorState\n @sa otNat64GetPrefixManagerState"]
13256 pub fn otNat64SetEnabled(aInstance: *mut otInstance, aEnabled: bool);
13257}
13258unsafe extern "C" {
13259 #[doc = " Allocate a new message buffer for sending an IPv4 message to the NAT64 translator.\n\n Message buffers allocated by this function will have 20 bytes (difference between the size of IPv6 headers\n and IPv4 header sizes) reserved.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n @note If @p aSettings is `NULL`, the link layer security is enabled and the message priority is set to\n OT_MESSAGE_PRIORITY_NORMAL by default.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSettings A pointer to the message settings or NULL to set default settings.\n\n @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.\n\n @sa otNat64Send"]
13260 pub fn otIp4NewMessage(
13261 aInstance: *mut otInstance,
13262 aSettings: *const otMessageSettings,
13263 ) -> *mut otMessage;
13264}
13265unsafe extern "C" {
13266 #[doc = " Sets the CIDR used when setting the source address of the outgoing translated IPv4 packets.\n\n Is available only when OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE is enabled.\n\n @note A valid CIDR must have a non-zero prefix length. The actual addresses pool is limited by the size of the\n mapping pool and the number of addresses available in the CIDR block.\n\n @note This function can be called at any time, but the NAT64 translator will be reset and all existing sessions will\n be expired when updating the configured CIDR.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCidr A pointer to an otIp4Cidr for the IPv4 CIDR block for NAT64.\n\n @retval OT_ERROR_INVALID_ARGS The given CIDR is not a valid IPv4 CIDR for NAT64.\n @retval OT_ERROR_NONE Successfully set the CIDR for NAT64.\n\n @sa otNat64Send\n @sa otNat64SetReceiveIp4Callback"]
13267 pub fn otNat64SetIp4Cidr(aInstance: *mut otInstance, aCidr: *const otIp4Cidr) -> otError;
13268}
13269unsafe extern "C" {
13270 #[doc = " Clears the CIDR used when setting the source address of the outgoing translated IPv4 packets.\n\n Is available only when OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE is enabled.\n\n @note This function can be called at any time, but the NAT64 translator will be reset and all existing sessions\n will be expired when clearing the configured CIDR.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @sa otNat64SetIp4Cidr"]
13271 pub fn otNat64ClearIp4Cidr(aInstance: *mut otInstance);
13272}
13273unsafe extern "C" {
13274 #[doc = " Translates an IPv4 datagram to an IPv6 datagram and sends via the Thread interface.\n\n The caller transfers ownership of @p aMessage when making this call. OpenThread will free @p aMessage when\n processing is complete, including when a value other than `OT_ERROR_NONE` is returned.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the message buffer containing the IPv4 datagram.\n\n @retval OT_ERROR_NONE Successfully processed the message.\n @retval OT_ERROR_DROP Message was well-formed but not fully processed due to packet processing\n rules.\n @retval OT_ERROR_NO_BUFS Could not allocate necessary message buffers when processing the datagram.\n @retval OT_ERROR_NO_ROUTE No route to host.\n @retval OT_ERROR_INVALID_SOURCE_ADDRESS Source address is invalid, e.g. an anycast address or a multicast address.\n @retval OT_ERROR_PARSE Encountered a malformed header when processing the message."]
13275 pub fn otNat64Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
13276}
13277#[doc = " Pointer is called when an IPv4 datagram (translated by NAT64 translator) is received.\n\n @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram. This function transfers\n the ownership of the @p aMessage to the receiver of the callback. The message should be\n freed by the receiver of the callback after it is processed.\n @param[in] aContext A pointer to application-specific context."]
13278pub type otNat64ReceiveIp4Callback = ::std::option::Option<
13279 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
13280>;
13281unsafe extern "C" {
13282 #[doc = " Registers a callback to provide received IPv4 datagrams.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to a function that is called when an IPv4 datagram is received or\n NULL to disable the callback.\n @param[in] aContext A pointer to application-specific context."]
13283 pub fn otNat64SetReceiveIp4Callback(
13284 aInstance: *mut otInstance,
13285 aCallback: otNat64ReceiveIp4Callback,
13286 aContext: *mut ::std::os::raw::c_void,
13287 );
13288}
13289unsafe extern "C" {
13290 #[doc = " Gets the IPv4 CIDR configured in the NAT64 translator.\n\n Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aCidr A pointer to an otIp4Cidr. Where the CIDR will be filled."]
13291 pub fn otNat64GetCidr(aInstance: *mut otInstance, aCidr: *mut otIp4Cidr) -> otError;
13292}
13293unsafe extern "C" {
13294 #[doc = " Test if two IPv4 addresses are the same.\n\n @param[in] aFirst A pointer to the first IPv4 address to compare.\n @param[in] aSecond A pointer to the second IPv4 address to compare.\n\n @retval TRUE The two IPv4 addresses are the same.\n @retval FALSE The two IPv4 addresses are not the same."]
13295 pub fn otIp4IsAddressEqual(aFirst: *const otIp4Address, aSecond: *const otIp4Address) -> bool;
13296}
13297unsafe extern "C" {
13298 #[doc = " Set @p aIp4Address by performing NAT64 address translation from @p aIp6Address as specified\n in RFC 6052.\n\n The NAT64 @p aPrefixLength MUST be one of the following values: 32, 40, 48, 56, 64, or 96, otherwise the behavior\n of this method is undefined.\n\n @param[in] aPrefixLength The prefix length to use for IPv4/IPv6 translation.\n @param[in] aIp6Address A pointer to an IPv6 address.\n @param[out] aIp4Address A pointer to output the IPv4 address."]
13299 pub fn otIp4ExtractFromIp6Address(
13300 aPrefixLength: u8,
13301 aIp6Address: *const otIp6Address,
13302 aIp4Address: *mut otIp4Address,
13303 );
13304}
13305unsafe extern "C" {
13306 #[doc = " Extracts the IPv4 address from a given IPv4-mapped IPv6 address.\n\n An IPv4-mapped IPv6 address consists of an 80-bit prefix of zeros, the next 16 bits set to ones, and the remaining,\n least-significant 32 bits contain the IPv4 address, e.g., `::ffff:192.0.2.128` representing `192.0.2.128`.\n\n @param[in] aIp6Address An IPv6 address to extract IPv4 from.\n @param[out] aIp4Address An IPv4 address to output the extracted address.\n\n @retval OT_ERROR_NONE Extracted the IPv4 address successfully. @p aIp4Address is updated.\n @retval OT_ERROR_PARSE The @p aIp6Address does not follow the IPv4-mapped IPv6 address format."]
13307 pub fn otIp4FromIp4MappedIp6Address(
13308 aIp6Address: *const otIp6Address,
13309 aIp4Address: *mut otIp4Address,
13310 ) -> otError;
13311}
13312unsafe extern "C" {
13313 #[doc = " Converts a given IP4 address to an IPv6 address following the IPv4-mapped IPv6 address format.\n\n @param[in] aIp4Address An IPv4 address to convert.\n @param[out] aIp6Address An IPv6 address to set."]
13314 pub fn otIp4ToIp4MappedIp6Address(
13315 aIp4Address: *const otIp4Address,
13316 aIp6Address: *mut otIp6Address,
13317 );
13318}
13319unsafe extern "C" {
13320 #[doc = " Converts the address to a string.\n\n The string format uses quad-dotted notation of four bytes in the address (e.g., \"127.0.0.1\").\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be\n truncated but the outputted string is always null-terminated.\n\n @param[in] aAddress A pointer to an IPv4 address (MUST NOT be NULL).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer (in bytes)."]
13321 pub fn otIp4AddressToString(
13322 aAddress: *const otIp4Address,
13323 aBuffer: *mut ::std::os::raw::c_char,
13324 aSize: u16,
13325 );
13326}
13327unsafe extern "C" {
13328 #[doc = " Converts a human-readable IPv4 CIDR string into a binary representation.\n\n @param[in] aString A pointer to a NULL-terminated string.\n @param[out] aCidr A pointer to an IPv4 CIDR.\n\n @retval OT_ERROR_NONE Successfully parsed the string.\n @retval OT_ERROR_INVALID_ARGS Failed to parse the string."]
13329 pub fn otIp4CidrFromString(
13330 aString: *const ::std::os::raw::c_char,
13331 aCidr: *mut otIp4Cidr,
13332 ) -> otError;
13333}
13334unsafe extern "C" {
13335 #[doc = " Converts the IPv4 CIDR to a string.\n\n The string format uses quad-dotted notation of four bytes in the address with the length of prefix (e.g.,\n \"127.0.0.1/32\").\n\n If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be\n truncated but the outputted string is always null-terminated.\n\n @param[in] aCidr A pointer to an IPv4 CIDR (MUST NOT be NULL).\n @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be NULL).\n @param[in] aSize The size of @p aBuffer (in bytes)."]
13336 pub fn otIp4CidrToString(
13337 aCidr: *const otIp4Cidr,
13338 aBuffer: *mut ::std::os::raw::c_char,
13339 aSize: u16,
13340 );
13341}
13342unsafe extern "C" {
13343 #[doc = " Converts a human-readable IPv4 address string into a binary representation.\n\n @param[in] aString A pointer to a NULL-terminated string.\n @param[out] aAddress A pointer to an IPv4 address.\n\n @retval OT_ERROR_NONE Successfully parsed the string.\n @retval OT_ERROR_INVALID_ARGS Failed to parse the string."]
13344 pub fn otIp4AddressFromString(
13345 aString: *const ::std::os::raw::c_char,
13346 aAddress: *mut otIp4Address,
13347 ) -> otError;
13348}
13349unsafe extern "C" {
13350 #[doc = " Sets the IPv6 address by performing NAT64 address translation from the preferred NAT64 prefix and the given IPv4\n address as specified in RFC 6052.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aIp4Address A pointer to the IPv4 address to translate to IPv6.\n @param[out] aIp6Address A pointer to the synthesized IPv6 address.\n\n @returns OT_ERROR_NONE Successfully synthesized the IPv6 address from NAT64 prefix and IPv4 address.\n @returns OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data."]
13351 pub fn otNat64SynthesizeIp6Address(
13352 aInstance: *mut otInstance,
13353 aIp4Address: *const otIp4Address,
13354 aIp6Address: *mut otIp6Address,
13355 ) -> otError;
13356}
13357unsafe extern "C" {
13358 #[doc = " Converts a given `otNat64State` to a human-readable string.\n\n @param[in] aState The NAT64 state.\n\n @returns The string representation of @p aState."]
13359 pub fn otNat64StateToString(aState: otNat64State) -> *const ::std::os::raw::c_char;
13360}
13361#[doc = " Pointer is called to send HDLC encoded NCP data.\n\n @param[in] aBuf A pointer to a buffer with an output.\n @param[in] aBufLength A length of the output data stored in the buffer.\n\n @returns Number of bytes processed by the callback."]
13362pub type otNcpHdlcSendCallback = ::std::option::Option<
13363 unsafe extern "C" fn(aBuf: *const u8, aBufLength: u16) -> ::std::os::raw::c_int,
13364>;
13365unsafe extern "C" {
13366 #[doc = " Is called after NCP send finished."]
13367 pub fn otNcpHdlcSendDone();
13368}
13369unsafe extern "C" {
13370 #[doc = " Is called after HDLC encoded NCP data received.\n\n @param[in] aBuf A pointer to a buffer.\n @param[in] aBufLength The length of the data stored in the buffer."]
13371 pub fn otNcpHdlcReceive(aBuf: *const u8, aBufLength: u16);
13372}
13373unsafe extern "C" {
13374 #[doc = " Initialize the NCP based on HDLC framing.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSendCallback The function pointer used to send NCP data."]
13375 pub fn otNcpHdlcInit(aInstance: *mut otInstance, aSendCallback: otNcpHdlcSendCallback);
13376}
13377unsafe extern "C" {
13378 #[doc = " Initialize the NCP based on HDLC framing.\n\n @param[in] aInstances The OpenThread instance pointers array.\n @param[in] aCount Number of elements in the array.\n @param[in] aSendCallback The function pointer used to send NCP data."]
13379 pub fn otNcpHdlcInitMulti(
13380 aInstance: *mut *mut otInstance,
13381 aCount: u8,
13382 aSendCallback: otNcpHdlcSendCallback,
13383 );
13384}
13385unsafe extern "C" {
13386 #[doc = " Initialize the NCP based on SPI framing.\n\n @param[in] aInstance The OpenThread instance structure."]
13387 pub fn otNcpSpiInit(aInstance: *mut otInstance);
13388}
13389unsafe extern "C" {
13390 #[doc = " @brief Send data to the host via a specific stream.\n\n Attempts to send the given data to the host\n using the given aStreamId. This is useful for reporting\n error messages, implementing debug/diagnostic consoles,\n and potentially other types of datastreams.\n\n The write either is accepted in its entirety or rejected.\n Partial writes are not attempted.\n\n @param[in] aStreamId A numeric identifier for the stream to write to.\n If set to '0', will default to the debug stream.\n @param[in] aDataPtr A pointer to the data to send on the stream.\n If aDataLen is non-zero, this param MUST NOT be NULL.\n @param[in] aDataLen The number of bytes of data from aDataPtr to send.\n\n @retval OT_ERROR_NONE The data was queued for delivery to the host.\n @retval OT_ERROR_BUSY There are not enough resources to complete this\n request. This is usually a temporary condition.\n @retval OT_ERROR_INVALID_ARGS The given aStreamId was invalid."]
13391 pub fn otNcpStreamWrite(
13392 aStreamId: ::std::os::raw::c_int,
13393 aDataPtr: *const u8,
13394 aDataLen: ::std::os::raw::c_int,
13395 ) -> otError;
13396}
13397unsafe extern "C" {
13398 #[doc = " Writes OpenThread Log using `otNcpStreamWrite`.\n\n @param[in] aLogLevel The log level.\n @param[in] aLogRegion The log region.\n @param[in] aFormat A pointer to the format string.\n @param[in] aArgs va_list matching aFormat."]
13399 pub fn otNcpPlatLogv(
13400 aLogLevel: otLogLevel,
13401 aLogRegion: otLogRegion,
13402 aFormat: *const ::std::os::raw::c_char,
13403 aArgs: *mut __va_list_tag,
13404 );
13405}
13406#[doc = " Defines delegate (function pointer) type to control behavior of peek/poke operation.\n\n This delegate function is called to decide whether to allow peek or poke of a specific memory region. It is used\n if NCP support for peek/poke commands is enabled.\n\n @param[in] aAddress Start address of memory region.\n @param[in] aCount Number of bytes to peek or poke.\n\n @returns TRUE to allow peek/poke of the given memory region, FALSE otherwise."]
13407pub type otNcpDelegateAllowPeekPoke =
13408 ::std::option::Option<unsafe extern "C" fn(aAddress: u32, aCount: u16) -> bool>;
13409unsafe extern "C" {
13410 #[doc = " Registers peek/poke delegate functions with NCP module.\n\n The delegate functions are called by NCP module to decide whether to allow peek or poke of a specific memory region.\n If the delegate pointer is set to NULL, it allows peek/poke operation for any address.\n\n @param[in] aAllowPeekDelegate Delegate function pointer for peek operation.\n @param[in] aAllowPokeDelegate Delegate function pointer for poke operation."]
13411 pub fn otNcpRegisterPeekPokeDelegates(
13412 aAllowPeekDelegate: otNcpDelegateAllowPeekPoke,
13413 aAllowPokeDelegate: otNcpDelegateAllowPeekPoke,
13414 );
13415}
13416pub type otNetworkDiagIterator = u16;
13417#[doc = " Represents a Network Diagnostics IPv6 Address List TLV value."]
13418#[repr(C)]
13419#[derive(Copy, Clone)]
13420pub struct otNetworkDiagIp6AddrList {
13421 #[doc = "< Number of IPv6 addresses."]
13422 pub mCount: u8,
13423 #[doc = "< Array of IPv6 addresses."]
13424 pub mList: [otIp6Address; 15usize],
13425}
13426impl Default for otNetworkDiagIp6AddrList {
13427 fn default() -> Self {
13428 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13429 unsafe {
13430 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13431 s.assume_init()
13432 }
13433 }
13434}
13435#[doc = " Represents a Network Diagnostic TLV Data."]
13436#[repr(C)]
13437#[derive(Debug, Copy, Clone)]
13438pub struct otNetworkDiagData {
13439 #[doc = "< Number of bytes in the data."]
13440 pub mCount: u8,
13441 #[doc = "< Array containing the data bytes."]
13442 pub m8: [u8; 254usize],
13443}
13444impl Default for otNetworkDiagData {
13445 fn default() -> Self {
13446 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13447 unsafe {
13448 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13449 s.assume_init()
13450 }
13451 }
13452}
13453#[doc = " Represents a Network Diagnostic Connectivity value."]
13454#[repr(C)]
13455#[derive(Debug, Default, Copy, Clone)]
13456pub struct otNetworkDiagConnectivity {
13457 #[doc = "< The priority of the sender as a parent."]
13458 pub mParentPriority: i8,
13459 #[doc = "< Number of neighbors with link of quality 3."]
13460 pub mLinkQuality3: u8,
13461 #[doc = "< Number of neighbors with link of quality 2."]
13462 pub mLinkQuality2: u8,
13463 #[doc = "< Number of neighbors with link of quality 1."]
13464 pub mLinkQuality1: u8,
13465 #[doc = "< Cost to the Leader."]
13466 pub mLeaderCost: u8,
13467 #[doc = "< Most recent received ID seq number."]
13468 pub mIdSequence: u8,
13469 #[doc = "< Number of active routers."]
13470 pub mActiveRouters: u8,
13471 #[doc = "< Buffer capacity in bytes for SEDs. Optional."]
13472 pub mSedBufferSize: u16,
13473 #[doc = "< Queue capacity (number of IPv6 datagrams) per SED. Optional."]
13474 pub mSedDatagramCount: u8,
13475}
13476#[doc = " Represents a Network Diagnostic Route data."]
13477#[repr(C)]
13478#[derive(Debug, Default, Copy, Clone)]
13479pub struct otNetworkDiagRouteData {
13480 #[doc = "< The Assigned Router ID."]
13481 pub mRouterId: u8,
13482 pub _bitfield_align_1: [u8; 0],
13483 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13484}
13485impl otNetworkDiagRouteData {
13486 #[inline]
13487 pub fn mLinkQualityOut(&self) -> u8 {
13488 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
13489 }
13490 #[inline]
13491 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13492 unsafe {
13493 let val: u8 = ::std::mem::transmute(val);
13494 self._bitfield_1.set(0usize, 2u8, val as u64)
13495 }
13496 }
13497 #[inline]
13498 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13499 unsafe {
13500 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13501 ::std::ptr::addr_of!((*this)._bitfield_1),
13502 0usize,
13503 2u8,
13504 ) as u8)
13505 }
13506 }
13507 #[inline]
13508 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13509 unsafe {
13510 let val: u8 = ::std::mem::transmute(val);
13511 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13512 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13513 0usize,
13514 2u8,
13515 val as u64,
13516 )
13517 }
13518 }
13519 #[inline]
13520 pub fn mLinkQualityIn(&self) -> u8 {
13521 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13522 }
13523 #[inline]
13524 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13525 unsafe {
13526 let val: u8 = ::std::mem::transmute(val);
13527 self._bitfield_1.set(2usize, 2u8, val as u64)
13528 }
13529 }
13530 #[inline]
13531 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13532 unsafe {
13533 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13534 ::std::ptr::addr_of!((*this)._bitfield_1),
13535 2usize,
13536 2u8,
13537 ) as u8)
13538 }
13539 }
13540 #[inline]
13541 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13542 unsafe {
13543 let val: u8 = ::std::mem::transmute(val);
13544 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13545 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13546 2usize,
13547 2u8,
13548 val as u64,
13549 )
13550 }
13551 }
13552 #[inline]
13553 pub fn mRouteCost(&self) -> u8 {
13554 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) }
13555 }
13556 #[inline]
13557 pub fn set_mRouteCost(&mut self, val: u8) {
13558 unsafe {
13559 let val: u8 = ::std::mem::transmute(val);
13560 self._bitfield_1.set(4usize, 4u8, val as u64)
13561 }
13562 }
13563 #[inline]
13564 pub unsafe fn mRouteCost_raw(this: *const Self) -> u8 {
13565 unsafe {
13566 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13567 ::std::ptr::addr_of!((*this)._bitfield_1),
13568 4usize,
13569 4u8,
13570 ) as u8)
13571 }
13572 }
13573 #[inline]
13574 pub unsafe fn set_mRouteCost_raw(this: *mut Self, val: u8) {
13575 unsafe {
13576 let val: u8 = ::std::mem::transmute(val);
13577 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13578 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13579 4usize,
13580 4u8,
13581 val as u64,
13582 )
13583 }
13584 }
13585 #[inline]
13586 pub fn new_bitfield_1(
13587 mLinkQualityOut: u8,
13588 mLinkQualityIn: u8,
13589 mRouteCost: u8,
13590 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13591 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13592 __bindgen_bitfield_unit.set(0usize, 2u8, {
13593 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13594 mLinkQualityOut as u64
13595 });
13596 __bindgen_bitfield_unit.set(2usize, 2u8, {
13597 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13598 mLinkQualityIn as u64
13599 });
13600 __bindgen_bitfield_unit.set(4usize, 4u8, {
13601 let mRouteCost: u8 = unsafe { ::std::mem::transmute(mRouteCost) };
13602 mRouteCost as u64
13603 });
13604 __bindgen_bitfield_unit
13605 }
13606}
13607#[doc = " Represents a Network Diagnostic Route64 TLV value."]
13608#[repr(C)]
13609#[derive(Debug, Copy, Clone)]
13610pub struct otNetworkDiagRoute {
13611 #[doc = "< Sequence number for Router ID assignments."]
13612 pub mIdSequence: u8,
13613 #[doc = "< Number of routes."]
13614 pub mRouteCount: u8,
13615 #[doc = "< Link Quality and Routing Cost data."]
13616 pub mRouteData: [otNetworkDiagRouteData; 63usize],
13617}
13618impl Default for otNetworkDiagRoute {
13619 fn default() -> Self {
13620 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13621 unsafe {
13622 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13623 s.assume_init()
13624 }
13625 }
13626}
13627#[doc = " Represents a Network Diagnostic Enhanced Route data."]
13628#[repr(C)]
13629#[derive(Debug, Default, Copy, Clone)]
13630pub struct otNetworkDiagEnhRouteData {
13631 #[doc = "< The Router ID."]
13632 pub mRouterId: u8,
13633 pub _bitfield_align_1: [u8; 0],
13634 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13635 #[doc = " The next hop Router ID tracked towards this router.\n\n This field indicates the next hop router towards `mRouterId` when using multi-hop forwarding.\n\n If the device has no direct link with the router (`mHasLink == false`), this field indicates the next hop router\n that would be used to forward messages destined to `mRouterId`.\n\n If the device has a direct link with the router (`mHasLink == true`), this field indicates the alternate\n multi-hop path that may be used. Note that whether the direct link or this alternate path through the next hop\n is used to forward messages depends on their associated total path costs.\n\n If there is no next hop, then `OT_NETWORK_MAX_ROUTER_ID + 1` is used."]
13636 pub mNextHop: u8,
13637 #[doc = " The route cost associated with forwarding to `mRouterId` using `mNextHop` (when valid).\n\n This is the route cost `mNextHop` has claimed to have towards `mRouterId`. Importantly, it does not include the\n link cost to send to `mNextHop` itself."]
13638 pub mNextHopCost: u8,
13639}
13640impl otNetworkDiagEnhRouteData {
13641 #[inline]
13642 pub fn mIsSelf(&self) -> bool {
13643 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13644 }
13645 #[inline]
13646 pub fn set_mIsSelf(&mut self, val: bool) {
13647 unsafe {
13648 let val: u8 = ::std::mem::transmute(val);
13649 self._bitfield_1.set(0usize, 1u8, val as u64)
13650 }
13651 }
13652 #[inline]
13653 pub unsafe fn mIsSelf_raw(this: *const Self) -> bool {
13654 unsafe {
13655 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13656 ::std::ptr::addr_of!((*this)._bitfield_1),
13657 0usize,
13658 1u8,
13659 ) as u8)
13660 }
13661 }
13662 #[inline]
13663 pub unsafe fn set_mIsSelf_raw(this: *mut Self, val: bool) {
13664 unsafe {
13665 let val: u8 = ::std::mem::transmute(val);
13666 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13667 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13668 0usize,
13669 1u8,
13670 val as u64,
13671 )
13672 }
13673 }
13674 #[inline]
13675 pub fn mHasLink(&self) -> bool {
13676 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13677 }
13678 #[inline]
13679 pub fn set_mHasLink(&mut self, val: bool) {
13680 unsafe {
13681 let val: u8 = ::std::mem::transmute(val);
13682 self._bitfield_1.set(1usize, 1u8, val as u64)
13683 }
13684 }
13685 #[inline]
13686 pub unsafe fn mHasLink_raw(this: *const Self) -> bool {
13687 unsafe {
13688 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13689 ::std::ptr::addr_of!((*this)._bitfield_1),
13690 1usize,
13691 1u8,
13692 ) as u8)
13693 }
13694 }
13695 #[inline]
13696 pub unsafe fn set_mHasLink_raw(this: *mut Self, val: bool) {
13697 unsafe {
13698 let val: u8 = ::std::mem::transmute(val);
13699 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13700 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13701 1usize,
13702 1u8,
13703 val as u64,
13704 )
13705 }
13706 }
13707 #[inline]
13708 pub fn mLinkQualityOut(&self) -> u8 {
13709 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13710 }
13711 #[inline]
13712 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13713 unsafe {
13714 let val: u8 = ::std::mem::transmute(val);
13715 self._bitfield_1.set(2usize, 2u8, val as u64)
13716 }
13717 }
13718 #[inline]
13719 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13720 unsafe {
13721 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13722 ::std::ptr::addr_of!((*this)._bitfield_1),
13723 2usize,
13724 2u8,
13725 ) as u8)
13726 }
13727 }
13728 #[inline]
13729 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13730 unsafe {
13731 let val: u8 = ::std::mem::transmute(val);
13732 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13733 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13734 2usize,
13735 2u8,
13736 val as u64,
13737 )
13738 }
13739 }
13740 #[inline]
13741 pub fn mLinkQualityIn(&self) -> u8 {
13742 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
13743 }
13744 #[inline]
13745 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13746 unsafe {
13747 let val: u8 = ::std::mem::transmute(val);
13748 self._bitfield_1.set(4usize, 2u8, val as u64)
13749 }
13750 }
13751 #[inline]
13752 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13753 unsafe {
13754 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13755 ::std::ptr::addr_of!((*this)._bitfield_1),
13756 4usize,
13757 2u8,
13758 ) as u8)
13759 }
13760 }
13761 #[inline]
13762 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13763 unsafe {
13764 let val: u8 = ::std::mem::transmute(val);
13765 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13766 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13767 4usize,
13768 2u8,
13769 val as u64,
13770 )
13771 }
13772 }
13773 #[inline]
13774 pub fn new_bitfield_1(
13775 mIsSelf: bool,
13776 mHasLink: bool,
13777 mLinkQualityOut: u8,
13778 mLinkQualityIn: u8,
13779 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13780 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13781 __bindgen_bitfield_unit.set(0usize, 1u8, {
13782 let mIsSelf: u8 = unsafe { ::std::mem::transmute(mIsSelf) };
13783 mIsSelf as u64
13784 });
13785 __bindgen_bitfield_unit.set(1usize, 1u8, {
13786 let mHasLink: u8 = unsafe { ::std::mem::transmute(mHasLink) };
13787 mHasLink as u64
13788 });
13789 __bindgen_bitfield_unit.set(2usize, 2u8, {
13790 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13791 mLinkQualityOut as u64
13792 });
13793 __bindgen_bitfield_unit.set(4usize, 2u8, {
13794 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13795 mLinkQualityIn as u64
13796 });
13797 __bindgen_bitfield_unit
13798 }
13799}
13800#[doc = " Represents a Network Diagnostic Enhanced Route TLV value."]
13801#[repr(C)]
13802#[derive(Debug, Copy, Clone)]
13803pub struct otNetworkDiagEnhRoute {
13804 #[doc = "< Number of `mRouteData` entries."]
13805 pub mRouteCount: u8,
13806 #[doc = "< Route Data per router."]
13807 pub mRouteData: [otNetworkDiagEnhRouteData; 63usize],
13808}
13809impl Default for otNetworkDiagEnhRoute {
13810 fn default() -> Self {
13811 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13812 unsafe {
13813 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13814 s.assume_init()
13815 }
13816 }
13817}
13818#[doc = " Represents a Network Diagnostic Mac Counters value.\n\n See <a href=\"https://www.ietf.org/rfc/rfc2863\">RFC 2863</a> for definitions of member fields."]
13819#[repr(C)]
13820#[derive(Debug, Default, Copy, Clone)]
13821pub struct otNetworkDiagMacCounters {
13822 pub mIfInUnknownProtos: u32,
13823 pub mIfInErrors: u32,
13824 pub mIfOutErrors: u32,
13825 pub mIfInUcastPkts: u32,
13826 pub mIfInBroadcastPkts: u32,
13827 pub mIfInDiscards: u32,
13828 pub mIfOutUcastPkts: u32,
13829 pub mIfOutBroadcastPkts: u32,
13830 pub mIfOutDiscards: u32,
13831}
13832#[doc = " Represents a Network Diagnostics MLE Counters value."]
13833#[repr(C)]
13834#[derive(Debug, Default, Copy, Clone)]
13835pub struct otNetworkDiagMleCounters {
13836 #[doc = "< Number of times device entered disabled role."]
13837 pub mDisabledRole: u16,
13838 #[doc = "< Number of times device entered detached role."]
13839 pub mDetachedRole: u16,
13840 #[doc = "< Number of times device entered child role."]
13841 pub mChildRole: u16,
13842 #[doc = "< Number of times device entered router role."]
13843 pub mRouterRole: u16,
13844 #[doc = "< Number of times device entered leader role."]
13845 pub mLeaderRole: u16,
13846 #[doc = "< Number of attach attempts while device was detached."]
13847 pub mAttachAttempts: u16,
13848 #[doc = "< Number of changes to partition ID."]
13849 pub mPartitionIdChanges: u16,
13850 #[doc = "< Number of attempts to attach to a better partition."]
13851 pub mBetterPartitionAttachAttempts: u16,
13852 #[doc = "< Number of time device changed its parent."]
13853 pub mParentChanges: u16,
13854 #[doc = "< Milliseconds tracked by next counters (zero if not supported)."]
13855 pub mTrackedTime: u64,
13856 #[doc = "< Milliseconds device has been in disabled role."]
13857 pub mDisabledTime: u64,
13858 #[doc = "< Milliseconds device has been in detached role."]
13859 pub mDetachedTime: u64,
13860 #[doc = "< Milliseconds device has been in child role."]
13861 pub mChildTime: u64,
13862 #[doc = "< Milliseconds device has been in router role."]
13863 pub mRouterTime: u64,
13864 #[doc = "< Milliseconds device has been in leader role."]
13865 pub mLeaderTime: u64,
13866}
13867#[doc = " Represents a Network Diagnostic Child Table Entry."]
13868#[repr(C)]
13869#[derive(Debug, Default, Copy, Clone)]
13870pub struct otNetworkDiagChildEntry {
13871 pub _bitfield_align_1: [u16; 0],
13872 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
13873 #[doc = "< Link mode."]
13874 pub mMode: otLinkModeConfig,
13875}
13876impl otNetworkDiagChildEntry {
13877 #[inline]
13878 pub fn mTimeout(&self) -> u16 {
13879 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 5u8) as u16) }
13880 }
13881 #[inline]
13882 pub fn set_mTimeout(&mut self, val: u16) {
13883 unsafe {
13884 let val: u16 = ::std::mem::transmute(val);
13885 self._bitfield_1.set(0usize, 5u8, val as u64)
13886 }
13887 }
13888 #[inline]
13889 pub unsafe fn mTimeout_raw(this: *const Self) -> u16 {
13890 unsafe {
13891 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13892 ::std::ptr::addr_of!((*this)._bitfield_1),
13893 0usize,
13894 5u8,
13895 ) as u16)
13896 }
13897 }
13898 #[inline]
13899 pub unsafe fn set_mTimeout_raw(this: *mut Self, val: u16) {
13900 unsafe {
13901 let val: u16 = ::std::mem::transmute(val);
13902 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13903 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13904 0usize,
13905 5u8,
13906 val as u64,
13907 )
13908 }
13909 }
13910 #[inline]
13911 pub fn mLinkQuality(&self) -> u8 {
13912 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u8) }
13913 }
13914 #[inline]
13915 pub fn set_mLinkQuality(&mut self, val: u8) {
13916 unsafe {
13917 let val: u8 = ::std::mem::transmute(val);
13918 self._bitfield_1.set(5usize, 2u8, val as u64)
13919 }
13920 }
13921 #[inline]
13922 pub unsafe fn mLinkQuality_raw(this: *const Self) -> u8 {
13923 unsafe {
13924 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13925 ::std::ptr::addr_of!((*this)._bitfield_1),
13926 5usize,
13927 2u8,
13928 ) as u8)
13929 }
13930 }
13931 #[inline]
13932 pub unsafe fn set_mLinkQuality_raw(this: *mut Self, val: u8) {
13933 unsafe {
13934 let val: u8 = ::std::mem::transmute(val);
13935 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13936 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13937 5usize,
13938 2u8,
13939 val as u64,
13940 )
13941 }
13942 }
13943 #[inline]
13944 pub fn mChildId(&self) -> u16 {
13945 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u16) }
13946 }
13947 #[inline]
13948 pub fn set_mChildId(&mut self, val: u16) {
13949 unsafe {
13950 let val: u16 = ::std::mem::transmute(val);
13951 self._bitfield_1.set(7usize, 9u8, val as u64)
13952 }
13953 }
13954 #[inline]
13955 pub unsafe fn mChildId_raw(this: *const Self) -> u16 {
13956 unsafe {
13957 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13958 ::std::ptr::addr_of!((*this)._bitfield_1),
13959 7usize,
13960 9u8,
13961 ) as u16)
13962 }
13963 }
13964 #[inline]
13965 pub unsafe fn set_mChildId_raw(this: *mut Self, val: u16) {
13966 unsafe {
13967 let val: u16 = ::std::mem::transmute(val);
13968 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13969 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13970 7usize,
13971 9u8,
13972 val as u64,
13973 )
13974 }
13975 }
13976 #[inline]
13977 pub fn new_bitfield_1(
13978 mTimeout: u16,
13979 mLinkQuality: u8,
13980 mChildId: u16,
13981 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
13982 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
13983 __bindgen_bitfield_unit.set(0usize, 5u8, {
13984 let mTimeout: u16 = unsafe { ::std::mem::transmute(mTimeout) };
13985 mTimeout as u64
13986 });
13987 __bindgen_bitfield_unit.set(5usize, 2u8, {
13988 let mLinkQuality: u8 = unsafe { ::std::mem::transmute(mLinkQuality) };
13989 mLinkQuality as u64
13990 });
13991 __bindgen_bitfield_unit.set(7usize, 9u8, {
13992 let mChildId: u16 = unsafe { ::std::mem::transmute(mChildId) };
13993 mChildId as u64
13994 });
13995 __bindgen_bitfield_unit
13996 }
13997}
13998#[doc = " Represents a Network Diagnostic Child Table TLV value."]
13999#[repr(C)]
14000#[derive(Debug, Copy, Clone)]
14001pub struct otNetworkDiagChildTable {
14002 #[doc = "< Number of child entries in the table."]
14003 pub mCount: u8,
14004 #[doc = "< Child table."]
14005 pub mTable: [otNetworkDiagChildEntry; 63usize],
14006}
14007impl Default for otNetworkDiagChildTable {
14008 fn default() -> Self {
14009 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14010 unsafe {
14011 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14012 s.assume_init()
14013 }
14014 }
14015}
14016#[doc = " Represents a Border Router State TLV value."]
14017pub use self::otBorderRoutingState as otNetworkDiagBrState;
14018#[doc = " Represents a Network Diagnostic TLV."]
14019#[repr(C)]
14020#[derive(Copy, Clone)]
14021pub struct otNetworkDiagTlv {
14022 #[doc = "< The Network Diagnostic TLV type."]
14023 pub mType: u8,
14024 pub mData: otNetworkDiagTlv__bindgen_ty_1,
14025}
14026#[repr(C)]
14027#[derive(Copy, Clone)]
14028pub union otNetworkDiagTlv__bindgen_ty_1 {
14029 pub mExtAddress: otExtAddress,
14030 pub mEui64: otExtAddress,
14031 pub mAddr16: u16,
14032 pub mMode: otLinkModeConfig,
14033 pub mTimeout: u32,
14034 pub mConnectivity: otNetworkDiagConnectivity,
14035 pub mRoute: otNetworkDiagRoute,
14036 pub mEnhRoute: otNetworkDiagEnhRoute,
14037 pub mLeaderData: otLeaderData,
14038 pub mNetworkData: otNetworkDiagData,
14039 pub mIp6AddrList: otNetworkDiagIp6AddrList,
14040 pub mMacCounters: otNetworkDiagMacCounters,
14041 pub mMleCounters: otNetworkDiagMleCounters,
14042 pub mBatteryLevel: u8,
14043 pub mSupplyVoltage: u16,
14044 pub mMaxChildTimeout: u32,
14045 pub mVersion: u16,
14046 pub mVendorName: [::std::os::raw::c_char; 33usize],
14047 pub mVendorModel: [::std::os::raw::c_char; 33usize],
14048 pub mVendorSwVersion: [::std::os::raw::c_char; 17usize],
14049 pub mThreadStackVersion: [::std::os::raw::c_char; 65usize],
14050 pub mVendorAppUrl: [::std::os::raw::c_char; 97usize],
14051 pub mNonPreferredChannels: otChannelMask,
14052 pub mChannelPages: otNetworkDiagData,
14053 pub mChildTable: otNetworkDiagChildTable,
14054 pub mBrState: otNetworkDiagBrState,
14055 pub mBrIfAddrList: otNetworkDiagIp6AddrList,
14056 pub mBrPrefix: otIp6NetworkPrefix,
14057}
14058impl Default for otNetworkDiagTlv__bindgen_ty_1 {
14059 fn default() -> Self {
14060 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14061 unsafe {
14062 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14063 s.assume_init()
14064 }
14065 }
14066}
14067impl Default for otNetworkDiagTlv {
14068 fn default() -> Self {
14069 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14070 unsafe {
14071 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14072 s.assume_init()
14073 }
14074 }
14075}
14076unsafe extern "C" {
14077 #[doc = " Gets the next Network Diagnostic TLV in the message.\n\n Requires `OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE`.\n\n @param[in] aMessage A pointer to a message.\n @param[in,out] aIterator A pointer to the Network Diagnostic iterator context. To get the first\n Network Diagnostic TLV it should be set to OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT.\n @param[out] aNetworkDiagTlv A pointer to where the Network Diagnostic TLV information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next Network Diagnostic TLV.\n @retval OT_ERROR_NOT_FOUND No subsequent Network Diagnostic TLV exists in the message.\n @retval OT_ERROR_PARSE Parsing the next Network Diagnostic failed.\n\n @Note A subsequent call to this function is allowed only when current return value is OT_ERROR_NONE."]
14078 pub fn otThreadGetNextDiagnosticTlv(
14079 aMessage: *const otMessage,
14080 aIterator: *mut otNetworkDiagIterator,
14081 aNetworkDiagTlv: *mut otNetworkDiagTlv,
14082 ) -> otError;
14083}
14084#[doc = " Pointer is called when Network Diagnostic Get response is received.\n\n @param[in] aError The error when failed to get the response.\n @param[in] aMessage A pointer to the message buffer containing the received Network Diagnostic\n Get response payload. Available only when @p aError is `OT_ERROR_NONE`.\n @param[in] aMessageInfo A pointer to the message info for @p aMessage. Available only when\n @p aError is `OT_ERROR_NONE`.\n @param[in] aContext A pointer to application-specific context."]
14085pub type otReceiveDiagnosticGetCallback = ::std::option::Option<
14086 unsafe extern "C" fn(
14087 aError: otError,
14088 aMessage: *mut otMessage,
14089 aMessageInfo: *const otMessageInfo,
14090 aContext: *mut ::std::os::raw::c_void,
14091 ),
14092>;
14093unsafe extern "C" {
14094 #[doc = " Send a Network Diagnostic Get request.\n\n Requires `OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to destination address.\n @param[in] aTlvTypes An array of Network Diagnostic TLV types.\n @param[in] aCount Number of types in aTlvTypes.\n @param[in] aCallback A pointer to a function that is called when Network Diagnostic Get response\n is received or NULL to disable the callback.\n @param[in] aCallbackContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully queued the DIAG_GET.req.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available to send DIAG_GET.req."]
14095 pub fn otThreadSendDiagnosticGet(
14096 aInstance: *mut otInstance,
14097 aDestination: *const otIp6Address,
14098 aTlvTypes: *const u8,
14099 aCount: u8,
14100 aCallback: otReceiveDiagnosticGetCallback,
14101 aCallbackContext: *mut ::std::os::raw::c_void,
14102 ) -> otError;
14103}
14104unsafe extern "C" {
14105 #[doc = " Send a Network Diagnostic Reset request.\n\n Requires `OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestination A pointer to destination address.\n @param[in] aTlvTypes An array of Network Diagnostic TLV types. Currently only Type 9 is allowed.\n @param[in] aCount Number of types in aTlvTypes\n\n @retval OT_ERROR_NONE Successfully queued the DIAG_RST.ntf.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available to send DIAG_RST.ntf."]
14106 pub fn otThreadSendDiagnosticReset(
14107 aInstance: *mut otInstance,
14108 aDestination: *const otIp6Address,
14109 aTlvTypes: *const u8,
14110 aCount: u8,
14111 ) -> otError;
14112}
14113unsafe extern "C" {
14114 #[doc = " Get the vendor name string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor name string."]
14115 pub fn otThreadGetVendorName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14116}
14117unsafe extern "C" {
14118 #[doc = " Get the vendor model string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor model string."]
14119 pub fn otThreadGetVendorModel(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14120}
14121unsafe extern "C" {
14122 #[doc = " Get the vendor software version string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor software version string."]
14123 pub fn otThreadGetVendorSwVersion(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14124}
14125unsafe extern "C" {
14126 #[doc = " Get the vendor app URL string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor app URL string."]
14127 pub fn otThreadGetVendorAppUrl(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14128}
14129unsafe extern "C" {
14130 #[doc = " Set the vendor name string.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @p aVendorName should be UTF8 with max length of 32 chars (`MAX_VENDOR_NAME_TLV_LENGTH`). Maximum length does not\n include the null `\\0` character.\n\n If `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled, @p aVendorName must start with the \"RD:\" prefix.\n This is enforced to ensure reference devices are identifiable. If @p aVendorName does not follow this pattern,\n the name is rejected, and `OT_ERROR_INVALID_ARGS` is returned.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVendorName The vendor name string.\n\n @retval OT_ERROR_NONE Successfully set the vendor name.\n @retval OT_ERROR_INVALID_ARGS @p aVendorName is not valid. It is too long, is not UTF-8, or does not start with\n the \"RD:\" prefix when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled."]
14131 pub fn otThreadSetVendorName(
14132 aInstance: *mut otInstance,
14133 aVendorName: *const ::std::os::raw::c_char,
14134 ) -> otError;
14135}
14136unsafe extern "C" {
14137 #[doc = " Set the vendor model string.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @p aVendorModel should be UTF8 with max length of 32 chars (`MAX_VENDOR_MODEL_TLV_LENGTH`). Maximum length does not\n include the null `\\0` character.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVendorModel The vendor model string.\n\n @retval OT_ERROR_NONE Successfully set the vendor model.\n @retval OT_ERROR_INVALID_ARGS @p aVendorModel is not valid (too long or not UTF8)."]
14138 pub fn otThreadSetVendorModel(
14139 aInstance: *mut otInstance,
14140 aVendorModel: *const ::std::os::raw::c_char,
14141 ) -> otError;
14142}
14143unsafe extern "C" {
14144 #[doc = " Set the vendor software version string.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @p aVendorSwVersion should be UTF8 with max length of 16 chars(`MAX_VENDOR_SW_VERSION_TLV_LENGTH`). Maximum length\n does not include the null `\\0` character.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVendorSwVersion The vendor software version string.\n\n @retval OT_ERROR_NONE Successfully set the vendor software version.\n @retval OT_ERROR_INVALID_ARGS @p aVendorSwVersion is not valid (too long or not UTF8)."]
14145 pub fn otThreadSetVendorSwVersion(
14146 aInstance: *mut otInstance,
14147 aVendorSwVersion: *const ::std::os::raw::c_char,
14148 ) -> otError;
14149}
14150unsafe extern "C" {
14151 #[doc = " Set the vendor app URL string.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @p aVendorAppUrl should be UTF8 with max length of 64 chars (`MAX_VENDOR_APPL_URL_TLV_LENGTH`). Maximum length\n does not include the null `\\0` character.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVendorAppUrl The vendor app URL string.\n\n @retval OT_ERROR_NONE Successfully set the vendor app URL string.\n @retval OT_ERROR_INVALID_ARGS @p aVendorAppUrl is not valid (too long or not UTF8)."]
14152 pub fn otThreadSetVendorAppUrl(
14153 aInstance: *mut otInstance,
14154 aVendorAppUrl: *const ::std::os::raw::c_char,
14155 ) -> otError;
14156}
14157#[doc = " Callback function pointer to notify when a Network Diagnostic Reset request message is received for the\n `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.\n\n This is used to inform the device to reevaluate the channels that are presently included in the non-preferred\n channels list and update it if needed based on the reevaluation.\n\n @param[in] aContext A pointer to application-specific context."]
14158pub type otThreadNonPreferredChannelsResetCallback =
14159 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14160unsafe extern "C" {
14161 #[doc = " Sets the non-preferred channels value for `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.\n\n This value is used to respond to a Network Diagnostic Get request for this TLV.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask specifying the non-preferred channels."]
14162 pub fn otThreadSetNonPreferredChannels(aInstance: *mut otInstance, aChannelMask: otChannelMask);
14163}
14164unsafe extern "C" {
14165 #[doc = " Gets the non-preferred channels for `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.\n\n @returns The non-preferred channels as a channel mask."]
14166 pub fn otThreadGetNonPreferredChannels(aInstance: *mut otInstance) -> otChannelMask;
14167}
14168unsafe extern "C" {
14169 #[doc = " Sets the callback to notify when a Network Diagnostic Reset request message is received for the\n `OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS` TLV.\n\n A subsequent call to this function will replace the previously set callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback The callback function pointer. Can be NULL.\n @param[in] aContext A pointer to application-specific context used with @p aCallback."]
14170 pub fn otThreadSetNonPreferredChannelsResetCallback(
14171 aInstance: *mut otInstance,
14172 aCallback: otThreadNonPreferredChannelsResetCallback,
14173 aContext: *mut ::std::os::raw::c_void,
14174 );
14175}
14176#[doc = "< The device hasn't attached to a network."]
14177pub const OT_NETWORK_TIME_UNSYNCHRONIZED: otNetworkTimeStatus = -1;
14178#[doc = "< The device hasn’t received time sync for more than two periods time."]
14179pub const OT_NETWORK_TIME_RESYNC_NEEDED: otNetworkTimeStatus = 0;
14180#[doc = "< The device network time is synchronized."]
14181pub const OT_NETWORK_TIME_SYNCHRONIZED: otNetworkTimeStatus = 1;
14182#[doc = " Represents OpenThread time synchronization status."]
14183pub type otNetworkTimeStatus = ::std::os::raw::c_int;
14184#[doc = " Pointer is called when a network time sync or status change occurs."]
14185pub type otNetworkTimeSyncCallbackFn =
14186 ::std::option::Option<unsafe extern "C" fn(aCallbackContext: *mut ::std::os::raw::c_void)>;
14187unsafe extern "C" {
14188 #[doc = " Get the Thread network time.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in,out] aNetworkTime The Thread network time in microseconds.\n\n @returns The time synchronization status."]
14189 pub fn otNetworkTimeGet(
14190 aInstance: *mut otInstance,
14191 aNetworkTime: *mut u64,
14192 ) -> otNetworkTimeStatus;
14193}
14194unsafe extern "C" {
14195 #[doc = " Set the time synchronization period.\n\n Can only be called while Thread protocols are disabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTimeSyncPeriod The time synchronization period, in seconds.\n\n @retval OT_ERROR_NONE Successfully set the time sync period.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
14196 pub fn otNetworkTimeSetSyncPeriod(aInstance: *mut otInstance, aTimeSyncPeriod: u16) -> otError;
14197}
14198unsafe extern "C" {
14199 #[doc = " Get the time synchronization period.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The time synchronization period."]
14200 pub fn otNetworkTimeGetSyncPeriod(aInstance: *mut otInstance) -> u16;
14201}
14202unsafe extern "C" {
14203 #[doc = " Set the time synchronization XTAL accuracy threshold for Router-Capable device.\n\n Can only be called while Thread protocols are disabled.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aXTALThreshold The XTAL accuracy threshold for Router, in PPM.\n\n @retval OT_ERROR_NONE Successfully set the time sync period.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled."]
14204 pub fn otNetworkTimeSetXtalThreshold(
14205 aInstance: *mut otInstance,
14206 aXTALThreshold: u16,
14207 ) -> otError;
14208}
14209unsafe extern "C" {
14210 #[doc = " Get the time synchronization XTAL accuracy threshold for Router.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The XTAL accuracy threshold for Router, in PPM."]
14211 pub fn otNetworkTimeGetXtalThreshold(aInstance: *mut otInstance) -> u16;
14212}
14213unsafe extern "C" {
14214 #[doc = " Set a callback to be called when a network time sync or status change occurs\n\n This callback shall be called only when the network time offset jumps by\n OPENTHREAD_CONFIG_TIME_SYNC_JUMP_NOTIF_MIN_US or when the status changes.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCallbackFn The callback function to be called\n @param[in] aCallbackContext The context to be passed to the callback function upon invocation"]
14215 pub fn otNetworkTimeSyncSetCallback(
14216 aInstance: *mut otInstance,
14217 aCallbackFn: otNetworkTimeSyncCallbackFn,
14218 aCallbackContext: *mut ::std::os::raw::c_void,
14219 );
14220}
14221#[doc = " Represents a ping reply."]
14222#[repr(C)]
14223#[derive(Copy, Clone)]
14224pub struct otPingSenderReply {
14225 #[doc = "< Sender IPv6 address (address from which ping reply was received)."]
14226 pub mSenderAddress: otIp6Address,
14227 #[doc = "< Round trip time in msec."]
14228 pub mRoundTripTime: u16,
14229 #[doc = "< Data size (number of bytes) in reply (excluding IPv6 and ICMP6 headers)."]
14230 pub mSize: u16,
14231 #[doc = "< Sequence number."]
14232 pub mSequenceNumber: u16,
14233 #[doc = "< Hop limit."]
14234 pub mHopLimit: u8,
14235}
14236impl Default for otPingSenderReply {
14237 fn default() -> Self {
14238 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14239 unsafe {
14240 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14241 s.assume_init()
14242 }
14243 }
14244}
14245#[doc = " Represents statistics of a ping request."]
14246#[repr(C)]
14247#[derive(Debug, Default, Copy, Clone)]
14248pub struct otPingSenderStatistics {
14249 #[doc = "< The number of ping requests already sent."]
14250 pub mSentCount: u16,
14251 #[doc = "< The number of ping replies received."]
14252 pub mReceivedCount: u16,
14253 #[doc = "< The total round trip time of ping requests."]
14254 pub mTotalRoundTripTime: u32,
14255 #[doc = "< The min round trip time among ping requests."]
14256 pub mMinRoundTripTime: u16,
14257 #[doc = "< The max round trip time among ping requests."]
14258 pub mMaxRoundTripTime: u16,
14259 #[doc = "< Whether this is a multicast ping request."]
14260 pub mIsMulticast: bool,
14261}
14262#[doc = " Pointer type specifies the callback to notify receipt of a ping reply.\n\n @param[in] aReply A pointer to a `otPingSenderReply` containing info about the received ping reply.\n @param[in] aContext A pointer to application-specific context."]
14263pub type otPingSenderReplyCallback = ::std::option::Option<
14264 unsafe extern "C" fn(aReply: *const otPingSenderReply, aContext: *mut ::std::os::raw::c_void),
14265>;
14266#[doc = " Pointer type specifies the callback to report the ping statistics.\n\n @param[in] aStatistics A pointer to a `otPingSenderStatistics` containing info about the received ping\n statistics.\n @param[in] aContext A pointer to application-specific context."]
14267pub type otPingSenderStatisticsCallback = ::std::option::Option<
14268 unsafe extern "C" fn(
14269 aStatistics: *const otPingSenderStatistics,
14270 aContext: *mut ::std::os::raw::c_void,
14271 ),
14272>;
14273#[doc = " Represents a ping request configuration."]
14274#[repr(C)]
14275#[derive(Copy, Clone)]
14276pub struct otPingSenderConfig {
14277 #[doc = "< Source address of the ping."]
14278 pub mSource: otIp6Address,
14279 #[doc = "< Destination address to ping."]
14280 pub mDestination: otIp6Address,
14281 #[doc = "< Callback function to report replies (can be NULL if not needed)."]
14282 pub mReplyCallback: otPingSenderReplyCallback,
14283 #[doc = "< Callback function to report statistics (can be NULL if not needed)."]
14284 pub mStatisticsCallback: otPingSenderStatisticsCallback,
14285 #[doc = "< A pointer to the callback application-specific context."]
14286 pub mCallbackContext: *mut ::std::os::raw::c_void,
14287 #[doc = "< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default."]
14288 pub mSize: u16,
14289 #[doc = "< Number of ping messages to send. Zero to use default."]
14290 pub mCount: u16,
14291 #[doc = "< Ping tx interval in milliseconds. Zero to use default."]
14292 pub mInterval: u32,
14293 #[doc = "< Time in milliseconds to wait for final reply after sending final request.\n< Zero to use default."]
14294 pub mTimeout: u16,
14295 #[doc = "< Hop limit (used if `mAllowZeroHopLimit` is false). Zero for default."]
14296 pub mHopLimit: u8,
14297 #[doc = "< Indicates whether hop limit is zero."]
14298 pub mAllowZeroHopLimit: bool,
14299 #[doc = "< Allow looping back pings to multicast address that device is subscribed to."]
14300 pub mMulticastLoop: bool,
14301}
14302impl Default for otPingSenderConfig {
14303 fn default() -> Self {
14304 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14305 unsafe {
14306 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14307 s.assume_init()
14308 }
14309 }
14310}
14311unsafe extern "C" {
14312 #[doc = " Starts a ping.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig The ping config to use.\n\n @retval OT_ERROR_NONE The ping started successfully.\n @retval OT_ERROR_BUSY Could not start since busy with a previous ongoing ping request.\n @retval OT_ERROR_INVALID_ARGS The @p aConfig contains invalid parameters (e.g., ping interval is too long).\n"]
14313 pub fn otPingSenderPing(
14314 aInstance: *mut otInstance,
14315 aConfig: *const otPingSenderConfig,
14316 ) -> otError;
14317}
14318unsafe extern "C" {
14319 #[doc = " Stops an ongoing ping.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
14320 pub fn otPingSenderStop(aInstance: *mut otInstance);
14321}
14322unsafe extern "C" {
14323 #[doc = " Set the alarm to fire at @p aDt microseconds after @p aT0.\n\n For @p aT0, the platform MUST support all values in [0, 2^32-1].\n For @p aDt, the platform MUST support all values in [0, 2^31-1].\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aT0 The reference time.\n @param[in] aDt The time delay in microseconds from @p aT0."]
14324 pub fn otPlatAlarmMicroStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14325}
14326unsafe extern "C" {
14327 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14328 pub fn otPlatAlarmMicroStop(aInstance: *mut otInstance);
14329}
14330unsafe extern "C" {
14331 #[doc = " Get the current time.\n\n The current time MUST represent a free-running timer. When maintaining current time, the time value MUST utilize the\n entire range [0, 2^32-1] and MUST NOT wrap before 2^32.\n\n @returns The current time in microseconds."]
14332 pub fn otPlatAlarmMicroGetNow() -> u32;
14333}
14334unsafe extern "C" {
14335 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14336 pub fn otPlatAlarmMicroFired(aInstance: *mut otInstance);
14337}
14338unsafe extern "C" {
14339 #[doc = " Set the alarm to fire at @p aDt milliseconds after @p aT0.\n\n For @p aT0 the platform MUST support all values in [0, 2^32-1].\n For @p aDt, the platform MUST support all values in [0, 2^31-1].\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aT0 The reference time.\n @param[in] aDt The time delay in milliseconds from @p aT0."]
14340 pub fn otPlatAlarmMilliStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14341}
14342unsafe extern "C" {
14343 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14344 pub fn otPlatAlarmMilliStop(aInstance: *mut otInstance);
14345}
14346unsafe extern "C" {
14347 #[doc = " Get the current time.\n\n The current time MUST represent a free-running timer. When maintaining current time, the time value MUST utilize the\n entire range [0, 2^32-1] and MUST NOT wrap before 2^32.\n\n @returns The current time in milliseconds."]
14348 pub fn otPlatAlarmMilliGetNow() -> u32;
14349}
14350unsafe extern "C" {
14351 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14352 pub fn otPlatAlarmMilliFired(aInstance: *mut otInstance);
14353}
14354unsafe extern "C" {
14355 #[doc = " Signal diagnostics module that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14356 pub fn otPlatDiagAlarmFired(aInstance: *mut otInstance);
14357}
14358unsafe extern "C" {
14359 #[doc = " Callback from the platform to report DHCPv6 Prefix Delegation (PD) prefixes.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` and `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to\n be enabled, while `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` should be disabled.\n\n When `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` is enabled, the OpenThread stack's native DHCPv6\n PD client will be used. Otherwise, the platform layer is expected to interact with DHCPv6 servers to acquire\n and provide the delegated prefix(es) using this callback or `otPlatBorderRoutingProcessDhcp6PdPrefix()`.\n\n In this function, an ICMPv6 Router Advertisement (received on the platform's Thread interface) is passed to the\n OpenThread stack. This RA message is intended as a mechanism to distribute DHCPv6 PD prefixes to a Thread Border\n Router. Each Prefix Information Option (PIO) in the RA is evaluated as a candidate DHCPv6 PD prefix.\n\n This function can be called again to renew/refresh the lifetimes of PD prefixes or to signal their deprecation\n (by setting a zero \"preferred lifetime\") or removal (by setting a zero \"valid lifetime\").\n\n Important note: it is not expected that the RA message will contain all currently valid PD prefixes. The OT stack\n will parse the RA and process all included PIOs as PD prefix candidates. Any previously reported PD prefix (from an\n earlier call to this function or `otPlatBorderRoutingProcessDhcp6PdPrefix()`) that does not appear in the new RA\n remains unchanged (i.e., it will be assumed valid until its previously indicated lifetime expires).\n\n The `aMessage` should point to a buffer containing the ICMPv6 message payload (excluding the IP headers but\n including the ICMPv6 header) with \"Router Advertisement\" (code 134) as the value of the `Type` field in the ICMPv6\n header.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to an ICMPv6 Router Advertisement message.\n @param[in] aLength The length of the ICMPv6 Router Advertisement message."]
14360 pub fn otPlatBorderRoutingProcessIcmp6Ra(
14361 aInstance: *mut otInstance,
14362 aMessage: *const u8,
14363 aLength: u16,
14364 );
14365}
14366unsafe extern "C" {
14367 #[doc = " Callback to report a single DHCPv6 Prefix Delegation (PD) prefix.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` and `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` to\n be enabled, while `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` should be disabled.\n\n When `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` is enabled, the OpenThread stack's native DHCPv6\n PD client will be used. Otherwise, the platform layer is expected to interact with DHCPv6 servers to acquire\n and provide the delegated prefix(es) using this callback or `otPlatBorderRoutingProcessIcmp6Ra()`.\n\n This function can be called again to renew/refresh the lifetimes of PD prefixes or to signal their deprecation\n (by setting a zero \"preferred lifetime\") or removal (by setting a zero \"valid lifetime\"). This function may be\n called multiple times to provide different PD prefixes.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefixInfo A pointer to the prefix information structure."]
14368 pub fn otPlatBorderRoutingProcessDhcp6PdPrefix(
14369 aInstance: *mut otInstance,
14370 aPrefixInfo: *const otBorderRoutingPrefixTableEntry,
14371 );
14372}
14373unsafe extern "C" {
14374 #[doc = " Standard printf() to the debug uart with no log decoration.\n\n @param[in] fmt printf formatter text\n\n This is a debug convenience function that is not intended to be\n used in anything other then \"debug scenarios\" by a developer.\n\n lf -> cr/lf mapping is automatically handled via otPlatDebugUart_putchar()\n\n @sa otPlatDebugUart_vprintf() for limitations\n\n This is a WEAK symbol that can easily be overridden as needed."]
14375 pub fn otPlatDebugUart_printf(fmt: *const ::std::os::raw::c_char, ...);
14376}
14377unsafe extern "C" {
14378 #[doc = " Standard vprintf() to the debug uart, with no log decoration.\n\n @param[in] fmt printf formatter text\n @param[in] ap va_list value for print parameters.\n\n Implementation limitation: this formats the text into\n a purposely small text buffer on the stack, thus long\n messages may be truncated.\n\n This is a WEAK symbol that can easily be overridden as needed.\n\n For example, some platforms might override this via a non-WEAK\n symbol because the platform provides a UART_vprintf() like\n function that can handle an arbitrary length output."]
14379 pub fn otPlatDebugUart_vprintf(fmt: *const ::std::os::raw::c_char, ap: *mut __va_list_tag);
14380}
14381unsafe extern "C" {
14382 #[doc = " Platform specific write single byte to Debug Uart\n This should not perform CR/LF mapping.\n\n MUST be implemented by the platform\n\n @param[in] c what to transmit"]
14383 pub fn otPlatDebugUart_putchar_raw(c: ::std::os::raw::c_int);
14384}
14385unsafe extern "C" {
14386 #[doc = " Poll/test debug uart if a key has been pressed.\n It would be common to a stub function that returns 0.\n\n MUST be implemented by the platform\n\n @retval zero - nothing ready\n @retval nonzero - otPlatDebugUart_getc() will succeed."]
14387 pub fn otPlatDebugUart_kbhit() -> ::std::os::raw::c_int;
14388}
14389unsafe extern "C" {
14390 #[doc = " Poll/Read a byte from the debug uart\n\n MUST be implemented by the platform\n\n @retval (negative) no data available, see otPlatDebugUart_kbhit()\n @retval (0x00..0x0ff) data byte value"]
14391 pub fn otPlatDebugUart_getc() -> ::std::os::raw::c_int;
14392}
14393unsafe extern "C" {
14394 #[doc = " Write byte to the uart, expand cr/lf as need.\n\n A WEAK default implementation is provided\n that can be overridden as needed.\n\n @param[in] c the byte to transmit"]
14395 pub fn otPlatDebugUart_putchar(c: ::std::os::raw::c_int);
14396}
14397unsafe extern "C" {
14398 #[doc = " identical to \"man 3 puts\" - terminates with lf\n Which is then mapped to cr/lf as required\n\n A WEAK default implementation is provided\n that can be overridden as needed.\n\n @param[in] s the string to print with a lf at the end"]
14399 pub fn otPlatDebugUart_puts(s: *const ::std::os::raw::c_char);
14400}
14401unsafe extern "C" {
14402 #[doc = " Write N bytes to the UART, mapping cr/lf\n\n @param[in] pBytes pointer to bytes to transmit.\n @param[in] nBytes how many bytes to transmit."]
14403 pub fn otPlatDebugUart_write_bytes(pBytes: *const u8, nBytes: ::std::os::raw::c_int);
14404}
14405unsafe extern "C" {
14406 #[doc = " puts() without a terminal newline.\n see: \"man 3 puts\", without a adding a terminal lf\n\n @param[in] s the string to print without a lf at the end\n\n Note, the terminal \"lf\" mapped to cr/lf via\n the function otPlatDebugUart_putchar()"]
14407 pub fn otPlatDebugUart_puts_no_nl(s: *const ::std::os::raw::c_char);
14408}
14409unsafe extern "C" {
14410 #[doc = " Some platforms (simulation) can log to a file.\n\n @returns OT_ERROR_NONE\n @returns OT_ERROR_FAILED\n\n Platforms that desire this MUST provide an implementation."]
14411 pub fn otPlatDebugUart_logfile(filename: *const ::std::os::raw::c_char) -> otError;
14412}
14413#[repr(C)]
14414#[derive(Debug, Copy, Clone)]
14415pub struct otPlatDnsUpstreamQuery {
14416 _unused: [u8; 0],
14417}
14418unsafe extern "C" {
14419 #[doc = " Indicates whether upstream DNS query functionality is available on the platform.\n\n This function allows the platform to inform the OpenThread stack if no upstream DNS server is\n available.\n\n This function is used to optimize query handling. If this function returns `false` (e.g., no upstream DNS server is\n currently available), one can avoid attempting an upstream resolution (which would likely time out) and instead\n immediately send an appropriate negative response (e.g., `SERVFAIL`) to the DNS client.\n\n @param[in] aInstance The OpenThread instance.\n\n @retval TRUE Upstream DNS query functionality is available.\n @retval FALSE Upstream DNS query functionality is not available."]
14420 pub fn otPlatDnsIsUpstreamQueryAvailable(aInstance: *mut otInstance) -> bool;
14421}
14422unsafe extern "C" {
14423 #[doc = " Starts an upstream query transaction.\n\n - In success case (and errors represented by DNS protocol messages), the platform is expected to call\n `otPlatDnsUpstreamQueryDone`.\n - The OpenThread core may cancel a query transaction (possibly due to a timeout) by invoking\n `otPlatDnsCancelUpstreamQuery()`. The platform MUST still call `otPlatDnsUpstreamQueryDone()` on a\n cancelled transaction to release the transaction.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTxn A pointer to the opaque DNS query transaction object.\n @param[in] aQuery A message buffer of the DNS payload that should be sent to upstream DNS server."]
14424 pub fn otPlatDnsStartUpstreamQuery(
14425 aInstance: *mut otInstance,
14426 aTxn: *mut otPlatDnsUpstreamQuery,
14427 aQuery: *const otMessage,
14428 );
14429}
14430unsafe extern "C" {
14431 #[doc = " Cancels a transaction of upstream query.\n\n The platform MUST call `otPlatDnsUpstreamQueryDone()` to release the transaction.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTxn A pointer to the opaque DNS query transaction object."]
14432 pub fn otPlatDnsCancelUpstreamQuery(
14433 aInstance: *mut otInstance,
14434 aTxn: *mut otPlatDnsUpstreamQuery,
14435 );
14436}
14437unsafe extern "C" {
14438 #[doc = " The platform calls this function to finish DNS query.\n\n The transaction will be released, so the platform MUST NOT call on the same transaction twice. This function passes\n the ownership of `aResponse` to OpenThread stack.\n\n Platform can pass NULL to close a transaction without a response.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTxn A pointer to the opaque DNS query transaction object.\n @param[in] aResponse A message buffer of the DNS response payload or NULL to close a transaction without a\n response."]
14439 pub fn otPlatDnsUpstreamQueryDone(
14440 aInstance: *mut otInstance,
14441 aTxn: *mut otPlatDnsUpstreamQuery,
14442 aResponse: *mut otMessage,
14443 );
14444}
14445unsafe extern "C" {
14446 #[doc = " Fill buffer with entropy.\n\n MUST be implemented using a true random number generator (TRNG).\n\n @param[out] aOutput A pointer to where the true random values are placed. Must not be NULL.\n @param[in] aOutputLength Size of @p aBuffer.\n\n @retval OT_ERROR_NONE Successfully filled @p aBuffer with true random values.\n @retval OT_ERROR_FAILED Failed to fill @p aBuffer with true random values.\n @retval OT_ERROR_INVALID_ARGS @p aBuffer was set to NULL."]
14447 pub fn otPlatEntropyGet(aOutput: *mut u8, aOutputLength: u16) -> otError;
14448}
14449unsafe extern "C" {
14450 #[doc = " Initializes the flash driver.\n\n @param[in] aInstance The OpenThread instance structure."]
14451 pub fn otPlatFlashInit(aInstance: *mut otInstance);
14452}
14453unsafe extern "C" {
14454 #[doc = " Gets the size of the swap space.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The size of the swap space in bytes."]
14455 pub fn otPlatFlashGetSwapSize(aInstance: *mut otInstance) -> u32;
14456}
14457unsafe extern "C" {
14458 #[doc = " Erases the swap space indicated by @p aSwapIndex.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSwapIndex A value in [0, 1] that indicates the swap space."]
14459 pub fn otPlatFlashErase(aInstance: *mut otInstance, aSwapIndex: u8);
14460}
14461unsafe extern "C" {
14462 #[doc = " Reads @p aSize bytes into @p aData.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSwapIndex A value in [0, 1] that indicates the swap space.\n @param[in] aOffset A byte offset within the swap space.\n @param[out] aData A pointer to the data buffer for reading.\n @param[in] aSize Number of bytes to read."]
14463 pub fn otPlatFlashRead(
14464 aInstance: *mut otInstance,
14465 aSwapIndex: u8,
14466 aOffset: u32,
14467 aData: *mut ::std::os::raw::c_void,
14468 aSize: u32,
14469 );
14470}
14471unsafe extern "C" {
14472 #[doc = " Writes @p aSize bytes from @p aData.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSwapIndex A value in [0, 1] that indicates the swap space.\n @param[in] aOffset A byte offset within the swap space.\n @param[out] aData A pointer to the data to write.\n @param[in] aSize Number of bytes to write."]
14473 pub fn otPlatFlashWrite(
14474 aInstance: *mut otInstance,
14475 aSwapIndex: u8,
14476 aOffset: u32,
14477 aData: *const ::std::os::raw::c_void,
14478 aSize: u32,
14479 );
14480}
14481#[doc = " Represents an InfraIf Link-Layer Address."]
14482#[repr(C)]
14483#[derive(Debug, Default, Copy, Clone)]
14484pub struct otPlatInfraIfLinkLayerAddress {
14485 #[doc = "< The link-layer address bytes."]
14486 pub mAddress: [u8; 16usize],
14487 #[doc = "< The address length (number of bytes)."]
14488 pub mLength: u8,
14489}
14490unsafe extern "C" {
14491 #[doc = " Tells whether an infra interface has the given IPv6 address assigned.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aInfraIfIndex The index of the infra interface.\n @param[in] aAddress The IPv6 address.\n\n @returns TRUE if the infra interface has given IPv6 address assigned, FALSE otherwise."]
14492 pub fn otPlatInfraIfHasAddress(
14493 aInstance: *mut otInstance,
14494 aInfraIfIndex: u32,
14495 aAddress: *const otIp6Address,
14496 ) -> bool;
14497}
14498unsafe extern "C" {
14499 #[doc = " Sends an ICMPv6 Neighbor Discovery message on given infrastructure interface.\n\n See RFC 4861: https://tools.ietf.org/html/rfc4861.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aInfraIfIndex The index of the infrastructure interface this message is sent to.\n @param[in] aDestAddress The destination address this message is sent to.\n @param[in] aBuffer The ICMPv6 message buffer. The ICMPv6 checksum is left zero and the\n platform should do the checksum calculate.\n @param[in] aBufferLength The length of the message buffer.\n\n @note Per RFC 4861, the implementation should send the message with IPv6 link-local source address\n of interface @p aInfraIfIndex and IP Hop Limit 255.\n\n @retval OT_ERROR_NONE Successfully sent the ICMPv6 message.\n @retval OT_ERROR_FAILED Failed to send the ICMPv6 message."]
14500 pub fn otPlatInfraIfSendIcmp6Nd(
14501 aInstance: *mut otInstance,
14502 aInfraIfIndex: u32,
14503 aDestAddress: *const otIp6Address,
14504 aBuffer: *const u8,
14505 aBufferLength: u16,
14506 ) -> otError;
14507}
14508unsafe extern "C" {
14509 #[doc = " The infra interface driver calls this method to notify OpenThread\n that an ICMPv6 Neighbor Discovery message is received.\n\n See RFC 4861: https://tools.ietf.org/html/rfc4861.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aInfraIfIndex The index of the infrastructure interface on which the ICMPv6 message is received.\n @param[in] aSrcAddress The source address this message is received from.\n @param[in] aBuffer The ICMPv6 message buffer.\n @param[in] aBufferLength The length of the ICMPv6 message buffer.\n\n @note Per RFC 4861, the caller should enforce that the source address MUST be a IPv6 link-local\n address and the IP Hop Limit MUST be 255."]
14510 pub fn otPlatInfraIfRecvIcmp6Nd(
14511 aInstance: *mut otInstance,
14512 aInfraIfIndex: u32,
14513 aSrcAddress: *const otIp6Address,
14514 aBuffer: *const u8,
14515 aBufferLength: u16,
14516 );
14517}
14518unsafe extern "C" {
14519 #[doc = " The infra interface driver calls this method to notify OpenThread\n of the interface state changes.\n\n It is fine for the platform to call to method even when the running state\n of the interface hasn't changed. In this case, the Routing Manager state is\n not affected.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aInfraIfIndex The index of the infrastructure interface.\n @param[in] aIsRunning A boolean that indicates whether the infrastructure\n interface is running.\n\n @retval OT_ERROR_NONE Successfully updated the infra interface status.\n @retval OT_ERROR_INVALID_STATE The Routing Manager is not initialized.\n @retval OT_ERROR_INVALID_ARGS The @p aInfraIfIndex doesn't match the infra interface the\n Routing Manager are initialized with."]
14520 pub fn otPlatInfraIfStateChanged(
14521 aInstance: *mut otInstance,
14522 aInfraIfIndex: u32,
14523 aIsRunning: bool,
14524 ) -> otError;
14525}
14526unsafe extern "C" {
14527 #[doc = " Send a request to discover the NAT64 prefix on the infrastructure interface with @p aInfraIfIndex.\n\n OpenThread will call this method periodically to monitor the presence or change of NAT64 prefix.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aInfraIfIndex The index of the infrastructure interface to discover the NAT64 prefix.\n\n @retval OT_ERROR_NONE Successfully requested NAT64 prefix discovery.\n @retval OT_ERROR_FAILED Failed to request NAT64 prefix discovery.\n @retval OT_ERROR_NOT_IMPLEMENTED Platform does not support this discovery method. will rely on RA-based mechanism.\n\n @note This function requests the platform to discover a NAT64 prefix (e.g. using RFC 7050 DNS-based\n discovery). The priority of the discovered prefix is lower than that of the prefix discovered via Router\n Advertisements PREF64 option (RFC 8781)."]
14528 pub fn otPlatInfraIfDiscoverNat64Prefix(
14529 aInstance: *mut otInstance,
14530 aInfraIfIndex: u32,
14531 ) -> otError;
14532}
14533unsafe extern "C" {
14534 #[doc = " The infra interface driver calls this method to notify OpenThread that\n the discovery of NAT64 prefix is done.\n\n Is expected to be invoked after calling otPlatInfraIfDiscoverNat64Prefix.\n If no NAT64 prefix is discovered, @p aIp6Prefix shall point to an empty prefix with zero length.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aInfraIfIndex The index of the infrastructure interface on which the NAT64 prefix is discovered.\n @param[in] aIp6Prefix A pointer to NAT64 prefix.\n\n @note This function is used to report a NAT64 prefix discovered by the platform (e.g. using RFC 7050 DNS-based\n discovery). The priority of the discovered prefix is lower than that of the prefix discovered via Router\n Advertisements PREF64 option (RFC 8781)."]
14535 pub fn otPlatInfraIfDiscoverNat64PrefixDone(
14536 aInstance: *mut otInstance,
14537 aInfraIfIndex: u32,
14538 aIp6Prefix: *const otIp6Prefix,
14539 );
14540}
14541unsafe extern "C" {
14542 #[doc = " Get the link-layer address of the infrastructure interface.\n\n OpenThread invokes this method when the address is required, for example: when generating an ND6 message\n which includes a source link-layer address option.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aInfraIfIndex The index of the infrastructure interface.\n @param[out] aInfraIfLinkLayerAddress A pointer to infrastructure interface link-layer address.\n\n @retval OT_ERROR_NONE Successfully get the infrastructure interface link-layer address.\n @retval OT_ERROR_FAILED Failed to get the infrastructure interface link-layer address."]
14543 pub fn otPlatGetInfraIfLinkLayerAddress(
14544 aInstance: *mut otInstance,
14545 aIfIndex: u32,
14546 aInfraIfLinkLayerAddress: *mut otPlatInfraIfLinkLayerAddress,
14547 ) -> otError;
14548}
14549unsafe extern "C" {
14550 #[doc = " Enables or disables listening for DHCPv6 Prefix Delegation (PD) messages on client.\n\n This function is only used when `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` is enabled.\n\n When enabled, the platform must open a UDP socket on the specified infrastructure interface, binding to the DHCPv6\n client port 546 to receive messages from DHCPv6 servers.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aEnable A boolean to enable (`true`) or disable (`false`) listening.\n @param[in] aInfraIfIndex The index of the infrastructure interface to operate on."]
14551 pub fn otPlatInfraIfDhcp6PdClientSetListeningEnabled(
14552 aInstance: *mut otInstance,
14553 aEnable: bool,
14554 aInfraIfIndex: u32,
14555 );
14556}
14557unsafe extern "C" {
14558 #[doc = " Sends a DHCPv6 message to a unicast or multicast destination address.\n\n This function is only used when `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` is enabled.\n\n The platform is responsible for constructing a UDP datagram with the given DHCPv6 message as its payload. The\n datagram must be sent from the DHCPv6 client port (546) to the server port (547) on the specified infrastructure\n interface. The destination IPv6 address can be a unicast address or the multicast `All_DHCP_Relay_Agents_and_Servers`\n address (`ff02::1:2`).\n\n This function passes the ownership of @p aMessage to the platform layer. Platform MUST then free the message\n when no longer needed.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aMessage An `otMessage` containing the DHCPv6 payload. Ownership is passed to the platform layer.\n @param[in] aDestAddress The IPv6 multicast or unicast destination address.\n @param[in] aInfraIfIndex The index of the infrastructure interface from which to send the message."]
14559 pub fn otPlatInfraIfDhcp6PdClientSend(
14560 aInstance: *mut otInstance,
14561 aMessage: *mut otMessage,
14562 aDestAddress: *mut otIp6Address,
14563 aInfraIfIndex: u32,
14564 );
14565}
14566unsafe extern "C" {
14567 #[doc = " Callback from the platform to notify the OpenThread stack of a received DHCPv6 message.\n\n This function is provided when `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_CLIENT_ENABLE` is enabled.\n\n The platform calls this function whenever a DHCPv6 message is received on the client port (546) while listening on\n this port is enabled (refer to `otPlatInfraIfDhcp6PdClientSetListeningEnabled()`).\n\n The platform is responsible for allocating the `otMessage` to pass the received UDP payload. Ownership of the\n @p aMessage is passed to the OpenThread stack (which will free it once no longer needed).\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aMessage The `otMessage` containing the received DHCPv6 payload. Ownership is passed to OT stack.\n @param[in] aInfraIfIndex The index of the infrastructure interface from which the message was received.."]
14568 pub fn otPlatInfraIfDhcp6PdClientHandleReceived(
14569 aInstance: *mut otInstance,
14570 aMessage: *mut otMessage,
14571 aInfraIfIndex: u32,
14572 );
14573}
14574unsafe extern "C" {
14575 #[doc = " Dynamically allocates new memory. On platforms that support it, they should redirect to `calloc`. For\n those that don't support `calloc`, they should implement the standard `calloc` behavior.\n\n See: https://man7.org/linux/man-pages/man3/calloc.3.html\n\n Is required for `OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`.\n\n @param[in] aNum The number of blocks to allocate\n @param[in] aSize The size of each block to allocate\n\n @retval void* The pointer to the front of the memory allocated\n @retval NULL Failed to allocate the memory requested."]
14576 pub fn otPlatCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
14577}
14578unsafe extern "C" {
14579 #[doc = " Frees memory that was dynamically allocated by `otPlatCAlloc()`.\n\n Is required for `OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`.\n\n @param[in] aPtr A pointer the memory blocks to free. The pointer may be NULL."]
14580 pub fn otPlatFree(aPtr: *mut ::std::os::raw::c_void);
14581}
14582#[doc = " Represents an OpenThread message buffer."]
14583#[repr(C)]
14584#[derive(Debug, Copy, Clone)]
14585pub struct otMessageBuffer {
14586 #[doc = "< Pointer to the next buffer."]
14587 pub mNext: *mut otMessageBuffer,
14588}
14589impl Default for otMessageBuffer {
14590 fn default() -> Self {
14591 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14592 unsafe {
14593 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14594 s.assume_init()
14595 }
14596 }
14597}
14598unsafe extern "C" {
14599 #[doc = " Initialize the platform implemented message pool.\n\n Is used when `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aMinNumFreeBuffers An uint16 containing the minimum number of free buffers desired by OpenThread.\n @param[in] aBufferSize The size in bytes of a buffer object."]
14600 pub fn otPlatMessagePoolInit(
14601 aInstance: *mut otInstance,
14602 aMinNumFreeBuffers: u16,
14603 aBufferSize: usize,
14604 );
14605}
14606unsafe extern "C" {
14607 #[doc = " Allocate a buffer from the platform managed buffer pool.\n\n Is used when `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is enabled.\n\n The returned buffer instance MUST have at least `aBufferSize` bytes (as specified in `otPlatMessagePoolInit()`).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to the buffer or NULL if no buffers are available."]
14608 pub fn otPlatMessagePoolNew(aInstance: *mut otInstance) -> *mut otMessageBuffer;
14609}
14610unsafe extern "C" {
14611 #[doc = " Is used to free a buffer back to the platform managed buffer pool.\n\n Is used when `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aBuffer The buffer to free."]
14612 pub fn otPlatMessagePoolFree(aInstance: *mut otInstance, aBuffer: *mut otMessageBuffer);
14613}
14614unsafe extern "C" {
14615 #[doc = " Get the number of free buffers.\n\n Is used when `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The number of buffers currently free and available to OpenThread."]
14616 pub fn otPlatMessagePoolNumFreeBuffers(aInstance: *mut otInstance) -> u16;
14617}
14618unsafe extern "C" {
14619 #[doc = " Deinitialize the platform implemented message pool.\n\n Is used when `OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT` is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
14620 pub fn otPlatMessagePoolDeinit(aInstance: *mut otInstance);
14621}
14622unsafe extern "C" {
14623 #[doc = " Performs a software reset on the platform, if supported.\n\n @param[in] aInstance The OpenThread instance structure."]
14624 pub fn otPlatReset(aInstance: *mut otInstance);
14625}
14626unsafe extern "C" {
14627 #[doc = " Performs a hardware reset on the platform to launch bootloader mode, if supported.\n\n Used when `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE` is enabled.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Reset to bootloader successfully.\n @retval OT_ERROR_BUSY Failed due to another operation is ongoing.\n @retval OT_ERROR_NOT_CAPABLE Not capable of resetting to bootloader."]
14628 pub fn otPlatResetToBootloader(aInstance: *mut otInstance) -> otError;
14629}
14630pub const OT_PLAT_RESET_REASON_POWER_ON: otPlatResetReason = 0;
14631pub const OT_PLAT_RESET_REASON_EXTERNAL: otPlatResetReason = 1;
14632pub const OT_PLAT_RESET_REASON_SOFTWARE: otPlatResetReason = 2;
14633pub const OT_PLAT_RESET_REASON_FAULT: otPlatResetReason = 3;
14634pub const OT_PLAT_RESET_REASON_CRASH: otPlatResetReason = 4;
14635pub const OT_PLAT_RESET_REASON_ASSERT: otPlatResetReason = 5;
14636pub const OT_PLAT_RESET_REASON_OTHER: otPlatResetReason = 6;
14637pub const OT_PLAT_RESET_REASON_UNKNOWN: otPlatResetReason = 7;
14638pub const OT_PLAT_RESET_REASON_WATCHDOG: otPlatResetReason = 8;
14639pub const OT_PLAT_RESET_REASON_COUNT: otPlatResetReason = 9;
14640#[doc = " Enumeration of possible reset reason codes.\n\n These are in the same order as the Spinel reset reason codes."]
14641pub type otPlatResetReason = ::std::os::raw::c_uint;
14642unsafe extern "C" {
14643 #[doc = " Returns the reason for the last platform reset.\n\n @param[in] aInstance The OpenThread instance structure."]
14644 pub fn otPlatGetResetReason(aInstance: *mut otInstance) -> otPlatResetReason;
14645}
14646unsafe extern "C" {
14647 #[doc = " Provides a platform specific implementation for assert.\n\n @param[in] aFilename The name of the file where the assert occurred.\n @param[in] aLineNumber The line number in the file where the assert occurred."]
14648 pub fn otPlatAssertFail(
14649 aFilename: *const ::std::os::raw::c_char,
14650 aLineNumber: ::std::os::raw::c_int,
14651 );
14652}
14653unsafe extern "C" {
14654 #[doc = " Performs a platform specific operation to wake the host MCU.\n This is used only for NCP configurations."]
14655 pub fn otPlatWakeHost();
14656}
14657#[doc = " NCP's MCU stays on and active all the time.\n\n When the NCP's desired power state is set to `ON`, host can send messages to NCP without requiring any \"poke\" or\n external triggers.\n\n @note The `ON` power state only determines the MCU's power mode and is not related to radio's state."]
14658pub const OT_PLAT_MCU_POWER_STATE_ON: otPlatMcuPowerState = 0;
14659#[doc = " NCP's MCU can enter low-power (energy-saving) state.\n\n When the NCP's desired power state is set to `LOW_POWER`, host is expected to \"poke\" the NCP (e.g., an external\n trigger like an interrupt) before it can communicate with the NCP (send a message to the NCP). The \"poke\"\n mechanism is determined by the platform code (based on NCP's interface to the host).\n\n While power state is set to `LOW_POWER`, NCP can still (at any time) send messages to host. Note that receiving\n a message from the NCP does NOT indicate that the NCP's power state has changed, i.e., host is expected to\n continue to \"poke\" when it wants to talk to the NCP until the power state is explicitly changed (by a successful\n call to `otPlatSetMcuPowerState()` changing the state to `ON`).\n\n @note The `LOW_POWER` power state only determines the MCU's power mode and is not related to radio's state\n (radio is managed by OpenThread core and device role, e.g., device being sleepy or not."]
14660pub const OT_PLAT_MCU_POWER_STATE_LOW_POWER: otPlatMcuPowerState = 1;
14661#[doc = " NCP is fully off.\n\n An NCP hardware reset (via a RESET pin) is required to bring the NCP back to `SPINEL_MCU_POWER_STATE_ON`.\n RAM is not retained after reset."]
14662pub const OT_PLAT_MCU_POWER_STATE_OFF: otPlatMcuPowerState = 2;
14663#[doc = " Enumeration of micro-controller's power states.\n\n These values are used for NCP configuration when `OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL` is enabled.\n\n The power state specifies the desired power state of NCP's micro-controller (MCU) when the underlying platform's\n operating system enters idle mode (i.e., all active tasks/events are processed and the MCU can potentially enter a\n energy-saving power state).\n\n The power state primarily determines how the host should interact with the NCP and whether the host needs an\n external trigger (a \"poke\") to NCP before it can communicate with the NCP or not.\n\n After a reset, the MCU power state MUST be `OT_PLAT_POWER_STATE_ON`."]
14664pub type otPlatMcuPowerState = ::std::os::raw::c_uint;
14665unsafe extern "C" {
14666 #[doc = " Sets the desired MCU power state.\n\n This is only applicable and used for NCP configuration when `OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL`\n is enabled.\n\n @param[in] aInstance A pointer to OpenThread instance.\n @param[in] aState The new MCU power state.\n\n @retval OT_ERROR_NONE The power state updated successfully.\n @retval OT_ERROR_FAILED The given MCU power state is not supported by the platform."]
14667 pub fn otPlatSetMcuPowerState(
14668 aInstance: *mut otInstance,
14669 aState: otPlatMcuPowerState,
14670 ) -> otError;
14671}
14672unsafe extern "C" {
14673 #[doc = " Gets the current desired MCU power state.\n\n This is only applicable and used for NCP configuration when `OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL`\n is enabled.\n\n After a reset, the power state MUST return `OT_PLAT_POWER_STATE_ON`. During operation, power state SHOULD only\n change through an explicit successful call to `otPlatSetMcuPowerState()`.\n\n @param[in] aInstance A pointer to OpenThread instance.\n\n @returns The current power state."]
14674 pub fn otPlatGetMcuPowerState(aInstance: *mut otInstance) -> otPlatMcuPowerState;
14675}
14676unsafe extern "C" {
14677 #[doc = " Logs a crash dump using OpenThread logging APIs\n\n @note This API is an optional logging platform API. It's up to the platform layer to implement it.\n\n @retval OT_ERROR_NONE Crash dump was logged successfully\n @retval OT_ERROR_NOT_CAPABLE Platform is not capable of logging a crash dump"]
14678 pub fn otPlatLogCrashDump() -> otError;
14679}
14680unsafe extern "C" {
14681 #[doc = " Exports status information to OTNS.\n\n The status information is represented by a null-terminated string with format recognizable by OTNS.\n Each call to `otPlatOtnsStatus` can send multiple statuses, separated by ';', e.x. \"parid=577fbc37;lrid=5\".\n Each status contains key and value separated by '='.\n Status value can be further separated into multiple fields using ',',\n e.x. \"ping_request=fdde:ad00:beef:0:459e:d7b4:b65e:5480,4,112000\".\n\n New statuses should follow these conventions.\n\n Currently, OTNS only supports virtual time simulation.\n\n @param[in] aStatus The status string."]
14682 pub fn otPlatOtnsStatus(aStatus: *const ::std::os::raw::c_char);
14683}
14684#[doc = "< Active Operational Dataset."]
14685pub const OT_SETTINGS_KEY_ACTIVE_DATASET: _bindgen_ty_11 = 1;
14686#[doc = "< Pending Operational Dataset."]
14687pub const OT_SETTINGS_KEY_PENDING_DATASET: _bindgen_ty_11 = 2;
14688#[doc = "< Thread network information."]
14689pub const OT_SETTINGS_KEY_NETWORK_INFO: _bindgen_ty_11 = 3;
14690#[doc = "< Parent information."]
14691pub const OT_SETTINGS_KEY_PARENT_INFO: _bindgen_ty_11 = 4;
14692#[doc = "< Child information."]
14693pub const OT_SETTINGS_KEY_CHILD_INFO: _bindgen_ty_11 = 5;
14694#[doc = "< SLAAC key to generate semantically opaque IID."]
14695pub const OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY: _bindgen_ty_11 = 7;
14696#[doc = "< Duplicate Address Detection (DAD) information."]
14697pub const OT_SETTINGS_KEY_DAD_INFO: _bindgen_ty_11 = 8;
14698#[doc = "< SRP client ECDSA public/private key pair."]
14699pub const OT_SETTINGS_KEY_SRP_ECDSA_KEY: _bindgen_ty_11 = 11;
14700#[doc = "< The SRP client info (selected SRP server address)."]
14701pub const OT_SETTINGS_KEY_SRP_CLIENT_INFO: _bindgen_ty_11 = 12;
14702#[doc = "< The SRP server info (UDP port)."]
14703pub const OT_SETTINGS_KEY_SRP_SERVER_INFO: _bindgen_ty_11 = 13;
14704#[doc = "< BR ULA prefix."]
14705pub const OT_SETTINGS_KEY_BR_ULA_PREFIX: _bindgen_ty_11 = 15;
14706#[doc = "< BR local on-link prefixes."]
14707pub const OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES: _bindgen_ty_11 = 16;
14708#[doc = "< Unique Border Agent/Router ID."]
14709pub const OT_SETTINGS_KEY_BORDER_AGENT_ID: _bindgen_ty_11 = 17;
14710#[doc = "< TCAT Commissioner certificate"]
14711pub const OT_SETTINGS_KEY_TCAT_COMMR_CERT: _bindgen_ty_11 = 18;
14712pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MIN: _bindgen_ty_11 = 32768;
14713pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MAX: _bindgen_ty_11 = 65535;
14714#[doc = " Defines the keys of settings.\n\n Note: When adding a new settings key, if the settings corresponding to the key contains security sensitive\n information, the developer MUST add the key to the array `aSensitiveKeys` which is passed in\n `otPlatSettingsInit()`."]
14715pub type _bindgen_ty_11 = ::std::os::raw::c_uint;
14716unsafe extern "C" {
14717 #[doc = " Performs any initialization for the settings subsystem, if necessary.\n\n Also sets the sensitive keys that should be stored in the secure area.\n\n Note that the memory pointed by @p aSensitiveKeys MUST not be released before @p aInstance is destroyed.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aSensitiveKeys A pointer to an array containing the list of sensitive keys. May be NULL only if\n @p aSensitiveKeysLength is 0, which means that there is no sensitive keys.\n @param[in] aSensitiveKeysLength The number of entries in the @p aSensitiveKeys array."]
14718 pub fn otPlatSettingsInit(
14719 aInstance: *mut otInstance,
14720 aSensitiveKeys: *const u16,
14721 aSensitiveKeysLength: u16,
14722 );
14723}
14724unsafe extern "C" {
14725 #[doc = " Performs any de-initialization for the settings subsystem, if necessary.\n\n @param[in] aInstance The OpenThread instance structure."]
14726 pub fn otPlatSettingsDeinit(aInstance: *mut otInstance);
14727}
14728unsafe extern "C" {
14729 #[doc = " Fetches the value of a setting.\n\n Fetches the value of the setting identified\n by @p aKey and write it to the memory pointed to by aValue.\n It then writes the length to the integer pointed to by\n @p aValueLength. The initial value of @p aValueLength is the\n maximum number of bytes to be written to @p aValue.\n\n Can be used to check for the existence of\n a key without fetching the value by setting @p aValue and\n @p aValueLength to NULL. You can also check the length of\n the setting without fetching it by setting only aValue\n to NULL.\n\n Note that the underlying storage implementation is not\n required to maintain the order of settings with multiple\n values. The order of such values MAY change after ANY\n write operation to the store.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aKey The key associated with the requested setting.\n @param[in] aIndex The index of the specific item to get.\n @param[out] aValue A pointer to where the value of the setting should be written. May be set to NULL if\n just testing for the presence or length of a setting.\n @param[in,out] aValueLength A pointer to the length of the value. When called, this pointer should point to an\n integer containing the maximum value size that can be written to @p aValue. At return,\n the actual length of the setting is written. This may be set to NULL if performing\n a presence check.\n\n @retval OT_ERROR_NONE The given setting was found and fetched successfully.\n @retval OT_ERROR_NOT_FOUND The given setting was not found in the setting store.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on this platform."]
14730 pub fn otPlatSettingsGet(
14731 aInstance: *mut otInstance,
14732 aKey: u16,
14733 aIndex: ::std::os::raw::c_int,
14734 aValue: *mut u8,
14735 aValueLength: *mut u16,
14736 ) -> otError;
14737}
14738unsafe extern "C" {
14739 #[doc = " Sets or replaces the value of a setting.\n\n Sets or replaces the value of a setting\n identified by @p aKey.\n\n Calling this function successfully may cause unrelated\n settings with multiple values to be reordered.\n\n OpenThread stack guarantees to use `otPlatSettingsSet()`\n method for a @p aKey that was either previously set using\n `otPlatSettingsSet()` (i.e., contains a single value) or\n is empty and/or fully deleted (contains no value).\n\n Platform layer can rely and use this fact for optimizing\n its implementation.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aKey The key associated with the setting to change.\n @param[in] aValue A pointer to where the new value of the setting should be read from. MUST NOT be NULL if\n @p aValueLength is non-zero.\n @param[in] aValueLength The length of the data pointed to by aValue. May be zero.\n\n @retval OT_ERROR_NONE The given setting was changed or staged.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on this platform.\n @retval OT_ERROR_NO_BUFS No space remaining to store the given setting."]
14740 pub fn otPlatSettingsSet(
14741 aInstance: *mut otInstance,
14742 aKey: u16,
14743 aValue: *const u8,
14744 aValueLength: u16,
14745 ) -> otError;
14746}
14747unsafe extern "C" {
14748 #[doc = " Adds a value to a setting.\n\n Adds the value to a setting\n identified by @p aKey, without replacing any existing\n values.\n\n Note that the underlying implementation is not required\n to maintain the order of the items associated with a\n specific key. The added value may be added to the end,\n the beginning, or even somewhere in the middle. The order\n of any pre-existing values may also change.\n\n Calling this function successfully may cause unrelated\n settings with multiple values to be reordered.\n\n OpenThread stack guarantees to use `otPlatSettingsAdd()`\n method for a @p aKey that was either previously managed by\n `otPlatSettingsAdd()` (i.e., contains one or more items) or\n is empty and/or fully deleted (contains no value).\n\n Platform layer can rely and use this fact for optimizing\n its implementation.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aKey The key associated with the setting to change.\n @param[in] aValue A pointer to where the new value of the setting should be read from. MUST NOT be NULL\n if @p aValueLength is non-zero.\n @param[in] aValueLength The length of the data pointed to by @p aValue. May be zero.\n\n @retval OT_ERROR_NONE The given setting was added or staged to be added.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on this platform.\n @retval OT_ERROR_NO_BUFS No space remaining to store the given setting."]
14749 pub fn otPlatSettingsAdd(
14750 aInstance: *mut otInstance,
14751 aKey: u16,
14752 aValue: *const u8,
14753 aValueLength: u16,
14754 ) -> otError;
14755}
14756unsafe extern "C" {
14757 #[doc = " Removes a setting from the setting store.\n\n Deletes a specific value from the\n setting identified by aKey from the settings store.\n\n Note that the underlying implementation is not required\n to maintain the order of the items associated with a\n specific key.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aKey The key associated with the requested setting.\n @param[in] aIndex The index of the value to be removed. If set to -1, all values for this @p aKey will be\n removed.\n\n @retval OT_ERROR_NONE The given key and index was found and removed successfully.\n @retval OT_ERROR_NOT_FOUND The given key or index was not found in the setting store.\n @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on this platform."]
14758 pub fn otPlatSettingsDelete(
14759 aInstance: *mut otInstance,
14760 aKey: u16,
14761 aIndex: ::std::os::raw::c_int,
14762 ) -> otError;
14763}
14764unsafe extern "C" {
14765 #[doc = " Removes all settings from the setting store.\n\n Deletes all settings from the settings\n store, resetting it to its initial factory state.\n\n @param[in] aInstance The OpenThread instance structure."]
14766 pub fn otPlatSettingsWipe(aInstance: *mut otInstance);
14767}
14768#[doc = " Indicates that a SPI transaction has completed with the given length. The data written to the slave has been written\n to the pointer indicated by the `aInputBuf` argument to the previous call to `otPlatSpiSlavePrepareTransaction()`.\n\n Once this function is called, `otPlatSpiSlavePrepareTransaction()` is invalid and must be called again for the next\n transaction to be valid.\n\n Note that this function is always called at the end of a transaction, even if `otPlatSpiSlavePrepareTransaction()`\n has not yet been called. In such cases, `aOutputBufLen` and `aInputBufLen` will be zero.\n\n This callback can be called from ISR context. The return value from this function indicates if any further\n processing is required. If `TRUE` is returned the platform spi-slave driver implementation must invoke the\n transaction process callback (`aProcessCallback` set in `otPlatSpiSlaveEnable()`) which unlike this callback must be\n called from the same OS context that any other OpenThread API/callback is called.\n\n @param[in] aContext Context pointer passed into `otPlatSpiSlaveEnable()`.\n @param[in] aOutputBuf Value of `aOutputBuf` from last call to `otPlatSpiSlavePrepareTransaction()`.\n @param[in] aOutputBufLen Value of `aOutputBufLen` from last call to `otPlatSpiSlavePrepareTransaction()`.\n @param[in] aInputBuf Value of aInputBuf from last call to `otPlatSpiSlavePrepareTransaction()`.\n @param[in] aInputBufLen Value of aInputBufLen from last call to `otPlatSpiSlavePrepareTransaction()`\n @param[in] aTransactionLength Length of the completed transaction, in bytes.\n\n @returns TRUE if after this call returns the platform should invoke the process callback `aProcessCallback`,\n FALSE if there is nothing to process and no need to invoke the process callback."]
14769pub type otPlatSpiSlaveTransactionCompleteCallback = ::std::option::Option<
14770 unsafe extern "C" fn(
14771 aContext: *mut ::std::os::raw::c_void,
14772 aOutputBuf: *mut u8,
14773 aOutputBufLen: u16,
14774 aInputBuf: *mut u8,
14775 aInputBufLen: u16,
14776 aTransactionLength: u16,
14777 ) -> bool,
14778>;
14779#[doc = " Invoked after a transaction complete callback is called and returns `TRUE` to do any further processing required.\n Unlike `otPlatSpiSlaveTransactionCompleteCallback` which can be called from any OS context (e.g., ISR), this\n callback MUST be called from the same OS context as any other OpenThread API/callback.\n\n @param[in] aContext Context pointer passed into `otPlatSpiSlaveEnable()`."]
14780pub type otPlatSpiSlaveTransactionProcessCallback =
14781 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14782unsafe extern "C" {
14783 #[doc = " Initialize the SPI slave interface.\n\n Note that SPI slave is not fully ready until a transaction is prepared using `otPlatSPISlavePrepareTransaction()`.\n\n If `otPlatSPISlavePrepareTransaction() is not called before the master begins a transaction, the resulting SPI\n transaction will send all `0xFF` bytes and discard all received bytes.\n\n @param[in] aCompleteCallback Pointer to transaction complete callback.\n @param[in] aProcessCallback Pointer to process callback.\n @param[in] aContext Context pointer to be passed to callbacks.\n\n @retval OT_ERROR_NONE Successfully enabled the SPI Slave interface.\n @retval OT_ERROR_ALREADY SPI Slave interface is already enabled.\n @retval OT_ERROR_FAILED Failed to enable the SPI Slave interface."]
14784 pub fn otPlatSpiSlaveEnable(
14785 aCompleteCallback: otPlatSpiSlaveTransactionCompleteCallback,
14786 aProcessCallback: otPlatSpiSlaveTransactionProcessCallback,
14787 aContext: *mut ::std::os::raw::c_void,
14788 ) -> otError;
14789}
14790unsafe extern "C" {
14791 #[doc = " Shutdown and disable the SPI slave interface."]
14792 pub fn otPlatSpiSlaveDisable();
14793}
14794unsafe extern "C" {
14795 #[doc = " Prepare data for the next SPI transaction. Data pointers MUST remain valid until the transaction complete callback\n is called by the SPI slave driver, or until after the next call to `otPlatSpiSlavePrepareTransaction()`.\n\n May be called more than once before the SPI master initiates the transaction. Each *successful* call\n to this function will cause the previous values from earlier calls to be discarded.\n\n Not calling this function after a completed transaction is the same as if this function was previously called with\n both buffer lengths set to zero and `aRequestTransactionFlag` set to `false`.\n\n Once `aOutputBufLen` bytes of `aOutputBuf` has been clocked out, the MISO pin shall be set high until the master\n finishes the SPI transaction. This is the functional equivalent of padding the end of `aOutputBuf` with `0xFF` bytes\n out to the length of the transaction.\n\n Once `aInputBufLen` bytes of aInputBuf have been clocked in from MOSI, all subsequent values from the MOSI pin are\n ignored until the SPI master finishes the transaction.\n\n Note that even if `aInputBufLen` or `aOutputBufLen` (or both) are exhausted before the SPI master finishes a\n transaction, the ongoing size of the transaction must still be kept track of to be passed to the transaction\n complete callback. For example, if `aInputBufLen` is equal to 10 and `aOutputBufLen` equal to 20 and the SPI master\n clocks out 30 bytes, the value 30 is passed to the transaction complete callback.\n\n If a `NULL` pointer is passed in as `aOutputBuf` or `aInputBuf` it means that that buffer pointer should not change\n from its previous/current value. In this case, the corresponding length argument should be ignored. For example,\n `otPlatSpiSlavePrepareTransaction(NULL, 0, aInputBuf, aInputLen, false)` changes the input buffer pointer and its\n length but keeps the output buffer pointer same as before.\n\n Any call to this function while a transaction is in progress will cause all of the arguments to be ignored and the\n return value to be `OT_ERROR_BUSY`.\n\n @param[in] aOutputBuf Data to be written to MISO pin\n @param[in] aOutputBufLen Size of the output buffer, in bytes\n @param[in] aInputBuf Data to be read from MOSI pin\n @param[in] aInputBufLen Size of the input buffer, in bytes\n @param[in] aRequestTransactionFlag Set to true if host interrupt should be set\n\n @retval OT_ERROR_NONE Transaction was successfully prepared.\n @retval OT_ERROR_BUSY A transaction is currently in progress.\n @retval OT_ERROR_INVALID_STATE otPlatSpiSlaveEnable() hasn't been called."]
14796 pub fn otPlatSpiSlavePrepareTransaction(
14797 aOutputBuf: *mut u8,
14798 aOutputBufLen: u16,
14799 aInputBuf: *mut u8,
14800 aInputBufLen: u16,
14801 aRequestTransactionFlag: bool,
14802 ) -> otError;
14803}
14804unsafe extern "C" {
14805 #[doc = " Get the current platform time in microseconds referenced to a continuous\n monotonic local clock (64 bits width).\n\n The clock SHALL NOT wrap during the device's uptime. Implementations SHALL\n therefore identify and compensate for internal counter overflows. The clock\n does not have a defined epoch and it SHALL NOT introduce any continuous or\n discontinuous adjustments (e.g. leap seconds). Implementations SHALL\n compensate for any sleep times of the device.\n\n Implementations MAY choose to discipline the platform clock and compensate\n for sleep times by any means (e.g. by combining a high precision/low power\n RTC with a high resolution counter) as long as the exposed combined clock\n provides continuous monotonic microsecond resolution ticks within the\n accuracy limits announced by @ref otPlatTimeGetXtalAccuracy.\n\n @returns The current time in microseconds."]
14806 pub fn otPlatTimeGet() -> u64;
14807}
14808unsafe extern "C" {
14809 #[doc = " Get the current estimated worst case accuracy (maximum ± deviation from the\n nominal frequency) of the local platform clock in units of PPM.\n\n @note Implementations MAY estimate this value based on current operating\n conditions (e.g. temperature).\n\n In case the implementation does not estimate the current value but returns a\n fixed value, this value MUST be the worst-case accuracy over all possible\n foreseen operating conditions (temperature, pressure, etc) of the\n implementation.\n\n @returns The current platform clock accuracy, in PPM."]
14810 pub fn otPlatTimeGetXtalAccuracy() -> u16;
14811}
14812unsafe extern "C" {
14813 #[doc = " Initializes and enables TREL platform layer.\n\n Upon this call, the platform layer MUST perform the following:\n\n 1) TREL platform layer MUST open a UDP socket to listen for and receive TREL messages from peers. The socket is\n bound to an ephemeral port number chosen by the platform layer. The port number MUST be returned in @p aUdpPort.\n The socket is also bound to network interface(s) on which TREL is to be supported. The socket and the chosen port\n should stay valid while TREL is enabled.\n\n 2) If `OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE` is enabled, the OpenThread core TREL implementation itself will\n handle mDNS (DNS-SD) TREL service registration and peer discovery. Otherwise the platform layer MUST initiate an\n ongoing DNS-SD browse on the service name \"_trel._udp\" within the local browsing domain to discover other devices\n supporting TREL. The ongoing browse will produce two different types of events: \"add\" events and \"remove\" events.\n When the browse is started, it should produce an \"add\" event for every TREL peer currently present on the network.\n Whenever a TREL peer goes offline, a \"remove\" event should be produced. \"remove\" events are not guaranteed, however.\n When a TREL service instance is discovered, a new ongoing DNS-SD query for an AAAA record should be started on the\n hostname indicated in the SRV record of the discovered instance. If multiple host IPv6 addressees are discovered for\n a peer, one with highest scope among all addresses MUST be reported (if there are multiple address at same scope,\n one must be selected randomly). TREL platform MUST signal back the discovered peer info using\n `otPlatTrelHandleDiscoveredPeerInfo()` callback. This callback MUST be invoked when a new peer is discovered, when\n there is a change in an existing entry (e.g., new TXT record or new port number or new IPv6 address), or when the\n peer is removed.\n\n @param[in] aInstance The OpenThread instance.\n @param[out] aUdpPort A pointer to return the selected port number by platform layer."]
14814 pub fn otPlatTrelEnable(aInstance: *mut otInstance, aUdpPort: *mut u16);
14815}
14816unsafe extern "C" {
14817 #[doc = " Disables TREL platform layer.\n\n After this call, the platform layer MUST stop DNS-SD browse on the service name \"_trel._udp\", stop advertising the\n TREL DNS-SD service (from `otPlatTrelRegisterService()`) and MUST close the UDP socket used to receive TREL messages.\n\n @pram[in] aInstance The OpenThread instance."]
14818 pub fn otPlatTrelDisable(aInstance: *mut otInstance);
14819}
14820#[doc = " Represents a TREL peer info discovered using DNS-SD browse on the service name \"_trel._udp\"."]
14821#[repr(C)]
14822#[derive(Copy, Clone)]
14823pub struct otPlatTrelPeerInfo {
14824 #[doc = " This boolean flag indicates whether the entry is being removed or added.\n\n - TRUE indicates that peer is removed.\n - FALSE indicates that it is a new entry or an update to an existing entry."]
14825 pub mRemoved: bool,
14826 #[doc = " The TXT record data (encoded as specified by DNS-SD) from the SRV record of the discovered TREL peer service\n instance."]
14827 pub mTxtData: *const u8,
14828 #[doc = "< Number of bytes in @p mTxtData buffer."]
14829 pub mTxtLength: u16,
14830 #[doc = " The TREL peer socket address (IPv6 address and port number).\n\n The port number is determined from the SRV record of the discovered TREL peer service instance. The IPv6 address\n is determined from the DNS-SD query for AAAA records on the hostname indicated in the SRV record of the\n discovered service instance. If multiple host IPv6 addressees are discovered, one with highest scope is used."]
14831 pub mSockAddr: otSockAddr,
14832}
14833impl Default for otPlatTrelPeerInfo {
14834 fn default() -> Self {
14835 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14836 unsafe {
14837 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14838 s.assume_init()
14839 }
14840 }
14841}
14842unsafe extern "C" {
14843 #[doc = " This is a callback function from platform layer to report a discovered TREL peer info.\n\n This is only applicable when `OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE` is disabled.\n\n @note The @p aInfo structure and its content (e.g., the `mTxtData` buffer) does not need to persist after returning\n from this call. OpenThread code will make a copy of all the info it needs.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aInfo A pointer to the TREL peer info."]
14844 pub fn otPlatTrelHandleDiscoveredPeerInfo(
14845 aInstance: *mut otInstance,
14846 aInfo: *const otPlatTrelPeerInfo,
14847 );
14848}
14849unsafe extern "C" {
14850 #[doc = " Notifies platform that a TREL packet is received from a peer using a different socket address than the one reported\n earlier from `otPlatTrelHandleDiscoveredPeerInfo()`.\n\n This is only applicable when `OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE` is disabled.\n\n Ideally the platform underlying DNS-SD should detect changes to advertised port and addresses by peers, however,\n there are situations where this is not detected reliably. This function signals to the platform layer than we\n received a packet from a peer with it using a different port or address. This can be used by the playroom layer to\n restart/confirm the DNS-SD service/address resolution for the peer service and/or take any other relevant actions.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aPeerSockAddr The address of the peer, reported from `otPlatTrelHandleDiscoveredPeerInfo()` call.\n @param[in] aRxSockAddr The address of received packet from the same peer (differs from @p aPeerSockAddr)."]
14851 pub fn otPlatTrelNotifyPeerSocketAddressDifference(
14852 aInstance: *mut otInstance,
14853 aPeerSockAddr: *const otSockAddr,
14854 aRxSockAddr: *const otSockAddr,
14855 );
14856}
14857unsafe extern "C" {
14858 #[doc = " Registers a new service to be advertised using DNS-SD [RFC6763].\n\n This is only applicable when `OPENTHREAD_CONFIG_TREL_MANAGE_DNSSD_ENABLE` is disabled.\n\n The service name is \"_trel._udp\". The platform should use its own hostname, which when combined with the service\n name and the local DNS-SD domain name will produce the full service instance name, for example\n \"example-host._trel._udp.local.\".\n\n The domain under which the service instance name appears will be 'local' for mDNS, and will be whatever domain is\n used for service registration in the case of a non-mDNS local DNS-SD service.\n\n A subsequent call to this function updates the previous service. It is used to update the TXT record data and/or the\n port number.\n\n The @p aTxtData buffer is not persisted after the return from this function. The platform layer MUST NOT keep the\n pointer and instead copy the content if needed.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aPort The port number to include in the SRV record of the advertised service.\n @param[in] aTxtData A pointer to the TXT record data (encoded) to be include in the advertised service.\n @param[in] aTxtLength The length of @p aTxtData (number of bytes)."]
14859 pub fn otPlatTrelRegisterService(
14860 aInstance: *mut otInstance,
14861 aPort: u16,
14862 aTxtData: *const u8,
14863 aTxtLength: u8,
14864 );
14865}
14866unsafe extern "C" {
14867 #[doc = " Requests a TREL UDP packet to be sent to a given destination.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aUdpPayload A pointer to UDP payload.\n @param[in] aUdpPayloadLen The payload length (number of bytes).\n @param[in] aDestSockAddr The destination socket address."]
14868 pub fn otPlatTrelSend(
14869 aInstance: *mut otInstance,
14870 aUdpPayload: *const u8,
14871 aUdpPayloadLen: u16,
14872 aDestSockAddr: *const otSockAddr,
14873 );
14874}
14875unsafe extern "C" {
14876 #[doc = " Is a callback from platform to notify of a received TREL UDP packet.\n\n @note The buffer content (up to its specified length) may get changed during processing by OpenThread core (e.g.,\n decrypted in place), so the platform implementation should expect that after returning from this function the\n @p aBuffer content may have been altered.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aBuffer A buffer containing the received UDP payload.\n @param[in] aLength UDP payload length (number of bytes).\n @param[in] aSockAddr The sender address."]
14877 pub fn otPlatTrelHandleReceived(
14878 aInstance: *mut otInstance,
14879 aBuffer: *mut u8,
14880 aLength: u16,
14881 aSenderAddr: *const otSockAddr,
14882 );
14883}
14884#[doc = " Represents a group of TREL related counters in the platform layer."]
14885#[repr(C)]
14886#[derive(Debug, Default, Copy, Clone)]
14887pub struct otPlatTrelCounters {
14888 #[doc = "< Number of packets successfully transmitted through TREL."]
14889 pub mTxPackets: u64,
14890 #[doc = "< Sum of size of packets successfully transmitted through TREL."]
14891 pub mTxBytes: u64,
14892 #[doc = "< Number of packet transmission failures through TREL."]
14893 pub mTxFailure: u64,
14894 #[doc = "< Number of packets received through TREL."]
14895 pub mRxPackets: u64,
14896 #[doc = "< Sum of size of packets received through TREL."]
14897 pub mRxBytes: u64,
14898}
14899unsafe extern "C" {
14900 #[doc = " Gets the pointer to the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
14901 pub fn otPlatTrelGetCounters(aInstance: *mut otInstance) -> *const otPlatTrelCounters;
14902}
14903unsafe extern "C" {
14904 #[doc = " Resets the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
14905 pub fn otPlatTrelResetCounters(aInstance: *mut otInstance);
14906}
14907#[doc = " Represents a callback to handle a received UDP message.\n\n This callback is used by a UDP receiver (see `otUdpAddReceiver()`) to process an incoming UDP message.\n\n This callback does not transfer ownership of @p aMessage. The callback implementation must not modify the message\n content. The message is guaranteed to be valid only within the context of the callback.\n\n @param[in] aContext A pointer to the application-specific context.\n @param[in] aMessage A pointer to the received UDP message.\n @param[in] aMessageInfo A pointer to the IPv6 message info structure.\n\n @retval TRUE The message is handled by this receiver and should not be further processed.\n @retval FALSE The message is not handled by this receiver."]
14908pub type otUdpHandler = ::std::option::Option<
14909 unsafe extern "C" fn(
14910 aContext: *mut ::std::os::raw::c_void,
14911 aMessage: *const otMessage,
14912 aMessageInfo: *const otMessageInfo,
14913 ) -> bool,
14914>;
14915#[doc = " Represents a UDP receiver."]
14916#[repr(C)]
14917#[derive(Debug, Copy, Clone)]
14918pub struct otUdpReceiver {
14919 #[doc = "< A pointer to the next UDP receiver (internal use only)."]
14920 pub mNext: *mut otUdpReceiver,
14921 #[doc = "< A function pointer to the receiver callback."]
14922 pub mHandler: otUdpHandler,
14923 #[doc = "< A pointer to application-specific context."]
14924 pub mContext: *mut ::std::os::raw::c_void,
14925}
14926impl Default for otUdpReceiver {
14927 fn default() -> Self {
14928 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14929 unsafe {
14930 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14931 s.assume_init()
14932 }
14933 }
14934}
14935unsafe extern "C" {
14936 #[doc = " Adds a UDP receiver.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aUdpReceiver A pointer to the UDP receiver.\n\n @retval OT_ERROR_NONE The receiver is successfully added.\n @retval OT_ERROR_ALREADY The UDP receiver was already added."]
14937 pub fn otUdpAddReceiver(
14938 aInstance: *mut otInstance,
14939 aUdpReceiver: *mut otUdpReceiver,
14940 ) -> otError;
14941}
14942unsafe extern "C" {
14943 #[doc = " Removes a UDP receiver.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aUdpReceiver A pointer to the UDP receiver.\n\n @retval OT_ERROR_NONE The receiver is successfully removed.\n @retval OT_ERROR_NOT_FOUND The UDP receiver was not added."]
14944 pub fn otUdpRemoveReceiver(
14945 aInstance: *mut otInstance,
14946 aUdpReceiver: *mut otUdpReceiver,
14947 ) -> otError;
14948}
14949unsafe extern "C" {
14950 #[doc = " Sends a UDP message without socket.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to a message without UDP header.\n @param[in] aMessageInfo A pointer to a message info associated with @p aMessage.\n\n @retval OT_ERROR_NONE Successfully enqueued the message into an output interface.\n @retval OT_ERROR_NO_BUFS Insufficient available buffer to add the IPv6 headers.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given."]
14951 pub fn otUdpSendDatagram(
14952 aInstance: *mut otInstance,
14953 aMessage: *mut otMessage,
14954 aMessageInfo: *mut otMessageInfo,
14955 ) -> otError;
14956}
14957#[doc = " Callback function pointer to notify the application of a received UDP message on a UDP socket.\n\n This callback does not transfer ownership of @p aMessage. The callback implementation must not modify the message\n content. The message is guaranteed to be valid only within the context of the callback.\n\n @param[in] aContext A pointer to the application-specific context.\n @param[in] aMessage A pointer to the received UDP message.\n @param[in] aMessageInfo A pointer to the IPv6 message info structure."]
14958pub type otUdpReceive = ::std::option::Option<
14959 unsafe extern "C" fn(
14960 aContext: *mut ::std::os::raw::c_void,
14961 aMessage: *mut otMessage,
14962 aMessageInfo: *const otMessageInfo,
14963 ),
14964>;
14965#[doc = "< Unspecified network interface."]
14966pub const OT_NETIF_UNSPECIFIED: otNetifIdentifier = 0;
14967#[doc = "< The host Thread interface - allow use of platform UDP."]
14968pub const OT_NETIF_THREAD_HOST: otNetifIdentifier = 1;
14969#[doc = "< The internal Thread interface (within OpenThread) - do not use platform UDP."]
14970pub const OT_NETIF_THREAD_INTERNAL: otNetifIdentifier = 2;
14971#[doc = "< The Backbone interface."]
14972pub const OT_NETIF_BACKBONE: otNetifIdentifier = 3;
14973#[doc = " Defines the OpenThread network interface identifiers."]
14974pub type otNetifIdentifier = ::std::os::raw::c_uint;
14975#[doc = " Represents a UDP socket."]
14976#[repr(C)]
14977#[derive(Copy, Clone)]
14978pub struct otUdpSocket {
14979 #[doc = "< The local IPv6 socket address."]
14980 pub mSockName: otSockAddr,
14981 #[doc = "< The peer IPv6 socket address."]
14982 pub mPeerName: otSockAddr,
14983 #[doc = "< A function pointer to the application callback."]
14984 pub mHandler: otUdpReceive,
14985 #[doc = "< A pointer to application-specific context."]
14986 pub mContext: *mut ::std::os::raw::c_void,
14987 #[doc = "< A handle to platform's UDP."]
14988 pub mHandle: *mut ::std::os::raw::c_void,
14989 #[doc = "< A pointer to the next UDP socket (internal use only)."]
14990 pub mNext: *mut otUdpSocket,
14991 #[doc = "< The network interface identifier."]
14992 pub mNetifId: otNetifIdentifier,
14993}
14994impl Default for otUdpSocket {
14995 fn default() -> Self {
14996 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14997 unsafe {
14998 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14999 s.assume_init()
15000 }
15001 }
15002}
15003unsafe extern "C" {
15004 #[doc = " Allocate a new message buffer for sending a UDP message.\n\n @note If @p aSettings is 'NULL', the link layer security is enabled and the message priority is set to\n OT_MESSAGE_PRIORITY_NORMAL by default.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSettings A pointer to the message settings or NULL to use default settings.\n\n @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.\n\n @sa otMessageFree"]
15005 pub fn otUdpNewMessage(
15006 aInstance: *mut otInstance,
15007 aSettings: *const otMessageSettings,
15008 ) -> *mut otMessage;
15009}
15010unsafe extern "C" {
15011 #[doc = " Open a UDP/IPv6 socket.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n @param[in] aCallback A pointer to the application callback function.\n @param[in] aContext A pointer to application-specific context.\n\n @retval OT_ERROR_NONE Successfully opened the socket.\n @retval OT_ERROR_FAILED Failed to open the socket."]
15012 pub fn otUdpOpen(
15013 aInstance: *mut otInstance,
15014 aSocket: *mut otUdpSocket,
15015 aCallback: otUdpReceive,
15016 aContext: *mut ::std::os::raw::c_void,
15017 ) -> otError;
15018}
15019unsafe extern "C" {
15020 #[doc = " Check if a UDP socket is open.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n\n @returns Whether the UDP socket is open."]
15021 pub fn otUdpIsOpen(aInstance: *mut otInstance, aSocket: *const otUdpSocket) -> bool;
15022}
15023unsafe extern "C" {
15024 #[doc = " Close a UDP/IPv6 socket.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n\n @retval OT_ERROR_NONE Successfully closed the socket.\n @retval OT_ERROR_FAILED Failed to close UDP Socket."]
15025 pub fn otUdpClose(aInstance: *mut otInstance, aSocket: *mut otUdpSocket) -> otError;
15026}
15027unsafe extern "C" {
15028 #[doc = " Bind a UDP/IPv6 socket.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n @param[in] aSockName A pointer to an IPv6 socket address structure.\n @param[in] aNetif The network interface to bind.\n\n @retval OT_ERROR_NONE Bind operation was successful.\n @retval OT_ERROR_FAILED Failed to bind UDP socket."]
15029 pub fn otUdpBind(
15030 aInstance: *mut otInstance,
15031 aSocket: *mut otUdpSocket,
15032 aSockName: *const otSockAddr,
15033 aNetif: otNetifIdentifier,
15034 ) -> otError;
15035}
15036unsafe extern "C" {
15037 #[doc = " Connect a UDP/IPv6 socket.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n @param[in] aSockName A pointer to an IPv6 socket address structure.\n\n @retval OT_ERROR_NONE Connect operation was successful.\n @retval OT_ERROR_FAILED Failed to connect UDP socket."]
15038 pub fn otUdpConnect(
15039 aInstance: *mut otInstance,
15040 aSocket: *mut otUdpSocket,
15041 aSockName: *const otSockAddr,
15042 ) -> otError;
15043}
15044unsafe extern "C" {
15045 #[doc = " Send a UDP/IPv6 message.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSocket A pointer to a UDP socket structure.\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aMessageInfo A pointer to a message info structure.\n\n If the return value is OT_ERROR_NONE, OpenThread takes ownership of @p aMessage, and the caller should no longer\n reference @p aMessage. If the return value is not OT_ERROR_NONE, the caller retains ownership of @p aMessage,\n including freeing @p aMessage if the message buffer is no longer needed.\n\n @retval OT_ERROR_NONE The message is successfully scheduled for sending.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments are given.\n @retval OT_ERROR_NO_BUFS Insufficient available buffer to add the UDP and IPv6 headers."]
15046 pub fn otUdpSend(
15047 aInstance: *mut otInstance,
15048 aSocket: *mut otUdpSocket,
15049 aMessage: *mut otMessage,
15050 aMessageInfo: *const otMessageInfo,
15051 ) -> otError;
15052}
15053unsafe extern "C" {
15054 #[doc = " Gets the head of linked list of UDP Sockets.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the head of UDP Socket linked list."]
15055 pub fn otUdpGetSockets(aInstance: *mut otInstance) -> *mut otUdpSocket;
15056}
15057#[doc = " Pointer delivers the UDP packet to host and host should send the packet through its own network stack.\n\n @param[in] aMessage A pointer to the UDP Message.\n @param[in] aPeerPort The destination UDP port.\n @param[in] aPeerAddr A pointer to the destination IPv6 address.\n @param[in] aSockPort The source UDP port.\n @param[in] aContext A pointer to application-specific context."]
15058pub type otUdpForwarder = ::std::option::Option<
15059 unsafe extern "C" fn(
15060 aMessage: *mut otMessage,
15061 aPeerPort: u16,
15062 aPeerAddr: *mut otIp6Address,
15063 aSockPort: u16,
15064 aContext: *mut ::std::os::raw::c_void,
15065 ),
15066>;
15067unsafe extern "C" {
15068 #[doc = " Set UDP forward callback to deliver UDP packets to host.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aForwarder A pointer to a function called to forward UDP packet to host.\n @param[in] aContext A pointer to application-specific context."]
15069 pub fn otUdpForwardSetForwarder(
15070 aInstance: *mut otInstance,
15071 aForwarder: otUdpForwarder,
15072 aContext: *mut ::std::os::raw::c_void,
15073 );
15074}
15075unsafe extern "C" {
15076 #[doc = " Handle a UDP packet received from host.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to the UDP Message.\n @param[in] aPeerPort The source UDP port.\n @param[in] aPeerAddr A pointer to the source address.\n @param[in] aSockPort The destination UDP port.\n\n @warning No matter the call success or fail, the message is freed."]
15077 pub fn otUdpForwardReceive(
15078 aInstance: *mut otInstance,
15079 aMessage: *mut otMessage,
15080 aPeerPort: u16,
15081 aPeerAddr: *const otIp6Address,
15082 aSockPort: u16,
15083 );
15084}
15085unsafe extern "C" {
15086 #[doc = " Determines if the given UDP port is exclusively opened by OpenThread API.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] port UDP port number to verify.\n\n @retval true The port is being used exclusively by OpenThread.\n @retval false The port is not used by any of the OpenThread API or is shared (e.g. is Backbone socket)."]
15087 pub fn otUdpIsPortInUse(aInstance: *mut otInstance, port: u16) -> bool;
15088}
15089unsafe extern "C" {
15090 #[doc = " Initializes the UDP socket by platform.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n\n @retval OT_ERROR_NONE Successfully initialized UDP socket by platform.\n @retval OT_ERROR_FAILED Failed to initialize UDP Socket."]
15091 pub fn otPlatUdpSocket(aUdpSocket: *mut otUdpSocket) -> otError;
15092}
15093unsafe extern "C" {
15094 #[doc = " Closes the UDP socket by platform.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n\n @retval OT_ERROR_NONE Successfully closed UDP socket by platform.\n @retval OT_ERROR_FAILED Failed to close UDP Socket."]
15095 pub fn otPlatUdpClose(aUdpSocket: *mut otUdpSocket) -> otError;
15096}
15097unsafe extern "C" {
15098 #[doc = " Binds the UDP socket by platform.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n\n @retval OT_ERROR_NONE Successfully bound UDP socket by platform.\n @retval OT_ERROR_FAILED Failed to bind UDP socket."]
15099 pub fn otPlatUdpBind(aUdpSocket: *mut otUdpSocket) -> otError;
15100}
15101unsafe extern "C" {
15102 #[doc = " Binds the UDP socket to a platform network interface.\n\n Note: only available when `OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE` is used.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n @param[in] aNetifIdentifier The network interface identifier.\n\n @retval OT_ERROR_NONE Successfully bound UDP socket.\n @retval OT_ERROR_FAILED Failed to bind UDP."]
15103 pub fn otPlatUdpBindToNetif(
15104 aUdpSocket: *mut otUdpSocket,
15105 aNetifIdentifier: otNetifIdentifier,
15106 ) -> otError;
15107}
15108unsafe extern "C" {
15109 #[doc = " Connects UDP socket by platform.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n\n @retval OT_ERROR_NONE Successfully connected by platform.\n @retval OT_ERROR_FAILED Failed to connect UDP socket."]
15110 pub fn otPlatUdpConnect(aUdpSocket: *mut otUdpSocket) -> otError;
15111}
15112unsafe extern "C" {
15113 #[doc = " Sends UDP payload by platform.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n @param[in] aMessage A pointer to the message to send.\n @param[in] aMessageInfo A pointer to the message info associated with @p aMessage.\n\n @retval OT_ERROR_NONE Successfully sent by platform, and @p aMessage is freed.\n @retval OT_ERROR_FAILED Failed to bind UDP socket."]
15114 pub fn otPlatUdpSend(
15115 aUdpSocket: *mut otUdpSocket,
15116 aMessage: *mut otMessage,
15117 aMessageInfo: *const otMessageInfo,
15118 ) -> otError;
15119}
15120unsafe extern "C" {
15121 #[doc = " Configures the UDP socket to join a UDP multicast group.\n\n Note: only available when `OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE` is used.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n @param[in] aNetifIdentifier The network interface identifier.\n @param[in] aAddress The UDP multicast group address.\n\n @retval OT_ERROR_NONE Successfully joined the multicast group.\n @retval OT_ERROR_FAILED Failed to join the multicast group."]
15122 pub fn otPlatUdpJoinMulticastGroup(
15123 aUdpSocket: *mut otUdpSocket,
15124 aNetifIdentifier: otNetifIdentifier,
15125 aAddress: *const otIp6Address,
15126 ) -> otError;
15127}
15128unsafe extern "C" {
15129 #[doc = " Configures the UDP socket to leave a UDP multicast group.\n\n Note: only available when `OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE` is used.\n\n @param[in] aUdpSocket A pointer to the UDP socket.\n @param[in] aNetifIdentifier The network interface identifier.\n @param[in] aAddress The UDP multicast group address.\n\n @retval OT_ERROR_NONE Successfully left the multicast group.\n @retval OT_ERROR_FAILED Failed to leave the multicast group."]
15130 pub fn otPlatUdpLeaveMulticastGroup(
15131 aUdpSocket: *mut otUdpSocket,
15132 aNetifIdentifier: otNetifIdentifier,
15133 aAddress: *const otIp6Address,
15134 ) -> otError;
15135}
15136unsafe extern "C" {
15137 #[doc = " Fills a given buffer with cryptographically secure random bytes.\n\n @param[out] aBuffer A pointer to a buffer to fill with the random bytes.\n @param[in] aSize Size of buffer (number of bytes to fill)."]
15138 pub fn otRandomCryptoFillBuffer(aBuffer: *mut u8, aSize: u16) -> otError;
15139}
15140unsafe extern "C" {
15141 #[doc = " Generates and returns a random `uint32_t` value.\n\n @returns A random `uint32_t` value."]
15142 pub fn otRandomNonCryptoGetUint32() -> u32;
15143}
15144unsafe extern "C" {
15145 #[doc = " Generates and returns a random byte.\n\n @returns A random `uint8_t` value."]
15146 pub fn otRandomNonCryptoGetUint8() -> u8;
15147}
15148unsafe extern "C" {
15149 #[doc = " Generates and returns a random `uint16_t` value.\n\n @returns A random `uint16_t` value."]
15150 pub fn otRandomNonCryptoGetUint16() -> u16;
15151}
15152unsafe extern "C" {
15153 #[doc = " Generates and returns a random `uint8_t` value within a given range `[aMin, aMax)`.\n\n @param[in] aMin A minimum value (this value can be included in returned random result).\n @param[in] aMax A maximum value (this value is excluded from returned random result).\n\n @returns A random `uint8_t` value in the given range (i.e., aMin <= random value < aMax)."]
15154 pub fn otRandomNonCryptoGetUint8InRange(aMin: u8, aMax: u8) -> u8;
15155}
15156unsafe extern "C" {
15157 #[doc = " Generates and returns a random `uint16_t` value within a given range `[aMin, aMax)`.\n\n @note The returned random value can include the @p aMin value but excludes the @p aMax.\n\n @param[in] aMin A minimum value (this value can be included in returned random result).\n @param[in] aMax A maximum value (this value is excluded from returned random result).\n\n @returns A random `uint16_t` value in the given range (i.e., aMin <= random value < aMax)."]
15158 pub fn otRandomNonCryptoGetUint16InRange(aMin: u16, aMax: u16) -> u16;
15159}
15160unsafe extern "C" {
15161 #[doc = " Generates and returns a random `uint32_t` value within a given range `[aMin, aMax)`.\n\n @note The returned random value can include the @p aMin value but excludes the @p aMax.\n\n @param[in] aMin A minimum value (this value can be included in returned random result).\n @param[in] aMax A maximum value (this value is excluded from returned random result).\n\n @returns A random `uint32_t` value in the given range (i.e., aMin <= random value < aMax)."]
15162 pub fn otRandomNonCryptoGetUint32InRange(aMin: u32, aMax: u32) -> u32;
15163}
15164unsafe extern "C" {
15165 #[doc = " Fills a given buffer with random bytes.\n\n @param[out] aBuffer A pointer to a buffer to fill with the random bytes.\n @param[in] aSize Size of buffer (number of bytes to fill)."]
15166 pub fn otRandomNonCryptoFillBuffer(aBuffer: *mut u8, aSize: u16);
15167}
15168unsafe extern "C" {
15169 #[doc = " Adds a random jitter within a given range to a given value.\n\n @param[in] aValue A value to which the random jitter is added.\n @param[in] aJitter Maximum jitter. Random jitter is selected from the range `[-aJitter, aJitter]`.\n\n @returns The given value with an added random jitter."]
15170 pub fn otRandomNonCryptoAddJitter(aValue: u32, aJitter: u16) -> u32;
15171}
15172unsafe extern "C" {
15173 #[doc = " Provides a full or stable copy of the local Thread Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.\n @param[out] aData A pointer to the data buffer.\n @param[in,out] aDataLength On entry, size of the data buffer pointed to by @p aData.\n On exit, number of copied bytes."]
15174 pub fn otServerGetNetDataLocal(
15175 aInstance: *mut otInstance,
15176 aStable: bool,
15177 aData: *mut u8,
15178 aDataLength: *mut u8,
15179 ) -> otError;
15180}
15181unsafe extern "C" {
15182 #[doc = " Add a service configuration to the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aConfig A pointer to the service configuration.\n\n @retval OT_ERROR_NONE Successfully added the configuration to the local network data.\n @retval OT_ERROR_INVALID_ARGS One or more configuration parameters were invalid.\n @retval OT_ERROR_NO_BUFS Not enough room is available to add the configuration to the local network data.\n\n @sa otServerRemoveService\n @sa otServerRegister"]
15183 pub fn otServerAddService(
15184 aInstance: *mut otInstance,
15185 aConfig: *const otServiceConfig,
15186 ) -> otError;
15187}
15188unsafe extern "C" {
15189 #[doc = " Remove a service configuration from the local network data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnterpriseNumber Enterprise Number of the service entry to be deleted.\n @param[in] aServiceData A pointer to an Service Data to look for during deletion.\n @param[in] aServiceDataLength The length of @p aServiceData in bytes.\n\n @retval OT_ERROR_NONE Successfully removed the configuration from the local network data.\n @retval OT_ERROR_NOT_FOUND Could not find the Border Router entry.\n\n @sa otServerAddService\n @sa otServerRegister"]
15190 pub fn otServerRemoveService(
15191 aInstance: *mut otInstance,
15192 aEnterpriseNumber: u32,
15193 aServiceData: *const u8,
15194 aServiceDataLength: u8,
15195 ) -> otError;
15196}
15197unsafe extern "C" {
15198 #[doc = " Gets the next service in the local Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in,out] aIterator A pointer to the Network Data iterator context. To get the first service entry\nit should be set to OT_NETWORK_DATA_ITERATOR_INIT.\n @param[out] aConfig A pointer to where the service information will be placed.\n\n @retval OT_ERROR_NONE Successfully found the next service.\n @retval OT_ERROR_NOT_FOUND No subsequent service exists in the Thread Network Data."]
15199 pub fn otServerGetNextService(
15200 aInstance: *mut otInstance,
15201 aIterator: *mut otNetworkDataIterator,
15202 aConfig: *mut otServiceConfig,
15203 ) -> otError;
15204}
15205unsafe extern "C" {
15206 #[doc = " Immediately register the local network data with the Leader.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully queued a Server Data Request message for delivery.\n\n @sa otServerAddService\n @sa otServerRemoveService"]
15207 pub fn otServerRegister(aInstance: *mut otInstance) -> otError;
15208}
15209#[doc = " Implements SNTP Query parameters."]
15210#[repr(C)]
15211#[derive(Debug, Copy, Clone)]
15212pub struct otSntpQuery {
15213 #[doc = "< A reference to the message info related with SNTP Server."]
15214 pub mMessageInfo: *const otMessageInfo,
15215}
15216impl Default for otSntpQuery {
15217 fn default() -> Self {
15218 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15219 unsafe {
15220 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15221 s.assume_init()
15222 }
15223 }
15224}
15225#[doc = " Pointer is called when a SNTP response is received.\n\n @param[in] aContext A pointer to application-specific context.\n @param[in] aTime Specifies the time at the server when the response left for the client, in UNIX time.\n @param[in] aResult A result of the SNTP transaction.\n\n @retval OT_ERROR_NONE A response was received successfully and time is provided\n in @p aTime.\n @retval OT_ERROR_ABORT A SNTP transaction was aborted by stack.\n @retval OT_ERROR_BUSY The Kiss-o'-death packet has been received.\n @retval OT_ERROR_RESPONSE_TIMEOUT No SNTP response has been received within timeout.\n @retval OT_ERROR_FAILED A response was received but contains incorrect data."]
15226pub type otSntpResponseHandler = ::std::option::Option<
15227 unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void, aTime: u64, aResult: otError),
15228>;
15229unsafe extern "C" {
15230 #[doc = " Sends a SNTP query.\n\n Is available only if feature `OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aQuery A pointer to specify SNTP query parameters.\n @param[in] aHandler A function pointer that shall be called on response reception or time-out.\n @param[in] aContext A pointer to arbitrary context information."]
15231 pub fn otSntpClientQuery(
15232 aInstance: *mut otInstance,
15233 aQuery: *const otSntpQuery,
15234 aHandler: otSntpResponseHandler,
15235 aContext: *mut ::std::os::raw::c_void,
15236 ) -> otError;
15237}
15238unsafe extern "C" {
15239 #[doc = " Sets the unix era number.\n\n The default value of unix era is set to 0. The subsequent eras start after year 2106.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aUnixEra Unix era number."]
15240 pub fn otSntpClientSetUnixEra(aInstance: *mut otInstance, aUnixEra: u32);
15241}
15242#[doc = "< Item to be added/registered."]
15243pub const OT_SRP_CLIENT_ITEM_STATE_TO_ADD: otSrpClientItemState = 0;
15244#[doc = "< Item is being added/registered."]
15245pub const OT_SRP_CLIENT_ITEM_STATE_ADDING: otSrpClientItemState = 1;
15246#[doc = "< Item to be refreshed (re-register to renew lease)."]
15247pub const OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: otSrpClientItemState = 2;
15248#[doc = "< Item is being refreshed."]
15249pub const OT_SRP_CLIENT_ITEM_STATE_REFRESHING: otSrpClientItemState = 3;
15250#[doc = "< Item to be removed."]
15251pub const OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: otSrpClientItemState = 4;
15252#[doc = "< Item is being removed."]
15253pub const OT_SRP_CLIENT_ITEM_STATE_REMOVING: otSrpClientItemState = 5;
15254#[doc = "< Item is registered with server."]
15255pub const OT_SRP_CLIENT_ITEM_STATE_REGISTERED: otSrpClientItemState = 6;
15256#[doc = "< Item is removed."]
15257pub const OT_SRP_CLIENT_ITEM_STATE_REMOVED: otSrpClientItemState = 7;
15258#[doc = " Specifies an SRP client item (service or host info) state."]
15259pub type otSrpClientItemState = ::std::os::raw::c_uint;
15260#[doc = " Represents an SRP client host info."]
15261#[repr(C)]
15262#[derive(Debug, Copy, Clone)]
15263pub struct otSrpClientHostInfo {
15264 #[doc = "< Host name (label) string (NULL if not yet set)."]
15265 pub mName: *const ::std::os::raw::c_char,
15266 #[doc = "< Array of host IPv6 addresses (NULL if not set or auto address is enabled)."]
15267 pub mAddresses: *const otIp6Address,
15268 #[doc = "< Number of IPv6 addresses in `mAddresses` array."]
15269 pub mNumAddresses: u8,
15270 #[doc = "< Indicates whether auto address mode is enabled or not."]
15271 pub mAutoAddress: bool,
15272 #[doc = "< Host info state."]
15273 pub mState: otSrpClientItemState,
15274}
15275impl Default for otSrpClientHostInfo {
15276 fn default() -> Self {
15277 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15278 unsafe {
15279 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15280 s.assume_init()
15281 }
15282 }
15283}
15284#[doc = " Represents an SRP client service.\n\n The values in this structure, including the string buffers for the names and the TXT record entries, MUST persist\n and stay constant after an instance of this structure is passed to OpenThread from `otSrpClientAddService()` or\n `otSrpClientRemoveService()`.\n\n The `mState`, `mData`, `mNext` fields are used/managed by OT core only. Their value is ignored when an instance of\n `otSrpClientService` is passed in `otSrpClientAddService()` or `otSrpClientRemoveService()` or other functions. The\n caller does not need to set these fields.\n\n The `mLease` and `mKeyLease` fields specify the desired lease and key lease intervals for this service. Zero value\n indicates that the interval is unspecified and then the default lease or key lease intervals from\n `otSrpClientGetLeaseInterval()` and `otSrpClientGetKeyLeaseInterval()` are used for this service. If the key lease\n interval (whether set explicitly or determined from the default) is shorter than the lease interval for a service,\n SRP client will re-use the lease interval value for key lease interval as well. For example, if in service `mLease`\n is explicitly set to 2 days and `mKeyLease` is set to zero and default key lease is set to 1 day, then when\n registering this service, the requested key lease for this service is also set to 2 days."]
15285#[repr(C)]
15286#[derive(Debug, Copy, Clone)]
15287pub struct otSrpClientService {
15288 #[doc = "< The service labels (e.g., \"_mt._udp\", not the full domain name)."]
15289 pub mName: *const ::std::os::raw::c_char,
15290 #[doc = "< The service instance name label (not the full name)."]
15291 pub mInstanceName: *const ::std::os::raw::c_char,
15292 #[doc = "< Array of sub-type labels (must end with `NULL` or can be `NULL`)."]
15293 pub mSubTypeLabels: *const *const ::std::os::raw::c_char,
15294 #[doc = "< Array of TXT entries (`mNumTxtEntries` gives num of entries)."]
15295 pub mTxtEntries: *const otDnsTxtEntry,
15296 #[doc = "< The service port number."]
15297 pub mPort: u16,
15298 #[doc = "< The service priority."]
15299 pub mPriority: u16,
15300 #[doc = "< The service weight."]
15301 pub mWeight: u16,
15302 #[doc = "< Number of entries in the `mTxtEntries` array."]
15303 pub mNumTxtEntries: u8,
15304 #[doc = "< Service state (managed by OT core)."]
15305 pub mState: otSrpClientItemState,
15306 #[doc = "< Internal data (used by OT core)."]
15307 pub mData: u32,
15308 #[doc = "< Pointer to next entry in a linked-list (managed by OT core)."]
15309 pub mNext: *mut otSrpClientService,
15310 #[doc = "< Desired lease interval in sec - zero to use default."]
15311 pub mLease: u32,
15312 #[doc = "< Desired key lease interval in sec - zero to use default."]
15313 pub mKeyLease: u32,
15314}
15315impl Default for otSrpClientService {
15316 fn default() -> Self {
15317 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15318 unsafe {
15319 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15320 s.assume_init()
15321 }
15322 }
15323}
15324#[doc = " Pointer type defines the callback used by SRP client to notify user of changes/events/errors.\n\n This callback is invoked on a successful registration of an update (i.e., add/remove of host-info and/or some\n service(s)) with the SRP server, or if there is a failure or error (e.g., server rejects a update request or client\n times out waiting for response, etc).\n\n In case of a successful reregistration of an update, `aError` parameter would be `OT_ERROR_NONE` and the host info\n and the full list of services is provided as input parameters to the callback. Note that host info and services each\n track its own state in the corresponding `mState` member variable of the related data structure (the state\n indicating whether the host-info/service is registered or removed or still being added/removed, etc).\n\n The list of removed services is passed as its own linked-list `aRemovedServices` in the callback. Note that when the\n callback is invoked, the SRP client (OpenThread implementation) is done with the removed service instances listed in\n `aRemovedServices` and no longer tracks/stores them (i.e., if from the callback we call `otSrpClientGetServices()`\n the removed services will not be present in the returned list). Providing a separate list of removed services in\n the callback helps indicate to user which items are now removed and allow user to re-claim/reuse the instances.\n\n If the server rejects an SRP update request, the DNS response code (RFC 2136) is mapped to the following errors:\n\n - (0) NOERROR Success (no error condition) -> OT_ERROR_NONE\n - (1) FORMERR Server unable to interpret due to format error -> OT_ERROR_PARSE\n - (2) SERVFAIL Server encountered an internal failure -> OT_ERROR_FAILED\n - (3) NXDOMAIN Name that ought to exist, does not exist -> OT_ERROR_NOT_FOUND\n - (4) NOTIMP Server does not support the query type (OpCode) -> OT_ERROR_NOT_IMPLEMENTED\n - (5) REFUSED Server refused for policy/security reasons -> OT_ERROR_SECURITY\n - (6) YXDOMAIN Some name that ought not to exist, does exist -> OT_ERROR_DUPLICATED\n - (7) YXRRSET Some RRset that ought not to exist, does exist -> OT_ERROR_DUPLICATED\n - (8) NXRRSET Some RRset that ought to exist, does not exist -> OT_ERROR_NOT_FOUND\n - (9) NOTAUTH Service is not authoritative for zone -> OT_ERROR_SECURITY\n - (10) NOTZONE A name is not in the zone -> OT_ERROR_PARSE\n - (20) BADNAME Bad name -> OT_ERROR_PARSE\n - (21) BADALG Bad algorithm -> OT_ERROR_SECURITY\n - (22) BADTRUN Bad truncation -> OT_ERROR_PARSE\n - Other response codes -> OT_ERROR_FAILED\n\n The following errors are also possible:\n\n - OT_ERROR_RESPONSE_TIMEOUT : Timed out waiting for response from server (client would continue to retry).\n - OT_ERROR_INVALID_ARGS : The provided service structure is invalid (e.g., bad service name or `otDnsTxtEntry`).\n - OT_ERROR_NO_BUFS : Insufficient buffer to prepare or send the update message.\n\n Note that in case of any failure, the client continues the operation, i.e. it prepares and (re)transmits the SRP\n update message to the server, after some wait interval. The retry wait interval starts from the minimum value and\n is increased by the growth factor every failure up to the max value (please see configuration parameter\n `OPENTHREAD_CONFIG_SRP_CLIENT_MIN_RETRY_WAIT_INTERVAL` and the related ones for more details).\n\n @param[in] aError The error (see above).\n @param[in] aHostInfo A pointer to host info.\n @param[in] aServices The head of linked-list containing all services (excluding the ones removed). NULL if\n the list is empty.\n @param[in] aRemovedServices The head of linked-list containing all removed services. NULL if the list is empty.\n @param[in] aContext A pointer to an arbitrary context (provided when callback was registered)."]
15325pub type otSrpClientCallback = ::std::option::Option<
15326 unsafe extern "C" fn(
15327 aError: otError,
15328 aHostInfo: *const otSrpClientHostInfo,
15329 aServices: *const otSrpClientService,
15330 aRemovedServices: *const otSrpClientService,
15331 aContext: *mut ::std::os::raw::c_void,
15332 ),
15333>;
15334#[doc = " Pointer type defines the callback used by SRP client to notify user when it is auto-started or stopped.\n\n This is only used when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.\n\n This callback is invoked when auto-start mode is enabled and the SRP client is either automatically started or\n stopped.\n\n @param[in] aServerSockAddr A non-NULL pointer indicates SRP server was started and pointer will give the\n selected server socket address. A NULL pointer indicates SRP server was stopped.\n @param[in] aContext A pointer to an arbitrary context (provided when callback was registered)."]
15335pub type otSrpClientAutoStartCallback = ::std::option::Option<
15336 unsafe extern "C" fn(aServerSockAddr: *const otSockAddr, aContext: *mut ::std::os::raw::c_void),
15337>;
15338unsafe extern "C" {
15339 #[doc = " Starts the SRP client operation.\n\n SRP client will prepare and send \"SRP Update\" message to the SRP server once all the following conditions are met:\n\n - The SRP client is started - `otSrpClientStart()` is called.\n - Host name is set - `otSrpClientSetHostName()` is called.\n - At least one host IPv6 address is set - `otSrpClientSetHostAddresses()` is called.\n - At least one service is added - `otSrpClientAddService()` is called.\n\n It does not matter in which order these functions are called. When all conditions are met, the SRP client will\n wait for a short delay before preparing an \"SRP Update\" message and sending it to server. This delay allows for user\n to add multiple services and/or IPv6 addresses before the first SRP Update message is sent (ensuring a single SRP\n Update is sent containing all the info). The config `OPENTHREAD_CONFIG_SRP_CLIENT_UPDATE_TX_DELAY` specifies the\n delay interval.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aServerSockAddr The socket address (IPv6 address and port number) of the SRP server.\n\n @retval OT_ERROR_NONE SRP client operation started successfully or it is already running with same server\n socket address and callback.\n @retval OT_ERROR_BUSY SRP client is busy running with a different socket address.\n @retval OT_ERROR_FAILED Failed to open/connect the client's UDP socket."]
15340 pub fn otSrpClientStart(
15341 aInstance: *mut otInstance,
15342 aServerSockAddr: *const otSockAddr,
15343 ) -> otError;
15344}
15345unsafe extern "C" {
15346 #[doc = " Stops the SRP client operation.\n\n Stops any further interactions with the SRP server. Note that it does not remove or clear host info\n and/or list of services. It marks all services to be added/removed again once the client is (re)started.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15347 pub fn otSrpClientStop(aInstance: *mut otInstance);
15348}
15349unsafe extern "C" {
15350 #[doc = " Indicates whether the SRP client is running or not.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns TRUE if the SRP client is running, FALSE otherwise."]
15351 pub fn otSrpClientIsRunning(aInstance: *mut otInstance) -> bool;
15352}
15353unsafe extern "C" {
15354 #[doc = " Gets the socket address (IPv6 address and port number) of the SRP server which is being used by SRP\n client.\n\n If the client is not running, the address is unspecified (all zero) with zero port number.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to the SRP server's socket address (is always non-NULL)."]
15355 pub fn otSrpClientGetServerAddress(aInstance: *mut otInstance) -> *const otSockAddr;
15356}
15357unsafe extern "C" {
15358 #[doc = " Sets the callback to notify caller of events/changes from SRP client.\n\n The SRP client allows a single callback to be registered. So consecutive calls to this function will overwrite any\n previously set callback functions.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aCallback The callback to notify of events and changes. Can be NULL if not needed.\n @param[in] aContext An arbitrary context used with @p aCallback."]
15359 pub fn otSrpClientSetCallback(
15360 aInstance: *mut otInstance,
15361 aCallback: otSrpClientCallback,
15362 aContext: *mut ::std::os::raw::c_void,
15363 );
15364}
15365unsafe extern "C" {
15366 #[doc = " Enables the auto-start mode.\n\n This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.\n\n Config option `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE` specifies the default auto-start mode (whether\n it is enabled or disabled at the start of OT stack).\n\n When auto-start is enabled, the SRP client will monitor the Thread Network Data to discover SRP servers and select\n the preferred server and automatically start and stop the client when an SRP server is detected.\n\n There are three categories of Network Data entries indicating presence of SRP sever. They are preferred in the\n following order:\n\n 1) Preferred unicast entries where server address is included in the service data. If there are multiple options,\n the one with numerically lowest IPv6 address is preferred.\n\n 2) Anycast entries each having a seq number. A larger sequence number in the sense specified by Serial Number\n Arithmetic logic in RFC-1982 is considered more recent and therefore preferred. The largest seq number using\n serial number arithmetic is preferred if it is well-defined (i.e., the seq number is larger than all other\n seq numbers). If it is not well-defined, then the numerically largest seq number is preferred.\n\n 3) Unicast entries where the server address info is included in server data. If there are multiple options, the\n one with numerically lowest IPv6 address is preferred.\n\n When there is a change in the Network Data entries, client will check that the currently selected server is still\n present in the Network Data and is still the preferred one. Otherwise the client will switch to the new preferred\n server or stop if there is none.\n\n When the SRP client is explicitly started through a successful call to `otSrpClientStart()`, the given SRP server\n address in `otSrpClientStart()` will continue to be used regardless of the state of auto-start mode and whether the\n same SRP server address is discovered or not in the Thread Network Data. In this case, only an explicit\n `otSrpClientStop()` call will stop the client.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aCallback A callback to notify when client is auto-started/stopped. Can be NULL if not needed.\n @param[in] aContext A context to be passed when invoking @p aCallback."]
15367 pub fn otSrpClientEnableAutoStartMode(
15368 aInstance: *mut otInstance,
15369 aCallback: otSrpClientAutoStartCallback,
15370 aContext: *mut ::std::os::raw::c_void,
15371 );
15372}
15373unsafe extern "C" {
15374 #[doc = " Disables the auto-start mode.\n\n This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.\n\n Disabling the auto-start mode will not stop the client if it is already running but the client stops monitoring\n the Thread Network Data to verify that the selected SRP server is still present in it.\n\n Note that a call to `otSrpClientStop()` will also disable the auto-start mode.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15375 pub fn otSrpClientDisableAutoStartMode(aInstance: *mut otInstance);
15376}
15377unsafe extern "C" {
15378 #[doc = " Indicates the current state of auto-start mode (enabled or disabled).\n\n This is only available when auto-start feature `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns TRUE if the auto-start mode is enabled, FALSE otherwise."]
15379 pub fn otSrpClientIsAutoStartModeEnabled(aInstance: *mut otInstance) -> bool;
15380}
15381unsafe extern "C" {
15382 #[doc = " Gets the TTL value in every record included in SRP update requests.\n\n Note that this is the TTL requested by the SRP client. The server may choose to accept a different TTL.\n\n By default, the TTL will equal the lease interval. Passing 0 or a value larger than the lease interval via\n `otSrpClientSetTtl()` will also cause the TTL to equal the lease interval.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The TTL (in seconds)."]
15383 pub fn otSrpClientGetTtl(aInstance: *mut otInstance) -> u32;
15384}
15385unsafe extern "C" {
15386 #[doc = " Sets the TTL value in every record included in SRP update requests.\n\n Changing the TTL does not impact the TTL of already registered services/host-info.\n It only affects future SRP update messages (i.e., adding new services and/or refreshes of the existing services).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aTtl The TTL (in seconds). If value is zero or greater than lease interval, the TTL is set to the\n lease interval."]
15387 pub fn otSrpClientSetTtl(aInstance: *mut otInstance, aTtl: u32);
15388}
15389unsafe extern "C" {
15390 #[doc = " Gets the default lease interval used in SRP update requests.\n\n The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.\n\n Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease\n interval.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The lease interval (in seconds)."]
15391 pub fn otSrpClientGetLeaseInterval(aInstance: *mut otInstance) -> u32;
15392}
15393unsafe extern "C" {
15394 #[doc = " Sets the default lease interval used in SRP update requests.\n\n The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.\n\n Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.\n It only affects any future SRP update messages (i.e., adding new services and/or refreshes of the existing services).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aInterval The lease interval (in seconds). If zero, the default value specified by\n `OPENTHREAD_CONFIG_SRP_CLIENT_DEFAULT_LEASE` would be used."]
15395 pub fn otSrpClientSetLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15396}
15397unsafe extern "C" {
15398 #[doc = " Gets the default key lease interval used in SRP update requests.\n\n The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.\n\n Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease\n interval.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The key lease interval (in seconds)."]
15399 pub fn otSrpClientGetKeyLeaseInterval(aInstance: *mut otInstance) -> u32;
15400}
15401unsafe extern "C" {
15402 #[doc = " Sets the default key lease interval used in SRP update requests.\n\n The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.\n\n Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.\n It only affects any future SRP update messages (i.e., adding new services and/or refreshes of existing services).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aInterval The key lease interval (in seconds). If zero, the default value specified by\n `OPENTHREAD_CONFIG_SRP_CLIENT_DEFAULT_KEY_LEASE` would be used."]
15403 pub fn otSrpClientSetKeyLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15404}
15405unsafe extern "C" {
15406 #[doc = " Gets the host info.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to host info structure."]
15407 pub fn otSrpClientGetHostInfo(aInstance: *mut otInstance) -> *const otSrpClientHostInfo;
15408}
15409unsafe extern "C" {
15410 #[doc = " Sets the host name label.\n\n After a successful call to this function, `otSrpClientCallback` will be called to report the status of host info\n registration with SRP server.\n\n The name string buffer pointed to by @p aName MUST persist and stay unchanged after returning from this function.\n OpenThread will keep the pointer to the string.\n\n The host name can be set before client is started or after start but before host info is registered with server\n (host info should be in either `STATE_TO_ADD` or `STATE_REMOVED`).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aName A pointer to host name label string (MUST NOT be NULL). Pointer to the string buffer MUST\n persist and remain valid and constant after return from this function.\n\n @retval OT_ERROR_NONE The host name label was set successfully.\n @retval OT_ERROR_INVALID_ARGS The @p aName is NULL.\n @retval OT_ERROR_INVALID_STATE The host name is already set and registered with the server."]
15411 pub fn otSrpClientSetHostName(
15412 aInstance: *mut otInstance,
15413 aName: *const ::std::os::raw::c_char,
15414 ) -> otError;
15415}
15416unsafe extern "C" {
15417 #[doc = " Enables auto host address mode.\n\n When enabled host IPv6 addresses are automatically set by SRP client using all the preferred unicast addresses on\n Thread netif excluding all link-local and mesh-local addresses. If there is no preferred address, then Mesh Local\n EID address is added. The SRP client will automatically re-register when/if addresses on Thread netif are updated\n (new addresses are added or existing addresses are removed or marked as non-preferred).\n\n The auto host address mode can be enabled before start or during operation of SRP client except when the host info\n is being removed (client is busy handling a remove request from an call to `otSrpClientRemoveHostAndServices()` and\n host info still being in either `STATE_TO_REMOVE` or `STATE_REMOVING` states).\n\n After auto host address mode is enabled, it can be disabled by a call to `otSrpClientSetHostAddresses()` which\n then explicitly sets the host addresses.\n\n @retval OT_ERROR_NONE Successfully enabled auto host address mode.\n @retval OT_ERROR_INVALID_STATE Host is being removed and therefore cannot enable auto host address mode."]
15418 pub fn otSrpClientEnableAutoHostAddress(aInstance: *mut otInstance) -> otError;
15419}
15420unsafe extern "C" {
15421 #[doc = " Sets/updates the list of host IPv6 address.\n\n Host IPv6 addresses can be set/changed before start or during operation of SRP client (e.g. to add/remove or change\n a previously registered host address), except when the host info is being removed (client is busy handling a remove\n request from an earlier call to `otSrpClientRemoveHostAndServices()` and host info still being in either\n `STATE_TO_REMOVE` or `STATE_REMOVING` states).\n\n The host IPv6 address array pointed to by @p aIp6Addresses MUST persist and remain unchanged after returning from\n this function (with `OT_ERROR_NONE`). OpenThread will save the pointer to the array.\n\n After a successful call to this function, `otSrpClientCallback` will be called to report the status of the address\n registration with SRP server.\n\n Calling this function disables auto host address mode if it was previously enabled from a successful call to\n `otSrpClientEnableAutoHostAddress()`.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aIp6Addresses A pointer to the an array containing the host IPv6 addresses.\n @param[in] aNumAddresses The number of addresses in the @p aIp6Addresses array.\n\n @retval OT_ERROR_NONE The host IPv6 address list change started successfully. The `otSrpClientCallback`\n will be called to report the status of registering addresses with server.\n @retval OT_ERROR_INVALID_ARGS The address list is invalid (e.g., must contain at least one address).\n @retval OT_ERROR_INVALID_STATE Host is being removed and therefore cannot change host address."]
15422 pub fn otSrpClientSetHostAddresses(
15423 aInstance: *mut otInstance,
15424 aIp6Addresses: *const otIp6Address,
15425 aNumAddresses: u8,
15426 ) -> otError;
15427}
15428unsafe extern "C" {
15429 #[doc = " Adds a service to be registered with server.\n\n After a successful call to this function, `otSrpClientCallback` will be called to report the status of the service\n addition/registration with SRP server.\n\n The `otSrpClientService` instance being pointed to by @p aService MUST persist and remain unchanged after returning\n from this function (with `OT_ERROR_NONE`). OpenThread will save the pointer to the service instance.\n\n The `otSrpClientService` instance is not longer tracked by OpenThread and can be reclaimed only when\n\n - It is removed explicitly by a call to `otSrpClientRemoveService()` or removed along with other services by a\n call to `otSrpClientRemoveHostAndServices() and only after the `otSrpClientCallback` is called indicating the\n service was removed. Or,\n - A call to `otSrpClientClearHostAndServices()` which removes the host and all related services immediately.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aService A pointer to a `otSrpClientService` instance to add.\n\n @retval OT_ERROR_NONE The addition of service started successfully. The `otSrpClientCallback` will be\n called to report the status.\n @retval OT_ERROR_ALREADY A service with the same service and instance names is already in the list.\n @retval OT_ERROR_INVALID_ARGS The service structure is invalid (e.g., bad service name or `otDnsTxtEntry`)."]
15430 pub fn otSrpClientAddService(
15431 aInstance: *mut otInstance,
15432 aService: *mut otSrpClientService,
15433 ) -> otError;
15434}
15435unsafe extern "C" {
15436 #[doc = " Requests a service to be unregistered with server.\n\n After a successful call to this function, `otSrpClientCallback` will be called to report the status of remove\n request with SRP server.\n\n The `otSrpClientService` instance being pointed to by @p aService MUST persist and remain unchanged after returning\n from this function (with `OT_ERROR_NONE`). OpenThread will keep the service instance during the remove process.\n Only after the `otSrpClientCallback` is called indicating the service instance is removed from SRP client\n service list and can be be freed/reused.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aService A pointer to a `otSrpClientService` instance to remove.\n\n @retval OT_ERROR_NONE The removal of service started successfully. The `otSrpClientCallback` will be called to\n report the status.\n @retval OT_ERROR_NOT_FOUND The service could not be found in the list."]
15437 pub fn otSrpClientRemoveService(
15438 aInstance: *mut otInstance,
15439 aService: *mut otSrpClientService,
15440 ) -> otError;
15441}
15442unsafe extern "C" {
15443 #[doc = " Clears a service, immediately removing it from the client service list.\n\n Unlike `otSrpClientRemoveService()` which sends an update message to the server to remove the service, this function\n clears the service from the client's service list without any interaction with the server. On a successful call to\n this function, the `otSrpClientCallback` will NOT be called and the @p aService entry can be reclaimed and re-used\n by the caller immediately.\n\n Can be used along with a subsequent call to `otSrpClientAddService()` (potentially reusing the same @p\n aService entry with the same service and instance names) to update some of the parameters in an existing service.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aService A pointer to a `otSrpClientService` instance to delete.\n\n @retval OT_ERROR_NONE The @p aService is deleted successfully. It can be reclaimed and re-used immediately.\n @retval OT_ERROR_NOT_FOUND The service could not be found in the list."]
15444 pub fn otSrpClientClearService(
15445 aInstance: *mut otInstance,
15446 aService: *mut otSrpClientService,
15447 ) -> otError;
15448}
15449unsafe extern "C" {
15450 #[doc = " Gets the list of services being managed by client.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to the head of linked-list of all services or NULL if the list is empty."]
15451 pub fn otSrpClientGetServices(aInstance: *mut otInstance) -> *const otSrpClientService;
15452}
15453unsafe extern "C" {
15454 #[doc = " Starts the remove process of the host info and all services.\n\n After returning from this function, `otSrpClientCallback` will be called to report the status of remove request with\n SRP server.\n\n If the host info is to be permanently removed from server, @p aRemoveKeyLease should be set to `true` which removes\n the key lease associated with host on server. Otherwise, the key lease record is kept as before, which ensures\n that the server holds the host name in reserve for when the client is once again able to provide and register its\n service(s).\n\n The @p aSendUnregToServer determines the behavior when the host info is not yet registered with the server. If\n @p aSendUnregToServer is set to `false` (which is the default/expected value) then the SRP client will immediately\n remove the host info and services without sending an update message to server (no need to update the server if\n nothing is yet registered with it). If @p aSendUnregToServer is set to `true` then the SRP client will send an\n update message to the server. Note that if the host info is registered then the value of @p aSendUnregToServer does\n not matter and the SRP client will always send an update message to server requesting removal of all info.\n\n One situation where @p aSendUnregToServer can be useful is on a device reset/reboot, caller may want to remove any\n previously registered services with the server. In this case, caller can `otSrpClientSetHostName()` and then request\n `otSrpClientRemoveHostAndServices()` with `aSendUnregToServer` as `true`.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aRemoveKeyLease A boolean indicating whether or not the host key lease should also be removed.\n @param[in] aSendUnregToServer A boolean indicating whether to send update to server when host info is not registered.\n\n @retval OT_ERROR_NONE The removal of host info and services started successfully. The `otSrpClientCallback`\n will be called to report the status.\n @retval OT_ERROR_ALREADY The host info is already removed."]
15455 pub fn otSrpClientRemoveHostAndServices(
15456 aInstance: *mut otInstance,
15457 aRemoveKeyLease: bool,
15458 aSendUnregToServer: bool,
15459 ) -> otError;
15460}
15461unsafe extern "C" {
15462 #[doc = " Clears all host info and all the services.\n\n Unlike `otSrpClientRemoveHostAndServices()` which sends an update message to the server to remove all the info, this\n function clears all the info immediately without any interaction with the server.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15463 pub fn otSrpClientClearHostAndServices(aInstance: *mut otInstance);
15464}
15465unsafe extern "C" {
15466 #[doc = " Gets the domain name being used by SRP client.\n\n Requires `OPENTHREAD_CONFIG_SRP_CLIENT_DOMAIN_NAME_API_ENABLE` to be enabled.\n\n If domain name is not set, \"default.service.arpa\" will be used.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns The domain name string."]
15467 pub fn otSrpClientGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15468}
15469unsafe extern "C" {
15470 #[doc = " Sets the domain name to be used by SRP client.\n\n Requires `OPENTHREAD_CONFIG_SRP_CLIENT_DOMAIN_NAME_API_ENABLE` to be enabled.\n\n If not set \"default.service.arpa\" will be used.\n\n The name string buffer pointed to by @p aName MUST persist and stay unchanged after returning from this function.\n OpenThread will keep the pointer to the string.\n\n The domain name can be set before client is started or after start but before host info is registered with server\n (host info should be in either `STATE_TO_ADD` or `STATE_TO_REMOVE`).\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aName A pointer to the domain name string. If NULL sets it to default \"default.service.arpa\".\n\n @retval OT_ERROR_NONE The domain name label was set successfully.\n @retval OT_ERROR_INVALID_STATE The host info is already registered with server."]
15471 pub fn otSrpClientSetDomainName(
15472 aInstance: *mut otInstance,
15473 aName: *const ::std::os::raw::c_char,
15474 ) -> otError;
15475}
15476unsafe extern "C" {
15477 #[doc = " Converts a `otSrpClientItemState` to a string.\n\n @param[in] aItemState An item state.\n\n @returns A string representation of @p aItemState."]
15478 pub fn otSrpClientItemStateToString(
15479 aItemState: otSrpClientItemState,
15480 ) -> *const ::std::os::raw::c_char;
15481}
15482unsafe extern "C" {
15483 #[doc = " Enables/disables \"service key record inclusion\" mode.\n\n When enabled, SRP client will include KEY record in Service Description Instructions in the SRP update messages\n that it sends.\n\n Is available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` configuration is enabled.\n\n @note KEY record is optional in Service Description Instruction (it is required and always included in the Host\n Description Instruction). The default behavior of SRP client is to not include it. This function is intended to\n override the default behavior for testing only.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aEnabled TRUE to enable, FALSE to disable the \"service key record inclusion\" mode."]
15484 pub fn otSrpClientSetServiceKeyRecordEnabled(aInstance: *mut otInstance, aEnabled: bool);
15485}
15486unsafe extern "C" {
15487 #[doc = " Indicates whether the \"service key record inclusion\" mode is enabled or disabled.\n\n Is available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` configuration is enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns TRUE if \"service key record inclusion\" mode is enabled, FALSE otherwise."]
15488 pub fn otSrpClientIsServiceKeyRecordEnabled(aInstance: *mut otInstance) -> bool;
15489}
15490#[doc = " Represents a SRP client service pool entry."]
15491#[repr(C)]
15492#[derive(Debug, Copy, Clone)]
15493pub struct otSrpClientBuffersServiceEntry {
15494 #[doc = "< The SRP client service structure."]
15495 pub mService: otSrpClientService,
15496 #[doc = "< The SRP client TXT entry."]
15497 pub mTxtEntry: otDnsTxtEntry,
15498}
15499impl Default for otSrpClientBuffersServiceEntry {
15500 fn default() -> Self {
15501 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15502 unsafe {
15503 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15504 s.assume_init()
15505 }
15506 }
15507}
15508unsafe extern "C" {
15509 #[doc = " Gets the string buffer to use for SRP client host name.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aSize Pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be\n NULL).\n\n @returns A pointer to char buffer to use for SRP client host name."]
15510 pub fn otSrpClientBuffersGetHostNameString(
15511 aInstance: *mut otInstance,
15512 aSize: *mut u16,
15513 ) -> *mut ::std::os::raw::c_char;
15514}
15515unsafe extern "C" {
15516 #[doc = " Gets the array of IPv6 address entries to use as SRP client host address list.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[out] aArrayLength Pointer to a variable to return the array length i.e., number of IPv6 address entries in\n the array (MUST NOT be NULL).\n\n @returns A pointer to an array of `otIp6Address` entries (number of entries is returned in @p aArrayLength)."]
15517 pub fn otSrpClientBuffersGetHostAddressesArray(
15518 aInstance: *mut otInstance,
15519 aArrayLength: *mut u8,
15520 ) -> *mut otIp6Address;
15521}
15522unsafe extern "C" {
15523 #[doc = " Allocates a new service entry from the pool.\n\n The returned service entry instance will be initialized as follows:\n\n - `mService.mName` will point to an allocated string buffer which can be retrieved using the function\n `otSrpClientBuffersGetServiceEntryServiceNameString()`.\n - `mService.mInstanceName` will point to an allocated string buffer which can be retrieved using the function\n `otSrpClientBuffersGetServiceEntryInstanceNameString()`.\n - `mService.mSubTypeLabels` points to an array that is returned from `otSrpClientBuffersGetSubTypeLabelsArray()`.\n - `mService.mTxtEntries` will point to `mTxtEntry`.\n - `mService.mNumTxtEntries` will be set to one.\n - Other `mService` fields (port, priority, weight) are set to zero.\n - `mTxtEntry.mKey` is set to NULL (value is treated as already encoded).\n - `mTxtEntry.mValue` will point to an allocated buffer which can be retrieved using the function\n `otSrpClientBuffersGetServiceEntryTxtBuffer()`.\n - `mTxtEntry.mValueLength` is set to zero.\n - All related data/string buffers and arrays are cleared to all zero.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @returns A pointer to the newly allocated service entry or NULL if not more entry available in the pool."]
15524 pub fn otSrpClientBuffersAllocateService(
15525 aInstance: *mut otInstance,
15526 ) -> *mut otSrpClientBuffersServiceEntry;
15527}
15528unsafe extern "C" {
15529 #[doc = " Frees a previously allocated service entry.\n\n The @p aService MUST be previously allocated using `otSrpClientBuffersAllocateService()` and not yet freed. Otherwise\n the behavior of this function is undefined.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aService A pointer to the service entry to free (MUST NOT be NULL)."]
15530 pub fn otSrpClientBuffersFreeService(
15531 aInstance: *mut otInstance,
15532 aService: *mut otSrpClientBuffersServiceEntry,
15533 );
15534}
15535unsafe extern "C" {
15536 #[doc = " Frees all previously allocated service entries.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15537 pub fn otSrpClientBuffersFreeAllServices(aInstance: *mut otInstance);
15538}
15539unsafe extern "C" {
15540 #[doc = " Gets the string buffer for service name from a service entry.\n\n @param[in] aEntry A pointer to a previously allocated service entry (MUST NOT be NULL).\n @param[out] aSize A pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be\n NULL).\n\n @returns A pointer to the string buffer."]
15541 pub fn otSrpClientBuffersGetServiceEntryServiceNameString(
15542 aEntry: *mut otSrpClientBuffersServiceEntry,
15543 aSize: *mut u16,
15544 ) -> *mut ::std::os::raw::c_char;
15545}
15546unsafe extern "C" {
15547 #[doc = " Gets the string buffer for service instance name from a service entry.\n\n @param[in] aEntry A pointer to a previously allocated service entry (MUST NOT be NULL).\n @param[out] aSize A pointer to a variable to return the size (number of bytes) of the string buffer (MUST NOT be\n NULL).\n\n @returns A pointer to the string buffer."]
15548 pub fn otSrpClientBuffersGetServiceEntryInstanceNameString(
15549 aEntry: *mut otSrpClientBuffersServiceEntry,
15550 aSize: *mut u16,
15551 ) -> *mut ::std::os::raw::c_char;
15552}
15553unsafe extern "C" {
15554 #[doc = " Gets the buffer for TXT record from a service entry.\n\n @param[in] aEntry A pointer to a previously allocated service entry (MUST NOT be NULL).\n @param[out] aSize A pointer to a variable to return the size (number of bytes) of the buffer (MUST NOT be NULL).\n\n @returns A pointer to the buffer."]
15555 pub fn otSrpClientBuffersGetServiceEntryTxtBuffer(
15556 aEntry: *mut otSrpClientBuffersServiceEntry,
15557 aSize: *mut u16,
15558 ) -> *mut u8;
15559}
15560unsafe extern "C" {
15561 #[doc = " Gets the array for service subtype labels from the service entry.\n\n @param[in] aEntry A pointer to a previously allocated service entry (MUST NOT be NULL).\n @param[out] aArrayLength A pointer to a variable to return the array length (MUST NOT be NULL).\n\n @returns A pointer to the array."]
15562 pub fn otSrpClientBuffersGetSubTypeLabelsArray(
15563 aEntry: *mut otSrpClientBuffersServiceEntry,
15564 aArrayLength: *mut u16,
15565 ) -> *mut *const ::std::os::raw::c_char;
15566}
15567#[repr(C)]
15568#[derive(Debug, Copy, Clone)]
15569pub struct otSrpServerHost {
15570 _unused: [u8; 0],
15571}
15572#[repr(C)]
15573#[derive(Debug, Copy, Clone)]
15574pub struct otSrpServerService {
15575 _unused: [u8; 0],
15576}
15577#[doc = " The ID of a SRP service update transaction on the SRP Server."]
15578pub type otSrpServerServiceUpdateId = u32;
15579#[doc = "< The SRP server is disabled."]
15580pub const OT_SRP_SERVER_STATE_DISABLED: otSrpServerState = 0;
15581#[doc = "< The SRP server is enabled and running."]
15582pub const OT_SRP_SERVER_STATE_RUNNING: otSrpServerState = 1;
15583#[doc = "< The SRP server is enabled but stopped."]
15584pub const OT_SRP_SERVER_STATE_STOPPED: otSrpServerState = 2;
15585#[doc = " Represents the state of the SRP server."]
15586pub type otSrpServerState = ::std::os::raw::c_uint;
15587#[doc = "< Unicast address mode. Use Network Data publisher."]
15588pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST: otSrpServerAddressMode = 0;
15589#[doc = "< Anycast address mode. Use Network Data publisher"]
15590pub const OT_SRP_SERVER_ADDRESS_MODE_ANYCAST: otSrpServerAddressMode = 1;
15591#[doc = "< Unicast address mode. Immediately force add to Network Data."]
15592pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD: otSrpServerAddressMode = 2;
15593#[doc = " Represents the address mode used by the SRP server.\n\n Address mode specifies how the address and port number are determined by the SRP server and how this info is\n published in the Thread Network Data.\n\n @warning Using the `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` option will make the implementation\n non-compliant with the Thread specification. This option is intended for testing and specific use-cases.\n When selected, the SRP server, upon being enabled, will bypass the Network Data publisher and always add the\n \"SRP/DNS unicast\" entry directly to the Network Data, regardless of how many other similar entries are present."]
15594pub type otSrpServerAddressMode = ::std::os::raw::c_uint;
15595#[doc = " Includes SRP server TTL configurations."]
15596#[repr(C)]
15597#[derive(Debug, Default, Copy, Clone)]
15598pub struct otSrpServerTtlConfig {
15599 #[doc = "< The minimum TTL in seconds."]
15600 pub mMinTtl: u32,
15601 #[doc = "< The maximum TTL in seconds."]
15602 pub mMaxTtl: u32,
15603}
15604#[doc = " Includes SRP server LEASE and KEY-LEASE configurations."]
15605#[repr(C)]
15606#[derive(Debug, Default, Copy, Clone)]
15607pub struct otSrpServerLeaseConfig {
15608 #[doc = "< The minimum LEASE interval in seconds."]
15609 pub mMinLease: u32,
15610 #[doc = "< The maximum LEASE interval in seconds."]
15611 pub mMaxLease: u32,
15612 #[doc = "< The minimum KEY-LEASE interval in seconds."]
15613 pub mMinKeyLease: u32,
15614 #[doc = "< The maximum KEY-LEASE interval in seconds."]
15615 pub mMaxKeyLease: u32,
15616}
15617#[doc = " Includes SRP server lease information of a host/service."]
15618#[repr(C)]
15619#[derive(Debug, Default, Copy, Clone)]
15620pub struct otSrpServerLeaseInfo {
15621 #[doc = "< The lease time of a host/service in milliseconds."]
15622 pub mLease: u32,
15623 #[doc = "< The key lease time of a host/service in milliseconds."]
15624 pub mKeyLease: u32,
15625 #[doc = "< The remaining lease time of the host/service in milliseconds."]
15626 pub mRemainingLease: u32,
15627 #[doc = "< The remaining key lease time of a host/service in milliseconds."]
15628 pub mRemainingKeyLease: u32,
15629}
15630#[doc = " Includes the statistics of SRP server responses."]
15631#[repr(C)]
15632#[derive(Debug, Default, Copy, Clone)]
15633pub struct otSrpServerResponseCounters {
15634 #[doc = "< The number of successful responses."]
15635 pub mSuccess: u32,
15636 #[doc = "< The number of server failure responses."]
15637 pub mServerFailure: u32,
15638 #[doc = "< The number of format error responses."]
15639 pub mFormatError: u32,
15640 #[doc = "< The number of 'name exists' responses."]
15641 pub mNameExists: u32,
15642 #[doc = "< The number of refused responses."]
15643 pub mRefused: u32,
15644 #[doc = "< The number of other responses."]
15645 pub mOther: u32,
15646}
15647unsafe extern "C" {
15648 #[doc = " Returns the domain authorized to the SRP server.\n\n If the domain if not set by SetDomain, \"default.service.arpa.\" will be returned.\n A trailing dot is always appended even if the domain is set without it.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the dot-joined domain string."]
15649 pub fn otSrpServerGetDomain(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15650}
15651unsafe extern "C" {
15652 #[doc = " Sets the domain on the SRP server.\n\n A trailing dot will be appended to @p aDomain if it is not already there.\n Should only be called before the SRP server is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDomain The domain to be set. MUST NOT be NULL.\n\n @retval OT_ERROR_NONE Successfully set the domain to @p aDomain.\n @retval OT_ERROR_INVALID_STATE The SRP server is already enabled and the Domain cannot be changed.\n @retval OT_ERROR_INVALID_ARGS The argument @p aDomain is not a valid DNS domain name.\n @retval OT_ERROR_NO_BUFS There is no memory to store content of @p aDomain."]
15653 pub fn otSrpServerSetDomain(
15654 aInstance: *mut otInstance,
15655 aDomain: *const ::std::os::raw::c_char,
15656 ) -> otError;
15657}
15658unsafe extern "C" {
15659 #[doc = " Returns the state of the SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The current state of the SRP server."]
15660 pub fn otSrpServerGetState(aInstance: *mut otInstance) -> otSrpServerState;
15661}
15662unsafe extern "C" {
15663 #[doc = " Returns the port the SRP server is listening to.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The port of the SRP server. It returns 0 if the server is not running."]
15664 pub fn otSrpServerGetPort(aInstance: *mut otInstance) -> u16;
15665}
15666unsafe extern "C" {
15667 #[doc = " Returns the address mode being used by the SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The SRP server's address mode."]
15668 pub fn otSrpServerGetAddressMode(aInstance: *mut otInstance) -> otSrpServerAddressMode;
15669}
15670unsafe extern "C" {
15671 #[doc = " Sets the address mode to be used by the SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMode The address mode to use.\n\n @retval OT_ERROR_NONE Successfully set the address mode.\n @retval OT_ERROR_INVALID_STATE The SRP server is enabled and the address mode cannot be changed."]
15672 pub fn otSrpServerSetAddressMode(
15673 aInstance: *mut otInstance,
15674 aMode: otSrpServerAddressMode,
15675 ) -> otError;
15676}
15677unsafe extern "C" {
15678 #[doc = " Returns the sequence number used with anycast address mode.\n\n The sequence number is included in \"DNS/SRP Service Anycast Address\" entry published in the Network Data.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The anycast sequence number."]
15679 pub fn otSrpServerGetAnycastModeSequenceNumber(aInstance: *mut otInstance) -> u8;
15680}
15681unsafe extern "C" {
15682 #[doc = " Sets the sequence number used with anycast address mode.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aSequenceNumber The sequence number to use.\n\n @retval OT_ERROR_NONE Successfully set the address mode.\n @retval OT_ERROR_INVALID_STATE The SRP server is enabled and the sequence number cannot be changed."]
15683 pub fn otSrpServerSetAnycastModeSequenceNumber(
15684 aInstance: *mut otInstance,
15685 aSequenceNumber: u8,
15686 ) -> otError;
15687}
15688unsafe extern "C" {
15689 #[doc = " Enables/disables the SRP server.\n\n On a Border Router, it is recommended to use `otSrpServerSetAutoEnableMode()` instead.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled A boolean to enable/disable the SRP server."]
15690 pub fn otSrpServerSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
15691}
15692unsafe extern "C" {
15693 #[doc = " Enables/disables the auto-enable mode on SRP server.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.\n\n When this mode is enabled, the Border Routing Manager controls if/when to enable or disable the SRP server.\n SRP sever is auto-enabled if/when Border Routing is started and it is done with the initial prefix and route\n configurations (when the OMR and on-link prefixes are determined, advertised in emitted Router Advertisement message\n on infrastructure side and published in the Thread Network Data). The SRP server is auto-disabled if/when BR is\n stopped (e.g., if the infrastructure network interface is brought down or if BR gets detached).\n\n This mode can be disabled by a `otSrpServerSetAutoEnableMode()` call with @p aEnabled set to `false` or if the SRP\n server is explicitly enabled or disabled by a call to `otSrpServerSetEnabled()` function. Disabling auto-enable mode\n using `otSrpServerSetAutoEnableMode(false)` will not change the current state of SRP sever (e.g., if it is enabled\n it stays enabled).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled A boolean to enable/disable the auto-enable mode."]
15694 pub fn otSrpServerSetAutoEnableMode(aInstance: *mut otInstance, aEnabled: bool);
15695}
15696unsafe extern "C" {
15697 #[doc = " Indicates whether the auto-enable mode is enabled or disabled.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` feature.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The auto-enable mode is enabled.\n @retval FALSE The auto-enable mode is disabled."]
15698 pub fn otSrpServerIsAutoEnableMode(aInstance: *mut otInstance) -> bool;
15699}
15700unsafe extern "C" {
15701 #[doc = " Enables the \"Fast Start Mode\" on the SRP server.\n\n Requires the `OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE` feature to be enabled.\n\n The Fast Start Mode is designed for scenarios where a device, often a mobile device, needs to act as a provisional\n SRP server (e.g., functioning as a temporary Border Router). The SRP server function is enabled only if no other\n Border Routers (BRs) are already providing the SRP service within the Thread network. A common use case is a mobile\n device joining a Thread network where it may be the first, or only, BR. Importantly, Fast Start Mode allows the\n device to quickly start its SRP server functionality upon joining the network, allowing other Thread devices to\n quickly connect and register their services without the typical delays associated with standard Border Router\n initialization (and SRP server startup).\n\n When Fast Start Mode is enabled, the SRP server manages when to start or stop based on the presence of other BRs,\n following this process:\n - Upon initial attachment to the Thread network, the device immediately inspects the received Network Data for any\n existing \"SRP/DNS\" entries. These entries indicate the presence of other active BRs providing SRP server service:\n - If no \"SRP/DNS\" entries from other BRs are found, the device immediately enables its own SRP server. This\n activation uses `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD`, which bypasses the usual delay associated with\n the standard Network Data publisher, directly adding its own \"SRP/DNS unicast\" entry to the Network Data.\n - If \"SRP/DNS\" entries from other BRs are detected, the device will not enable its SRP server, deferring to the\n existing ones.\n - After starting its SRP server in Fast Start Mode, the device continuously monitors the Network Data. If, at any\n point, new \"SRP/DNS\" entries appear (indicating that another BR has become active), the device automatically\n disables its own SRP server functionality, relinquishing the role to the newly available BR.\n\n The Fast Start Mode can be enabled when the device is in the detached or disabled state, the SRP server is currently\n disabled, and \"auto-enable mode\" is not in use (i.e., `otSrpServerIsAutoEnableMode()` returns `false`).\n\n After successfully enabling Fast Start Mode, it can be disabled either by a call to `otSrpServerSetEnabled()`,\n explicitly enabling or disabling the SRP server, or by a call to `otSrpServerSetAutoEnableMode()`, enabling or\n disabling the auto-enable mode. If the Fast Start Mode (while active) enables the SRP server, upon disabling\n Fast Start Mode (regardless of how it is done), the SRP server will also be stopped, and the use of the\n `OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD` address mode will be stopped, and the address mode will be\n automatically reverted back to its previous setting before Fast Start Mode was enabled.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n\n @retval OT_ERROR_NONE Fast Start Mode was successfully enabled.\n @retval OT_ERROR_INVALID_STATE Cannot enable Fast Start Mode (e.g., already attached or server already enabled)."]
15702 pub fn otSrpServerEnableFastStartMode(aInstance: *mut otInstance) -> otError;
15703}
15704unsafe extern "C" {
15705 #[doc = " Indicates whether the Fast Start Mode is enabled or disabled.\n\n Requires `OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE` feature to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE The fast-start mode is enabled.\n @retval FALSE The fast-start mode is disabled."]
15706 pub fn otSrpServerIsFastStartModeEnabled(aInstance: *mut otInstance) -> bool;
15707}
15708unsafe extern "C" {
15709 #[doc = " Returns SRP server TTL configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aTtlConfig A pointer to an `otSrpServerTtlConfig` instance."]
15710 pub fn otSrpServerGetTtlConfig(
15711 aInstance: *mut otInstance,
15712 aTtlConfig: *mut otSrpServerTtlConfig,
15713 );
15714}
15715unsafe extern "C" {
15716 #[doc = " Sets SRP server TTL configuration.\n\n The granted TTL will always be no greater than the max lease interval configured via `otSrpServerSetLeaseConfig()`,\n regardless of the minimum and maximum TTL configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTtlConfig A pointer to an `otSrpServerTtlConfig` instance.\n\n @retval OT_ERROR_NONE Successfully set the TTL configuration.\n @retval OT_ERROR_INVALID_ARGS The TTL configuration is not valid."]
15717 pub fn otSrpServerSetTtlConfig(
15718 aInstance: *mut otInstance,
15719 aTtlConfig: *const otSrpServerTtlConfig,
15720 ) -> otError;
15721}
15722unsafe extern "C" {
15723 #[doc = " Returns SRP server LEASE and KEY-LEASE configurations.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aLeaseConfig A pointer to an `otSrpServerLeaseConfig` instance."]
15724 pub fn otSrpServerGetLeaseConfig(
15725 aInstance: *mut otInstance,
15726 aLeaseConfig: *mut otSrpServerLeaseConfig,
15727 );
15728}
15729unsafe extern "C" {
15730 #[doc = " Sets SRP server LEASE and KEY-LEASE configurations.\n\n When a non-zero LEASE time is requested from a client, the granted value will be\n limited in range [aMinLease, aMaxLease]; and a non-zero KEY-LEASE will be granted\n in range [aMinKeyLease, aMaxKeyLease]. For zero LEASE or KEY-LEASE time, zero will\n be granted.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aLeaseConfig A pointer to an `otSrpServerLeaseConfig` instance.\n\n @retval OT_ERROR_NONE Successfully set the LEASE and KEY-LEASE ranges.\n @retval OT_ERROR_INVALID_ARGS The LEASE or KEY-LEASE range is not valid."]
15731 pub fn otSrpServerSetLeaseConfig(
15732 aInstance: *mut otInstance,
15733 aLeaseConfig: *const otSrpServerLeaseConfig,
15734 ) -> otError;
15735}
15736#[doc = " Handles SRP service updates.\n\n Is called by the SRP server to notify that a SRP host and possibly SRP services\n are being updated. It is important that the SRP updates are not committed until the handler\n returns the result by calling otSrpServerHandleServiceUpdateResult or times out after @p aTimeout.\n\n A SRP service observer should always call otSrpServerHandleServiceUpdateResult with error code\n OT_ERROR_NONE immediately after receiving the update events.\n\n A more generic handler may perform validations on the SRP host/services and rejects the SRP updates\n if any validation fails. For example, an Advertising Proxy should advertise (or remove) the host and\n services on a multicast-capable link and returns specific error code if any failure occurs.\n\n @param[in] aId The service update transaction ID. This ID must be passed back with\n `otSrpServerHandleServiceUpdateResult`.\n @param[in] aHost A pointer to the otSrpServerHost object which contains the SRP updates. The\n handler should publish/un-publish the host and each service points to this\n host with below rules:\n 1. If the host is not deleted (indicated by `otSrpServerHostIsDeleted`),\n then it should be published or updated with mDNS. Otherwise, the host\n should be un-published (remove AAAA RRs).\n 2. For each service points to this host, it must be un-published if the host\n is to be un-published. Otherwise, the handler should publish or update the\n service when it is not deleted (indicated by `otSrpServerServiceIsDeleted`)\n and un-publish it when deleted.\n @param[in] aTimeout The maximum time in milliseconds for the handler to process the service event.\n @param[in] aContext A pointer to application-specific context.\n\n @sa otSrpServerSetServiceUpdateHandler\n @sa otSrpServerHandleServiceUpdateResult"]
15737pub type otSrpServerServiceUpdateHandler = ::std::option::Option<
15738 unsafe extern "C" fn(
15739 aId: otSrpServerServiceUpdateId,
15740 aHost: *const otSrpServerHost,
15741 aTimeout: u32,
15742 aContext: *mut ::std::os::raw::c_void,
15743 ),
15744>;
15745unsafe extern "C" {
15746 #[doc = " Sets the SRP service updates handler on SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aServiceHandler A pointer to a service handler. Use NULL to remove the handler.\n @param[in] aContext A pointer to arbitrary context information.\n May be NULL if not used."]
15747 pub fn otSrpServerSetServiceUpdateHandler(
15748 aInstance: *mut otInstance,
15749 aServiceHandler: otSrpServerServiceUpdateHandler,
15750 aContext: *mut ::std::os::raw::c_void,
15751 );
15752}
15753unsafe extern "C" {
15754 #[doc = " Reports the result of processing a SRP update to the SRP server.\n\n The Service Update Handler should call this function to return the result of its\n processing of a SRP update.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aId The service update transaction ID. This should be the same ID\n provided via `otSrpServerServiceUpdateHandler`.\n @param[in] aError An error to be returned to the SRP server. Use OT_ERROR_DUPLICATED\n to represent DNS name conflicts."]
15755 pub fn otSrpServerHandleServiceUpdateResult(
15756 aInstance: *mut otInstance,
15757 aId: otSrpServerServiceUpdateId,
15758 aError: otError,
15759 );
15760}
15761unsafe extern "C" {
15762 #[doc = " Returns the next registered host on the SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aHost A pointer to current host; use NULL to get the first host.\n\n @returns A pointer to the registered host. NULL, if no more hosts can be found."]
15763 pub fn otSrpServerGetNextHost(
15764 aInstance: *mut otInstance,
15765 aHost: *const otSrpServerHost,
15766 ) -> *const otSrpServerHost;
15767}
15768unsafe extern "C" {
15769 #[doc = " Returns the response counters of the SRP server.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the response counters of the SRP server."]
15770 pub fn otSrpServerGetResponseCounters(
15771 aInstance: *mut otInstance,
15772 ) -> *const otSrpServerResponseCounters;
15773}
15774unsafe extern "C" {
15775 #[doc = " Tells if the SRP service host has been deleted.\n\n A SRP service host can be deleted but retains its name for future uses.\n In this case, the host instance is not removed from the SRP server/registry.\n\n @param[in] aHost A pointer to the SRP service host.\n\n @returns TRUE if the host has been deleted, FALSE if not."]
15776 pub fn otSrpServerHostIsDeleted(aHost: *const otSrpServerHost) -> bool;
15777}
15778unsafe extern "C" {
15779 #[doc = " Returns the full name of the host.\n\n @param[in] aHost A pointer to the SRP service host.\n\n @returns A pointer to the null-terminated host name string."]
15780 pub fn otSrpServerHostGetFullName(
15781 aHost: *const otSrpServerHost,
15782 ) -> *const ::std::os::raw::c_char;
15783}
15784unsafe extern "C" {
15785 #[doc = " Indicates whether the host matches a given host name.\n\n DNS name matches are performed using a case-insensitive string comparison (i.e., \"Abc\" and \"aBc\" are considered to\n be the same).\n\n @param[in] aHost A pointer to the SRP service host.\n @param[in] aFullName A full host name.\n\n @retval TRUE If host matches the host name.\n @retval FALSE If host does not match the host name."]
15786 pub fn otSrpServerHostMatchesFullName(
15787 aHost: *const otSrpServerHost,
15788 aFullName: *const ::std::os::raw::c_char,
15789 ) -> bool;
15790}
15791unsafe extern "C" {
15792 #[doc = " Returns the addresses of given host.\n\n @param[in] aHost A pointer to the SRP service host.\n @param[out] aAddressesNum A pointer to where we should output the number of the addresses to.\n\n @returns A pointer to the array of IPv6 Address."]
15793 pub fn otSrpServerHostGetAddresses(
15794 aHost: *const otSrpServerHost,
15795 aAddressesNum: *mut u8,
15796 ) -> *const otIp6Address;
15797}
15798unsafe extern "C" {
15799 #[doc = " Returns the LEASE and KEY-LEASE information of a given host.\n\n @param[in] aHost A pointer to the SRP server host.\n @param[out] aLeaseInfo A pointer to where to output the LEASE and KEY-LEASE information."]
15800 pub fn otSrpServerHostGetLeaseInfo(
15801 aHost: *const otSrpServerHost,
15802 aLeaseInfo: *mut otSrpServerLeaseInfo,
15803 );
15804}
15805unsafe extern "C" {
15806 #[doc = " Returns the next service of given host.\n\n @param[in] aHost A pointer to the SRP service host.\n @param[in] aService A pointer to current SRP service instance; use NULL to get the first service.\n\n @returns A pointer to the next service or NULL if there is no more services."]
15807 pub fn otSrpServerHostGetNextService(
15808 aHost: *const otSrpServerHost,
15809 aService: *const otSrpServerService,
15810 ) -> *const otSrpServerService;
15811}
15812unsafe extern "C" {
15813 #[doc = " Indicates whether or not the SRP service has been deleted.\n\n A SRP service can be deleted but retains its name for future uses.\n In this case, the service instance is not removed from the SRP server/registry.\n It is guaranteed that all services are deleted if the host is deleted.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns TRUE if the service has been deleted, FALSE if not."]
15814 pub fn otSrpServerServiceIsDeleted(aService: *const otSrpServerService) -> bool;
15815}
15816unsafe extern "C" {
15817 #[doc = " Returns the full service instance name of the service.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns A pointer to the null-terminated service instance name string."]
15818 pub fn otSrpServerServiceGetInstanceName(
15819 aService: *const otSrpServerService,
15820 ) -> *const ::std::os::raw::c_char;
15821}
15822unsafe extern "C" {
15823 #[doc = " Indicates whether this service matches a given service instance name.\n\n DNS name matches are performed using a case-insensitive string comparison (i.e., \"Abc\" and \"aBc\" are considered to\n be the same).\n\n @param[in] aService A pointer to the SRP service.\n @param[in] aInstanceName The service instance name.\n\n @retval TRUE If service matches the service instance name.\n @retval FALSE If service does not match the service instance name."]
15824 pub fn otSrpServerServiceMatchesInstanceName(
15825 aService: *const otSrpServerService,
15826 aInstanceName: *const ::std::os::raw::c_char,
15827 ) -> bool;
15828}
15829unsafe extern "C" {
15830 #[doc = " Returns the service instance label (first label in instance name) of the service.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns A pointer to the null-terminated service instance label string.."]
15831 pub fn otSrpServerServiceGetInstanceLabel(
15832 aService: *const otSrpServerService,
15833 ) -> *const ::std::os::raw::c_char;
15834}
15835unsafe extern "C" {
15836 #[doc = " Returns the full service name of the service.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns A pointer to the null-terminated service name string."]
15837 pub fn otSrpServerServiceGetServiceName(
15838 aService: *const otSrpServerService,
15839 ) -> *const ::std::os::raw::c_char;
15840}
15841unsafe extern "C" {
15842 #[doc = " Indicates whether this service matches a given service name.\n\n DNS name matches are performed using a case-insensitive string comparison (i.e., \"Abc\" and \"aBc\" are considered to\n be the same).\n\n @param[in] aService A pointer to the SRP service.\n @param[in] aServiceName The service name.\n\n @retval TRUE If service matches the service name.\n @retval FALSE If service does not match the service name."]
15843 pub fn otSrpServerServiceMatchesServiceName(
15844 aService: *const otSrpServerService,
15845 aServiceName: *const ::std::os::raw::c_char,
15846 ) -> bool;
15847}
15848unsafe extern "C" {
15849 #[doc = " Gets the number of sub-types of the service.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns The number of sub-types of @p aService."]
15850 pub fn otSrpServerServiceGetNumberOfSubTypes(aService: *const otSrpServerService) -> u16;
15851}
15852unsafe extern "C" {
15853 #[doc = " Gets the sub-type service name (full name) of the service at a given index\n\n The full service name for a sub-type service follows \"<sub-label>._sub.<service-labels>.<domain>.\".\n\n @param[in] aService A pointer to the SRP service.\n @param[in] aIndex The index to get.\n\n @returns A pointer to sub-type service name at @p aIndex, or `NULL` if no sub-type at this index."]
15854 pub fn otSrpServerServiceGetSubTypeServiceNameAt(
15855 aService: *const otSrpServerService,
15856 aIndex: u16,
15857 ) -> *const ::std::os::raw::c_char;
15858}
15859unsafe extern "C" {
15860 #[doc = " Indicates whether or not the service has a given sub-type.\n\n DNS name matches are performed using a case-insensitive string comparison (i.e., \"Abc\" and \"aBc\" are considered to\n be the same).\n\n @param[in] aService A pointer to the SRP service.\n @param[in] aSubTypeServiceName The sub-type service name (full name) to check.\n\n @retval TRUE Service contains the sub-type @p aSubTypeServiceName.\n @retval FALSE Service does not contain the sub-type @p aSubTypeServiceName."]
15861 pub fn otSrpServerServiceHasSubTypeServiceName(
15862 aService: *const otSrpServerService,
15863 aSubTypeServiceName: *const ::std::os::raw::c_char,
15864 ) -> bool;
15865}
15866unsafe extern "C" {
15867 #[doc = " Parses a sub-type service name (full name) and extracts the sub-type label.\n\n The full service name for a sub-type service follows \"<sub-label>._sub.<service-labels>.<domain>.\".\n\n @param[in] aSubTypeServiceName A sub-type service name (full name).\n @param[out] aLabel A pointer to a buffer to copy the extracted sub-type label.\n @param[in] aLabelSize Maximum size of @p aLabel buffer.\n\n @retval OT_ERROR_NONE Name was successfully parsed and @p aLabel was updated.\n @retval OT_ERROR_NO_BUFS The sub-type label could not fit in @p aLabel buffer (number of chars from label\n that could fit are copied in @p aLabel ensuring it is null-terminated).\n @retval OT_ERROR_INVALID_ARGS @p aSubTypeServiceName is not a valid sub-type format."]
15868 pub fn otSrpServerParseSubTypeServiceName(
15869 aSubTypeServiceName: *const ::std::os::raw::c_char,
15870 aLabel: *mut ::std::os::raw::c_char,
15871 aLabelSize: u8,
15872 ) -> otError;
15873}
15874unsafe extern "C" {
15875 #[doc = " Returns the port of the service instance.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns The port of the service."]
15876 pub fn otSrpServerServiceGetPort(aService: *const otSrpServerService) -> u16;
15877}
15878unsafe extern "C" {
15879 #[doc = " Returns the weight of the service instance.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns The weight of the service."]
15880 pub fn otSrpServerServiceGetWeight(aService: *const otSrpServerService) -> u16;
15881}
15882unsafe extern "C" {
15883 #[doc = " Returns the priority of the service instance.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns The priority of the service."]
15884 pub fn otSrpServerServiceGetPriority(aService: *const otSrpServerService) -> u16;
15885}
15886unsafe extern "C" {
15887 #[doc = " Returns the TTL of the service instance.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns The TTL of the service instance.."]
15888 pub fn otSrpServerServiceGetTtl(aService: *const otSrpServerService) -> u32;
15889}
15890unsafe extern "C" {
15891 #[doc = " Returns the TXT record data of the service instance.\n\n @param[in] aService A pointer to the SRP service.\n @param[out] aDataLength A pointer to return the TXT record data length. MUST NOT be NULL.\n\n @returns A pointer to the buffer containing the TXT record data (the TXT data length is returned in @p aDataLength)."]
15892 pub fn otSrpServerServiceGetTxtData(
15893 aService: *const otSrpServerService,
15894 aDataLength: *mut u16,
15895 ) -> *const u8;
15896}
15897unsafe extern "C" {
15898 #[doc = " Returns the host which the service instance reside on.\n\n @param[in] aService A pointer to the SRP service.\n\n @returns A pointer to the host instance."]
15899 pub fn otSrpServerServiceGetHost(aService: *const otSrpServerService)
15900 -> *const otSrpServerHost;
15901}
15902unsafe extern "C" {
15903 #[doc = " Returns the LEASE and KEY-LEASE information of a given service.\n\n @param[in] aService A pointer to the SRP server service.\n @param[out] aLeaseInfo A pointer to where to output the LEASE and KEY-LEASE information."]
15904 pub fn otSrpServerServiceGetLeaseInfo(
15905 aService: *const otSrpServerService,
15906 aLeaseInfo: *mut otSrpServerLeaseInfo,
15907 );
15908}
15909unsafe extern "C" {
15910 #[doc = " Run all queued OpenThread tasklets at the time this is called.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
15911 pub fn otTaskletsProcess(aInstance: *mut otInstance);
15912}
15913unsafe extern "C" {
15914 #[doc = " Indicates whether or not OpenThread has tasklets pending.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If there are tasklets pending.\n @retval FALSE If there are no tasklets pending."]
15915 pub fn otTaskletsArePending(aInstance: *mut otInstance) -> bool;
15916}
15917unsafe extern "C" {
15918 #[doc = " OpenThread calls this function when the tasklet queue transitions from empty to non-empty.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
15919 pub fn otTaskletsSignalPending(aInstance: *mut otInstance);
15920}
15921#[doc = " A linked buffer structure for use with TCP.\n\n A single otLinkedBuffer structure references an array of bytes in memory,\n via mData and mLength. The mNext field is used to form a chain of\n otLinkedBuffer structures."]
15922#[repr(C)]
15923#[derive(Debug, Copy, Clone)]
15924pub struct otLinkedBuffer {
15925 #[doc = "< Pointer to the next linked buffer in the chain, or NULL if it is the end."]
15926 pub mNext: *mut otLinkedBuffer,
15927 #[doc = "< Pointer to data referenced by this linked buffer."]
15928 pub mData: *const u8,
15929 #[doc = "< Length of this linked buffer (number of bytes)."]
15930 pub mLength: usize,
15931}
15932impl Default for otLinkedBuffer {
15933 fn default() -> Self {
15934 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15935 unsafe {
15936 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15937 s.assume_init()
15938 }
15939 }
15940}
15941#[doc = " This callback informs the application that the TCP 3-way handshake is\n complete and that the connection is now established.\n\n @param[in] aEndpoint The TCP endpoint whose connection is now established."]
15942pub type otTcpEstablished =
15943 ::std::option::Option<unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint)>;
15944#[doc = " This callback informs the application that data in the provided\n @p aData have been acknowledged by the connection peer and that @p aData and\n the data it contains can be reclaimed by the application.\n\n The @p aData are guaranteed to be identical to those passed in to TCP via\n otTcpSendByReference(), including any extensions effected via\n otTcpSendByExtension().\n\n @param[in] aEndpoint The TCP endpoint for the connection.\n @param[in] aData A pointer to the otLinkedBuffer that can be reclaimed."]
15945pub type otTcpSendDone = ::std::option::Option<
15946 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aData: *mut otLinkedBuffer),
15947>;
15948#[doc = " This callback informs the application if forward progress has been made in\n transferring data from the send buffer to the recipient. This callback is\n not necessary for correct TCP operation. Most applications can just rely on\n the otTcpSendDone() callback to reclaim linked buffers once the TCP stack is\n done using them. The purpose of this callback is to support advanced\n applications that benefit from finer-grained information about how the\n the connection is making forward progress in transferring data to the\n connection peer.\n\n This callback's operation is closely tied to TCP's send buffer. The send\n buffer can be understood as having two regions. First, there is the\n \"in-flight\" region at the head (front) of the send buffer. It corresponds\n to data which has been sent to the recipient, but is not yet acknowledged.\n Second, there is the \"backlog\" region, which consists of all data in the\n send buffer that is not in the \"in-flight\" region. The \"backlog\" region\n corresponds to data that is queued for sending, but has not yet been sent.\n\n The callback is invoked in response to two types of events. First, the\n \"in-flight\" region of the send buffer may shrink (e.g., when the recipient\n acknowledges data that we sent earlier). Second, the \"backlog\" region of the\n send buffer may shrink (e.g., new data was sent out). These two conditions\n often occur at the same time, in response to an ACK segment from the\n connection peer, which is why they are combined in a single callback.\n\n The TCP stack only uses the @p aInSendBuffer bytes at the tail of the send\n buffer; when @p aInSendBuffer decreases by an amount x, it means that x\n additional bytes that were formerly at the head of the send buffer are no\n longer part of the send buffer and can now be reclaimed (i.e., overwritten)\n by the application. Note that the otLinkedBuffer structure itself can only\n be reclaimed once all bytes that it references are no longer part of the\n send buffer.\n\n This callback subsumes otTcpSendDone(), in the following sense: applications\n can determine when linked buffers can be reclaimed by comparing\n @p aInSendBuffer with how many bytes are in each linked buffer. However, we\n expect otTcpSendDone(), which directly conveys which otLinkedBuffers can be\n reclaimed, to be much simpler to use. If both callbacks are registered and\n are triggered by the same event (e.g., the same ACK segment received), then\n the otTcpSendDone() callback will be triggered first, followed by this\n callback.\n\n Additionally, this callback provides @p aBacklog, which indicates how many\n bytes of data in the send buffer are not yet in flight. For applications\n that only want to add data to the send buffer when there is an assurance\n that it will be sent out soon, it may be desirable to only send out data\n when @p aBacklog is suitably small (0 or close to 0). For example, an\n application may use @p aBacklog so that it can react to queue buildup by\n dropping or aggregating data to avoid creating a backlog of data.\n\n After a call to otTcpSendByReference() or otTcpSendByExtension() with a\n positive number of bytes, the otTcpForwardProgress() callback is guaranteed\n to be called, to indicate when the bytes that were added to the send buffer\n are sent out. The call to otTcpForwardProgress() may be made immediately\n after the bytes are added to the send buffer (if some of those bytes are\n immediately sent out, reducing the backlog), or sometime in the future (once\n the connection sends out some or all of the data, reducing the backlog). By\n \"immediately,\" we mean that the callback is immediately scheduled for\n execution in a tasklet; to avoid reentrancy-related complexity, the\n otTcpForwardProgress() callback is never directly called from the\n otTcpSendByReference() or otTcpSendByExtension() functions.\n\n @param[in] aEndpoint The TCP endpoint for the connection.\n @param[in] aInSendBuffer The number of bytes in the send buffer (sum of \"in-flight\" and \"backlog\" regions).\n @param[in] aBacklog The number of bytes that are queued for sending but have not yet been sent (the \"backlog\"\n region)."]
15949pub type otTcpForwardProgress = ::std::option::Option<
15950 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aInSendBuffer: usize, aBacklog: usize),
15951>;
15952#[doc = " This callback indicates the number of bytes available for consumption from\n the receive buffer.\n\n It is called whenever bytes are added to the receive buffer and when the\n end of stream is reached. If the end of the stream has been reached (i.e.,\n if no more data will become available to read because the connection peer\n has closed their end of the connection for writing), then @p aEndOfStream is\n true. Finally, @p aBytesRemaining indicates how much capacity is left in the\n receive buffer to hold additional data that arrives.\n\n @param[in] aEndpoint The TCP endpoint for the connection.\n @param[in] aBytesAvailable The number of bytes in the connection's receive buffer.\n @param[in] aEndOfStream Indicates if additional data, beyond what is already in the connection's receive buffer,\n can be received.\n @param[in] aBytesRemaining The number of additional bytes that can be received before the receive buffer becomes\n full."]
15953pub type otTcpReceiveAvailable = ::std::option::Option<
15954 unsafe extern "C" fn(
15955 aEndpoint: *mut otTcpEndpoint,
15956 aBytesAvailable: usize,
15957 aEndOfStream: bool,
15958 aBytesRemaining: usize,
15959 ),
15960>;
15961pub const OT_TCP_DISCONNECTED_REASON_NORMAL: otTcpDisconnectedReason = 0;
15962pub const OT_TCP_DISCONNECTED_REASON_REFUSED: otTcpDisconnectedReason = 1;
15963pub const OT_TCP_DISCONNECTED_REASON_RESET: otTcpDisconnectedReason = 2;
15964pub const OT_TCP_DISCONNECTED_REASON_TIME_WAIT: otTcpDisconnectedReason = 3;
15965pub const OT_TCP_DISCONNECTED_REASON_TIMED_OUT: otTcpDisconnectedReason = 4;
15966pub type otTcpDisconnectedReason = ::std::os::raw::c_uint;
15967#[doc = " This callback indicates that the connection was broken and should no longer\n be used, or that a connection has entered the TIME-WAIT state.\n\n It can occur if a connection establishment attempt (initiated by calling\n otTcpConnect()) fails, or any point thereafter (e.g., if the connection\n times out or an RST segment is received from the connection peer). Once this\n callback fires, all resources that the application provided for this\n connection (i.e., any `otLinkedBuffers` and memory they reference, but not\n the TCP endpoint itself or space for the receive buffers) can be reclaimed.\n In the case of a connection entering the TIME-WAIT state, this callback is\n called twice, once upon entry into the TIME-WAIT state (with\n OT_TCP_DISCONNECTED_REASON_TIME_WAIT, and again when the TIME-WAIT state\n expires (with OT_TCP_DISCONNECTED_REASON_NORMAL).\n\n @param[in] aEndpoint The TCP endpoint whose connection has been lost.\n @param[in] aReason The reason why the connection was lost."]
15968pub type otTcpDisconnected = ::std::option::Option<
15969 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aReason: otTcpDisconnectedReason),
15970>;
15971#[doc = " Represents a TCP endpoint.\n\n A TCP endpoint acts an endpoint of TCP connection. It can be used to\n initiate TCP connections, and, once a TCP connection is established, send\n data to and receive data from the connection peer.\n\n The application should not inspect the fields of this structure directly; it\n should only interact with it via the TCP API functions whose signatures are\n provided in this file."]
15972#[repr(C)]
15973#[derive(Copy, Clone)]
15974pub struct otTcpEndpoint {
15975 pub mTcb: otTcpEndpoint__bindgen_ty_1,
15976 #[doc = "< A pointer to the next TCP endpoint (internal use only)"]
15977 pub mNext: *mut otTcpEndpoint,
15978 #[doc = "< A pointer to application-specific context"]
15979 pub mContext: *mut ::std::os::raw::c_void,
15980 #[doc = "< \"Established\" callback function"]
15981 pub mEstablishedCallback: otTcpEstablished,
15982 #[doc = "< \"Send done\" callback function"]
15983 pub mSendDoneCallback: otTcpSendDone,
15984 #[doc = "< \"Forward progress\" callback function"]
15985 pub mForwardProgressCallback: otTcpForwardProgress,
15986 #[doc = "< \"Receive available\" callback function"]
15987 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
15988 #[doc = "< \"Disconnected\" callback function"]
15989 pub mDisconnectedCallback: otTcpDisconnected,
15990 pub mTimers: [u32; 4usize],
15991 pub mReceiveLinks: [otLinkedBuffer; 2usize],
15992 pub mSockAddr: otSockAddr,
15993 pub mPendingCallbacks: u8,
15994}
15995#[repr(C)]
15996#[derive(Copy, Clone)]
15997pub union otTcpEndpoint__bindgen_ty_1 {
15998 pub mSize: [u8; 680usize],
15999 pub mAlign: u64,
16000}
16001impl Default for otTcpEndpoint__bindgen_ty_1 {
16002 fn default() -> Self {
16003 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16004 unsafe {
16005 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16006 s.assume_init()
16007 }
16008 }
16009}
16010impl Default for otTcpEndpoint {
16011 fn default() -> Self {
16012 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16013 unsafe {
16014 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16015 s.assume_init()
16016 }
16017 }
16018}
16019#[doc = " Contains arguments to the otTcpEndpointInitialize() function."]
16020#[repr(C)]
16021#[derive(Debug, Copy, Clone)]
16022pub struct otTcpEndpointInitializeArgs {
16023 #[doc = "< Pointer to application-specific context"]
16024 pub mContext: *mut ::std::os::raw::c_void,
16025 #[doc = "< \"Established\" callback function"]
16026 pub mEstablishedCallback: otTcpEstablished,
16027 #[doc = "< \"Send done\" callback function"]
16028 pub mSendDoneCallback: otTcpSendDone,
16029 #[doc = "< \"Forward progress\" callback function"]
16030 pub mForwardProgressCallback: otTcpForwardProgress,
16031 #[doc = "< \"Receive available\" callback function"]
16032 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
16033 #[doc = "< \"Disconnected\" callback function"]
16034 pub mDisconnectedCallback: otTcpDisconnected,
16035 #[doc = "< Pointer to memory provided to the system for the TCP receive buffer"]
16036 pub mReceiveBuffer: *mut ::std::os::raw::c_void,
16037 #[doc = "< Size of memory provided to the system for the TCP receive buffer"]
16038 pub mReceiveBufferSize: usize,
16039}
16040impl Default for otTcpEndpointInitializeArgs {
16041 fn default() -> Self {
16042 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16043 unsafe {
16044 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16045 s.assume_init()
16046 }
16047 }
16048}
16049unsafe extern "C" {
16050 #[doc = " Initializes a TCP endpoint.\n\n Calling this function causes OpenThread to keep track of the TCP endpoint\n and store and retrieve TCP data inside the @p aEndpoint. The application\n should refrain from directly accessing or modifying the fields in\n @p aEndpoint. If the application needs to reclaim the memory backing\n @p aEndpoint, it should call otTcpEndpointDeinitialize().\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEndpoint A pointer to a TCP endpoint structure.\n @param[in] aArgs A pointer to a structure of arguments.\n\n @retval OT_ERROR_NONE Successfully opened the TCP endpoint.\n @retval OT_ERROR_FAILED Failed to open the TCP endpoint."]
16051 pub fn otTcpEndpointInitialize(
16052 aInstance: *mut otInstance,
16053 aEndpoint: *mut otTcpEndpoint,
16054 aArgs: *const otTcpEndpointInitializeArgs,
16055 ) -> otError;
16056}
16057unsafe extern "C" {
16058 #[doc = " Obtains the otInstance that was associated with @p aEndpoint upon\n initialization.\n\n @param[in] aEndpoint The TCP endpoint whose instance to obtain.\n\n @returns The otInstance pointer associated with @p aEndpoint."]
16059 pub fn otTcpEndpointGetInstance(aEndpoint: *mut otTcpEndpoint) -> *mut otInstance;
16060}
16061unsafe extern "C" {
16062 #[doc = " Obtains the context pointer that was associated with @p aEndpoint upon\n initialization.\n\n @param[in] aEndpoint The TCP endpoint whose context to obtain.\n\n @returns The context pointer associated with @p aEndpoint."]
16063 pub fn otTcpEndpointGetContext(aEndpoint: *mut otTcpEndpoint) -> *mut ::std::os::raw::c_void;
16064}
16065unsafe extern "C" {
16066 #[doc = " Obtains a pointer to a TCP endpoint's local host and port.\n\n The contents of the host and port may be stale if this socket is not in a\n connected state and has not been bound after it was last disconnected.\n\n @param[in] aEndpoint The TCP endpoint whose local host and port to obtain.\n\n @returns The local host and port of @p aEndpoint."]
16067 pub fn otTcpGetLocalAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16068}
16069unsafe extern "C" {
16070 #[doc = " Obtains a pointer to a TCP endpoint's peer's host and port.\n\n The contents of the host and port may be stale if this socket is not in a\n connected state.\n\n @param[in] aEndpoint The TCP endpoint whose peer's host and port to obtain.\n\n @returns The host and port of the connection peer of @p aEndpoint."]
16071 pub fn otTcpGetPeerAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16072}
16073unsafe extern "C" {
16074 #[doc = " Binds the TCP endpoint to an IP address and port.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure to bind.\n @param[in] aSockName The address and port to which to bind this TCP endpoint.\n\n @retval OT_ERROR_NONE Successfully bound the TCP endpoint.\n @retval OT_ERROR_FAILED Failed to bind the TCP endpoint."]
16075 pub fn otTcpBind(aEndpoint: *mut otTcpEndpoint, aSockName: *const otSockAddr) -> otError;
16076}
16077pub const OT_TCP_CONNECT_NO_FAST_OPEN: _bindgen_ty_12 = 1;
16078#[doc = " Defines flags passed to otTcpConnect()."]
16079pub type _bindgen_ty_12 = ::std::os::raw::c_uint;
16080unsafe extern "C" {
16081 #[doc = " Records the remote host and port for this connection.\n\n TCP Fast Open must be enabled or disabled using @p aFlags. If it is\n disabled, then the TCP connection establishment handshake is initiated\n immediately. If it is enabled, then this function merely records the\n the remote host and port, and the TCP connection establishment handshake\n only happens on the first call to `otTcpSendByReference()`.\n\n If TCP Fast Open is disabled, then the caller must wait for the\n `otTcpEstablished` callback indicating that TCP connection establishment\n handshake is done before it can start sending data e.g., by calling\n `otTcpSendByReference()`.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure to connect.\n @param[in] aSockName The IP address and port of the host to which to connect.\n @param[in] aFlags Flags specifying options for this operation (see enumeration above).\n\n @retval OT_ERROR_NONE Successfully completed the operation.\n @retval OT_ERROR_FAILED Failed to complete the operation."]
16082 pub fn otTcpConnect(
16083 aEndpoint: *mut otTcpEndpoint,
16084 aSockName: *const otSockAddr,
16085 aFlags: u32,
16086 ) -> otError;
16087}
16088pub const OT_TCP_SEND_MORE_TO_COME: _bindgen_ty_13 = 1;
16089#[doc = " Defines flags passed to @p otTcpSendByReference."]
16090pub type _bindgen_ty_13 = ::std::os::raw::c_uint;
16091unsafe extern "C" {
16092 #[doc = " Adds data referenced by the linked buffer pointed to by @p aBuffer to the\n send buffer.\n\n Upon a successful call to this function, the linked buffer and data it\n references are owned by the TCP stack; they should not be modified by the\n application until a \"send done\" callback returns ownership of those objects\n to the application. It is acceptable to call this function to add another\n linked buffer to the send queue, even if the \"send done\" callback for a\n previous invocation of this function has not yet fired.\n\n Note that @p aBuffer should not be chained; its mNext field should be\n NULL. If additional data will be added right after this call, then the\n OT_TCP_SEND_MORE_TO_COME flag should be used as a hint to the TCP\n implementation.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint on which to send data.\n @param[in] aBuffer A pointer to the linked buffer chain referencing data to add to the send buffer.\n @param[in] aFlags Flags specifying options for this operation (see enumeration above).\n\n @retval OT_ERROR_NONE Successfully added data to the send buffer.\n @retval OT_ERROR_FAILED Failed to add data to the send buffer."]
16093 pub fn otTcpSendByReference(
16094 aEndpoint: *mut otTcpEndpoint,
16095 aBuffer: *mut otLinkedBuffer,
16096 aFlags: u32,
16097 ) -> otError;
16098}
16099unsafe extern "C" {
16100 #[doc = " Adds data to the send buffer by extending the length of the final\n otLinkedBuffer in the send buffer by the specified amount.\n\n If the send buffer is empty, then the operation fails.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint on which to send data.\n @param[in] aNumBytes The number of bytes by which to extend the length of the final linked buffer.\n @param[in] aFlags Flags specifying options for this operation (see enumeration above).\n\n @retval OT_ERROR_NONE Successfully added data to the send buffer.\n @retval OT_ERROR_FAILED Failed to add data to the send buffer."]
16101 pub fn otTcpSendByExtension(
16102 aEndpoint: *mut otTcpEndpoint,
16103 aNumBytes: usize,
16104 aFlags: u32,
16105 ) -> otError;
16106}
16107unsafe extern "C" {
16108 #[doc = " Provides the application with a linked buffer chain referencing data\n currently in the TCP receive buffer.\n\n The linked buffer chain is valid until the \"receive ready\" callback is next\n invoked, or until the next call to otTcpReceiveContiguify() or\n otTcpCommitReceive().\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint on which to receive\n data.\n @param[out] aBuffer A pointer to the linked buffer chain referencing data currently in the receive buffer.\n\n @retval OT_ERROR_NONE Successfully completed the operation.\n @retval OT_ERROR_FAILED Failed to complete the operation."]
16109 pub fn otTcpReceiveByReference(
16110 aEndpoint: *mut otTcpEndpoint,
16111 aBuffer: *mut *const otLinkedBuffer,
16112 ) -> otError;
16113}
16114unsafe extern "C" {
16115 #[doc = " Reorganizes the receive buffer to be entirely contiguous in memory.\n\n This is optional; an application can simply traverse the linked buffer\n chain obtained by calling @p otTcpReceiveByReference. Some\n applications may wish to call this function to make the receive buffer\n contiguous to simplify their data processing, but this comes at the expense\n of CPU time to reorganize the data in the receive buffer.\n\n @param[in] aEndpoint A pointer to the TCP endpoint whose receive buffer to reorganize.\n\n @retval OT_ERROR_NONE Successfully completed the operation.\n @retval OT_ERROR_FAILED Failed to complete the operation."]
16116 pub fn otTcpReceiveContiguify(aEndpoint: *mut otTcpEndpoint) -> otError;
16117}
16118unsafe extern "C" {
16119 #[doc = " Informs the TCP stack that the application has finished processing\n @p aNumBytes bytes of data at the start of the receive buffer and that the\n TCP stack need not continue maintaining those bytes in the receive buffer.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint on which to receive\n data.\n @param[in] aNumBytes The number of bytes consumed.\n @param[in] aFlags Flags specifying options for this operation (none yet).\n\n @retval OT_ERROR_NONE Successfully completed the receive operation.\n @retval OT_ERROR_FAILED Failed to complete the receive operation."]
16120 pub fn otTcpCommitReceive(
16121 aEndpoint: *mut otTcpEndpoint,
16122 aNumBytes: usize,
16123 aFlags: u32,
16124 ) -> otError;
16125}
16126unsafe extern "C" {
16127 #[doc = " Informs the connection peer that this TCP endpoint will not send more data.\n\n This should be used when the application has no more data to send to the\n connection peer. For this connection, future reads on the connection peer\n will result in the \"end of stream\" condition, and future writes on this\n connection endpoint will fail.\n\n The \"end of stream\" condition only applies after any data previously\n provided to the TCP stack to send out has been received by the connection\n peer.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint to shut down.\n\n @retval OT_ERROR_NONE Successfully queued the \"end of stream\" condition for transmission.\n @retval OT_ERROR_FAILED Failed to queue the \"end of stream\" condition for transmission."]
16128 pub fn otTcpSendEndOfStream(aEndpoint: *mut otTcpEndpoint) -> otError;
16129}
16130unsafe extern "C" {
16131 #[doc = " Forcibly ends the TCP connection associated with this TCP endpoint.\n\n This immediately makes the TCP endpoint free for use for another connection\n and empties the send and receive buffers, transferring ownership of any data\n provided by the application in otTcpSendByReference() and\n otTcpSendByExtension() calls back to the application. The TCP endpoint's\n callbacks and memory for the receive buffer remain associated with the\n TCP endpoint.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure representing the TCP endpoint to abort.\n\n @retval OT_ERROR_NONE Successfully aborted the TCP endpoint's connection.\n @retval OT_ERROR_FAILED Failed to abort the TCP endpoint's connection."]
16132 pub fn otTcpAbort(aEndpoint: *mut otTcpEndpoint) -> otError;
16133}
16134unsafe extern "C" {
16135 #[doc = " Deinitializes this TCP endpoint.\n\n This means that OpenThread no longer keeps track of this TCP endpoint and\n deallocates all resources it has internally allocated for this TCP endpoint.\n The application can reuse the memory backing the TCP endpoint as it sees fit.\n\n If it corresponds to a live TCP connection, the connection is terminated\n unceremoniously (as in otTcpAbort()). All resources the application has\n provided for this TCP endpoint (linked buffers for the send buffer, memory\n for the receive buffer, the @p aEndpoint structure itself, etc.) are\n immediately returned to the application.\n\n @param[in] aEndpoint A pointer to the TCP endpoint structure to deinitialize.\n\n @retval OT_ERROR_NONE Successfully deinitialized the TCP endpoint.\n @retval OT_ERROR_FAILED Failed to deinitialize the TCP endpoint."]
16136 pub fn otTcpEndpointDeinitialize(aEndpoint: *mut otTcpEndpoint) -> otError;
16137}
16138#[doc = "< Accept the incoming connection."]
16139pub const OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT: otTcpIncomingConnectionAction = 0;
16140#[doc = "< Defer (silently ignore) the incoming connection."]
16141pub const OT_TCP_INCOMING_CONNECTION_ACTION_DEFER: otTcpIncomingConnectionAction = 1;
16142#[doc = "< Refuse the incoming connection."]
16143pub const OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE: otTcpIncomingConnectionAction = 2;
16144#[doc = " Defines incoming connection actions.\n\n This is used in otTcpAcceptReady() callback."]
16145pub type otTcpIncomingConnectionAction = ::std::os::raw::c_uint;
16146#[doc = " This callback indicates that an incoming connection that matches this TCP\n listener has arrived.\n\n The typical response is for the application to accept the incoming\n connection. It does so by populating @p aAcceptInto with a pointer to the\n otTcpEndpoint into which to accept the incoming connection. This\n otTcpEndpoint must already be initialized using otTcpEndpointInitialize().\n Then, the application returns OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT.\n\n Alternatively, the application can decline to accept the incoming\n connection. There are two ways for the application to do this. First, if the\n application returns OT_TCP_INCOMING_CONNECTION_ACTION_DEFER, then OpenThread\n silently ignores the connection establishment request; the connection peer\n will likely retransmit the request, at which point the callback will be\n called again. This is valuable if resources are not presently available to\n accept the connection, but they may be available when the connection peer\n retransmits its connection establishment attempt. Second, if the application\n returns OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE, then OpenThread sends a\n \"connection refused\" message to the host that attempted to establish a\n connection. If the application declines the incoming connection, it is not\n required to populate @p aAcceptInto.\n\n @param[in] aListener The TCP listener that matches the incoming connection.\n @param[in] aPeer The host and port from which the incoming connection originates.\n @param[out] aAcceptInto The TCP endpoint into which to accept the incoming connection.\n\n @returns Description of how to handle the incoming connection."]
16147pub type otTcpAcceptReady = ::std::option::Option<
16148 unsafe extern "C" fn(
16149 aListener: *mut otTcpListener,
16150 aPeer: *const otSockAddr,
16151 aAcceptInto: *mut *mut otTcpEndpoint,
16152 ) -> otTcpIncomingConnectionAction,
16153>;
16154#[doc = " This callback indicates that the TCP connection is now ready for two-way\n communication.\n\n In the case of TCP Fast Open, this may be before the TCP\n connection handshake has actually completed. The application is provided\n with the context pointers both for the TCP listener that accepted the\n connection and the TCP endpoint into which it was accepted. The provided\n context is the one associated with the TCP listener.\n\n @param[in] aListener The TCP listener that matches the incoming connection.\n @param[in] aEndpoint The TCP endpoint into which the incoming connection was accepted.\n @param[in] aPeer the host and port from which the incoming connection originated."]
16155pub type otTcpAcceptDone = ::std::option::Option<
16156 unsafe extern "C" fn(
16157 aListener: *mut otTcpListener,
16158 aEndpoint: *mut otTcpEndpoint,
16159 aPeer: *const otSockAddr,
16160 ),
16161>;
16162#[doc = " Represents a TCP listener.\n\n A TCP listener is used to listen for and accept incoming TCP connections.\n\n The application should not inspect the fields of this structure directly; it\n should only interact with it via the TCP API functions whose signatures are\n provided in this file."]
16163#[repr(C)]
16164#[derive(Copy, Clone)]
16165pub struct otTcpListener {
16166 pub mTcbListen: otTcpListener__bindgen_ty_1,
16167 #[doc = "< A pointer to the next TCP listener (internal use only)"]
16168 pub mNext: *mut otTcpListener,
16169 #[doc = "< A pointer to application-specific context"]
16170 pub mContext: *mut ::std::os::raw::c_void,
16171 #[doc = "< \"Accept ready\" callback function"]
16172 pub mAcceptReadyCallback: otTcpAcceptReady,
16173 #[doc = "< \"Accept done\" callback function"]
16174 pub mAcceptDoneCallback: otTcpAcceptDone,
16175}
16176#[repr(C)]
16177#[derive(Copy, Clone)]
16178pub union otTcpListener__bindgen_ty_1 {
16179 pub mSize: [u8; 40usize],
16180 pub mAlign: *mut ::std::os::raw::c_void,
16181}
16182impl Default for otTcpListener__bindgen_ty_1 {
16183 fn default() -> Self {
16184 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16185 unsafe {
16186 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16187 s.assume_init()
16188 }
16189 }
16190}
16191impl Default for otTcpListener {
16192 fn default() -> Self {
16193 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16194 unsafe {
16195 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16196 s.assume_init()
16197 }
16198 }
16199}
16200#[doc = " Contains arguments to the otTcpListenerInitialize() function."]
16201#[repr(C)]
16202#[derive(Debug, Copy, Clone)]
16203pub struct otTcpListenerInitializeArgs {
16204 #[doc = "< Pointer to application-specific context"]
16205 pub mContext: *mut ::std::os::raw::c_void,
16206 #[doc = "< \"Accept ready\" callback function"]
16207 pub mAcceptReadyCallback: otTcpAcceptReady,
16208 #[doc = "< \"Accept done\" callback function"]
16209 pub mAcceptDoneCallback: otTcpAcceptDone,
16210}
16211impl Default for otTcpListenerInitializeArgs {
16212 fn default() -> Self {
16213 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16214 unsafe {
16215 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16216 s.assume_init()
16217 }
16218 }
16219}
16220unsafe extern "C" {
16221 #[doc = " Initializes a TCP listener.\n\n Calling this function causes OpenThread to keep track of the TCP listener\n and store and retrieve TCP data inside @p aListener. The application should\n refrain from directly accessing or modifying the fields in @p aListener. If\n the application needs to reclaim the memory backing @p aListener, it should\n call otTcpListenerDeinitialize().\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aListener A pointer to a TCP listener structure.\n @param[in] aArgs A pointer to a structure of arguments.\n\n @retval OT_ERROR_NONE Successfully opened the TCP listener.\n @retval OT_ERROR_FAILED Failed to open the TCP listener."]
16222 pub fn otTcpListenerInitialize(
16223 aInstance: *mut otInstance,
16224 aListener: *mut otTcpListener,
16225 aArgs: *const otTcpListenerInitializeArgs,
16226 ) -> otError;
16227}
16228unsafe extern "C" {
16229 #[doc = " Obtains the otInstance that was associated with @p aListener upon\n initialization.\n\n @param[in] aListener The TCP listener whose instance to obtain.\n\n @returns The otInstance pointer associated with @p aListener."]
16230 pub fn otTcpListenerGetInstance(aListener: *mut otTcpListener) -> *mut otInstance;
16231}
16232unsafe extern "C" {
16233 #[doc = " Obtains the context pointer that was associated with @p aListener upon\n initialization.\n\n @param[in] aListener The TCP listener whose context to obtain.\n\n @returns The context pointer associated with @p aListener."]
16234 pub fn otTcpListenerGetContext(aListener: *mut otTcpListener) -> *mut ::std::os::raw::c_void;
16235}
16236unsafe extern "C" {
16237 #[doc = " Causes incoming TCP connections that match the specified IP address and port\n to trigger this TCP listener's callbacks.\n\n @param[in] aListener A pointer to the TCP listener structure that should begin listening.\n @param[in] aSockName The address and port on which to listen for incoming connections.\n\n @retval OT_ERROR_NONE Successfully initiated listening on the TCP listener.\n @retval OT_ERROR_FAILED Failed to initiate listening on the TCP listener."]
16238 pub fn otTcpListen(aListener: *mut otTcpListener, aSockName: *const otSockAddr) -> otError;
16239}
16240unsafe extern "C" {
16241 #[doc = " Causes this TCP listener to stop listening for incoming connections.\n\n @param[in] aListener A pointer to the TCP listener structure that should stop listening.\n\n @retval OT_ERROR_NONE Successfully stopped listening on the TCP listener.\n @retval OT_ERROR_FAILED Failed to stop listening on the TCP listener."]
16242 pub fn otTcpStopListening(aListener: *mut otTcpListener) -> otError;
16243}
16244unsafe extern "C" {
16245 #[doc = " Deinitializes this TCP listener.\n\n This means that OpenThread no longer keeps track of this TCP listener and\n deallocates all resources it has internally allocated for this TCP listener.\n The application can reuse the memory backing the TCP listener as it sees\n fit.\n\n If the TCP listener is currently listening, it stops listening.\n\n @param[in] aListener A pointer to the TCP listener structure to deinitialize.\n\n @retval OT_ERROR_NONE Successfully deinitialized the TCP listener.\n @retval OT_ERROR_FAILED Failed to deinitialize the TCP listener."]
16246 pub fn otTcpListenerDeinitialize(aListener: *mut otTcpListener) -> otError;
16247}
16248#[doc = " Holds diagnostic information for a Thread Child"]
16249#[repr(C)]
16250#[derive(Debug, Default, Copy, Clone)]
16251pub struct otChildInfo {
16252 #[doc = "< IEEE 802.15.4 Extended Address"]
16253 pub mExtAddress: otExtAddress,
16254 #[doc = "< Timeout"]
16255 pub mTimeout: u32,
16256 #[doc = "< Seconds since last heard"]
16257 pub mAge: u32,
16258 #[doc = "< Seconds since attach"]
16259 pub mConnectionTime: u64,
16260 #[doc = "< RLOC16"]
16261 pub mRloc16: u16,
16262 #[doc = "< Child ID"]
16263 pub mChildId: u16,
16264 #[doc = "< Network Data Version"]
16265 pub mNetworkDataVersion: u8,
16266 #[doc = "< Link Quality In"]
16267 pub mLinkQualityIn: u8,
16268 #[doc = "< Average RSSI"]
16269 pub mAverageRssi: i8,
16270 #[doc = "< Last observed RSSI"]
16271 pub mLastRssi: i8,
16272 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
16273 pub mFrameErrorRate: u16,
16274 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
16275 pub mMessageErrorRate: u16,
16276 #[doc = "< Number of queued messages for the child."]
16277 pub mQueuedMessageCnt: u16,
16278 #[doc = "< Supervision interval (in seconds)."]
16279 pub mSupervisionInterval: u16,
16280 #[doc = "< MLE version"]
16281 pub mVersion: u8,
16282 pub _bitfield_align_1: [u8; 0],
16283 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16284 pub __bindgen_padding_0: [u16; 3usize],
16285}
16286impl otChildInfo {
16287 #[inline]
16288 pub fn mRxOnWhenIdle(&self) -> bool {
16289 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16290 }
16291 #[inline]
16292 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
16293 unsafe {
16294 let val: u8 = ::std::mem::transmute(val);
16295 self._bitfield_1.set(0usize, 1u8, val as u64)
16296 }
16297 }
16298 #[inline]
16299 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
16300 unsafe {
16301 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16302 ::std::ptr::addr_of!((*this)._bitfield_1),
16303 0usize,
16304 1u8,
16305 ) as u8)
16306 }
16307 }
16308 #[inline]
16309 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
16310 unsafe {
16311 let val: u8 = ::std::mem::transmute(val);
16312 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16313 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16314 0usize,
16315 1u8,
16316 val as u64,
16317 )
16318 }
16319 }
16320 #[inline]
16321 pub fn mFullThreadDevice(&self) -> bool {
16322 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16323 }
16324 #[inline]
16325 pub fn set_mFullThreadDevice(&mut self, val: bool) {
16326 unsafe {
16327 let val: u8 = ::std::mem::transmute(val);
16328 self._bitfield_1.set(1usize, 1u8, val as u64)
16329 }
16330 }
16331 #[inline]
16332 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
16333 unsafe {
16334 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16335 ::std::ptr::addr_of!((*this)._bitfield_1),
16336 1usize,
16337 1u8,
16338 ) as u8)
16339 }
16340 }
16341 #[inline]
16342 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
16343 unsafe {
16344 let val: u8 = ::std::mem::transmute(val);
16345 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16346 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16347 1usize,
16348 1u8,
16349 val as u64,
16350 )
16351 }
16352 }
16353 #[inline]
16354 pub fn mFullNetworkData(&self) -> bool {
16355 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16356 }
16357 #[inline]
16358 pub fn set_mFullNetworkData(&mut self, val: bool) {
16359 unsafe {
16360 let val: u8 = ::std::mem::transmute(val);
16361 self._bitfield_1.set(2usize, 1u8, val as u64)
16362 }
16363 }
16364 #[inline]
16365 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
16366 unsafe {
16367 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16368 ::std::ptr::addr_of!((*this)._bitfield_1),
16369 2usize,
16370 1u8,
16371 ) as u8)
16372 }
16373 }
16374 #[inline]
16375 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
16376 unsafe {
16377 let val: u8 = ::std::mem::transmute(val);
16378 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16379 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16380 2usize,
16381 1u8,
16382 val as u64,
16383 )
16384 }
16385 }
16386 #[inline]
16387 pub fn mIsStateRestoring(&self) -> bool {
16388 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
16389 }
16390 #[inline]
16391 pub fn set_mIsStateRestoring(&mut self, val: bool) {
16392 unsafe {
16393 let val: u8 = ::std::mem::transmute(val);
16394 self._bitfield_1.set(3usize, 1u8, val as u64)
16395 }
16396 }
16397 #[inline]
16398 pub unsafe fn mIsStateRestoring_raw(this: *const Self) -> bool {
16399 unsafe {
16400 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16401 ::std::ptr::addr_of!((*this)._bitfield_1),
16402 3usize,
16403 1u8,
16404 ) as u8)
16405 }
16406 }
16407 #[inline]
16408 pub unsafe fn set_mIsStateRestoring_raw(this: *mut Self, val: bool) {
16409 unsafe {
16410 let val: u8 = ::std::mem::transmute(val);
16411 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16412 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16413 3usize,
16414 1u8,
16415 val as u64,
16416 )
16417 }
16418 }
16419 #[inline]
16420 pub fn mIsCslSynced(&self) -> bool {
16421 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
16422 }
16423 #[inline]
16424 pub fn set_mIsCslSynced(&mut self, val: bool) {
16425 unsafe {
16426 let val: u8 = ::std::mem::transmute(val);
16427 self._bitfield_1.set(4usize, 1u8, val as u64)
16428 }
16429 }
16430 #[inline]
16431 pub unsafe fn mIsCslSynced_raw(this: *const Self) -> bool {
16432 unsafe {
16433 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16434 ::std::ptr::addr_of!((*this)._bitfield_1),
16435 4usize,
16436 1u8,
16437 ) as u8)
16438 }
16439 }
16440 #[inline]
16441 pub unsafe fn set_mIsCslSynced_raw(this: *mut Self, val: bool) {
16442 unsafe {
16443 let val: u8 = ::std::mem::transmute(val);
16444 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16445 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16446 4usize,
16447 1u8,
16448 val as u64,
16449 )
16450 }
16451 }
16452 #[inline]
16453 pub fn new_bitfield_1(
16454 mRxOnWhenIdle: bool,
16455 mFullThreadDevice: bool,
16456 mFullNetworkData: bool,
16457 mIsStateRestoring: bool,
16458 mIsCslSynced: bool,
16459 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16460 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16461 __bindgen_bitfield_unit.set(0usize, 1u8, {
16462 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
16463 mRxOnWhenIdle as u64
16464 });
16465 __bindgen_bitfield_unit.set(1usize, 1u8, {
16466 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
16467 mFullThreadDevice as u64
16468 });
16469 __bindgen_bitfield_unit.set(2usize, 1u8, {
16470 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
16471 mFullNetworkData as u64
16472 });
16473 __bindgen_bitfield_unit.set(3usize, 1u8, {
16474 let mIsStateRestoring: u8 = unsafe { ::std::mem::transmute(mIsStateRestoring) };
16475 mIsStateRestoring as u64
16476 });
16477 __bindgen_bitfield_unit.set(4usize, 1u8, {
16478 let mIsCslSynced: u8 = unsafe { ::std::mem::transmute(mIsCslSynced) };
16479 mIsCslSynced as u64
16480 });
16481 __bindgen_bitfield_unit
16482 }
16483}
16484pub type otChildIp6AddressIterator = u16;
16485pub const OT_CACHE_ENTRY_STATE_CACHED: otCacheEntryState = 0;
16486pub const OT_CACHE_ENTRY_STATE_SNOOPED: otCacheEntryState = 1;
16487pub const OT_CACHE_ENTRY_STATE_QUERY: otCacheEntryState = 2;
16488pub const OT_CACHE_ENTRY_STATE_RETRY_QUERY: otCacheEntryState = 3;
16489#[doc = " Defines the EID cache entry state."]
16490pub type otCacheEntryState = ::std::os::raw::c_uint;
16491#[doc = " Represents an EID cache entry."]
16492#[repr(C)]
16493#[derive(Copy, Clone)]
16494pub struct otCacheEntryInfo {
16495 #[doc = "< Target EID"]
16496 pub mTarget: otIp6Address,
16497 #[doc = "< RLOC16"]
16498 pub mRloc16: otShortAddress,
16499 #[doc = "< Entry state"]
16500 pub mState: otCacheEntryState,
16501 pub _bitfield_align_1: [u8; 0],
16502 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16503 #[doc = "< Last transaction time (applicable in cached state)."]
16504 pub mLastTransTime: u32,
16505 #[doc = "< Mesh Local EID (applicable if entry in cached state)."]
16506 pub mMeshLocalEid: otIp6Address,
16507 #[doc = "< Timeout in seconds (applicable if in snooped/query/retry-query states)."]
16508 pub mTimeout: u16,
16509 #[doc = "< Retry delay in seconds (applicable if in query-retry state)."]
16510 pub mRetryDelay: u16,
16511}
16512impl Default for otCacheEntryInfo {
16513 fn default() -> Self {
16514 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16515 unsafe {
16516 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16517 s.assume_init()
16518 }
16519 }
16520}
16521impl otCacheEntryInfo {
16522 #[inline]
16523 pub fn mCanEvict(&self) -> bool {
16524 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16525 }
16526 #[inline]
16527 pub fn set_mCanEvict(&mut self, val: bool) {
16528 unsafe {
16529 let val: u8 = ::std::mem::transmute(val);
16530 self._bitfield_1.set(0usize, 1u8, val as u64)
16531 }
16532 }
16533 #[inline]
16534 pub unsafe fn mCanEvict_raw(this: *const Self) -> bool {
16535 unsafe {
16536 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16537 ::std::ptr::addr_of!((*this)._bitfield_1),
16538 0usize,
16539 1u8,
16540 ) as u8)
16541 }
16542 }
16543 #[inline]
16544 pub unsafe fn set_mCanEvict_raw(this: *mut Self, val: bool) {
16545 unsafe {
16546 let val: u8 = ::std::mem::transmute(val);
16547 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16548 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16549 0usize,
16550 1u8,
16551 val as u64,
16552 )
16553 }
16554 }
16555 #[inline]
16556 pub fn mRampDown(&self) -> bool {
16557 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16558 }
16559 #[inline]
16560 pub fn set_mRampDown(&mut self, val: bool) {
16561 unsafe {
16562 let val: u8 = ::std::mem::transmute(val);
16563 self._bitfield_1.set(1usize, 1u8, val as u64)
16564 }
16565 }
16566 #[inline]
16567 pub unsafe fn mRampDown_raw(this: *const Self) -> bool {
16568 unsafe {
16569 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16570 ::std::ptr::addr_of!((*this)._bitfield_1),
16571 1usize,
16572 1u8,
16573 ) as u8)
16574 }
16575 }
16576 #[inline]
16577 pub unsafe fn set_mRampDown_raw(this: *mut Self, val: bool) {
16578 unsafe {
16579 let val: u8 = ::std::mem::transmute(val);
16580 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16581 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16582 1usize,
16583 1u8,
16584 val as u64,
16585 )
16586 }
16587 }
16588 #[inline]
16589 pub fn mValidLastTrans(&self) -> bool {
16590 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16591 }
16592 #[inline]
16593 pub fn set_mValidLastTrans(&mut self, val: bool) {
16594 unsafe {
16595 let val: u8 = ::std::mem::transmute(val);
16596 self._bitfield_1.set(2usize, 1u8, val as u64)
16597 }
16598 }
16599 #[inline]
16600 pub unsafe fn mValidLastTrans_raw(this: *const Self) -> bool {
16601 unsafe {
16602 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16603 ::std::ptr::addr_of!((*this)._bitfield_1),
16604 2usize,
16605 1u8,
16606 ) as u8)
16607 }
16608 }
16609 #[inline]
16610 pub unsafe fn set_mValidLastTrans_raw(this: *mut Self, val: bool) {
16611 unsafe {
16612 let val: u8 = ::std::mem::transmute(val);
16613 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16614 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16615 2usize,
16616 1u8,
16617 val as u64,
16618 )
16619 }
16620 }
16621 #[inline]
16622 pub fn new_bitfield_1(
16623 mCanEvict: bool,
16624 mRampDown: bool,
16625 mValidLastTrans: bool,
16626 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16627 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16628 __bindgen_bitfield_unit.set(0usize, 1u8, {
16629 let mCanEvict: u8 = unsafe { ::std::mem::transmute(mCanEvict) };
16630 mCanEvict as u64
16631 });
16632 __bindgen_bitfield_unit.set(1usize, 1u8, {
16633 let mRampDown: u8 = unsafe { ::std::mem::transmute(mRampDown) };
16634 mRampDown as u64
16635 });
16636 __bindgen_bitfield_unit.set(2usize, 1u8, {
16637 let mValidLastTrans: u8 = unsafe { ::std::mem::transmute(mValidLastTrans) };
16638 mValidLastTrans as u64
16639 });
16640 __bindgen_bitfield_unit
16641 }
16642}
16643#[doc = " Represents an iterator used for iterating through the EID cache table entries.\n\n To initialize the iterator and start from the first entry in the cache table, set all its fields in the structure to\n zero (e.g., `memset` the iterator to zero)."]
16644#[repr(C)]
16645#[derive(Debug, Copy, Clone)]
16646pub struct otCacheEntryIterator {
16647 #[doc = "< Opaque data used by the core implementation. Should not be changed by user."]
16648 pub mData: [*const ::std::os::raw::c_void; 2usize],
16649}
16650impl Default for otCacheEntryIterator {
16651 fn default() -> Self {
16652 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16653 unsafe {
16654 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16655 s.assume_init()
16656 }
16657 }
16658}
16659unsafe extern "C" {
16660 #[doc = " Gets the maximum number of children currently allowed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum number of children currently allowed.\n\n @sa otThreadSetMaxAllowedChildren"]
16661 pub fn otThreadGetMaxAllowedChildren(aInstance: *mut otInstance) -> u16;
16662}
16663unsafe extern "C" {
16664 #[doc = " Sets the maximum number of children currently allowed.\n\n This parameter can only be set when Thread protocol operation has been stopped.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMaxChildren The maximum allowed children.\n\n @retval OT_ERROR_NONE Successfully set the max.\n @retval OT_ERROR_INVALID_ARGS If @p aMaxChildren is not in the range [1, OPENTHREAD_CONFIG_MLE_MAX_CHILDREN].\n @retval OT_ERROR_INVALID_STATE If Thread isn't stopped.\n\n @sa otThreadGetMaxAllowedChildren"]
16665 pub fn otThreadSetMaxAllowedChildren(aInstance: *mut otInstance, aMaxChildren: u16) -> otError;
16666}
16667unsafe extern "C" {
16668 #[doc = " Indicates whether or not the device is router-eligible.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If device is router-eligible.\n @retval FALSE If device is not router-eligible."]
16669 pub fn otThreadIsRouterEligible(aInstance: *mut otInstance) -> bool;
16670}
16671unsafe extern "C" {
16672 #[doc = " Sets whether or not the device is router-eligible.\n\n If @p aEligible is false and the device is currently operating as a router, this call will cause the device to\n detach and attempt to reattach as a child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEligible TRUE to configure the device as router-eligible, FALSE otherwise.\n\n @retval OT_ERROR_NONE Successfully set the router-eligible configuration.\n @retval OT_ERROR_NOT_CAPABLE The device is not capable of becoming a router."]
16673 pub fn otThreadSetRouterEligible(aInstance: *mut otInstance, aEligible: bool) -> otError;
16674}
16675unsafe extern "C" {
16676 #[doc = " Set the preferred Router Id.\n\n Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if\n it can not be used, a randomly generated router id is picked. This property can be set only when the device role is\n either detached or disabled.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterId The preferred Router Id.\n\n @retval OT_ERROR_NONE Successfully set the preferred Router Id.\n @retval OT_ERROR_INVALID_STATE Could not set (role is not detached or disabled)"]
16677 pub fn otThreadSetPreferredRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
16678}
16679#[doc = "< Battery powered."]
16680pub const OT_POWER_SUPPLY_BATTERY: otPowerSupply = 0;
16681#[doc = "< Externally powered (mains-powered)."]
16682pub const OT_POWER_SUPPLY_EXTERNAL: otPowerSupply = 1;
16683#[doc = "< Stable external power with a battery backup or UPS."]
16684pub const OT_POWER_SUPPLY_EXTERNAL_STABLE: otPowerSupply = 2;
16685#[doc = "< Potentially unstable ext power (e.g. light bulb powered via a switch)."]
16686pub const OT_POWER_SUPPLY_EXTERNAL_UNSTABLE: otPowerSupply = 3;
16687#[doc = " Represents the power supply property on a device.\n\n This is used as a property in `otDeviceProperties` to calculate the leader weight."]
16688pub type otPowerSupply = ::std::os::raw::c_uint;
16689#[doc = " Represents the device properties which are used for calculating the local leader weight on a\n device.\n\n The parameters are set based on device's capability, whether acting as border router, its power supply config, etc.\n\n `mIsUnstable` indicates operational stability of device and is determined via a vendor specific mechanism. It can\n include the following cases:\n - Device internally detects that it loses external power supply more often than usual. What is usual is\n determined by the vendor.\n - Device internally detects that it reboots more often than usual. What is usual is determined by the vendor."]
16690#[repr(C)]
16691#[derive(Debug, Copy, Clone)]
16692pub struct otDeviceProperties {
16693 #[doc = "< Power supply config."]
16694 pub mPowerSupply: otPowerSupply,
16695 pub _bitfield_align_1: [u8; 0],
16696 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16697 #[doc = "< Weight adjustment. Should be -16 to +16 (clamped otherwise)."]
16698 pub mLeaderWeightAdjustment: i8,
16699}
16700impl Default for otDeviceProperties {
16701 fn default() -> Self {
16702 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16703 unsafe {
16704 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16705 s.assume_init()
16706 }
16707 }
16708}
16709impl otDeviceProperties {
16710 #[inline]
16711 pub fn mIsBorderRouter(&self) -> bool {
16712 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16713 }
16714 #[inline]
16715 pub fn set_mIsBorderRouter(&mut self, val: bool) {
16716 unsafe {
16717 let val: u8 = ::std::mem::transmute(val);
16718 self._bitfield_1.set(0usize, 1u8, val as u64)
16719 }
16720 }
16721 #[inline]
16722 pub unsafe fn mIsBorderRouter_raw(this: *const Self) -> bool {
16723 unsafe {
16724 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16725 ::std::ptr::addr_of!((*this)._bitfield_1),
16726 0usize,
16727 1u8,
16728 ) as u8)
16729 }
16730 }
16731 #[inline]
16732 pub unsafe fn set_mIsBorderRouter_raw(this: *mut Self, val: bool) {
16733 unsafe {
16734 let val: u8 = ::std::mem::transmute(val);
16735 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16736 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16737 0usize,
16738 1u8,
16739 val as u64,
16740 )
16741 }
16742 }
16743 #[inline]
16744 pub fn mSupportsCcm(&self) -> bool {
16745 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16746 }
16747 #[inline]
16748 pub fn set_mSupportsCcm(&mut self, val: bool) {
16749 unsafe {
16750 let val: u8 = ::std::mem::transmute(val);
16751 self._bitfield_1.set(1usize, 1u8, val as u64)
16752 }
16753 }
16754 #[inline]
16755 pub unsafe fn mSupportsCcm_raw(this: *const Self) -> bool {
16756 unsafe {
16757 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16758 ::std::ptr::addr_of!((*this)._bitfield_1),
16759 1usize,
16760 1u8,
16761 ) as u8)
16762 }
16763 }
16764 #[inline]
16765 pub unsafe fn set_mSupportsCcm_raw(this: *mut Self, val: bool) {
16766 unsafe {
16767 let val: u8 = ::std::mem::transmute(val);
16768 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16769 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16770 1usize,
16771 1u8,
16772 val as u64,
16773 )
16774 }
16775 }
16776 #[inline]
16777 pub fn mIsUnstable(&self) -> bool {
16778 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16779 }
16780 #[inline]
16781 pub fn set_mIsUnstable(&mut self, val: bool) {
16782 unsafe {
16783 let val: u8 = ::std::mem::transmute(val);
16784 self._bitfield_1.set(2usize, 1u8, val as u64)
16785 }
16786 }
16787 #[inline]
16788 pub unsafe fn mIsUnstable_raw(this: *const Self) -> bool {
16789 unsafe {
16790 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16791 ::std::ptr::addr_of!((*this)._bitfield_1),
16792 2usize,
16793 1u8,
16794 ) as u8)
16795 }
16796 }
16797 #[inline]
16798 pub unsafe fn set_mIsUnstable_raw(this: *mut Self, val: bool) {
16799 unsafe {
16800 let val: u8 = ::std::mem::transmute(val);
16801 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16802 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16803 2usize,
16804 1u8,
16805 val as u64,
16806 )
16807 }
16808 }
16809 #[inline]
16810 pub fn new_bitfield_1(
16811 mIsBorderRouter: bool,
16812 mSupportsCcm: bool,
16813 mIsUnstable: bool,
16814 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16815 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16816 __bindgen_bitfield_unit.set(0usize, 1u8, {
16817 let mIsBorderRouter: u8 = unsafe { ::std::mem::transmute(mIsBorderRouter) };
16818 mIsBorderRouter as u64
16819 });
16820 __bindgen_bitfield_unit.set(1usize, 1u8, {
16821 let mSupportsCcm: u8 = unsafe { ::std::mem::transmute(mSupportsCcm) };
16822 mSupportsCcm as u64
16823 });
16824 __bindgen_bitfield_unit.set(2usize, 1u8, {
16825 let mIsUnstable: u8 = unsafe { ::std::mem::transmute(mIsUnstable) };
16826 mIsUnstable as u64
16827 });
16828 __bindgen_bitfield_unit
16829 }
16830}
16831unsafe extern "C" {
16832 #[doc = " Get the current device properties.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @returns The device properties `otDeviceProperties`."]
16833 pub fn otThreadGetDeviceProperties(aInstance: *mut otInstance) -> *const otDeviceProperties;
16834}
16835unsafe extern "C" {
16836 #[doc = " Set the device properties which are then used to determine and set the Leader Weight.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDeviceProperties The device properties."]
16837 pub fn otThreadSetDeviceProperties(
16838 aInstance: *mut otInstance,
16839 aDeviceProperties: *const otDeviceProperties,
16840 );
16841}
16842unsafe extern "C" {
16843 #[doc = " Gets the Thread Leader Weight used when operating in the Leader role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Thread Leader Weight value.\n\n @sa otThreadSetLeaderWeight\n @sa otThreadSetDeviceProperties"]
16844 pub fn otThreadGetLocalLeaderWeight(aInstance: *mut otInstance) -> u8;
16845}
16846unsafe extern "C" {
16847 #[doc = " Sets the Thread Leader Weight used when operating in the Leader role.\n\n Directly sets the Leader Weight to the new value, replacing its previous value (which may have been\n determined from the current `otDeviceProperties`).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aWeight The Thread Leader Weight value.\n\n @sa otThreadGetLeaderWeight"]
16848 pub fn otThreadSetLocalLeaderWeight(aInstance: *mut otInstance, aWeight: u8);
16849}
16850unsafe extern "C" {
16851 #[doc = " Get the preferred Thread Leader Partition Id used when operating in the Leader role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Thread Leader Partition Id value."]
16852 pub fn otThreadGetPreferredLeaderPartitionId(aInstance: *mut otInstance) -> u32;
16853}
16854unsafe extern "C" {
16855 #[doc = " Set the preferred Thread Leader Partition Id used when operating in the Leader role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPartitionId The Thread Leader Partition Id value."]
16856 pub fn otThreadSetPreferredLeaderPartitionId(aInstance: *mut otInstance, aPartitionId: u32);
16857}
16858unsafe extern "C" {
16859 #[doc = " Gets the Joiner UDP Port.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Joiner UDP Port number.\n\n @sa otThreadSetJoinerUdpPort"]
16860 pub fn otThreadGetJoinerUdpPort(aInstance: *mut otInstance) -> u16;
16861}
16862unsafe extern "C" {
16863 #[doc = " Sets the Joiner UDP Port.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aJoinerUdpPort The Joiner UDP Port number.\n\n @retval OT_ERROR_NONE Successfully set the Joiner UDP Port.\n\n @sa otThreadGetJoinerUdpPort"]
16864 pub fn otThreadSetJoinerUdpPort(aInstance: *mut otInstance, aJoinerUdpPort: u16) -> otError;
16865}
16866unsafe extern "C" {
16867 #[doc = " Set Steering data out of band.\n\n Configuration option `OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE` should be set to enable setting of steering\n data out of band.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aExtAddress Address used to update the steering data.\n All zeros to clear the steering data (no steering data).\n All 0xFFs to set steering data/bloom filter to accept/allow all.\n A specific EUI64 which is then added to current steering data/bloom filter."]
16868 pub fn otThreadSetSteeringData(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
16869}
16870unsafe extern "C" {
16871 #[doc = " Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CONTEXT_ID_REUSE_DELAY value.\n\n @sa otThreadSetContextIdReuseDelay"]
16872 pub fn otThreadGetContextIdReuseDelay(aInstance: *mut otInstance) -> u32;
16873}
16874unsafe extern "C" {
16875 #[doc = " Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDelay The CONTEXT_ID_REUSE_DELAY value.\n\n @sa otThreadGetContextIdReuseDelay"]
16876 pub fn otThreadSetContextIdReuseDelay(aInstance: *mut otInstance, aDelay: u32);
16877}
16878unsafe extern "C" {
16879 #[doc = " Get the `NETWORK_ID_TIMEOUT` parameter.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The `NETWORK_ID_TIMEOUT` value.\n\n @sa otThreadSetNetworkIdTimeout"]
16880 pub fn otThreadGetNetworkIdTimeout(aInstance: *mut otInstance) -> u8;
16881}
16882unsafe extern "C" {
16883 #[doc = " Set the `NETWORK_ID_TIMEOUT` parameter.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTimeout The `NETWORK_ID_TIMEOUT` value.\n\n @sa otThreadGetNetworkIdTimeout"]
16884 pub fn otThreadSetNetworkIdTimeout(aInstance: *mut otInstance, aTimeout: u8);
16885}
16886unsafe extern "C" {
16887 #[doc = " Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The ROUTER_UPGRADE_THRESHOLD value.\n\n @sa otThreadSetRouterUpgradeThreshold"]
16888 pub fn otThreadGetRouterUpgradeThreshold(aInstance: *mut otInstance) -> u8;
16889}
16890unsafe extern "C" {
16891 #[doc = " Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.\n\n @sa otThreadGetRouterUpgradeThreshold"]
16892 pub fn otThreadSetRouterUpgradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
16893}
16894unsafe extern "C" {
16895 #[doc = " Get the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.\n\n This parameter specifies the max number of neighboring routers with which the device (as an FED)\n will try to establish link.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The MLE_CHILD_ROUTER_LINKS value.\n\n @sa otThreadSetChildRouterLinks"]
16896 pub fn otThreadGetChildRouterLinks(aInstance: *mut otInstance) -> u8;
16897}
16898unsafe extern "C" {
16899 #[doc = " Set the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChildRouterLinks The MLE_CHILD_ROUTER_LINKS value.\n\n @retval OT_ERROR_NONE Successfully set the value.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetChildRouterLinks"]
16900 pub fn otThreadSetChildRouterLinks(
16901 aInstance: *mut otInstance,
16902 aChildRouterLinks: u8,
16903 ) -> otError;
16904}
16905unsafe extern "C" {
16906 #[doc = " Release a Router ID that has been allocated by the device in the Leader role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterId The Router ID to release. Valid range is [0, 62].\n\n @retval OT_ERROR_NONE Successfully released the router id.\n @retval OT_ERROR_INVALID_ARGS @p aRouterId is not in the range [0, 62].\n @retval OT_ERROR_INVALID_STATE The device is not currently operating as a leader.\n @retval OT_ERROR_NOT_FOUND The router id is not currently allocated."]
16907 pub fn otThreadReleaseRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
16908}
16909unsafe extern "C" {
16910 #[doc = " Attempt to become a router.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully begin attempt to become a router.\n @retval OT_ERROR_INVALID_STATE Thread is disabled."]
16911 pub fn otThreadBecomeRouter(aInstance: *mut otInstance) -> otError;
16912}
16913unsafe extern "C" {
16914 #[doc = " Become a leader and start a new partition.\n\n If the device is not attached, this API will force the device to start as the leader of the network. This use case\n is only intended for testing and demo purposes, and using the API while the device is detached can make a production\n application non-compliant with the Thread Specification.\n\n If the device is already attached, this API can be used to try to take over as the leader, creating a new partition.\n For this to work, the local leader weight (`otThreadGetLocalLeaderWeight()`) must be larger than the weight of the\n current leader (`otThreadGetLeaderWeight()`). If it is not, `OT_ERROR_NOT_CAPABLE` is returned to indicate to the\n caller that they need to adjust the weight.\n\n Taking over the leader role in this way is only allowed when triggered by an explicit user action. Using this API\n without such user action can make a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval OT_ERROR_NONE Successfully became a leader and started a new partition, or was leader already.\n @retval OT_ERROR_INVALID_STATE Thread is disabled.\n @retval OT_ERROR_NOT_CAPABLE Device cannot override the current leader due to its local leader weight being same\n or smaller than current leader's weight, or device is not router eligible."]
16915 pub fn otThreadBecomeLeader(aInstance: *mut otInstance) -> otError;
16916}
16917unsafe extern "C" {
16918 #[doc = " Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The ROUTER_DOWNGRADE_THRESHOLD value.\n\n @sa otThreadSetRouterDowngradeThreshold"]
16919 pub fn otThreadGetRouterDowngradeThreshold(aInstance: *mut otInstance) -> u8;
16920}
16921unsafe extern "C" {
16922 #[doc = " Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.\n\n @sa otThreadGetRouterDowngradeThreshold"]
16923 pub fn otThreadSetRouterDowngradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
16924}
16925unsafe extern "C" {
16926 #[doc = " Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The ROUTER_SELECTION_JITTER value.\n\n @sa otThreadSetRouterSelectionJitter"]
16927 pub fn otThreadGetRouterSelectionJitter(aInstance: *mut otInstance) -> u8;
16928}
16929unsafe extern "C" {
16930 #[doc = " Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterJitter The ROUTER_SELECTION_JITTER value.\n\n @sa otThreadGetRouterSelectionJitter"]
16931 pub fn otThreadSetRouterSelectionJitter(aInstance: *mut otInstance, aRouterJitter: u8);
16932}
16933unsafe extern "C" {
16934 #[doc = " Gets diagnostic information for an attached Child by its Child ID or RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChildId The Child ID or RLOC16 for the attached child.\n @param[out] aChildInfo A pointer to where the child information is placed.\n\n @retval OT_ERROR_NONE @p aChildInfo was successfully updated with the info for the given ID.\n @retval OT_ERROR_NOT_FOUND No valid child with this Child ID.\n @retval OT_ERROR_INVALID_ARGS If @p aChildInfo is NULL."]
16935 pub fn otThreadGetChildInfoById(
16936 aInstance: *mut otInstance,
16937 aChildId: u16,
16938 aChildInfo: *mut otChildInfo,
16939 ) -> otError;
16940}
16941unsafe extern "C" {
16942 #[doc = " The function retains diagnostic information for an attached Child by the internal table index.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChildIndex The table index.\n @param[out] aChildInfo A pointer to where the child information is placed.\n\n @retval OT_ERROR_NONE @p aChildInfo was successfully updated with the info for the given index.\n @retval OT_ERROR_NOT_FOUND No valid child at this index.\n @retval OT_ERROR_INVALID_ARGS Either @p aChildInfo is NULL, or @p aChildIndex is out of range (higher\n than max table index).\n\n @sa otGetMaxAllowedChildren"]
16943 pub fn otThreadGetChildInfoByIndex(
16944 aInstance: *mut otInstance,
16945 aChildIndex: u16,
16946 aChildInfo: *mut otChildInfo,
16947 ) -> otError;
16948}
16949unsafe extern "C" {
16950 #[doc = " Gets the next IPv6 address (using an iterator) for a given child.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChildIndex The child index.\n @param[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next\n entry in the list. To get the first IPv6 address the iterator should be set to\n OT_CHILD_IP6_ADDRESS_ITERATOR_INIT.\n @param[out] aAddress A pointer to an IPv6 address where the child's next address is placed (on success).\n\n @retval OT_ERROR_NONE Successfully found the next IPv6 address (@p aAddress was successfully updated).\n @retval OT_ERROR_NOT_FOUND The child has no subsequent IPv6 address entry.\n @retval OT_ERROR_INVALID_ARGS @p aIterator or @p aAddress are NULL, or child at @p aChildIndex is not valid.\n\n @sa otThreadGetChildInfoByIndex"]
16951 pub fn otThreadGetChildNextIp6Address(
16952 aInstance: *mut otInstance,
16953 aChildIndex: u16,
16954 aIterator: *mut otChildIp6AddressIterator,
16955 aAddress: *mut otIp6Address,
16956 ) -> otError;
16957}
16958unsafe extern "C" {
16959 #[doc = " Get the current Router ID Sequence.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Router ID Sequence."]
16960 pub fn otThreadGetRouterIdSequence(aInstance: *mut otInstance) -> u8;
16961}
16962unsafe extern "C" {
16963 #[doc = " The function returns the maximum allowed router ID\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum allowed router ID."]
16964 pub fn otThreadGetMaxRouterId(aInstance: *mut otInstance) -> u8;
16965}
16966unsafe extern "C" {
16967 #[doc = " The function retains diagnostic information for a given Thread Router.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterId The router ID or RLOC16 for a given router.\n @param[out] aRouterInfo A pointer to where the router information is placed.\n\n @retval OT_ERROR_NONE Successfully retrieved the router info for given id.\n @retval OT_ERROR_NOT_FOUND No router entry with the given id.\n @retval OT_ERROR_INVALID_ARGS @p aRouterInfo is NULL."]
16968 pub fn otThreadGetRouterInfo(
16969 aInstance: *mut otInstance,
16970 aRouterId: u16,
16971 aRouterInfo: *mut otRouterInfo,
16972 ) -> otError;
16973}
16974unsafe extern "C" {
16975 #[doc = " Gets the next EID cache entry (using an iterator).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aEntryInfo A pointer to where the EID cache entry information is placed.\n @param[in,out] aIterator A pointer to an iterator. It will be updated to point to next entry on success. To get\n the first entry, initialize the iterator by setting all its fields to zero\n (e.g., `memset` the iterator structure to zero).\n\n @retval OT_ERROR_NONE Successfully populated @p aEntryInfo for next EID cache entry.\n @retval OT_ERROR_NOT_FOUND No more entries in the address cache table."]
16976 pub fn otThreadGetNextCacheEntry(
16977 aInstance: *mut otInstance,
16978 aEntryInfo: *mut otCacheEntryInfo,
16979 aIterator: *mut otCacheEntryIterator,
16980 ) -> otError;
16981}
16982unsafe extern "C" {
16983 #[doc = " Get the Thread PSKc\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aPskc A pointer to an `otPskc` to return the retrieved Thread PSKc.\n\n @sa otThreadSetPskc"]
16984 pub fn otThreadGetPskc(aInstance: *mut otInstance, aPskc: *mut otPskc);
16985}
16986unsafe extern "C" {
16987 #[doc = " Get Key Reference to Thread PSKc stored\n\n Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns Key Reference to PSKc\n\n @sa otThreadSetPskcRef"]
16988 pub fn otThreadGetPskcRef(aInstance: *mut otInstance) -> otPskcRef;
16989}
16990unsafe extern "C" {
16991 #[doc = " Set the Thread PSKc\n\n Will only succeed when Thread protocols are disabled. A successful\n call to this function will also invalidate the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPskc A pointer to the new Thread PSKc.\n\n @retval OT_ERROR_NONE Successfully set the Thread PSKc.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetPskc"]
16992 pub fn otThreadSetPskc(aInstance: *mut otInstance, aPskc: *const otPskc) -> otError;
16993}
16994unsafe extern "C" {
16995 #[doc = " Set the Key Reference to the Thread PSKc\n\n Requires the build-time feature `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` to be enabled.\n\n Will only succeed when Thread protocols are disabled. Upon success,\n this will also invalidate the Active and Pending Operational Datasets in\n non-volatile memory.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyRef Key Reference to the new Thread PSKc.\n\n @retval OT_ERROR_NONE Successfully set the Thread PSKc.\n @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.\n\n @sa otThreadGetPskcRef"]
16996 pub fn otThreadSetPskcRef(aInstance: *mut otInstance, aKeyRef: otPskcRef) -> otError;
16997}
16998unsafe extern "C" {
16999 #[doc = " Get the assigned parent priority.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The assigned parent priority value, -2 means not assigned.\n\n @sa otThreadSetParentPriority"]
17000 pub fn otThreadGetParentPriority(aInstance: *mut otInstance) -> i8;
17001}
17002unsafe extern "C" {
17003 #[doc = " Set the parent priority.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aParentPriority The parent priority value.\n\n @retval OT_ERROR_NONE Successfully set the parent priority.\n @retval OT_ERROR_INVALID_ARGS If the parent priority value is not among 1, 0, -1 and -2.\n\n @sa otThreadGetParentPriority"]
17004 pub fn otThreadSetParentPriority(aInstance: *mut otInstance, aParentPriority: i8) -> otError;
17005}
17006unsafe extern "C" {
17007 #[doc = " Gets the maximum number of IP addresses that each MTD child may register with this device as parent.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The maximum number of IP addresses that each MTD child may register with this device as parent.\n\n @sa otThreadSetMaxChildIpAddresses"]
17008 pub fn otThreadGetMaxChildIpAddresses(aInstance: *mut otInstance) -> u8;
17009}
17010unsafe extern "C" {
17011 #[doc = " Sets or restores the maximum number of IP addresses that each MTD child may register with this\n device as parent.\n\n Pass `0` to clear the setting and restore the default.\n\n Available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @note Only used by Thread Test Harness to limit the address registrations of the reference\n parent in order to test the MTD DUT reaction.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMaxIpAddresses The maximum number of IP addresses that each MTD child may register with this\n device as parent. 0 to clear the setting and restore the default.\n\n @retval OT_ERROR_NONE Successfully set/cleared the number.\n @retval OT_ERROR_INVALID_ARGS If exceeds the allowed maximum number.\n\n @sa otThreadGetMaxChildIpAddresses"]
17012 pub fn otThreadSetMaxChildIpAddresses(
17013 aInstance: *mut otInstance,
17014 aMaxIpAddresses: u8,
17015 ) -> otError;
17016}
17017#[doc = "< A child is being added."]
17018pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED: otNeighborTableEvent = 0;
17019#[doc = "< A child is being removed."]
17020pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED: otNeighborTableEvent = 1;
17021#[doc = "< An existing child's mode is changed."]
17022pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED: otNeighborTableEvent = 2;
17023#[doc = "< A router is being added."]
17024pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED: otNeighborTableEvent = 3;
17025#[doc = "< A router is being removed."]
17026pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED: otNeighborTableEvent = 4;
17027#[doc = " Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table."]
17028pub type otNeighborTableEvent = ::std::os::raw::c_uint;
17029#[doc = " Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table\n callback `otNeighborTableCallback`."]
17030#[repr(C)]
17031#[derive(Copy, Clone)]
17032pub struct otNeighborTableEntryInfo {
17033 #[doc = "< The OpenThread instance."]
17034 pub mInstance: *mut otInstance,
17035 pub mInfo: otNeighborTableEntryInfo__bindgen_ty_1,
17036}
17037#[repr(C)]
17038#[derive(Copy, Clone)]
17039pub union otNeighborTableEntryInfo__bindgen_ty_1 {
17040 #[doc = "< The child neighbor info."]
17041 pub mChild: otChildInfo,
17042 #[doc = "< The router neighbor info."]
17043 pub mRouter: otNeighborInfo,
17044}
17045impl Default for otNeighborTableEntryInfo__bindgen_ty_1 {
17046 fn default() -> Self {
17047 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17048 unsafe {
17049 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17050 s.assume_init()
17051 }
17052 }
17053}
17054impl Default for otNeighborTableEntryInfo {
17055 fn default() -> Self {
17056 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17057 unsafe {
17058 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17059 s.assume_init()
17060 }
17061 }
17062}
17063#[doc = " Pointer is called to notify that there is a change in the neighbor table.\n\n @param[in] aEvent A event flag.\n @param[in] aEntryInfo A pointer to table entry info."]
17064pub type otNeighborTableCallback = ::std::option::Option<
17065 unsafe extern "C" fn(aEvent: otNeighborTableEvent, aEntryInfo: *const otNeighborTableEntryInfo),
17066>;
17067unsafe extern "C" {
17068 #[doc = " Registers a neighbor table callback function.\n\n The provided callback (if non-NULL) will be invoked when there is a change in the neighbor table (e.g., a child or a\n router neighbor entry is being added/removed or an existing child's mode is changed).\n\n Subsequent calls to this method will overwrite the previous callback. Note that this callback in invoked while the\n neighbor/child table is being updated and always before the `otStateChangedCallback`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to callback handler function."]
17069 pub fn otThreadRegisterNeighborTableCallback(
17070 aInstance: *mut otInstance,
17071 aCallback: otNeighborTableCallback,
17072 );
17073}
17074unsafe extern "C" {
17075 #[doc = " Sets whether the device was commissioned using CCM.\n\n @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness\n to indicate whether this device was commissioned using CCM.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE if the device was commissioned using CCM, FALSE otherwise."]
17076 pub fn otThreadSetCcmEnabled(aInstance: *mut otInstance, aEnabled: bool);
17077}
17078unsafe extern "C" {
17079 #[doc = " Sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled.\n\n @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness\n to indicate that thread protocol version check VR should be skipped.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable Security Policy TLV version-threshold for routing, FALSE otherwise."]
17080 pub fn otThreadSetThreadVersionCheckEnabled(aInstance: *mut otInstance, aEnabled: bool);
17081}
17082unsafe extern "C" {
17083 #[doc = " Enables or disables the filter to drop TMF UDP messages from untrusted origin.\n\n TMF messages are only trusted when they originate from a trusted source, such as the Thread interface. In\n special cases, such as when a device uses platform UDP socket to send TMF messages, they will be dropped due\n to untrusted origin. This filter is enabled by default.\n\n When this filter is disabled, UDP messages sent to the TMF port that originate from untrusted origin (such as\n host, CLI or an external IPv6 node) will be allowed.\n\n @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` and is only used by Thread Test Harness\n to test network behavior by sending special TMF messages from the CLI on a POSIX host.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnabled TRUE to enable filter, FALSE otherwise."]
17084 pub fn otThreadSetTmfOriginFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
17085}
17086unsafe extern "C" {
17087 #[doc = " Indicates whether the filter that drops TMF UDP messages from untrusted origin is enabled or not.\n\n This is intended for testing only and available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` config is enabled.\n\n @retval TRUE The filter is enabled.\n @retval FALSE The filter is not enabled."]
17088 pub fn otThreadIsTmfOriginFilterEnabled(aInstance: *mut otInstance) -> bool;
17089}
17090unsafe extern "C" {
17091 #[doc = " Gets the range of router IDs that are allowed to assign to nodes within the thread network.\n\n @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used for test purpose. All the\n router IDs in the range [aMinRouterId, aMaxRouterId] are allowed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aMinRouterId The minimum router ID.\n @param[out] aMaxRouterId The maximum router ID.\n\n @sa otThreadSetRouterIdRange"]
17092 pub fn otThreadGetRouterIdRange(
17093 aInstance: *mut otInstance,
17094 aMinRouterId: *mut u8,
17095 aMaxRouterId: *mut u8,
17096 );
17097}
17098unsafe extern "C" {
17099 #[doc = " Sets the range of router IDs that are allowed to assign to nodes within the thread network.\n\n @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used for test purpose. All the\n router IDs in the range [aMinRouterId, aMaxRouterId] are allowed.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMinRouterId The minimum router ID.\n @param[in] aMaxRouterId The maximum router ID.\n\n @retval OT_ERROR_NONE Successfully set the range.\n @retval OT_ERROR_INVALID_ARGS aMinRouterId > aMaxRouterId, or the range is not covered by [0, 62].\n\n @sa otThreadGetRouterIdRange"]
17100 pub fn otThreadSetRouterIdRange(
17101 aInstance: *mut otInstance,
17102 aMinRouterId: u8,
17103 aMaxRouterId: u8,
17104 ) -> otError;
17105}
17106unsafe extern "C" {
17107 #[doc = " Gets the current Interval Max value used by Advertisement trickle timer.\n\n This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is intended for testing only.\n\n @returns The Interval Max of Advertisement trickle timer in milliseconds."]
17108 pub fn otThreadGetAdvertisementTrickleIntervalMax(aInstance: *mut otInstance) -> u32;
17109}
17110unsafe extern "C" {
17111 #[doc = " Indicates whether or not a Router ID is currently allocated.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterId The router ID to check.\n\n @retval TRUE The @p aRouterId is allocated.\n @retval FALSE The @p aRouterId is not allocated."]
17112 pub fn otThreadIsRouterIdAllocated(aInstance: *mut otInstance, aRouterId: u8) -> bool;
17113}
17114unsafe extern "C" {
17115 #[doc = " Gets the next hop and path cost towards a given RLOC16 destination.\n\n Can be used with either @p aNextHopRloc16 or @p aPathCost being NULL indicating caller does not want\n to get the value.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDestRloc16 The RLOC16 of destination.\n @param[out] aNextHopRloc16 A pointer to return RLOC16 of next hop, 0xfffe if no next hop.\n @param[out] aPathCost A pointer to return path cost towards destination."]
17116 pub fn otThreadGetNextHopAndPathCost(
17117 aInstance: *mut otInstance,
17118 aDestRloc16: u16,
17119 aNextHopRloc16: *mut u16,
17120 aPathCost: *mut u8,
17121 );
17122}
17123#[doc = " Represents a TREL peer."]
17124#[repr(C)]
17125#[derive(Copy, Clone)]
17126pub struct otTrelPeer {
17127 #[doc = "< The Extended MAC Address of TREL peer."]
17128 pub mExtAddress: otExtAddress,
17129 #[doc = "< The Extended PAN Identifier of TREL peer."]
17130 pub mExtPanId: otExtendedPanId,
17131 #[doc = "< The IPv6 socket address of TREL peer."]
17132 pub mSockAddr: otSockAddr,
17133}
17134impl Default for otTrelPeer {
17135 fn default() -> Self {
17136 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17137 unsafe {
17138 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17139 s.assume_init()
17140 }
17141 }
17142}
17143#[doc = " Represents an iterator for iterating over TREL peer table entries."]
17144pub type otTrelPeerIterator = *const ::std::os::raw::c_void;
17145unsafe extern "C" {
17146 #[doc = " Sets the user's preference to enable or disable the TREL operation.\n\n The TREL interface's operational state is determined by two factors: the user's preference (set by this function)\n and the OpenThread stack's internal state. The TREL interface is enabled only when both the user and the OpenThread\n stack have it enabled. Otherwise, it is disabled.\n\n Upon OpenThread initialization, the user's preference is set to enabled by default. This allows the stack to\n control the TREL interface state automatically (e.g., enabling it when radio links are enabled and disabling\n it when radio links are disabled).\n\n If the user explicitly disables the TREL operation by calling this function with @p aEnable as `false`, it will\n remain disabled until the user explicitly re-enables it by calling this function with @p aEnable as `true`. This\n ensures the user's 'disable' request persists across other OpenThread stack state changes (which may trigger\n disabling/enabling of all radio links, including the TREL link).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable A boolean to enable/disable the TREL operation."]
17147 pub fn otTrelSetEnabled(aInstance: *mut otInstance, aEnable: bool);
17148}
17149unsafe extern "C" {
17150 #[doc = " Indicates whether the TREL operation is enabled.\n\n The TREL operation is enabled if and only if it is enabled by both the user (see `otTrelSetEnabled()`) and the\n OpenThread stack.\n\n @param[in] aInstance The OpenThread instance.\n\n @retval TRUE if the TREL operation is enabled.\n @retval FALSE if the TREL operation is disabled."]
17151 pub fn otTrelIsEnabled(aInstance: *mut otInstance) -> bool;
17152}
17153unsafe extern "C" {
17154 #[doc = " Initializes a peer table iterator.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
17155 pub fn otTrelInitPeerIterator(aInstance: *mut otInstance, aIterator: *mut otTrelPeerIterator);
17156}
17157unsafe extern "C" {
17158 #[doc = " Iterates over the peer table entries and get the next entry from the table\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator. MUST be initialized.\n\n @returns A pointer to the next `otTrelPeer` entry or `NULL` if no more entries in the table."]
17159 pub fn otTrelGetNextPeer(
17160 aInstance: *mut otInstance,
17161 aIterator: *mut otTrelPeerIterator,
17162 ) -> *const otTrelPeer;
17163}
17164unsafe extern "C" {
17165 #[doc = " Returns the number of TREL peers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The number of TREL peers."]
17166 pub fn otTrelGetNumberOfPeers(aInstance: *mut otInstance) -> u16;
17167}
17168unsafe extern "C" {
17169 #[doc = " Sets the filter mode (enables/disables filtering).\n\n When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly\n intended for use during testing.\n\n Unlike `otTrel{Enable/Disable}()` which fully starts/stops the TREL operation, when filter mode is enabled the\n TREL interface continues to be enabled.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aFiltered TRUE to enable filter mode, FALSE to disable filter mode."]
17170 pub fn otTrelSetFilterEnabled(aInstance: *mut otInstance, aEnable: bool);
17171}
17172unsafe extern "C" {
17173 #[doc = " Indicates whether or not the filter mode is enabled.\n\n @param[in] aInstance The OpenThread instance.\n\n @retval TRUE if the TREL filter mode is enabled.\n @retval FALSE if the TREL filter mode is disabled."]
17174 pub fn otTrelIsFilterEnabled(aInstance: *mut otInstance) -> bool;
17175}
17176#[doc = " Represents a group of TREL related counters."]
17177pub type otTrelCounters = otPlatTrelCounters;
17178unsafe extern "C" {
17179 #[doc = " Gets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the TREL counters."]
17180 pub fn otTrelGetCounters(aInstance: *mut otInstance) -> *const otTrelCounters;
17181}
17182unsafe extern "C" {
17183 #[doc = " Resets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
17184 pub fn otTrelResetCounters(aInstance: *mut otInstance);
17185}
17186unsafe extern "C" {
17187 #[doc = " Gets the UDP port of the TREL interface.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns UDP port of the TREL interface."]
17188 pub fn otTrelGetUdpPort(aInstance: *mut otInstance) -> u16;
17189}
17190unsafe extern "C" {
17191 #[doc = " Calculates the Verhoeff checksum for a given decimal string.\n\n Requires `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.\n\n @param[in] aDecimalString The string containing decimal digits.\n @param[out] aChecksum Pointer to a `char` to return the calculated checksum.\n\n @retval OT_ERROR_NONE Successfully calculated the checksum, @p aChecksum is updated.\n @retval OT_ERROR_INVALID_ARGS The @p aDecimalString is not valid, i.e. it either contains chars other than\n ['0'-'9'], or is longer than `OT_VERHOEFF_CHECKSUM_MAX_STRING_LENGTH`."]
17192 pub fn otVerhoeffChecksumCalculate(
17193 aDecimalString: *const ::std::os::raw::c_char,
17194 aChecksum: *mut ::std::os::raw::c_char,
17195 ) -> otError;
17196}
17197unsafe extern "C" {
17198 #[doc = " Validates the Verhoeff checksum for a given decimal string.\n\n Requires `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.\n\n @param[in] aDecimalString The string containing decimal digits (last char is treated as checksum).\n\n @retval OT_ERROR_NONE Successfully validated the checksum in @p aDecimalString.\n @retval OT_ERROR_FAILED Checksum validation failed.\n @retval OT_ERROR_INVALID_ARGS The @p aDecimalString is not valid, i.e. it either contains chars other than\n ['0'-'9'], or is longer than `OT_VERHOEFF_CHECKSUM_MAX_STRING_LENGTH`."]
17199 pub fn otVerhoeffChecksumValidate(aDecimalString: *const ::std::os::raw::c_char) -> otError;
17200}
17201pub type __builtin_va_list = [__va_list_tag; 1usize];
17202#[repr(C)]
17203#[derive(Debug, Copy, Clone)]
17204pub struct __va_list_tag {
17205 pub gp_offset: ::std::os::raw::c_uint,
17206 pub fp_offset: ::std::os::raw::c_uint,
17207 pub overflow_arg_area: *mut ::std::os::raw::c_void,
17208 pub reg_save_area: *mut ::std::os::raw::c_void,
17209}
17210impl Default for __va_list_tag {
17211 fn default() -> Self {
17212 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17213 unsafe {
17214 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17215 s.assume_init()
17216 }
17217 }
17218}