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 = 610;
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_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT: u32 = 0;
181pub const OT_BORDER_AGENT_MIN_EPHEMERAL_KEY_LENGTH: u32 = 6;
182pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_LENGTH: u32 = 32;
183pub const OT_BORDER_AGENT_DEFAULT_EPHEMERAL_KEY_TIMEOUT: u32 = 120000;
184pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT: u32 = 600000;
185pub const OT_BORDER_AGENT_EPHEMERAL_KEY_TAP_STRING_LENGTH: u32 = 9;
186pub const OT_DNS_MAX_NAME_SIZE: u32 = 255;
187pub const OT_DNS_MAX_LABEL_SIZE: u32 = 64;
188pub const OT_DNS_TXT_KEY_MIN_LENGTH: u32 = 1;
189pub const OT_DNS_TXT_KEY_MAX_LENGTH: u32 = 9;
190pub const OT_DNS_TXT_KEY_ITER_MAX_LENGTH: u32 = 64;
191pub const OT_BORDER_AGENT_ID_LENGTH: u32 = 16;
192pub const OT_BORDER_AGENT_MESHCOP_SERVICE_TXT_DATA_MAX_LENGTH: u32 = 256;
193pub const OT_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME_MAX_LENGTH: u32 = 51;
194pub const OT_JOINER_MAX_DISCERNER_LENGTH: u32 = 64;
195pub const OT_STEERING_DATA_MIN_LENGTH: u32 = 1;
196pub const OT_STEERING_DATA_MAX_LENGTH: u32 = 16;
197pub const OT_COMMISSIONING_PASSPHRASE_MIN_SIZE: u32 = 6;
198pub const OT_COMMISSIONING_PASSPHRASE_MAX_SIZE: u32 = 255;
199pub const OT_PROVISIONING_URL_MAX_SIZE: u32 = 64;
200pub const OT_JOINER_MAX_PSKD_LENGTH: u32 = 32;
201pub const OT_NETWORK_DATA_ITERATOR_INIT: u32 = 0;
202pub const OT_SERVICE_DATA_MAX_SIZE: u32 = 252;
203pub const OT_SERVER_DATA_MAX_SIZE: u32 = 248;
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_TLV_VENDOR_OUI: u32 = 44;
313pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH: u32 = 32;
314pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH: u32 = 32;
315pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH: u32 = 16;
316pub const OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH: u32 = 64;
317pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH: u32 = 96;
318pub const OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT: u32 = 0;
319pub const OT_THREAD_VENDOR_OUI_MAX_SIZE: u32 = 5;
320pub const OT_THREAD_VENDOR_OUI_MA_L_BIT_LENGTH: u32 = 24;
321pub const OT_THREAD_VENDOR_OUI_MA_M_BIT_LENGTH: u32 = 28;
322pub const OT_THREAD_VENDOR_OUI_MA_S_BIT_LENGTH: u32 = 36;
323pub const OT_THREAD_VENDOR_OUI_STRING_SIZE: u32 = 16;
324pub const OT_THREAD_UNSPECIFIED_VENDOR_OUI: u32 = 4294967295;
325pub const OT_TIME_SYNC_INVALID_SEQ: u32 = 0;
326pub const OT_PLAT_INFRA_IF_MAX_LINK_LAYER_ADDR_LENGTH: u32 = 16;
327pub const OT_MS_PER_S: u32 = 1000;
328pub const OT_US_PER_MS: u32 = 1000;
329pub const OT_US_PER_S: u32 = 1000000;
330pub const OT_NS_PER_US: u32 = 1000;
331pub const OT_SNTP_DEFAULT_SERVER_IP: &[u8; 19] = b"2001:4860:4806:8::\0";
332pub const OT_SNTP_DEFAULT_SERVER_PORT: u32 = 123;
333pub const OT_TCP_ENDPOINT_TCB_SIZE_BASE: u32 = 392;
334pub const OT_TCP_ENDPOINT_TCB_NUM_PTR: u32 = 36;
335pub const OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS: u32 = 2598;
336pub const OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS: u32 = 4157;
337pub const OT_TCP_LISTENER_TCB_SIZE_BASE: u32 = 16;
338pub const OT_TCP_LISTENER_TCB_NUM_PTR: u32 = 3;
339pub const OT_CHILD_IP6_ADDRESS_ITERATOR_INIT: u32 = 0;
340pub const OT_VERHOEFF_CHECKSUM_MAX_STRING_LENGTH: u32 = 128;
341#[doc = " No error."]
342pub const OT_ERROR_NONE: otError = 0;
343#[doc = " Operational failed."]
344pub const OT_ERROR_FAILED: otError = 1;
345#[doc = " Message was dropped."]
346pub const OT_ERROR_DROP: otError = 2;
347#[doc = " Insufficient buffers."]
348pub const OT_ERROR_NO_BUFS: otError = 3;
349#[doc = " No route available."]
350pub const OT_ERROR_NO_ROUTE: otError = 4;
351#[doc = " Service is busy and could not service the operation."]
352pub const OT_ERROR_BUSY: otError = 5;
353#[doc = " Failed to parse message."]
354pub const OT_ERROR_PARSE: otError = 6;
355#[doc = " Input arguments are invalid."]
356pub const OT_ERROR_INVALID_ARGS: otError = 7;
357#[doc = " Security checks failed."]
358pub const OT_ERROR_SECURITY: otError = 8;
359#[doc = " Address resolution requires an address query operation."]
360pub const OT_ERROR_ADDRESS_QUERY: otError = 9;
361#[doc = " Address is not in the source match table."]
362pub const OT_ERROR_NO_ADDRESS: otError = 10;
363#[doc = " Operation was aborted."]
364pub const OT_ERROR_ABORT: otError = 11;
365#[doc = " Function or method is not implemented."]
366pub const OT_ERROR_NOT_IMPLEMENTED: otError = 12;
367#[doc = " Cannot complete due to invalid state."]
368pub const OT_ERROR_INVALID_STATE: otError = 13;
369#[doc = " No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006)."]
370pub const OT_ERROR_NO_ACK: otError = 14;
371#[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)."]
372pub const OT_ERROR_CHANNEL_ACCESS_FAILURE: otError = 15;
373#[doc = " Not currently attached to a Thread Partition."]
374pub const OT_ERROR_DETACHED: otError = 16;
375#[doc = " FCS check failure while receiving."]
376pub const OT_ERROR_FCS: otError = 17;
377#[doc = " No frame received."]
378pub const OT_ERROR_NO_FRAME_RECEIVED: otError = 18;
379#[doc = " Received a frame from an unknown neighbor."]
380pub const OT_ERROR_UNKNOWN_NEIGHBOR: otError = 19;
381#[doc = " Received a frame from an invalid source address."]
382pub const OT_ERROR_INVALID_SOURCE_ADDRESS: otError = 20;
383#[doc = " Received a frame filtered by the address filter (allowlisted or denylisted)."]
384pub const OT_ERROR_ADDRESS_FILTERED: otError = 21;
385#[doc = " Received a frame filtered by the destination address check."]
386pub const OT_ERROR_DESTINATION_ADDRESS_FILTERED: otError = 22;
387#[doc = " The requested item could not be found."]
388pub const OT_ERROR_NOT_FOUND: otError = 23;
389#[doc = " The operation is already in progress."]
390pub const OT_ERROR_ALREADY: otError = 24;
391#[doc = " The creation of IPv6 address failed."]
392pub const OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: otError = 26;
393#[doc = " Operation prevented by mode flags"]
394pub const OT_ERROR_NOT_CAPABLE: otError = 27;
395#[doc = " Coap response or acknowledgment or DNS, SNTP response not received."]
396pub const OT_ERROR_RESPONSE_TIMEOUT: otError = 28;
397#[doc = " Received a duplicated frame."]
398pub const OT_ERROR_DUPLICATED: otError = 29;
399#[doc = " Message is being dropped from reassembly list due to timeout."]
400pub const OT_ERROR_REASSEMBLY_TIMEOUT: otError = 30;
401#[doc = " Message is not a TMF Message."]
402pub const OT_ERROR_NOT_TMF: otError = 31;
403#[doc = " Received a non-lowpan data frame."]
404pub const OT_ERROR_NOT_LOWPAN_DATA_FRAME: otError = 32;
405#[doc = " The link margin was too low."]
406pub const OT_ERROR_LINK_MARGIN_LOW: otError = 34;
407#[doc = " Input (CLI) command is invalid."]
408pub const OT_ERROR_INVALID_COMMAND: otError = 35;
409#[doc = " Special error code used to indicate success/error status is pending and not yet known."]
410pub const OT_ERROR_PENDING: otError = 36;
411#[doc = " Request rejected."]
412pub const OT_ERROR_REJECTED: otError = 37;
413#[doc = " The number of defined errors."]
414pub const OT_NUM_ERRORS: otError = 38;
415#[doc = " Generic error (should not use)."]
416pub const OT_ERROR_GENERIC: otError = 255;
417#[doc = " Represents error codes used throughout OpenThread."]
418pub type otError = ::std::os::raw::c_uint;
419unsafe extern "C" {
420 #[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."]
421 pub fn otThreadErrorToString(aError: otError) -> *const ::std::os::raw::c_char;
422}
423#[repr(C)]
424#[derive(Debug, Default, Copy, Clone)]
425pub struct otInstance {
426 _unused: [u8; 0],
427}
428unsafe extern "C" {
429 #[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"]
430 pub fn otInstanceInit(
431 aInstanceBuffer: *mut ::std::os::raw::c_void,
432 aInstanceBufferSize: *mut usize,
433 ) -> *mut otInstance;
434}
435unsafe extern "C" {
436 #[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."]
437 pub fn otInstanceInitSingle() -> *mut otInstance;
438}
439unsafe extern "C" {
440 #[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."]
441 pub fn otInstanceGetSingle() -> *mut otInstance;
442}
443unsafe extern "C" {
444 #[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."]
445 pub fn otInstanceInitMultiple(aIdx: u8) -> *mut otInstance;
446}
447unsafe extern "C" {
448 #[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."]
449 pub fn otInstanceGetInstance(aIdx: u8) -> *mut otInstance;
450}
451unsafe extern "C" {
452 #[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."]
453 pub fn otInstanceGetIndex(aInstance: *mut otInstance) -> u8;
454}
455unsafe extern "C" {
456 #[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."]
457 pub fn otInstanceGetId(aInstance: *mut otInstance) -> u32;
458}
459unsafe extern "C" {
460 #[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."]
461 pub fn otInstanceIsInitialized(aInstance: *mut otInstance) -> bool;
462}
463unsafe extern "C" {
464 #[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."]
465 pub fn otInstanceFinalize(aInstance: *mut otInstance);
466}
467unsafe extern "C" {
468 #[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)."]
469 pub fn otInstanceGetUptime(aInstance: *mut otInstance) -> u64;
470}
471unsafe extern "C" {
472 #[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`."]
473 pub fn otInstanceGetUptimeAsString(
474 aInstance: *mut otInstance,
475 aBuffer: *mut ::std::os::raw::c_char,
476 aSize: u16,
477 );
478}
479#[doc = " Represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*`\n definitions."]
480pub type otChangedFlags = u32;
481#[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."]
482pub type otStateChangedCallback = ::std::option::Option<
483 unsafe extern "C" fn(aFlags: otChangedFlags, aContext: *mut ::std::os::raw::c_void),
484>;
485unsafe extern "C" {
486 #[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."]
487 pub fn otSetStateChangedCallback(
488 aInstance: *mut otInstance,
489 aCallback: otStateChangedCallback,
490 aContext: *mut ::std::os::raw::c_void,
491 ) -> otError;
492}
493unsafe extern "C" {
494 #[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."]
495 pub fn otRemoveStateChangeCallback(
496 aInstance: *mut otInstance,
497 aCallback: otStateChangedCallback,
498 aContext: *mut ::std::os::raw::c_void,
499 );
500}
501unsafe extern "C" {
502 #[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."]
503 pub fn otInstanceReset(aInstance: *mut otInstance);
504}
505unsafe extern "C" {
506 #[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."]
507 pub fn otInstanceResetToBootloader(aInstance: *mut otInstance) -> otError;
508}
509unsafe extern "C" {
510 #[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."]
511 pub fn otInstanceFactoryReset(aInstance: *mut otInstance);
512}
513unsafe extern "C" {
514 #[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."]
515 pub fn otInstanceResetRadioStack(aInstance: *mut otInstance);
516}
517unsafe extern "C" {
518 #[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."]
519 pub fn otInstanceErasePersistentInfo(aInstance: *mut otInstance) -> otError;
520}
521unsafe extern "C" {
522 #[doc = " Gets the OpenThread version string.\n\n @returns A pointer to the OpenThread version."]
523 pub fn otGetVersionString() -> *const ::std::os::raw::c_char;
524}
525unsafe extern "C" {
526 #[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."]
527 pub fn otGetRadioVersionString(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
528}
529#[doc = " Represents Backbone Router configuration."]
530#[repr(C)]
531#[derive(Debug, Default, Copy, Clone)]
532pub struct otBackboneRouterConfig {
533 #[doc = "< Only used when get Primary Backbone Router information in the Thread Network"]
534 pub mServer16: u16,
535 #[doc = "< Reregistration Delay (in seconds)"]
536 pub mReregistrationDelay: u16,
537 #[doc = "< Multicast Listener Registration Timeout (in seconds)"]
538 pub mMlrTimeout: u32,
539 #[doc = "< Sequence Number"]
540 pub mSequenceNumber: u8,
541}
542unsafe extern "C" {
543 #[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."]
544 pub fn otBackboneRouterGetPrimary(
545 aInstance: *mut otInstance,
546 aConfig: *mut otBackboneRouterConfig,
547 ) -> otError;
548}
549#[repr(C)]
550#[derive(Debug, Default, Copy, Clone)]
551pub struct otMessage {
552 _unused: [u8; 0],
553}
554#[doc = "< Low priority level."]
555pub const OT_MESSAGE_PRIORITY_LOW: otMessagePriority = 0;
556#[doc = "< Normal priority level."]
557pub const OT_MESSAGE_PRIORITY_NORMAL: otMessagePriority = 1;
558#[doc = "< High priority level."]
559pub const OT_MESSAGE_PRIORITY_HIGH: otMessagePriority = 2;
560#[doc = " Defines the OpenThread message priority levels."]
561pub type otMessagePriority = ::std::os::raw::c_uint;
562#[doc = "< Message from Thread Netif."]
563pub const OT_MESSAGE_ORIGIN_THREAD_NETIF: otMessageOrigin = 0;
564#[doc = "< Message from a trusted source on host."]
565pub const OT_MESSAGE_ORIGIN_HOST_TRUSTED: otMessageOrigin = 1;
566#[doc = "< Message from an untrusted source on host."]
567pub const OT_MESSAGE_ORIGIN_HOST_UNTRUSTED: otMessageOrigin = 2;
568#[doc = " Defines the OpenThread message origins."]
569pub type otMessageOrigin = ::std::os::raw::c_uint;
570#[doc = " Represents a message settings."]
571#[repr(C)]
572#[derive(Debug, Default, Copy, Clone)]
573pub struct otMessageSettings {
574 #[doc = "< TRUE if the message should be secured at Layer 2."]
575 pub mLinkSecurityEnabled: bool,
576 #[doc = "< Priority level (MUST be a `OT_MESSAGE_PRIORITY_*` from `otMessagePriority`)."]
577 pub mPriority: u8,
578}
579#[doc = " Represents link-specific information for messages received from the Thread radio."]
580#[repr(C)]
581#[derive(Debug, Default, Copy, Clone)]
582pub struct otThreadLinkInfo {
583 #[doc = "< Source PAN ID"]
584 pub mPanId: u16,
585 #[doc = "< 802.15.4 Channel"]
586 pub mChannel: u8,
587 #[doc = "< Received Signal Strength in dBm (averaged over fragments)"]
588 pub mRss: i8,
589 #[doc = "< Average Link Quality Indicator (averaged over fragments)"]
590 pub mLqi: u8,
591 pub _bitfield_align_1: [u8; 0],
592 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
593 #[doc = "< The time sync sequence."]
594 pub mTimeSyncSeq: u8,
595 #[doc = "< The time offset to the Thread network time, in microseconds."]
596 pub mNetworkTimeOffset: i64,
597 #[doc = "< Radio link type."]
598 pub mRadioType: u8,
599}
600impl otThreadLinkInfo {
601 #[inline]
602 pub fn mLinkSecurity(&self) -> bool {
603 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
604 }
605 #[inline]
606 pub fn set_mLinkSecurity(&mut self, val: bool) {
607 unsafe {
608 let val: u8 = ::std::mem::transmute(val);
609 self._bitfield_1.set(0usize, 1u8, val as u64)
610 }
611 }
612 #[inline]
613 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
614 unsafe {
615 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
616 ::std::ptr::addr_of!((*this)._bitfield_1),
617 0usize,
618 1u8,
619 ) as u8)
620 }
621 }
622 #[inline]
623 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
624 unsafe {
625 let val: u8 = ::std::mem::transmute(val);
626 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
627 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
628 0usize,
629 1u8,
630 val as u64,
631 )
632 }
633 }
634 #[inline]
635 pub fn mIsDstPanIdBroadcast(&self) -> bool {
636 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
637 }
638 #[inline]
639 pub fn set_mIsDstPanIdBroadcast(&mut self, val: bool) {
640 unsafe {
641 let val: u8 = ::std::mem::transmute(val);
642 self._bitfield_1.set(1usize, 1u8, val as u64)
643 }
644 }
645 #[inline]
646 pub unsafe fn mIsDstPanIdBroadcast_raw(this: *const Self) -> bool {
647 unsafe {
648 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
649 ::std::ptr::addr_of!((*this)._bitfield_1),
650 1usize,
651 1u8,
652 ) as u8)
653 }
654 }
655 #[inline]
656 pub unsafe fn set_mIsDstPanIdBroadcast_raw(this: *mut Self, val: bool) {
657 unsafe {
658 let val: u8 = ::std::mem::transmute(val);
659 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
660 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
661 1usize,
662 1u8,
663 val as u64,
664 )
665 }
666 }
667 #[inline]
668 pub fn new_bitfield_1(
669 mLinkSecurity: bool,
670 mIsDstPanIdBroadcast: bool,
671 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
672 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
673 __bindgen_bitfield_unit.set(0usize, 1u8, {
674 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
675 mLinkSecurity as u64
676 });
677 __bindgen_bitfield_unit.set(1usize, 1u8, {
678 let mIsDstPanIdBroadcast: u8 = unsafe { ::std::mem::transmute(mIsDstPanIdBroadcast) };
679 mIsDstPanIdBroadcast as u64
680 });
681 __bindgen_bitfield_unit
682 }
683}
684unsafe extern "C" {
685 #[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."]
686 pub fn otMessageGetInstance(aMessage: *const otMessage) -> *mut otInstance;
687}
688unsafe extern "C" {
689 #[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"]
690 pub fn otMessageFree(aMessage: *mut otMessage);
691}
692unsafe extern "C" {
693 #[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"]
694 pub fn otMessageGetLength(aMessage: *const otMessage) -> u16;
695}
696unsafe extern "C" {
697 #[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"]
698 pub fn otMessageSetLength(aMessage: *mut otMessage, aLength: u16) -> otError;
699}
700unsafe extern "C" {
701 #[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"]
702 pub fn otMessageGetOffset(aMessage: *const otMessage) -> u16;
703}
704unsafe extern "C" {
705 #[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"]
706 pub fn otMessageSetOffset(aMessage: *mut otMessage, aOffset: u16);
707}
708unsafe extern "C" {
709 #[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."]
710 pub fn otMessageIsLinkSecurityEnabled(aMessage: *const otMessage) -> bool;
711}
712unsafe extern "C" {
713 #[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."]
714 pub fn otMessageIsLoopbackToHostAllowed(aMessage: *const otMessage) -> bool;
715}
716unsafe extern "C" {
717 #[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."]
718 pub fn otMessageSetLoopbackToHostAllowed(aMessage: *mut otMessage, aAllowLoopbackToHost: bool);
719}
720unsafe extern "C" {
721 #[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 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."]
722 pub fn otMessageIsMulticastLoopEnabled(aMessage: *mut otMessage) -> bool;
723}
724unsafe extern "C" {
725 #[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."]
726 pub fn otMessageSetMulticastLoopEnabled(aMessage: *mut otMessage, aEnabled: bool);
727}
728unsafe extern "C" {
729 #[doc = " Gets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message origin."]
730 pub fn otMessageGetOrigin(aMessage: *const otMessage) -> otMessageOrigin;
731}
732unsafe extern "C" {
733 #[doc = " Sets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOrigin The message origin."]
734 pub fn otMessageSetOrigin(aMessage: *mut otMessage, aOrigin: otMessageOrigin);
735}
736unsafe extern "C" {
737 #[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."]
738 pub fn otMessageSetDirectTransmission(aMessage: *mut otMessage, aEnabled: bool);
739}
740unsafe extern "C" {
741 #[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."]
742 pub fn otMessageGetRss(aMessage: *const otMessage) -> i8;
743}
744unsafe extern "C" {
745 #[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`."]
746 pub fn otMessageGetThreadLinkInfo(
747 aMessage: *const otMessage,
748 aLinkInfo: *mut otThreadLinkInfo,
749 ) -> otError;
750}
751#[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."]
752pub type otMessageTxCallback = ::std::option::Option<
753 unsafe extern "C" fn(
754 aMessage: *const otMessage,
755 aError: otError,
756 aContext: *mut ::std::os::raw::c_void,
757 ),
758>;
759unsafe extern "C" {
760 #[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."]
761 pub fn otMessageRegisterTxCallback(
762 aMessage: *mut otMessage,
763 aCallback: otMessageTxCallback,
764 aContext: *mut ::std::os::raw::c_void,
765 );
766}
767unsafe extern "C" {
768 #[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"]
769 pub fn otMessageAppend(
770 aMessage: *mut otMessage,
771 aBuf: *const ::std::os::raw::c_void,
772 aLength: u16,
773 ) -> otError;
774}
775unsafe extern "C" {
776 #[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"]
777 pub fn otMessageRead(
778 aMessage: *const otMessage,
779 aOffset: u16,
780 aBuf: *mut ::std::os::raw::c_void,
781 aLength: u16,
782 ) -> u16;
783}
784unsafe extern "C" {
785 #[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"]
786 pub fn otMessageWrite(
787 aMessage: *mut otMessage,
788 aOffset: u16,
789 aBuf: *const ::std::os::raw::c_void,
790 aLength: u16,
791 ) -> ::std::os::raw::c_int;
792}
793unsafe extern "C" {
794 #[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."]
795 pub fn otMessageClone(aMessage: *const otMessage) -> *mut otMessage;
796}
797#[doc = " Represents an OpenThread message queue."]
798#[repr(C)]
799#[derive(Debug, Copy, Clone)]
800pub struct otMessageQueue {
801 #[doc = "< Opaque data used by the implementation."]
802 pub mData: *mut ::std::os::raw::c_void,
803 #[doc = "< Opaque data used by the implementation."]
804 pub mData2: *mut ::std::os::raw::c_void,
805}
806impl Default for otMessageQueue {
807 fn default() -> Self {
808 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
809 unsafe {
810 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
811 s.assume_init()
812 }
813 }
814}
815#[doc = " Represents information about a message queue."]
816#[repr(C)]
817#[derive(Debug, Default, Copy, Clone)]
818pub struct otMessageQueueInfo {
819 #[doc = "< Number of messages in the queue."]
820 pub mNumMessages: u16,
821 #[doc = "< Number of data buffers used by messages in the queue."]
822 pub mNumBuffers: u16,
823 #[doc = "< Total number of bytes used by all messages in the queue."]
824 pub mTotalBytes: u32,
825}
826#[doc = " Represents the message buffer information for different queues used by OpenThread stack."]
827#[repr(C)]
828#[derive(Debug, Default, Copy, Clone)]
829pub struct otBufferInfo {
830 #[doc = "< The total number of buffers in the messages pool (0xffff if unknown)."]
831 pub mTotalBuffers: u16,
832 #[doc = "< The number of free buffers (0xffff if unknown)."]
833 pub mFreeBuffers: u16,
834 #[doc = " The maximum number of used buffers at the same time since OT stack initialization or last call to\n `otMessageResetBufferInfo()`."]
835 pub mMaxUsedBuffers: u16,
836 #[doc = "< Info about 6LoWPAN send queue."]
837 pub m6loSendQueue: otMessageQueueInfo,
838 #[doc = "< Info about 6LoWPAN reassembly queue."]
839 pub m6loReassemblyQueue: otMessageQueueInfo,
840 #[doc = "< Info about IPv6 send queue."]
841 pub mIp6Queue: otMessageQueueInfo,
842 #[doc = "< Info about MPL send queue."]
843 pub mMplQueue: otMessageQueueInfo,
844 #[doc = "< Info about MLE delayed message queue."]
845 pub mMleQueue: otMessageQueueInfo,
846 #[doc = "< Info about CoAP/TMF send queue."]
847 pub mCoapQueue: otMessageQueueInfo,
848 #[doc = "< Info about CoAP secure send queue."]
849 pub mCoapSecureQueue: otMessageQueueInfo,
850 #[doc = "< Info about application CoAP send queue."]
851 pub mApplicationCoapQueue: otMessageQueueInfo,
852}
853unsafe extern "C" {
854 #[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."]
855 pub fn otMessageQueueInit(aQueue: *mut otMessageQueue);
856}
857unsafe extern "C" {
858 #[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."]
859 pub fn otMessageQueueEnqueue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
860}
861unsafe extern "C" {
862 #[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."]
863 pub fn otMessageQueueEnqueueAtHead(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
864}
865unsafe extern "C" {
866 #[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."]
867 pub fn otMessageQueueDequeue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
868}
869unsafe extern "C" {
870 #[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."]
871 pub fn otMessageQueueGetHead(aQueue: *mut otMessageQueue) -> *mut otMessage;
872}
873unsafe extern "C" {
874 #[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`."]
875 pub fn otMessageQueueGetNext(
876 aQueue: *mut otMessageQueue,
877 aMessage: *const otMessage,
878 ) -> *mut otMessage;
879}
880unsafe extern "C" {
881 #[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."]
882 pub fn otMessageGetBufferInfo(aInstance: *mut otInstance, aBufferInfo: *mut otBufferInfo);
883}
884unsafe extern "C" {
885 #[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."]
886 pub fn otMessageResetBufferInfo(aInstance: *mut otInstance);
887}
888#[doc = "< Key Type: Raw Data."]
889pub const OT_CRYPTO_KEY_TYPE_RAW: otCryptoKeyType = 0;
890#[doc = "< Key Type: AES."]
891pub const OT_CRYPTO_KEY_TYPE_AES: otCryptoKeyType = 1;
892#[doc = "< Key Type: HMAC."]
893pub const OT_CRYPTO_KEY_TYPE_HMAC: otCryptoKeyType = 2;
894#[doc = "< Key Type: ECDSA."]
895pub const OT_CRYPTO_KEY_TYPE_ECDSA: otCryptoKeyType = 3;
896#[doc = "< Key Type: Derive."]
897pub const OT_CRYPTO_KEY_TYPE_DERIVE: otCryptoKeyType = 4;
898#[doc = " Defines the key types."]
899pub type otCryptoKeyType = ::std::os::raw::c_uint;
900#[doc = "< Key Algorithm: Vendor Defined."]
901pub const OT_CRYPTO_KEY_ALG_VENDOR: otCryptoKeyAlgorithm = 0;
902#[doc = "< Key Algorithm: AES ECB."]
903pub const OT_CRYPTO_KEY_ALG_AES_ECB: otCryptoKeyAlgorithm = 1;
904#[doc = "< Key Algorithm: HMAC SHA-256."]
905pub const OT_CRYPTO_KEY_ALG_HMAC_SHA_256: otCryptoKeyAlgorithm = 2;
906#[doc = "< Key Algorithm: ECDSA."]
907pub const OT_CRYPTO_KEY_ALG_ECDSA: otCryptoKeyAlgorithm = 3;
908#[doc = "< Key Algorithm: HKDF SHA-256."]
909pub const OT_CRYPTO_KEY_ALG_HKDF_SHA256: otCryptoKeyAlgorithm = 4;
910#[doc = " Defines the key algorithms."]
911pub type otCryptoKeyAlgorithm = ::std::os::raw::c_uint;
912#[doc = "< Key Usage: Key Usage is empty."]
913pub const OT_CRYPTO_KEY_USAGE_NONE: _bindgen_ty_1 = 0;
914#[doc = "< Key Usage: Key can be exported."]
915pub const OT_CRYPTO_KEY_USAGE_EXPORT: _bindgen_ty_1 = 1;
916#[doc = "< Key Usage: Encryption (vendor defined)."]
917pub const OT_CRYPTO_KEY_USAGE_ENCRYPT: _bindgen_ty_1 = 2;
918#[doc = "< Key Usage: AES ECB."]
919pub const OT_CRYPTO_KEY_USAGE_DECRYPT: _bindgen_ty_1 = 4;
920#[doc = "< Key Usage: Sign Hash."]
921pub const OT_CRYPTO_KEY_USAGE_SIGN_HASH: _bindgen_ty_1 = 8;
922#[doc = "< Key Usage: Verify Hash."]
923pub const OT_CRYPTO_KEY_USAGE_VERIFY_HASH: _bindgen_ty_1 = 16;
924#[doc = "< Key Usage: Derive."]
925pub const OT_CRYPTO_KEY_USAGE_DERIVE: _bindgen_ty_1 = 32;
926#[doc = " Defines the key usage flags."]
927pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
928#[doc = "< Key Persistence: Key is volatile."]
929pub const OT_CRYPTO_KEY_STORAGE_VOLATILE: otCryptoKeyStorage = 0;
930#[doc = "< Key Persistence: Key is persistent."]
931pub const OT_CRYPTO_KEY_STORAGE_PERSISTENT: otCryptoKeyStorage = 1;
932#[doc = " Defines the key storage types."]
933pub type otCryptoKeyStorage = ::std::os::raw::c_uint;
934#[doc = " This datatype represents the key reference."]
935pub type otCryptoKeyRef = u32;
936#[doc = " @struct otCryptoKey\n\n Represents the Key Material required for Crypto operations."]
937#[repr(C)]
938#[derive(Debug, Copy, Clone)]
939pub struct otCryptoKey {
940 #[doc = "< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`."]
941 pub mKey: *const u8,
942 #[doc = "< The key length in bytes (applicable when `mKey` is not NULL)."]
943 pub mKeyLength: u16,
944 #[doc = "< The PSA key ref (requires `mKey` to be NULL)."]
945 pub mKeyRef: u32,
946}
947impl Default for otCryptoKey {
948 fn default() -> Self {
949 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
950 unsafe {
951 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
952 s.assume_init()
953 }
954 }
955}
956#[doc = " @struct otCryptoContext\n\n Stores the context object for platform APIs.\n\n If `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT` is enabled, the platform allocates and populates this.\n Otherwise OpenThread core allocates and populates this."]
957#[repr(C)]
958#[derive(Debug, Copy, Clone)]
959pub struct otCryptoContext {
960 #[doc = "< Pointer to the context."]
961 pub mContext: *mut ::std::os::raw::c_void,
962 #[doc = "< The length of the context in bytes."]
963 pub mContextSize: u16,
964}
965impl Default for otCryptoContext {
966 fn default() -> Self {
967 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
968 unsafe {
969 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
970 s.assume_init()
971 }
972 }
973}
974#[doc = " @struct otPlatCryptoSha256Hash\n\n Represents a SHA-256 hash."]
975#[repr(C, packed)]
976#[derive(Debug, Default, Copy, Clone)]
977pub struct otPlatCryptoSha256Hash {
978 #[doc = "< Hash bytes."]
979 pub m8: [u8; 32usize],
980}
981#[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)."]
982#[repr(C)]
983#[derive(Debug, Copy, Clone)]
984pub struct otPlatCryptoEcdsaKeyPair {
985 pub mDerBytes: [u8; 125usize],
986 pub mDerLength: u8,
987}
988impl Default for otPlatCryptoEcdsaKeyPair {
989 fn default() -> Self {
990 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
991 unsafe {
992 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
993 s.assume_init()
994 }
995 }
996}
997#[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)."]
998#[repr(C, packed)]
999#[derive(Debug, Copy, Clone)]
1000pub struct otPlatCryptoEcdsaPublicKey {
1001 pub m8: [u8; 64usize],
1002}
1003impl Default for otPlatCryptoEcdsaPublicKey {
1004 fn default() -> Self {
1005 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1006 unsafe {
1007 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1008 s.assume_init()
1009 }
1010 }
1011}
1012#[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)."]
1013#[repr(C, packed)]
1014#[derive(Debug, Copy, Clone)]
1015pub struct otPlatCryptoEcdsaSignature {
1016 pub m8: [u8; 64usize],
1017}
1018impl Default for otPlatCryptoEcdsaSignature {
1019 fn default() -> Self {
1020 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1021 unsafe {
1022 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1023 s.assume_init()
1024 }
1025 }
1026}
1027unsafe extern "C" {
1028 #[doc = " Initialize the Crypto module."]
1029 pub fn otPlatCryptoInit();
1030}
1031unsafe extern "C" {
1032 #[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."]
1033 pub fn otPlatCryptoImportKey(
1034 aKeyRef: *mut otCryptoKeyRef,
1035 aKeyType: otCryptoKeyType,
1036 aKeyAlgorithm: otCryptoKeyAlgorithm,
1037 aKeyUsage: ::std::os::raw::c_int,
1038 aKeyPersistence: otCryptoKeyStorage,
1039 aKey: *const u8,
1040 aKeyLen: usize,
1041 ) -> otError;
1042}
1043unsafe extern "C" {
1044 #[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."]
1045 pub fn otPlatCryptoExportKey(
1046 aKeyRef: otCryptoKeyRef,
1047 aBuffer: *mut u8,
1048 aBufferLen: usize,
1049 aKeyLen: *mut usize,
1050 ) -> otError;
1051}
1052unsafe extern "C" {
1053 #[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."]
1054 pub fn otPlatCryptoDestroyKey(aKeyRef: otCryptoKeyRef) -> otError;
1055}
1056unsafe extern "C" {
1057 #[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."]
1058 pub fn otPlatCryptoHasKey(aKeyRef: otCryptoKeyRef) -> bool;
1059}
1060unsafe extern "C" {
1061 #[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."]
1062 pub fn otPlatCryptoCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
1063}
1064unsafe extern "C" {
1065 #[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."]
1066 pub fn otPlatCryptoFree(aPtr: *mut ::std::os::raw::c_void);
1067}
1068unsafe extern "C" {
1069 #[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 If `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT` is enabled, @p aContext is populated by the platform.\n Otherwise OpenThread core allocates and populates it.\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."]
1070 pub fn otPlatCryptoHmacSha256Init(aContext: *mut otCryptoContext) -> otError;
1071}
1072unsafe extern "C" {
1073 #[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"]
1074 pub fn otPlatCryptoHmacSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1075}
1076unsafe extern "C" {
1077 #[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"]
1078 pub fn otPlatCryptoHmacSha256Start(
1079 aContext: *mut otCryptoContext,
1080 aKey: *const otCryptoKey,
1081 ) -> otError;
1082}
1083unsafe extern "C" {
1084 #[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"]
1085 pub fn otPlatCryptoHmacSha256Update(
1086 aContext: *mut otCryptoContext,
1087 aBuf: *const ::std::os::raw::c_void,
1088 aBufLength: u16,
1089 ) -> otError;
1090}
1091unsafe extern "C" {
1092 #[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"]
1093 pub fn otPlatCryptoHmacSha256Finish(
1094 aContext: *mut otCryptoContext,
1095 aBuf: *mut u8,
1096 aBufLength: usize,
1097 ) -> otError;
1098}
1099unsafe extern "C" {
1100 #[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 If `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT` is enabled, @p aContext is populated by the platform.\n Otherwise OpenThread core allocates and populates it.\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."]
1101 pub fn otPlatCryptoAesInit(aContext: *mut otCryptoContext) -> otError;
1102}
1103unsafe extern "C" {
1104 #[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"]
1105 pub fn otPlatCryptoAesSetKey(
1106 aContext: *mut otCryptoContext,
1107 aKey: *const otCryptoKey,
1108 ) -> otError;
1109}
1110unsafe extern "C" {
1111 #[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"]
1112 pub fn otPlatCryptoAesEncrypt(
1113 aContext: *mut otCryptoContext,
1114 aInput: *const u8,
1115 aOutput: *mut u8,
1116 ) -> otError;
1117}
1118unsafe extern "C" {
1119 #[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"]
1120 pub fn otPlatCryptoAesFree(aContext: *mut otCryptoContext) -> otError;
1121}
1122unsafe extern "C" {
1123 #[doc = " Initialise the HKDF context.\n\n @param[in] aContext Context for HKDF operation.\n\n @retval OT_ERROR_NONE Successfully Initialised HKDF operation.\n @retval OT_ERROR_FAILED Failed to Initialise HKDF operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n @note If `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT` is enabled, @p aContext is populated by the platform.\n Otherwise OpenThread core allocates and populates it.\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"]
1124 pub fn otPlatCryptoHkdfInit(aContext: *mut otCryptoContext) -> otError;
1125}
1126unsafe extern "C" {
1127 #[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"]
1128 pub fn otPlatCryptoHkdfExpand(
1129 aContext: *mut otCryptoContext,
1130 aInfo: *const u8,
1131 aInfoLength: u16,
1132 aOutputKey: *mut u8,
1133 aOutputKeyLength: u16,
1134 ) -> otError;
1135}
1136unsafe extern "C" {
1137 #[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."]
1138 pub fn otPlatCryptoHkdfExtract(
1139 aContext: *mut otCryptoContext,
1140 aSalt: *const u8,
1141 aSaltLength: u16,
1142 aInputKey: *const otCryptoKey,
1143 ) -> otError;
1144}
1145unsafe extern "C" {
1146 #[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"]
1147 pub fn otPlatCryptoHkdfDeinit(aContext: *mut otCryptoContext) -> otError;
1148}
1149unsafe extern "C" {
1150 #[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 @note If `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_ALLOCS_CONTEXT` is enabled, @p aContext is populated by the platform.\n Otherwise OpenThread core allocates and populates it.\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."]
1151 pub fn otPlatCryptoSha256Init(aContext: *mut otCryptoContext) -> otError;
1152}
1153unsafe extern "C" {
1154 #[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"]
1155 pub fn otPlatCryptoSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1156}
1157unsafe extern "C" {
1158 #[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"]
1159 pub fn otPlatCryptoSha256Start(aContext: *mut otCryptoContext) -> otError;
1160}
1161unsafe extern "C" {
1162 #[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"]
1163 pub fn otPlatCryptoSha256Update(
1164 aContext: *mut otCryptoContext,
1165 aBuf: *const ::std::os::raw::c_void,
1166 aBufLength: u16,
1167 ) -> otError;
1168}
1169unsafe extern "C" {
1170 #[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"]
1171 pub fn otPlatCryptoSha256Finish(
1172 aContext: *mut otCryptoContext,
1173 aHash: *mut u8,
1174 aHashSize: u16,
1175 ) -> otError;
1176}
1177unsafe extern "C" {
1178 #[doc = " Initialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1179 pub fn otPlatCryptoRandomInit();
1180}
1181unsafe extern "C" {
1182 #[doc = " Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1183 pub fn otPlatCryptoRandomDeinit();
1184}
1185unsafe extern "C" {
1186 #[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."]
1187 pub fn otPlatCryptoRandomGet(aBuffer: *mut u8, aSize: u16) -> otError;
1188}
1189unsafe extern "C" {
1190 #[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."]
1191 pub fn otPlatCryptoEcdsaGenerateKey(aKeyPair: *mut otPlatCryptoEcdsaKeyPair) -> otError;
1192}
1193unsafe extern "C" {
1194 #[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."]
1195 pub fn otPlatCryptoEcdsaGetPublicKey(
1196 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1197 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1198 ) -> otError;
1199}
1200unsafe extern "C" {
1201 #[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."]
1202 pub fn otPlatCryptoEcdsaSign(
1203 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1204 aHash: *const otPlatCryptoSha256Hash,
1205 aSignature: *mut otPlatCryptoEcdsaSignature,
1206 ) -> otError;
1207}
1208unsafe extern "C" {
1209 #[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."]
1210 pub fn otPlatCryptoEcdsaVerify(
1211 aPublicKey: *const otPlatCryptoEcdsaPublicKey,
1212 aHash: *const otPlatCryptoSha256Hash,
1213 aSignature: *const otPlatCryptoEcdsaSignature,
1214 ) -> otError;
1215}
1216unsafe extern "C" {
1217 #[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."]
1218 pub fn otPlatCryptoEcdsaSignUsingKeyRef(
1219 aKeyRef: otCryptoKeyRef,
1220 aHash: *const otPlatCryptoSha256Hash,
1221 aSignature: *mut otPlatCryptoEcdsaSignature,
1222 ) -> otError;
1223}
1224unsafe extern "C" {
1225 #[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."]
1226 pub fn otPlatCryptoEcdsaExportPublicKey(
1227 aKeyRef: otCryptoKeyRef,
1228 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1229 ) -> otError;
1230}
1231unsafe extern "C" {
1232 #[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."]
1233 pub fn otPlatCryptoEcdsaGenerateAndImportKey(aKeyRef: otCryptoKeyRef) -> otError;
1234}
1235unsafe extern "C" {
1236 #[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."]
1237 pub fn otPlatCryptoEcdsaVerifyUsingKeyRef(
1238 aKeyRef: otCryptoKeyRef,
1239 aHash: *const otPlatCryptoSha256Hash,
1240 aSignature: *const otPlatCryptoEcdsaSignature,
1241 ) -> otError;
1242}
1243unsafe extern "C" {
1244 #[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."]
1245 pub fn otPlatCryptoPbkdf2GenerateKey(
1246 aPassword: *const u8,
1247 aPasswordLen: u16,
1248 aSalt: *const u8,
1249 aSaltLen: u16,
1250 aIterationCounter: u32,
1251 aKeyLen: u16,
1252 aKey: *mut u8,
1253 ) -> otError;
1254}
1255#[doc = " @struct otPlatCryptoAesCcmConfig\n\n Holds the parameters for a one-shot AES-CCM* operation passed to `otPlatCryptoAesCcmProcessOneShot`."]
1256#[repr(C)]
1257#[derive(Debug, Copy, Clone)]
1258pub struct otPlatCryptoAesCcmConfig {
1259 #[doc = "< The encryption key."]
1260 pub mKey: otCryptoKey,
1261 #[doc = "< Pointer to the nonce buffer (IEEE 802.15.4 CCM* format, 13 bytes)."]
1262 pub mNonce: *const u8,
1263 #[doc = "< Length of @p mNonce in bytes."]
1264 pub mNonceLength: u8,
1265 #[doc = "< Authentication tag length in bytes (even)"]
1266 pub mTagLength: u8,
1267 #[doc = "< Length of the additional authenticated data (header) in bytes."]
1268 pub mHeaderLength: u32,
1269 #[doc = "< Payload length in bytes (excluding tag)."]
1270 pub mPlainTextLength: u32,
1271}
1272impl Default for otPlatCryptoAesCcmConfig {
1273 fn default() -> Self {
1274 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1275 unsafe {
1276 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1277 s.assume_init()
1278 }
1279 }
1280}
1281unsafe extern "C" {
1282 #[doc = " Performs in-place AES-CCM* authenticated encryption or decryption in a single call.\n\n For encryption (@p aEncrypt == true):\n - Plaintext at @p aData is replaced with ciphertext in-place.\n - The authentication tag is written to @p aData + @p aConfig->mPlainTextLength.\n\n For decryption (@p aEncrypt == false):\n - Ciphertext at @p aData is replaced with plaintext in-place.\n - The tag to verify must be at @p aData + @p aConfig->mPlainTextLength.\n\n Requires `OPENTHREAD_CONFIG_CRYPTO_PLATFORM_CCM_ONE_SHOT_ENABLE`.\n\n Default weak mbedTLS and PSA implementations are provided.\n\n @param[in] aEncrypt True to encrypt and generate tag; false to decrypt and verify tag.\n @param[in] aConfig CCM* parameters (key, nonce, lengths).\n @param[in] aHeader Additional authenticated data (not encrypted). May be NULL if header length is 0.\n @param[in,out] aData Payload buffer (plaintext on encrypt entry, ciphertext on decrypt entry).\n The buffer must hold @p aConfig->mPlainTextLength + @p aConfig->mTagLength bytes.\n\n @retval OT_ERROR_NONE Success.\n @retval OT_ERROR_SECURITY Tag mismatch (decrypt only).\n @retval OT_ERROR_FAILED Operation failed."]
1283 pub fn otPlatCryptoAesCcmProcessOneShot(
1284 aEncrypt: bool,
1285 aConfig: *const otPlatCryptoAesCcmConfig,
1286 aHeader: *const u8,
1287 aData: *mut u8,
1288 ) -> otError;
1289}
1290#[doc = "< aMaxPHYPacketSize (IEEE 802.15.4-2006)"]
1291pub const OT_RADIO_FRAME_MAX_SIZE: _bindgen_ty_2 = 127;
1292#[doc = "< Minimal size of frame FCS + CONTROL"]
1293pub const OT_RADIO_FRAME_MIN_SIZE: _bindgen_ty_2 = 3;
1294#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1295pub const OT_RADIO_SYMBOLS_PER_OCTET: _bindgen_ty_2 = 2;
1296#[doc = "< 2.4 GHz IEEE 802.15.4 (bits per second)"]
1297pub const OT_RADIO_BIT_RATE: _bindgen_ty_2 = 250000;
1298#[doc = "< Number of bits per octet"]
1299pub const OT_RADIO_BITS_PER_OCTET: _bindgen_ty_2 = 8;
1300#[doc = "< The O-QPSK PHY symbol rate when operating in the 780MHz, 915MHz, 2380MHz, 2450MHz"]
1301pub const OT_RADIO_SYMBOL_RATE: _bindgen_ty_2 = 62500;
1302#[doc = "< Symbol duration time in unit of microseconds"]
1303pub const OT_RADIO_SYMBOL_TIME: _bindgen_ty_2 = 16;
1304#[doc = "< Time for 10 symbols in unit of microseconds"]
1305pub const OT_RADIO_TEN_SYMBOLS_TIME: _bindgen_ty_2 = 160;
1306#[doc = "< LQI measurement not supported"]
1307pub const OT_RADIO_LQI_NONE: _bindgen_ty_2 = 0;
1308#[doc = "< Invalid or unknown RSSI value"]
1309pub const OT_RADIO_RSSI_INVALID: _bindgen_ty_2 = 127;
1310#[doc = "< Invalid or unknown power value"]
1311pub const OT_RADIO_POWER_INVALID: _bindgen_ty_2 = 127;
1312#[doc = "< Invalid short address."]
1313pub const OT_RADIO_INVALID_SHORT_ADDR: _bindgen_ty_2 = 65534;
1314#[doc = "< Broadcast short address."]
1315pub const OT_RADIO_BROADCAST_SHORT_ADDR: _bindgen_ty_2 = 65535;
1316#[doc = " @defgroup radio-types Radio Types\n\n @brief\n This module includes the platform abstraction for a radio frame.\n\n @{"]
1317pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
1318#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1319pub const OT_RADIO_CHANNEL_PAGE_0: _bindgen_ty_3 = 0;
1320#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1321pub const OT_RADIO_CHANNEL_PAGE_0_MASK: _bindgen_ty_3 = 1;
1322#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1323pub const OT_RADIO_CHANNEL_PAGE_2: _bindgen_ty_3 = 2;
1324#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1325pub const OT_RADIO_CHANNEL_PAGE_2_MASK: _bindgen_ty_3 = 4;
1326#[doc = " Defines the channel page."]
1327pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
1328#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1329pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 1;
1330#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1331pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 10;
1332#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1333pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 2046;
1334#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1335pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 11;
1336#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1337pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 26;
1338#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1339pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 134215680;
1340#[doc = " Defines the frequency band channel range."]
1341pub type _bindgen_ty_4 = ::std::os::raw::c_uint;
1342#[doc = " Represents radio capabilities.\n\n The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions."]
1343pub type otRadioCaps = u16;
1344#[doc = "< Radio supports no capability."]
1345pub const OT_RADIO_CAPS_NONE: _bindgen_ty_5 = 0;
1346#[doc = "< Radio supports AckTime event."]
1347pub const OT_RADIO_CAPS_ACK_TIMEOUT: _bindgen_ty_5 = 1;
1348#[doc = "< Radio supports Energy Scans."]
1349pub const OT_RADIO_CAPS_ENERGY_SCAN: _bindgen_ty_5 = 2;
1350#[doc = "< Radio supports tx retry logic with collision avoidance (CSMA)."]
1351pub const OT_RADIO_CAPS_TRANSMIT_RETRIES: _bindgen_ty_5 = 4;
1352#[doc = "< Radio supports CSMA backoff for frame tx (but no retry)."]
1353pub const OT_RADIO_CAPS_CSMA_BACKOFF: _bindgen_ty_5 = 8;
1354#[doc = "< Radio supports direct transition from sleep to TX with CSMA."]
1355pub const OT_RADIO_CAPS_SLEEP_TO_TX: _bindgen_ty_5 = 16;
1356#[doc = "< Radio supports tx security."]
1357pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_5 = 32;
1358#[doc = "< Radio supports tx at specific time."]
1359pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_5 = 64;
1360#[doc = "< Radio supports rx at specific time."]
1361pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_5 = 128;
1362#[doc = "< Radio supports RxOnWhenIdle handling."]
1363pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_5 = 256;
1364#[doc = "< Radio supports setting per-frame transmit power."]
1365pub const OT_RADIO_CAPS_TRANSMIT_FRAME_POWER: _bindgen_ty_5 = 512;
1366#[doc = "< Radio supports setting alternate short address."]
1367pub const OT_RADIO_CAPS_ALT_SHORT_ADDR: _bindgen_ty_5 = 1024;
1368#[doc = " Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`."]
1369pub type _bindgen_ty_5 = ::std::os::raw::c_uint;
1370#[doc = " Represents the IEEE 802.15.4 PAN ID."]
1371pub type otPanId = u16;
1372#[doc = " Represents the IEEE 802.15.4 Short Address."]
1373pub type otShortAddress = u16;
1374#[doc = "< Size of IE header in bytes."]
1375pub const OT_IE_HEADER_SIZE: _bindgen_ty_6 = 2;
1376#[doc = "< Size of CSL IE content in bytes."]
1377pub const OT_CSL_IE_SIZE: _bindgen_ty_6 = 4;
1378#[doc = "< Max length for header IE in ACK."]
1379pub const OT_ACK_IE_MAX_SIZE: _bindgen_ty_6 = 16;
1380#[doc = "< Max length of Link Metrics data in Vendor-Specific IE."]
1381pub const OT_ENH_PROBING_IE_DATA_MAX_SIZE: _bindgen_ty_6 = 2;
1382#[doc = " Defines constants about size of header IE in ACK."]
1383pub type _bindgen_ty_6 = ::std::os::raw::c_uint;
1384#[doc = " @struct otExtAddress\n\n Represents the IEEE 802.15.4 Extended Address."]
1385#[repr(C, packed)]
1386#[derive(Debug, Default, Copy, Clone)]
1387pub struct otExtAddress {
1388 #[doc = "< IEEE 802.15.4 Extended Address bytes"]
1389 pub m8: [u8; 8usize],
1390}
1391#[doc = " Represents a 64-bit radio time in microseconds referenced to a continuous monotonic local radio clock.\n\n This type is returned by `otPlatRadioGetNow()` and is used as the timestamp field (`mTimestamp`) in radio frames\n (`otRadioFrame`)."]
1392pub type otRadioTime64 = u64;
1393#[doc = " Represents a 32-bit radio time in microseconds.\n\n This type holds the lower 32 bits (least significant bits) of a full 64-bit radio time (`otRadioTime64`).\n\n It is used in APIs such as `otPlatRadioReceiveAt()` and `otPlatRadioUpdateCslSampleTime()` and as the transmission\n delay base time (`mTxDelayBaseTime`) in `otRadioFrame`. It is important for radio platform implementations to\n correctly account for its roll-over."]
1394pub type otRadioTime32 = u32;
1395#[doc = " @struct otMacKey\n\n Represents a MAC Key."]
1396#[repr(C, packed)]
1397#[derive(Debug, Default, Copy, Clone)]
1398pub struct otMacKey {
1399 #[doc = "< MAC Key bytes."]
1400 pub m8: [u8; 16usize],
1401}
1402#[doc = " Represents a MAC Key Ref used by PSA."]
1403pub type otMacKeyRef = otCryptoKeyRef;
1404#[doc = " @struct otMacKeyMaterial\n\n Represents a MAC Key."]
1405#[repr(C)]
1406#[derive(Copy, Clone)]
1407pub struct otMacKeyMaterial {
1408 pub mKeyMaterial: otMacKeyMaterial__bindgen_ty_1,
1409}
1410#[repr(C)]
1411#[derive(Copy, Clone)]
1412pub union otMacKeyMaterial__bindgen_ty_1 {
1413 #[doc = "< Reference to the key stored."]
1414 pub mKeyRef: otMacKeyRef,
1415 #[doc = "< Key stored as literal."]
1416 pub mKey: otMacKey,
1417}
1418impl Default for otMacKeyMaterial__bindgen_ty_1 {
1419 fn default() -> Self {
1420 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1421 unsafe {
1422 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1423 s.assume_init()
1424 }
1425 }
1426}
1427impl Default for otMacKeyMaterial {
1428 fn default() -> Self {
1429 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1430 unsafe {
1431 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1432 s.assume_init()
1433 }
1434 }
1435}
1436#[doc = "< Use Literal Keys."]
1437pub const OT_KEY_TYPE_LITERAL_KEY: otRadioKeyType = 0;
1438#[doc = "< Use Reference to Key."]
1439pub const OT_KEY_TYPE_KEY_REF: otRadioKeyType = 1;
1440#[doc = " Defines constants about key types."]
1441pub type otRadioKeyType = ::std::os::raw::c_uint;
1442#[doc = " Represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame."]
1443#[repr(C)]
1444#[derive(Debug, Default, Copy, Clone)]
1445pub struct otRadioIeInfo {
1446 #[doc = "< The time offset to the Thread network time."]
1447 pub mNetworkTimeOffset: i64,
1448 #[doc = "< The Time IE offset from the start of PSDU."]
1449 pub mTimeIeOffset: u8,
1450 #[doc = "< The Time sync sequence."]
1451 pub mTimeSyncSeq: u8,
1452}
1453#[doc = " Represents an IEEE 802.15.4 radio frame."]
1454#[repr(C)]
1455#[derive(Copy, Clone)]
1456pub struct otRadioFrame {
1457 #[doc = "< The PSDU."]
1458 pub mPsdu: *mut u8,
1459 #[doc = "< Length of the PSDU."]
1460 pub mLength: u16,
1461 #[doc = "< Channel used to transmit/receive the frame."]
1462 pub mChannel: u8,
1463 #[doc = "< Radio link type - should be ignored by radio driver."]
1464 pub mRadioType: u8,
1465 pub mInfo: otRadioFrame__bindgen_ty_1,
1466}
1467#[doc = " The union of transmit and receive information for a radio frame."]
1468#[repr(C)]
1469#[derive(Copy, Clone)]
1470pub union otRadioFrame__bindgen_ty_1 {
1471 pub mTxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_1,
1472 pub mRxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_2,
1473}
1474#[doc = " Structure representing radio frame transmit information."]
1475#[repr(C)]
1476#[derive(Debug, Copy, Clone)]
1477pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1478 #[doc = "< The key material used for AES-CCM frame security."]
1479 pub mAesKey: *const otMacKeyMaterial,
1480 #[doc = "< The pointer to the Header IE(s) related information."]
1481 pub mIeInfo: *mut otRadioIeInfo,
1482 #[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`."]
1483 pub mTxDelayBaseTime: otRadioTime32,
1484 #[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`."]
1485 pub mTxDelay: u32,
1486 #[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`)."]
1487 pub mMaxCsmaBackoffs: u8,
1488 #[doc = "< Maximum number of retries allowed after a transmission failure."]
1489 pub mMaxFrameRetries: u8,
1490 #[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."]
1491 pub mRxChannelAfterTxDone: u8,
1492 #[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()."]
1493 pub mTxPower: i8,
1494 pub _bitfield_align_1: [u8; 0],
1495 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1496 #[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."]
1497 pub mTimestamp: otRadioTime64,
1498}
1499impl Default for otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1500 fn default() -> Self {
1501 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1502 unsafe {
1503 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1504 s.assume_init()
1505 }
1506 }
1507}
1508impl otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1509 #[inline]
1510 pub fn mIsHeaderUpdated(&self) -> bool {
1511 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1512 }
1513 #[inline]
1514 pub fn set_mIsHeaderUpdated(&mut self, val: bool) {
1515 unsafe {
1516 let val: u8 = ::std::mem::transmute(val);
1517 self._bitfield_1.set(0usize, 1u8, val as u64)
1518 }
1519 }
1520 #[inline]
1521 pub unsafe fn mIsHeaderUpdated_raw(this: *const Self) -> bool {
1522 unsafe {
1523 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1524 ::std::ptr::addr_of!((*this)._bitfield_1),
1525 0usize,
1526 1u8,
1527 ) as u8)
1528 }
1529 }
1530 #[inline]
1531 pub unsafe fn set_mIsHeaderUpdated_raw(this: *mut Self, val: bool) {
1532 unsafe {
1533 let val: u8 = ::std::mem::transmute(val);
1534 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1535 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1536 0usize,
1537 1u8,
1538 val as u64,
1539 )
1540 }
1541 }
1542 #[inline]
1543 pub fn mIsARetx(&self) -> bool {
1544 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1545 }
1546 #[inline]
1547 pub fn set_mIsARetx(&mut self, val: bool) {
1548 unsafe {
1549 let val: u8 = ::std::mem::transmute(val);
1550 self._bitfield_1.set(1usize, 1u8, val as u64)
1551 }
1552 }
1553 #[inline]
1554 pub unsafe fn mIsARetx_raw(this: *const Self) -> bool {
1555 unsafe {
1556 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1557 ::std::ptr::addr_of!((*this)._bitfield_1),
1558 1usize,
1559 1u8,
1560 ) as u8)
1561 }
1562 }
1563 #[inline]
1564 pub unsafe fn set_mIsARetx_raw(this: *mut Self, val: bool) {
1565 unsafe {
1566 let val: u8 = ::std::mem::transmute(val);
1567 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1568 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1569 1usize,
1570 1u8,
1571 val as u64,
1572 )
1573 }
1574 }
1575 #[inline]
1576 pub fn mCsmaCaEnabled(&self) -> bool {
1577 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1578 }
1579 #[inline]
1580 pub fn set_mCsmaCaEnabled(&mut self, val: bool) {
1581 unsafe {
1582 let val: u8 = ::std::mem::transmute(val);
1583 self._bitfield_1.set(2usize, 1u8, val as u64)
1584 }
1585 }
1586 #[inline]
1587 pub unsafe fn mCsmaCaEnabled_raw(this: *const Self) -> bool {
1588 unsafe {
1589 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1590 ::std::ptr::addr_of!((*this)._bitfield_1),
1591 2usize,
1592 1u8,
1593 ) as u8)
1594 }
1595 }
1596 #[inline]
1597 pub unsafe fn set_mCsmaCaEnabled_raw(this: *mut Self, val: bool) {
1598 unsafe {
1599 let val: u8 = ::std::mem::transmute(val);
1600 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1601 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1602 2usize,
1603 1u8,
1604 val as u64,
1605 )
1606 }
1607 }
1608 #[inline]
1609 pub fn mCslPresent(&self) -> bool {
1610 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1611 }
1612 #[inline]
1613 pub fn set_mCslPresent(&mut self, val: bool) {
1614 unsafe {
1615 let val: u8 = ::std::mem::transmute(val);
1616 self._bitfield_1.set(3usize, 1u8, val as u64)
1617 }
1618 }
1619 #[inline]
1620 pub unsafe fn mCslPresent_raw(this: *const Self) -> bool {
1621 unsafe {
1622 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1623 ::std::ptr::addr_of!((*this)._bitfield_1),
1624 3usize,
1625 1u8,
1626 ) as u8)
1627 }
1628 }
1629 #[inline]
1630 pub unsafe fn set_mCslPresent_raw(this: *mut Self, val: bool) {
1631 unsafe {
1632 let val: u8 = ::std::mem::transmute(val);
1633 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1634 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1635 3usize,
1636 1u8,
1637 val as u64,
1638 )
1639 }
1640 }
1641 #[inline]
1642 pub fn mIsSecurityProcessed(&self) -> bool {
1643 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1644 }
1645 #[inline]
1646 pub fn set_mIsSecurityProcessed(&mut self, val: bool) {
1647 unsafe {
1648 let val: u8 = ::std::mem::transmute(val);
1649 self._bitfield_1.set(4usize, 1u8, val as u64)
1650 }
1651 }
1652 #[inline]
1653 pub unsafe fn mIsSecurityProcessed_raw(this: *const Self) -> bool {
1654 unsafe {
1655 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1656 ::std::ptr::addr_of!((*this)._bitfield_1),
1657 4usize,
1658 1u8,
1659 ) as u8)
1660 }
1661 }
1662 #[inline]
1663 pub unsafe fn set_mIsSecurityProcessed_raw(this: *mut Self, val: bool) {
1664 unsafe {
1665 let val: u8 = ::std::mem::transmute(val);
1666 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1667 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1668 4usize,
1669 1u8,
1670 val as u64,
1671 )
1672 }
1673 }
1674 #[inline]
1675 pub fn new_bitfield_1(
1676 mIsHeaderUpdated: bool,
1677 mIsARetx: bool,
1678 mCsmaCaEnabled: bool,
1679 mCslPresent: bool,
1680 mIsSecurityProcessed: bool,
1681 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1682 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1683 __bindgen_bitfield_unit.set(0usize, 1u8, {
1684 let mIsHeaderUpdated: u8 = unsafe { ::std::mem::transmute(mIsHeaderUpdated) };
1685 mIsHeaderUpdated as u64
1686 });
1687 __bindgen_bitfield_unit.set(1usize, 1u8, {
1688 let mIsARetx: u8 = unsafe { ::std::mem::transmute(mIsARetx) };
1689 mIsARetx as u64
1690 });
1691 __bindgen_bitfield_unit.set(2usize, 1u8, {
1692 let mCsmaCaEnabled: u8 = unsafe { ::std::mem::transmute(mCsmaCaEnabled) };
1693 mCsmaCaEnabled as u64
1694 });
1695 __bindgen_bitfield_unit.set(3usize, 1u8, {
1696 let mCslPresent: u8 = unsafe { ::std::mem::transmute(mCslPresent) };
1697 mCslPresent as u64
1698 });
1699 __bindgen_bitfield_unit.set(4usize, 1u8, {
1700 let mIsSecurityProcessed: u8 = unsafe { ::std::mem::transmute(mIsSecurityProcessed) };
1701 mIsSecurityProcessed as u64
1702 });
1703 __bindgen_bitfield_unit
1704 }
1705}
1706#[doc = " Structure representing radio frame receive information."]
1707#[repr(C)]
1708#[derive(Debug, Default, Copy, Clone)]
1709pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1710 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna."]
1711 pub mTimestamp: otRadioTime64,
1712 #[doc = "< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set)."]
1713 pub mAckFrameCounter: u32,
1714 #[doc = "< ACK security key index (applicable when `mAckedWithSecEnhAck` is set)."]
1715 pub mAckKeyId: u8,
1716 #[doc = "< Received signal strength indicator in dBm for received frames."]
1717 pub mRssi: i8,
1718 #[doc = "< Link Quality Indicator for received frames."]
1719 pub mLqi: u8,
1720 pub _bitfield_align_1: [u8; 0],
1721 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1722}
1723impl otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1724 #[inline]
1725 pub fn mAckedWithFramePending(&self) -> bool {
1726 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1727 }
1728 #[inline]
1729 pub fn set_mAckedWithFramePending(&mut self, val: bool) {
1730 unsafe {
1731 let val: u8 = ::std::mem::transmute(val);
1732 self._bitfield_1.set(0usize, 1u8, val as u64)
1733 }
1734 }
1735 #[inline]
1736 pub unsafe fn mAckedWithFramePending_raw(this: *const Self) -> bool {
1737 unsafe {
1738 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1739 ::std::ptr::addr_of!((*this)._bitfield_1),
1740 0usize,
1741 1u8,
1742 ) as u8)
1743 }
1744 }
1745 #[inline]
1746 pub unsafe fn set_mAckedWithFramePending_raw(this: *mut Self, val: bool) {
1747 unsafe {
1748 let val: u8 = ::std::mem::transmute(val);
1749 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1750 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1751 0usize,
1752 1u8,
1753 val as u64,
1754 )
1755 }
1756 }
1757 #[inline]
1758 pub fn mAckedWithSecEnhAck(&self) -> bool {
1759 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1760 }
1761 #[inline]
1762 pub fn set_mAckedWithSecEnhAck(&mut self, val: bool) {
1763 unsafe {
1764 let val: u8 = ::std::mem::transmute(val);
1765 self._bitfield_1.set(1usize, 1u8, val as u64)
1766 }
1767 }
1768 #[inline]
1769 pub unsafe fn mAckedWithSecEnhAck_raw(this: *const Self) -> bool {
1770 unsafe {
1771 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1772 ::std::ptr::addr_of!((*this)._bitfield_1),
1773 1usize,
1774 1u8,
1775 ) as u8)
1776 }
1777 }
1778 #[inline]
1779 pub unsafe fn set_mAckedWithSecEnhAck_raw(this: *mut Self, val: bool) {
1780 unsafe {
1781 let val: u8 = ::std::mem::transmute(val);
1782 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1783 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1784 1usize,
1785 1u8,
1786 val as u64,
1787 )
1788 }
1789 }
1790 #[inline]
1791 pub fn new_bitfield_1(
1792 mAckedWithFramePending: bool,
1793 mAckedWithSecEnhAck: bool,
1794 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1795 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1796 __bindgen_bitfield_unit.set(0usize, 1u8, {
1797 let mAckedWithFramePending: u8 =
1798 unsafe { ::std::mem::transmute(mAckedWithFramePending) };
1799 mAckedWithFramePending as u64
1800 });
1801 __bindgen_bitfield_unit.set(1usize, 1u8, {
1802 let mAckedWithSecEnhAck: u8 = unsafe { ::std::mem::transmute(mAckedWithSecEnhAck) };
1803 mAckedWithSecEnhAck as u64
1804 });
1805 __bindgen_bitfield_unit
1806 }
1807}
1808impl Default for otRadioFrame__bindgen_ty_1 {
1809 fn default() -> Self {
1810 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1811 unsafe {
1812 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1813 s.assume_init()
1814 }
1815 }
1816}
1817impl Default for otRadioFrame {
1818 fn default() -> Self {
1819 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1820 unsafe {
1821 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1822 s.assume_init()
1823 }
1824 }
1825}
1826pub const OT_RADIO_STATE_DISABLED: otRadioState = 0;
1827pub const OT_RADIO_STATE_SLEEP: otRadioState = 1;
1828pub const OT_RADIO_STATE_RECEIVE: otRadioState = 2;
1829pub const OT_RADIO_STATE_TRANSMIT: otRadioState = 3;
1830pub const OT_RADIO_STATE_INVALID: otRadioState = 255;
1831#[doc = " Represents the state of a radio.\n Initially, a radio is in the Disabled state."]
1832pub type otRadioState = ::std::os::raw::c_uint;
1833#[doc = " Represents radio coexistence metrics."]
1834#[repr(C)]
1835#[derive(Debug, Default, Copy, Clone)]
1836pub struct otRadioCoexMetrics {
1837 #[doc = "< Number of grant glitches."]
1838 pub mNumGrantGlitch: u32,
1839 #[doc = "< Number of tx requests."]
1840 pub mNumTxRequest: u32,
1841 #[doc = "< Number of tx requests while grant was active."]
1842 pub mNumTxGrantImmediate: u32,
1843 #[doc = "< Number of tx requests while grant was inactive."]
1844 pub mNumTxGrantWait: u32,
1845 #[doc = "< Number of tx requests while grant was inactive that were ultimately granted."]
1846 pub mNumTxGrantWaitActivated: u32,
1847 #[doc = "< Number of tx requests while grant was inactive that timed out."]
1848 pub mNumTxGrantWaitTimeout: u32,
1849 #[doc = "< Number of tx that were in progress when grant was deactivated."]
1850 pub mNumTxGrantDeactivatedDuringRequest: u32,
1851 #[doc = "< Number of tx requests that were not granted within 50us."]
1852 pub mNumTxDelayedGrant: u32,
1853 #[doc = "< Average time in usec from tx request to grant."]
1854 pub mAvgTxRequestToGrantTime: u32,
1855 #[doc = "< Number of rx requests."]
1856 pub mNumRxRequest: u32,
1857 #[doc = "< Number of rx requests while grant was active."]
1858 pub mNumRxGrantImmediate: u32,
1859 #[doc = "< Number of rx requests while grant was inactive."]
1860 pub mNumRxGrantWait: u32,
1861 #[doc = "< Number of rx requests while grant was inactive that were ultimately granted."]
1862 pub mNumRxGrantWaitActivated: u32,
1863 #[doc = "< Number of rx requests while grant was inactive that timed out."]
1864 pub mNumRxGrantWaitTimeout: u32,
1865 #[doc = "< Number of rx that were in progress when grant was deactivated."]
1866 pub mNumRxGrantDeactivatedDuringRequest: u32,
1867 #[doc = "< Number of rx requests that were not granted within 50us."]
1868 pub mNumRxDelayedGrant: u32,
1869 #[doc = "< Average time in usec from rx request to grant."]
1870 pub mAvgRxRequestToGrantTime: u32,
1871 #[doc = "< Number of rx requests that completed without receiving grant."]
1872 pub mNumRxGrantNone: u32,
1873 #[doc = "< Stats collection stopped due to saturation."]
1874 pub mStopped: bool,
1875}
1876#[doc = " Represents what metrics are specified to query."]
1877#[repr(C)]
1878#[derive(Debug, Default, Copy, Clone)]
1879pub struct otLinkMetrics {
1880 pub _bitfield_align_1: [u8; 0],
1881 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1882}
1883impl otLinkMetrics {
1884 #[inline]
1885 pub fn mPduCount(&self) -> bool {
1886 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1887 }
1888 #[inline]
1889 pub fn set_mPduCount(&mut self, val: bool) {
1890 unsafe {
1891 let val: u8 = ::std::mem::transmute(val);
1892 self._bitfield_1.set(0usize, 1u8, val as u64)
1893 }
1894 }
1895 #[inline]
1896 pub unsafe fn mPduCount_raw(this: *const Self) -> bool {
1897 unsafe {
1898 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1899 ::std::ptr::addr_of!((*this)._bitfield_1),
1900 0usize,
1901 1u8,
1902 ) as u8)
1903 }
1904 }
1905 #[inline]
1906 pub unsafe fn set_mPduCount_raw(this: *mut Self, val: bool) {
1907 unsafe {
1908 let val: u8 = ::std::mem::transmute(val);
1909 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1910 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1911 0usize,
1912 1u8,
1913 val as u64,
1914 )
1915 }
1916 }
1917 #[inline]
1918 pub fn mLqi(&self) -> bool {
1919 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1920 }
1921 #[inline]
1922 pub fn set_mLqi(&mut self, val: bool) {
1923 unsafe {
1924 let val: u8 = ::std::mem::transmute(val);
1925 self._bitfield_1.set(1usize, 1u8, val as u64)
1926 }
1927 }
1928 #[inline]
1929 pub unsafe fn mLqi_raw(this: *const Self) -> bool {
1930 unsafe {
1931 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1932 ::std::ptr::addr_of!((*this)._bitfield_1),
1933 1usize,
1934 1u8,
1935 ) as u8)
1936 }
1937 }
1938 #[inline]
1939 pub unsafe fn set_mLqi_raw(this: *mut Self, val: bool) {
1940 unsafe {
1941 let val: u8 = ::std::mem::transmute(val);
1942 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1943 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1944 1usize,
1945 1u8,
1946 val as u64,
1947 )
1948 }
1949 }
1950 #[inline]
1951 pub fn mLinkMargin(&self) -> bool {
1952 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1953 }
1954 #[inline]
1955 pub fn set_mLinkMargin(&mut self, val: bool) {
1956 unsafe {
1957 let val: u8 = ::std::mem::transmute(val);
1958 self._bitfield_1.set(2usize, 1u8, val as u64)
1959 }
1960 }
1961 #[inline]
1962 pub unsafe fn mLinkMargin_raw(this: *const Self) -> bool {
1963 unsafe {
1964 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1965 ::std::ptr::addr_of!((*this)._bitfield_1),
1966 2usize,
1967 1u8,
1968 ) as u8)
1969 }
1970 }
1971 #[inline]
1972 pub unsafe fn set_mLinkMargin_raw(this: *mut Self, val: bool) {
1973 unsafe {
1974 let val: u8 = ::std::mem::transmute(val);
1975 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1976 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1977 2usize,
1978 1u8,
1979 val as u64,
1980 )
1981 }
1982 }
1983 #[inline]
1984 pub fn mRssi(&self) -> bool {
1985 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1986 }
1987 #[inline]
1988 pub fn set_mRssi(&mut self, val: bool) {
1989 unsafe {
1990 let val: u8 = ::std::mem::transmute(val);
1991 self._bitfield_1.set(3usize, 1u8, val as u64)
1992 }
1993 }
1994 #[inline]
1995 pub unsafe fn mRssi_raw(this: *const Self) -> bool {
1996 unsafe {
1997 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1998 ::std::ptr::addr_of!((*this)._bitfield_1),
1999 3usize,
2000 1u8,
2001 ) as u8)
2002 }
2003 }
2004 #[inline]
2005 pub unsafe fn set_mRssi_raw(this: *mut Self, val: bool) {
2006 unsafe {
2007 let val: u8 = ::std::mem::transmute(val);
2008 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2009 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2010 3usize,
2011 1u8,
2012 val as u64,
2013 )
2014 }
2015 }
2016 #[inline]
2017 pub fn mReserved(&self) -> bool {
2018 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
2019 }
2020 #[inline]
2021 pub fn set_mReserved(&mut self, val: bool) {
2022 unsafe {
2023 let val: u8 = ::std::mem::transmute(val);
2024 self._bitfield_1.set(4usize, 1u8, val as u64)
2025 }
2026 }
2027 #[inline]
2028 pub unsafe fn mReserved_raw(this: *const Self) -> bool {
2029 unsafe {
2030 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2031 ::std::ptr::addr_of!((*this)._bitfield_1),
2032 4usize,
2033 1u8,
2034 ) as u8)
2035 }
2036 }
2037 #[inline]
2038 pub unsafe fn set_mReserved_raw(this: *mut Self, val: bool) {
2039 unsafe {
2040 let val: u8 = ::std::mem::transmute(val);
2041 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2042 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2043 4usize,
2044 1u8,
2045 val as u64,
2046 )
2047 }
2048 }
2049 #[inline]
2050 pub fn new_bitfield_1(
2051 mPduCount: bool,
2052 mLqi: bool,
2053 mLinkMargin: bool,
2054 mRssi: bool,
2055 mReserved: bool,
2056 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2057 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2058 __bindgen_bitfield_unit.set(0usize, 1u8, {
2059 let mPduCount: u8 = unsafe { ::std::mem::transmute(mPduCount) };
2060 mPduCount as u64
2061 });
2062 __bindgen_bitfield_unit.set(1usize, 1u8, {
2063 let mLqi: u8 = unsafe { ::std::mem::transmute(mLqi) };
2064 mLqi as u64
2065 });
2066 __bindgen_bitfield_unit.set(2usize, 1u8, {
2067 let mLinkMargin: u8 = unsafe { ::std::mem::transmute(mLinkMargin) };
2068 mLinkMargin as u64
2069 });
2070 __bindgen_bitfield_unit.set(3usize, 1u8, {
2071 let mRssi: u8 = unsafe { ::std::mem::transmute(mRssi) };
2072 mRssi as u64
2073 });
2074 __bindgen_bitfield_unit.set(4usize, 1u8, {
2075 let mReserved: u8 = unsafe { ::std::mem::transmute(mReserved) };
2076 mReserved as u64
2077 });
2078 __bindgen_bitfield_unit
2079 }
2080}
2081unsafe extern "C" {
2082 #[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)."]
2083 pub fn otPlatRadioGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
2084}
2085unsafe extern "C" {
2086 #[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."]
2087 pub fn otPlatRadioGetVersionString(aInstance: *mut otInstance)
2088 -> *const ::std::os::raw::c_char;
2089}
2090unsafe extern "C" {
2091 #[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."]
2092 pub fn otPlatRadioGetReceiveSensitivity(aInstance: *mut otInstance) -> i8;
2093}
2094unsafe extern "C" {
2095 #[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."]
2096 pub fn otPlatRadioGetIeeeEui64(aInstance: *mut otInstance, aIeeeEui64: *mut u8);
2097}
2098unsafe extern "C" {
2099 #[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."]
2100 pub fn otPlatRadioSetPanId(aInstance: *mut otInstance, aPanId: otPanId);
2101}
2102unsafe extern "C" {
2103 #[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."]
2104 pub fn otPlatRadioSetExtendedAddress(
2105 aInstance: *mut otInstance,
2106 aExtAddress: *const otExtAddress,
2107 );
2108}
2109unsafe extern "C" {
2110 #[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."]
2111 pub fn otPlatRadioSetShortAddress(aInstance: *mut otInstance, aShortAddress: otShortAddress);
2112}
2113unsafe extern "C" {
2114 #[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."]
2115 pub fn otPlatRadioSetAlternateShortAddress(
2116 aInstance: *mut otInstance,
2117 aShortAddress: otShortAddress,
2118 );
2119}
2120unsafe extern "C" {
2121 #[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."]
2122 pub fn otPlatRadioGetTransmitPower(aInstance: *mut otInstance, aPower: *mut i8) -> otError;
2123}
2124unsafe extern "C" {
2125 #[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."]
2126 pub fn otPlatRadioSetTransmitPower(aInstance: *mut otInstance, aPower: i8) -> otError;
2127}
2128unsafe extern "C" {
2129 #[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."]
2130 pub fn otPlatRadioGetCcaEnergyDetectThreshold(
2131 aInstance: *mut otInstance,
2132 aThreshold: *mut i8,
2133 ) -> otError;
2134}
2135unsafe extern "C" {
2136 #[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."]
2137 pub fn otPlatRadioSetCcaEnergyDetectThreshold(
2138 aInstance: *mut otInstance,
2139 aThreshold: i8,
2140 ) -> otError;
2141}
2142unsafe extern "C" {
2143 #[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."]
2144 pub fn otPlatRadioGetFemLnaGain(aInstance: *mut otInstance, aGain: *mut i8) -> otError;
2145}
2146unsafe extern "C" {
2147 #[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."]
2148 pub fn otPlatRadioSetFemLnaGain(aInstance: *mut otInstance, aGain: i8) -> otError;
2149}
2150unsafe extern "C" {
2151 #[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."]
2152 pub fn otPlatRadioGetPromiscuous(aInstance: *mut otInstance) -> bool;
2153}
2154unsafe extern "C" {
2155 #[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."]
2156 pub fn otPlatRadioSetPromiscuous(aInstance: *mut otInstance, aEnable: bool);
2157}
2158unsafe extern "C" {
2159 #[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."]
2160 pub fn otPlatRadioSetRxOnWhenIdle(aInstance: *mut otInstance, aEnable: bool);
2161}
2162unsafe extern "C" {
2163 #[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."]
2164 pub fn otPlatRadioSetMacKey(
2165 aInstance: *mut otInstance,
2166 aKeyIdMode: u8,
2167 aKeyId: u8,
2168 aPrevKey: *const otMacKeyMaterial,
2169 aCurrKey: *const otMacKeyMaterial,
2170 aNextKey: *const otMacKeyMaterial,
2171 aKeyType: otRadioKeyType,
2172 );
2173}
2174unsafe extern "C" {
2175 #[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."]
2176 pub fn otPlatRadioSetMacFrameCounter(aInstance: *mut otInstance, aMacFrameCounter: u32);
2177}
2178unsafe extern "C" {
2179 #[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."]
2180 pub fn otPlatRadioSetMacFrameCounterIfLarger(aInstance: *mut otInstance, aMacFrameCounter: u32);
2181}
2182unsafe extern "C" {
2183 #[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."]
2184 pub fn otPlatRadioGetNow(aInstance: *mut otInstance) -> otRadioTime64;
2185}
2186unsafe extern "C" {
2187 #[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."]
2188 pub fn otPlatRadioGetBusSpeed(aInstance: *mut otInstance) -> u32;
2189}
2190unsafe extern "C" {
2191 #[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."]
2192 pub fn otPlatRadioGetBusLatency(aInstance: *mut otInstance) -> u32;
2193}
2194unsafe extern "C" {
2195 #[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."]
2196 pub fn otPlatRadioGetState(aInstance: *mut otInstance) -> otRadioState;
2197}
2198unsafe extern "C" {
2199 #[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."]
2200 pub fn otPlatRadioEnable(aInstance: *mut otInstance) -> otError;
2201}
2202unsafe extern "C" {
2203 #[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."]
2204 pub fn otPlatRadioDisable(aInstance: *mut otInstance) -> otError;
2205}
2206unsafe extern "C" {
2207 #[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."]
2208 pub fn otPlatRadioIsEnabled(aInstance: *mut otInstance) -> bool;
2209}
2210unsafe extern "C" {
2211 #[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."]
2212 pub fn otPlatRadioSleep(aInstance: *mut otInstance) -> otError;
2213}
2214unsafe extern "C" {
2215 #[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."]
2216 pub fn otPlatRadioReceive(aInstance: *mut otInstance, aChannel: u8) -> otError;
2217}
2218unsafe extern "C" {
2219 #[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."]
2220 pub fn otPlatRadioReceiveAt(
2221 aInstance: *mut otInstance,
2222 aChannel: u8,
2223 aStart: otRadioTime32,
2224 aDuration: u32,
2225 ) -> otError;
2226}
2227unsafe extern "C" {
2228 #[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."]
2229 pub fn otPlatRadioReceiveDone(
2230 aInstance: *mut otInstance,
2231 aFrame: *mut otRadioFrame,
2232 aError: otError,
2233 );
2234}
2235unsafe extern "C" {
2236 #[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."]
2237 pub fn otPlatDiagRadioReceiveDone(
2238 aInstance: *mut otInstance,
2239 aFrame: *mut otRadioFrame,
2240 aError: otError,
2241 );
2242}
2243unsafe extern "C" {
2244 #[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."]
2245 pub fn otPlatRadioGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
2246}
2247unsafe extern "C" {
2248 #[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."]
2249 pub fn otPlatRadioTransmit(aInstance: *mut otInstance, aFrame: *mut otRadioFrame) -> otError;
2250}
2251unsafe extern "C" {
2252 #[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."]
2253 pub fn otPlatRadioTxStarted(aInstance: *mut otInstance, aFrame: *mut otRadioFrame);
2254}
2255unsafe extern "C" {
2256 #[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."]
2257 pub fn otPlatRadioTxDone(
2258 aInstance: *mut otInstance,
2259 aFrame: *mut otRadioFrame,
2260 aAckFrame: *mut otRadioFrame,
2261 aError: otError,
2262 );
2263}
2264unsafe extern "C" {
2265 #[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."]
2266 pub fn otPlatDiagRadioTransmitDone(
2267 aInstance: *mut otInstance,
2268 aFrame: *mut otRadioFrame,
2269 aError: otError,
2270 );
2271}
2272unsafe extern "C" {
2273 #[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."]
2274 pub fn otPlatRadioGetRssi(aInstance: *mut otInstance) -> i8;
2275}
2276unsafe extern "C" {
2277 #[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."]
2278 pub fn otPlatRadioEnergyScan(
2279 aInstance: *mut otInstance,
2280 aScanChannel: u8,
2281 aScanDuration: u16,
2282 ) -> otError;
2283}
2284unsafe extern "C" {
2285 #[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."]
2286 pub fn otPlatRadioEnergyScanDone(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8);
2287}
2288unsafe extern "C" {
2289 #[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."]
2290 pub fn otPlatRadioBusLatencyChanged(aInstance: *mut otInstance);
2291}
2292unsafe extern "C" {
2293 #[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."]
2294 pub fn otPlatRadioEnableSrcMatch(aInstance: *mut otInstance, aEnable: bool);
2295}
2296unsafe extern "C" {
2297 #[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."]
2298 pub fn otPlatRadioAddSrcMatchShortEntry(
2299 aInstance: *mut otInstance,
2300 aShortAddress: otShortAddress,
2301 ) -> otError;
2302}
2303unsafe extern "C" {
2304 #[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."]
2305 pub fn otPlatRadioAddSrcMatchExtEntry(
2306 aInstance: *mut otInstance,
2307 aExtAddress: *const otExtAddress,
2308 ) -> otError;
2309}
2310unsafe extern "C" {
2311 #[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."]
2312 pub fn otPlatRadioClearSrcMatchShortEntry(
2313 aInstance: *mut otInstance,
2314 aShortAddress: otShortAddress,
2315 ) -> otError;
2316}
2317unsafe extern "C" {
2318 #[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."]
2319 pub fn otPlatRadioClearSrcMatchExtEntry(
2320 aInstance: *mut otInstance,
2321 aExtAddress: *const otExtAddress,
2322 ) -> otError;
2323}
2324unsafe extern "C" {
2325 #[doc = " Clear all short addresses from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2326 pub fn otPlatRadioClearSrcMatchShortEntries(aInstance: *mut otInstance);
2327}
2328unsafe extern "C" {
2329 #[doc = " Clear all the extended/long addresses from source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2330 pub fn otPlatRadioClearSrcMatchExtEntries(aInstance: *mut otInstance);
2331}
2332unsafe extern "C" {
2333 #[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."]
2334 pub fn otPlatRadioGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
2335}
2336unsafe extern "C" {
2337 #[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."]
2338 pub fn otPlatRadioGetPreferredChannelMask(aInstance: *mut otInstance) -> u32;
2339}
2340unsafe extern "C" {
2341 #[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."]
2342 pub fn otPlatRadioSetCoexEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
2343}
2344unsafe extern "C" {
2345 #[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."]
2346 pub fn otPlatRadioIsCoexEnabled(aInstance: *mut otInstance) -> bool;
2347}
2348unsafe extern "C" {
2349 #[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."]
2350 pub fn otPlatRadioGetCoexMetrics(
2351 aInstance: *mut otInstance,
2352 aCoexMetrics: *mut otRadioCoexMetrics,
2353 ) -> otError;
2354}
2355unsafe extern "C" {
2356 #[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."]
2357 pub fn otPlatRadioEnableCsl(
2358 aInstance: *mut otInstance,
2359 aCslPeriod: u32,
2360 aShortAddr: otShortAddress,
2361 aExtAddr: *const otExtAddress,
2362 ) -> otError;
2363}
2364unsafe extern "C" {
2365 #[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."]
2366 pub fn otPlatRadioResetCsl(aInstance: *mut otInstance) -> otError;
2367}
2368unsafe extern "C" {
2369 #[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."]
2370 pub fn otPlatRadioUpdateCslSampleTime(
2371 aInstance: *mut otInstance,
2372 aCslSampleTime: otRadioTime32,
2373 );
2374}
2375unsafe extern "C" {
2376 #[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."]
2377 pub fn otPlatRadioGetCslAccuracy(aInstance: *mut otInstance) -> u8;
2378}
2379unsafe extern "C" {
2380 #[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."]
2381 pub fn otPlatRadioGetCslUncertainty(aInstance: *mut otInstance) -> u8;
2382}
2383unsafe extern "C" {
2384 #[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."]
2385 pub fn otPlatRadioSetChannelMaxTransmitPower(
2386 aInstance: *mut otInstance,
2387 aChannel: u8,
2388 aMaxPower: i8,
2389 ) -> otError;
2390}
2391unsafe extern "C" {
2392 #[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."]
2393 pub fn otPlatRadioSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
2394}
2395unsafe extern "C" {
2396 #[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."]
2397 pub fn otPlatRadioGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
2398}
2399unsafe extern "C" {
2400 #[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."]
2401 pub fn otPlatRadioConfigureEnhAckProbing(
2402 aInstance: *mut otInstance,
2403 aLinkMetrics: otLinkMetrics,
2404 aShortAddress: otShortAddress,
2405 aExtAddress: *const otExtAddress,
2406 ) -> otError;
2407}
2408unsafe extern "C" {
2409 #[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."]
2410 pub fn otPlatRadioAddCalibratedPower(
2411 aInstance: *mut otInstance,
2412 aChannel: u8,
2413 aActualPower: i16,
2414 aRawPowerSetting: *const u8,
2415 aRawPowerSettingLength: u16,
2416 ) -> otError;
2417}
2418unsafe extern "C" {
2419 #[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."]
2420 pub fn otPlatRadioClearCalibratedPowers(aInstance: *mut otInstance) -> otError;
2421}
2422unsafe extern "C" {
2423 #[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."]
2424 pub fn otPlatRadioSetChannelTargetPower(
2425 aInstance: *mut otInstance,
2426 aChannel: u8,
2427 aTargetPower: i16,
2428 ) -> otError;
2429}
2430unsafe extern "C" {
2431 #[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."]
2432 pub fn otPlatRadioGetRawPowerSetting(
2433 aInstance: *mut otInstance,
2434 aChannel: u8,
2435 aRawPowerSetting: *mut u8,
2436 aRawPowerSettingLength: *mut u16,
2437 ) -> otError;
2438}
2439#[doc = " @struct otIp6InterfaceIdentifier\n\n Represents the Interface Identifier of an IPv6 address."]
2440#[repr(C, packed)]
2441#[derive(Copy, Clone)]
2442pub struct otIp6InterfaceIdentifier {
2443 #[doc = "< The Interface Identifier accessor fields"]
2444 pub mFields: otIp6InterfaceIdentifier__bindgen_ty_1,
2445}
2446#[repr(C, packed)]
2447#[derive(Copy, Clone)]
2448pub union otIp6InterfaceIdentifier__bindgen_ty_1 {
2449 #[doc = "< 8-bit fields"]
2450 pub m8: [u8; 8usize],
2451 #[doc = "< 16-bit fields"]
2452 pub m16: [u16; 4usize],
2453 #[doc = "< 32-bit fields"]
2454 pub m32: [u32; 2usize],
2455}
2456impl Default for otIp6InterfaceIdentifier__bindgen_ty_1 {
2457 fn default() -> Self {
2458 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2459 unsafe {
2460 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2461 s.assume_init()
2462 }
2463 }
2464}
2465impl Default for otIp6InterfaceIdentifier {
2466 fn default() -> Self {
2467 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2468 unsafe {
2469 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2470 s.assume_init()
2471 }
2472 }
2473}
2474#[doc = " @struct otIp6NetworkPrefix\n\n Represents the Network Prefix of an IPv6 address (most significant 64 bits of the address)."]
2475#[repr(C, packed)]
2476#[derive(Debug, Default, Copy, Clone)]
2477pub struct otIp6NetworkPrefix {
2478 #[doc = "< The Network Prefix."]
2479 pub m8: [u8; 8usize],
2480}
2481#[doc = " @struct otIp6AddressComponents\n\n Represents the components of an IPv6 address."]
2482#[repr(C, packed)]
2483#[derive(Copy, Clone)]
2484pub struct otIp6AddressComponents {
2485 #[doc = "< The Network Prefix (most significant 64 bits of the address)"]
2486 pub mNetworkPrefix: otIp6NetworkPrefix,
2487 #[doc = "< The Interface Identifier (least significant 64 bits of the address)"]
2488 pub mIid: otIp6InterfaceIdentifier,
2489}
2490impl Default for otIp6AddressComponents {
2491 fn default() -> Self {
2492 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2493 unsafe {
2494 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2495 s.assume_init()
2496 }
2497 }
2498}
2499#[doc = " @struct otIp6Address\n\n Represents an IPv6 address."]
2500#[repr(C, packed)]
2501#[derive(Copy, Clone)]
2502pub struct otIp6Address {
2503 #[doc = "< IPv6 accessor fields"]
2504 pub mFields: otIp6Address__bindgen_ty_1,
2505}
2506#[repr(C, packed)]
2507#[derive(Copy, Clone)]
2508pub union otIp6Address__bindgen_ty_1 {
2509 #[doc = "< 8-bit fields"]
2510 pub m8: [u8; 16usize],
2511 #[doc = "< 16-bit fields"]
2512 pub m16: [u16; 8usize],
2513 #[doc = "< 32-bit fields"]
2514 pub m32: [u32; 4usize],
2515 #[doc = "< IPv6 address components"]
2516 pub mComponents: otIp6AddressComponents,
2517}
2518impl Default for otIp6Address__bindgen_ty_1 {
2519 fn default() -> Self {
2520 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2521 unsafe {
2522 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2523 s.assume_init()
2524 }
2525 }
2526}
2527impl Default for otIp6Address {
2528 fn default() -> Self {
2529 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2530 unsafe {
2531 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2532 s.assume_init()
2533 }
2534 }
2535}
2536#[doc = " @struct otIp6Prefix\n\n Represents an IPv6 prefix."]
2537#[repr(C, packed)]
2538#[derive(Copy, Clone)]
2539pub struct otIp6Prefix {
2540 #[doc = "< The IPv6 prefix."]
2541 pub mPrefix: otIp6Address,
2542 #[doc = "< The IPv6 prefix length (in bits)."]
2543 pub mLength: u8,
2544}
2545impl Default for otIp6Prefix {
2546 fn default() -> Self {
2547 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2548 unsafe {
2549 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2550 s.assume_init()
2551 }
2552 }
2553}
2554#[doc = "< Thread assigned (ALOC, RLOC, MLEID, etc.)"]
2555pub const OT_ADDRESS_ORIGIN_THREAD: _bindgen_ty_7 = 0;
2556#[doc = "< SLAAC assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2557pub const OT_ADDRESS_ORIGIN_SLAAC: _bindgen_ty_7 = 1;
2558#[doc = "< DHCPv6 assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2559pub const OT_ADDRESS_ORIGIN_DHCPV6: _bindgen_ty_7 = 2;
2560#[doc = "< Manually assigned address."]
2561pub const OT_ADDRESS_ORIGIN_MANUAL: _bindgen_ty_7 = 3;
2562#[doc = " IPv6 Address origins"]
2563pub type _bindgen_ty_7 = ::std::os::raw::c_uint;
2564#[doc = " Represents an IPv6 network interface unicast address."]
2565#[repr(C)]
2566#[derive(Copy, Clone)]
2567pub struct otNetifAddress {
2568 #[doc = "< The IPv6 unicast address."]
2569 pub mAddress: otIp6Address,
2570 #[doc = "< The Prefix length (in bits)."]
2571 pub mPrefixLength: u8,
2572 #[doc = "< The IPv6 address origin (OT_ADDRESS_ORIGIN_* values)."]
2573 pub mAddressOrigin: u8,
2574 pub _bitfield_align_1: [u8; 0],
2575 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
2576 #[doc = "< A pointer to the next network interface address."]
2577 pub mNext: *const otNetifAddress,
2578}
2579impl Default for otNetifAddress {
2580 fn default() -> Self {
2581 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2582 unsafe {
2583 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2584 s.assume_init()
2585 }
2586 }
2587}
2588impl otNetifAddress {
2589 #[inline]
2590 pub fn mPreferred(&self) -> bool {
2591 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2592 }
2593 #[inline]
2594 pub fn set_mPreferred(&mut self, val: bool) {
2595 unsafe {
2596 let val: u8 = ::std::mem::transmute(val);
2597 self._bitfield_1.set(0usize, 1u8, val as u64)
2598 }
2599 }
2600 #[inline]
2601 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
2602 unsafe {
2603 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2604 ::std::ptr::addr_of!((*this)._bitfield_1),
2605 0usize,
2606 1u8,
2607 ) as u8)
2608 }
2609 }
2610 #[inline]
2611 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
2612 unsafe {
2613 let val: u8 = ::std::mem::transmute(val);
2614 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2615 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2616 0usize,
2617 1u8,
2618 val as u64,
2619 )
2620 }
2621 }
2622 #[inline]
2623 pub fn mValid(&self) -> bool {
2624 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2625 }
2626 #[inline]
2627 pub fn set_mValid(&mut self, val: bool) {
2628 unsafe {
2629 let val: u8 = ::std::mem::transmute(val);
2630 self._bitfield_1.set(1usize, 1u8, val as u64)
2631 }
2632 }
2633 #[inline]
2634 pub unsafe fn mValid_raw(this: *const Self) -> bool {
2635 unsafe {
2636 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2637 ::std::ptr::addr_of!((*this)._bitfield_1),
2638 1usize,
2639 1u8,
2640 ) as u8)
2641 }
2642 }
2643 #[inline]
2644 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
2645 unsafe {
2646 let val: u8 = ::std::mem::transmute(val);
2647 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2648 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2649 1usize,
2650 1u8,
2651 val as u64,
2652 )
2653 }
2654 }
2655 #[inline]
2656 pub fn mScopeOverrideValid(&self) -> bool {
2657 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2658 }
2659 #[inline]
2660 pub fn set_mScopeOverrideValid(&mut self, val: bool) {
2661 unsafe {
2662 let val: u8 = ::std::mem::transmute(val);
2663 self._bitfield_1.set(2usize, 1u8, val as u64)
2664 }
2665 }
2666 #[inline]
2667 pub unsafe fn mScopeOverrideValid_raw(this: *const Self) -> bool {
2668 unsafe {
2669 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2670 ::std::ptr::addr_of!((*this)._bitfield_1),
2671 2usize,
2672 1u8,
2673 ) as u8)
2674 }
2675 }
2676 #[inline]
2677 pub unsafe fn set_mScopeOverrideValid_raw(this: *mut Self, val: bool) {
2678 unsafe {
2679 let val: u8 = ::std::mem::transmute(val);
2680 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2681 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2682 2usize,
2683 1u8,
2684 val as u64,
2685 )
2686 }
2687 }
2688 #[inline]
2689 pub fn mScopeOverride(&self) -> ::std::os::raw::c_uint {
2690 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 4u8) as u32) }
2691 }
2692 #[inline]
2693 pub fn set_mScopeOverride(&mut self, val: ::std::os::raw::c_uint) {
2694 unsafe {
2695 let val: u32 = ::std::mem::transmute(val);
2696 self._bitfield_1.set(3usize, 4u8, val as u64)
2697 }
2698 }
2699 #[inline]
2700 pub unsafe fn mScopeOverride_raw(this: *const Self) -> ::std::os::raw::c_uint {
2701 unsafe {
2702 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2703 ::std::ptr::addr_of!((*this)._bitfield_1),
2704 3usize,
2705 4u8,
2706 ) as u32)
2707 }
2708 }
2709 #[inline]
2710 pub unsafe fn set_mScopeOverride_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
2711 unsafe {
2712 let val: u32 = ::std::mem::transmute(val);
2713 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2714 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2715 3usize,
2716 4u8,
2717 val as u64,
2718 )
2719 }
2720 }
2721 #[inline]
2722 pub fn mRloc(&self) -> bool {
2723 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
2724 }
2725 #[inline]
2726 pub fn set_mRloc(&mut self, val: bool) {
2727 unsafe {
2728 let val: u8 = ::std::mem::transmute(val);
2729 self._bitfield_1.set(7usize, 1u8, val as u64)
2730 }
2731 }
2732 #[inline]
2733 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
2734 unsafe {
2735 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2736 ::std::ptr::addr_of!((*this)._bitfield_1),
2737 7usize,
2738 1u8,
2739 ) as u8)
2740 }
2741 }
2742 #[inline]
2743 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
2744 unsafe {
2745 let val: u8 = ::std::mem::transmute(val);
2746 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2747 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2748 7usize,
2749 1u8,
2750 val as u64,
2751 )
2752 }
2753 }
2754 #[inline]
2755 pub fn mMeshLocal(&self) -> bool {
2756 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
2757 }
2758 #[inline]
2759 pub fn set_mMeshLocal(&mut self, val: bool) {
2760 unsafe {
2761 let val: u8 = ::std::mem::transmute(val);
2762 self._bitfield_1.set(8usize, 1u8, val as u64)
2763 }
2764 }
2765 #[inline]
2766 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
2767 unsafe {
2768 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2769 ::std::ptr::addr_of!((*this)._bitfield_1),
2770 8usize,
2771 1u8,
2772 ) as u8)
2773 }
2774 }
2775 #[inline]
2776 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
2777 unsafe {
2778 let val: u8 = ::std::mem::transmute(val);
2779 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2780 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2781 8usize,
2782 1u8,
2783 val as u64,
2784 )
2785 }
2786 }
2787 #[inline]
2788 pub fn mSrpRegistered(&self) -> bool {
2789 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
2790 }
2791 #[inline]
2792 pub fn set_mSrpRegistered(&mut self, val: bool) {
2793 unsafe {
2794 let val: u8 = ::std::mem::transmute(val);
2795 self._bitfield_1.set(9usize, 1u8, val as u64)
2796 }
2797 }
2798 #[inline]
2799 pub unsafe fn mSrpRegistered_raw(this: *const Self) -> bool {
2800 unsafe {
2801 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2802 ::std::ptr::addr_of!((*this)._bitfield_1),
2803 9usize,
2804 1u8,
2805 ) as u8)
2806 }
2807 }
2808 #[inline]
2809 pub unsafe fn set_mSrpRegistered_raw(this: *mut Self, val: bool) {
2810 unsafe {
2811 let val: u8 = ::std::mem::transmute(val);
2812 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2813 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2814 9usize,
2815 1u8,
2816 val as u64,
2817 )
2818 }
2819 }
2820 #[inline]
2821 pub fn new_bitfield_1(
2822 mPreferred: bool,
2823 mValid: bool,
2824 mScopeOverrideValid: bool,
2825 mScopeOverride: ::std::os::raw::c_uint,
2826 mRloc: bool,
2827 mMeshLocal: bool,
2828 mSrpRegistered: bool,
2829 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
2830 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
2831 __bindgen_bitfield_unit.set(0usize, 1u8, {
2832 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
2833 mPreferred as u64
2834 });
2835 __bindgen_bitfield_unit.set(1usize, 1u8, {
2836 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
2837 mValid as u64
2838 });
2839 __bindgen_bitfield_unit.set(2usize, 1u8, {
2840 let mScopeOverrideValid: u8 = unsafe { ::std::mem::transmute(mScopeOverrideValid) };
2841 mScopeOverrideValid as u64
2842 });
2843 __bindgen_bitfield_unit.set(3usize, 4u8, {
2844 let mScopeOverride: u32 = unsafe { ::std::mem::transmute(mScopeOverride) };
2845 mScopeOverride as u64
2846 });
2847 __bindgen_bitfield_unit.set(7usize, 1u8, {
2848 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
2849 mRloc as u64
2850 });
2851 __bindgen_bitfield_unit.set(8usize, 1u8, {
2852 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
2853 mMeshLocal as u64
2854 });
2855 __bindgen_bitfield_unit.set(9usize, 1u8, {
2856 let mSrpRegistered: u8 = unsafe { ::std::mem::transmute(mSrpRegistered) };
2857 mSrpRegistered as u64
2858 });
2859 __bindgen_bitfield_unit
2860 }
2861}
2862#[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."]
2863#[repr(C)]
2864#[derive(Copy, Clone)]
2865pub struct otNetifMulticastAddress {
2866 #[doc = "< The IPv6 multicast address."]
2867 pub mAddress: otIp6Address,
2868 #[doc = "< A pointer to the next multicast address."]
2869 pub mNext: *const otNetifMulticastAddress,
2870 #[doc = "< The multicast address origin."]
2871 pub mAddressOrigin: u8,
2872 #[doc = "< Opaque data used by OpenThread core."]
2873 pub mData: u8,
2874}
2875impl Default for otNetifMulticastAddress {
2876 fn default() -> Self {
2877 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2878 unsafe {
2879 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2880 s.assume_init()
2881 }
2882 }
2883}
2884#[doc = " Represents an IPv6 socket address."]
2885#[repr(C)]
2886#[derive(Copy, Clone)]
2887pub struct otSockAddr {
2888 #[doc = "< An IPv6 address."]
2889 pub mAddress: otIp6Address,
2890 #[doc = "< A transport-layer port."]
2891 pub mPort: u16,
2892}
2893impl Default for otSockAddr {
2894 fn default() -> Self {
2895 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2896 unsafe {
2897 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2898 s.assume_init()
2899 }
2900 }
2901}
2902#[doc = "< Non-ECT"]
2903pub const OT_ECN_NOT_CAPABLE: _bindgen_ty_8 = 0;
2904#[doc = "< ECT(0)"]
2905pub const OT_ECN_CAPABLE_0: _bindgen_ty_8 = 2;
2906#[doc = "< ECT(1)"]
2907pub const OT_ECN_CAPABLE_1: _bindgen_ty_8 = 1;
2908#[doc = "< Congestion encountered (CE)"]
2909pub const OT_ECN_MARKED: _bindgen_ty_8 = 3;
2910#[doc = " ECN statuses, represented as in the IP header."]
2911pub type _bindgen_ty_8 = ::std::os::raw::c_uint;
2912#[doc = " Represents the local and peer IPv6 socket addresses."]
2913#[repr(C)]
2914#[derive(Copy, Clone)]
2915pub struct otMessageInfo {
2916 #[doc = "< The local IPv6 address."]
2917 pub mSockAddr: otIp6Address,
2918 #[doc = "< The peer IPv6 address."]
2919 pub mPeerAddr: otIp6Address,
2920 #[doc = "< The local transport-layer port."]
2921 pub mSockPort: u16,
2922 #[doc = "< The peer transport-layer port."]
2923 pub mPeerPort: u16,
2924 #[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."]
2925 pub mHopLimit: u8,
2926 pub _bitfield_align_1: [u8; 0],
2927 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2928}
2929impl Default for otMessageInfo {
2930 fn default() -> Self {
2931 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2932 unsafe {
2933 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2934 s.assume_init()
2935 }
2936 }
2937}
2938impl otMessageInfo {
2939 #[inline]
2940 pub fn mEcn(&self) -> u8 {
2941 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
2942 }
2943 #[inline]
2944 pub fn set_mEcn(&mut self, val: u8) {
2945 unsafe {
2946 let val: u8 = ::std::mem::transmute(val);
2947 self._bitfield_1.set(0usize, 2u8, val as u64)
2948 }
2949 }
2950 #[inline]
2951 pub unsafe fn mEcn_raw(this: *const Self) -> u8 {
2952 unsafe {
2953 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2954 ::std::ptr::addr_of!((*this)._bitfield_1),
2955 0usize,
2956 2u8,
2957 ) as u8)
2958 }
2959 }
2960 #[inline]
2961 pub unsafe fn set_mEcn_raw(this: *mut Self, val: u8) {
2962 unsafe {
2963 let val: u8 = ::std::mem::transmute(val);
2964 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2965 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2966 0usize,
2967 2u8,
2968 val as u64,
2969 )
2970 }
2971 }
2972 #[inline]
2973 pub fn mIsHostInterface(&self) -> bool {
2974 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2975 }
2976 #[inline]
2977 pub fn set_mIsHostInterface(&mut self, val: bool) {
2978 unsafe {
2979 let val: u8 = ::std::mem::transmute(val);
2980 self._bitfield_1.set(2usize, 1u8, val as u64)
2981 }
2982 }
2983 #[inline]
2984 pub unsafe fn mIsHostInterface_raw(this: *const Self) -> bool {
2985 unsafe {
2986 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2987 ::std::ptr::addr_of!((*this)._bitfield_1),
2988 2usize,
2989 1u8,
2990 ) as u8)
2991 }
2992 }
2993 #[inline]
2994 pub unsafe fn set_mIsHostInterface_raw(this: *mut Self, val: bool) {
2995 unsafe {
2996 let val: u8 = ::std::mem::transmute(val);
2997 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2998 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2999 2usize,
3000 1u8,
3001 val as u64,
3002 )
3003 }
3004 }
3005 #[inline]
3006 pub fn mAllowZeroHopLimit(&self) -> bool {
3007 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3008 }
3009 #[inline]
3010 pub fn set_mAllowZeroHopLimit(&mut self, val: bool) {
3011 unsafe {
3012 let val: u8 = ::std::mem::transmute(val);
3013 self._bitfield_1.set(3usize, 1u8, val as u64)
3014 }
3015 }
3016 #[inline]
3017 pub unsafe fn mAllowZeroHopLimit_raw(this: *const Self) -> bool {
3018 unsafe {
3019 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3020 ::std::ptr::addr_of!((*this)._bitfield_1),
3021 3usize,
3022 1u8,
3023 ) as u8)
3024 }
3025 }
3026 #[inline]
3027 pub unsafe fn set_mAllowZeroHopLimit_raw(this: *mut Self, val: bool) {
3028 unsafe {
3029 let val: u8 = ::std::mem::transmute(val);
3030 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3031 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3032 3usize,
3033 1u8,
3034 val as u64,
3035 )
3036 }
3037 }
3038 #[inline]
3039 pub fn mMulticastLoop(&self) -> bool {
3040 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3041 }
3042 #[inline]
3043 pub fn set_mMulticastLoop(&mut self, val: bool) {
3044 unsafe {
3045 let val: u8 = ::std::mem::transmute(val);
3046 self._bitfield_1.set(4usize, 1u8, val as u64)
3047 }
3048 }
3049 #[inline]
3050 pub unsafe fn mMulticastLoop_raw(this: *const Self) -> bool {
3051 unsafe {
3052 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3053 ::std::ptr::addr_of!((*this)._bitfield_1),
3054 4usize,
3055 1u8,
3056 ) as u8)
3057 }
3058 }
3059 #[inline]
3060 pub unsafe fn set_mMulticastLoop_raw(this: *mut Self, val: bool) {
3061 unsafe {
3062 let val: u8 = ::std::mem::transmute(val);
3063 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3064 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3065 4usize,
3066 1u8,
3067 val as u64,
3068 )
3069 }
3070 }
3071 #[inline]
3072 pub fn new_bitfield_1(
3073 mEcn: u8,
3074 mIsHostInterface: bool,
3075 mAllowZeroHopLimit: bool,
3076 mMulticastLoop: bool,
3077 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3078 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3079 __bindgen_bitfield_unit.set(0usize, 2u8, {
3080 let mEcn: u8 = unsafe { ::std::mem::transmute(mEcn) };
3081 mEcn as u64
3082 });
3083 __bindgen_bitfield_unit.set(2usize, 1u8, {
3084 let mIsHostInterface: u8 = unsafe { ::std::mem::transmute(mIsHostInterface) };
3085 mIsHostInterface as u64
3086 });
3087 __bindgen_bitfield_unit.set(3usize, 1u8, {
3088 let mAllowZeroHopLimit: u8 = unsafe { ::std::mem::transmute(mAllowZeroHopLimit) };
3089 mAllowZeroHopLimit as u64
3090 });
3091 __bindgen_bitfield_unit.set(4usize, 1u8, {
3092 let mMulticastLoop: u8 = unsafe { ::std::mem::transmute(mMulticastLoop) };
3093 mMulticastLoop as u64
3094 });
3095 __bindgen_bitfield_unit
3096 }
3097}
3098#[doc = "< IPv6 Hop-by-Hop Option"]
3099pub const OT_IP6_PROTO_HOP_OPTS: _bindgen_ty_9 = 0;
3100#[doc = "< Transmission Control Protocol"]
3101pub const OT_IP6_PROTO_TCP: _bindgen_ty_9 = 6;
3102#[doc = "< User Datagram"]
3103pub const OT_IP6_PROTO_UDP: _bindgen_ty_9 = 17;
3104#[doc = "< IPv6 encapsulation"]
3105pub const OT_IP6_PROTO_IP6: _bindgen_ty_9 = 41;
3106#[doc = "< Routing Header for IPv6"]
3107pub const OT_IP6_PROTO_ROUTING: _bindgen_ty_9 = 43;
3108#[doc = "< Fragment Header for IPv6"]
3109pub const OT_IP6_PROTO_FRAGMENT: _bindgen_ty_9 = 44;
3110#[doc = "< ICMP for IPv6"]
3111pub const OT_IP6_PROTO_ICMP6: _bindgen_ty_9 = 58;
3112#[doc = "< No Next Header for IPv6"]
3113pub const OT_IP6_PROTO_NONE: _bindgen_ty_9 = 59;
3114#[doc = "< Destination Options for IPv6"]
3115pub const OT_IP6_PROTO_DST_OPTS: _bindgen_ty_9 = 60;
3116#[doc = " Internet Protocol Numbers."]
3117pub type _bindgen_ty_9 = ::std::os::raw::c_uint;
3118unsafe extern "C" {
3119 #[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."]
3120 pub fn otIp6Init(
3121 aInstance: *mut otInstance,
3122 aUnicastAddrPool: *mut otNetifAddress,
3123 aUnicastAddrPoolSize: u16,
3124 aMulticastAddrPool: *mut otNetifMulticastAddress,
3125 aMulticastAddrPoolSize: u16,
3126 ) -> otError;
3127}
3128unsafe extern "C" {
3129 #[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`."]
3130 pub fn otIp6SetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3131}
3132unsafe extern "C" {
3133 #[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."]
3134 pub fn otIp6IsEnabled(aInstance: *mut otInstance) -> bool;
3135}
3136unsafe extern "C" {
3137 #[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."]
3138 pub fn otIp6AddUnicastAddress(
3139 aInstance: *mut otInstance,
3140 aAddress: *const otNetifAddress,
3141 ) -> otError;
3142}
3143unsafe extern "C" {
3144 #[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."]
3145 pub fn otIp6RemoveUnicastAddress(
3146 aInstance: *mut otInstance,
3147 aAddress: *const otIp6Address,
3148 ) -> otError;
3149}
3150unsafe extern "C" {
3151 #[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."]
3152 pub fn otIp6GetUnicastAddresses(aInstance: *mut otInstance) -> *const otNetifAddress;
3153}
3154unsafe extern "C" {
3155 #[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."]
3156 pub fn otIp6HasUnicastAddress(
3157 aInstance: *mut otInstance,
3158 aAddress: *const otIp6Address,
3159 ) -> bool;
3160}
3161unsafe extern "C" {
3162 #[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."]
3163 pub fn otIp6SubscribeMulticastAddress(
3164 aInstance: *mut otInstance,
3165 aAddress: *const otIp6Address,
3166 ) -> otError;
3167}
3168unsafe extern "C" {
3169 #[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."]
3170 pub fn otIp6UnsubscribeMulticastAddress(
3171 aInstance: *mut otInstance,
3172 aAddress: *const otIp6Address,
3173 ) -> otError;
3174}
3175unsafe extern "C" {
3176 #[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."]
3177 pub fn otIp6GetMulticastAddresses(aInstance: *mut otInstance)
3178 -> *const otNetifMulticastAddress;
3179}
3180unsafe extern "C" {
3181 #[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"]
3182 pub fn otIp6NewMessage(
3183 aInstance: *mut otInstance,
3184 aSettings: *const otMessageSettings,
3185 ) -> *mut otMessage;
3186}
3187unsafe extern "C" {
3188 #[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"]
3189 pub fn otIp6NewMessageFromBuffer(
3190 aInstance: *mut otInstance,
3191 aData: *const u8,
3192 aDataLength: u16,
3193 aSettings: *const otMessageSettings,
3194 ) -> *mut otMessage;
3195}
3196#[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."]
3197pub type otIp6ReceiveCallback = ::std::option::Option<
3198 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
3199>;
3200unsafe extern "C" {
3201 #[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"]
3202 pub fn otIp6SetReceiveCallback(
3203 aInstance: *mut otInstance,
3204 aCallback: otIp6ReceiveCallback,
3205 aCallbackContext: *mut ::std::os::raw::c_void,
3206 );
3207}
3208#[doc = " Represents IPv6 address information."]
3209#[repr(C)]
3210#[derive(Debug, Copy, Clone)]
3211pub struct otIp6AddressInfo {
3212 #[doc = "< A pointer to the IPv6 address."]
3213 pub mAddress: *const otIp6Address,
3214 #[doc = "< The prefix length of mAddress if it is a unicast address."]
3215 pub mPrefixLength: u8,
3216 pub _bitfield_align_1: [u8; 0],
3217 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3218 pub __bindgen_padding_0: [u16; 3usize],
3219}
3220impl Default for otIp6AddressInfo {
3221 fn default() -> Self {
3222 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3223 unsafe {
3224 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3225 s.assume_init()
3226 }
3227 }
3228}
3229impl otIp6AddressInfo {
3230 #[inline]
3231 pub fn mScope(&self) -> u8 {
3232 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
3233 }
3234 #[inline]
3235 pub fn set_mScope(&mut self, val: u8) {
3236 unsafe {
3237 let val: u8 = ::std::mem::transmute(val);
3238 self._bitfield_1.set(0usize, 4u8, val as u64)
3239 }
3240 }
3241 #[inline]
3242 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
3243 unsafe {
3244 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3245 ::std::ptr::addr_of!((*this)._bitfield_1),
3246 0usize,
3247 4u8,
3248 ) as u8)
3249 }
3250 }
3251 #[inline]
3252 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
3253 unsafe {
3254 let val: u8 = ::std::mem::transmute(val);
3255 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3256 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3257 0usize,
3258 4u8,
3259 val as u64,
3260 )
3261 }
3262 }
3263 #[inline]
3264 pub fn mPreferred(&self) -> bool {
3265 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3266 }
3267 #[inline]
3268 pub fn set_mPreferred(&mut self, val: bool) {
3269 unsafe {
3270 let val: u8 = ::std::mem::transmute(val);
3271 self._bitfield_1.set(4usize, 1u8, val as u64)
3272 }
3273 }
3274 #[inline]
3275 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
3276 unsafe {
3277 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3278 ::std::ptr::addr_of!((*this)._bitfield_1),
3279 4usize,
3280 1u8,
3281 ) as u8)
3282 }
3283 }
3284 #[inline]
3285 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
3286 unsafe {
3287 let val: u8 = ::std::mem::transmute(val);
3288 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3289 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3290 4usize,
3291 1u8,
3292 val as u64,
3293 )
3294 }
3295 }
3296 #[inline]
3297 pub fn mMeshLocal(&self) -> bool {
3298 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
3299 }
3300 #[inline]
3301 pub fn set_mMeshLocal(&mut self, val: bool) {
3302 unsafe {
3303 let val: u8 = ::std::mem::transmute(val);
3304 self._bitfield_1.set(5usize, 1u8, val as u64)
3305 }
3306 }
3307 #[inline]
3308 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
3309 unsafe {
3310 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3311 ::std::ptr::addr_of!((*this)._bitfield_1),
3312 5usize,
3313 1u8,
3314 ) as u8)
3315 }
3316 }
3317 #[inline]
3318 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
3319 unsafe {
3320 let val: u8 = ::std::mem::transmute(val);
3321 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3322 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3323 5usize,
3324 1u8,
3325 val as u64,
3326 )
3327 }
3328 }
3329 #[inline]
3330 pub fn new_bitfield_1(
3331 mScope: u8,
3332 mPreferred: bool,
3333 mMeshLocal: bool,
3334 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3335 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3336 __bindgen_bitfield_unit.set(0usize, 4u8, {
3337 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
3338 mScope as u64
3339 });
3340 __bindgen_bitfield_unit.set(4usize, 1u8, {
3341 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
3342 mPreferred as u64
3343 });
3344 __bindgen_bitfield_unit.set(5usize, 1u8, {
3345 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
3346 mMeshLocal as u64
3347 });
3348 __bindgen_bitfield_unit
3349 }
3350}
3351#[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."]
3352pub type otIp6AddressCallback = ::std::option::Option<
3353 unsafe extern "C" fn(
3354 aAddressInfo: *const otIp6AddressInfo,
3355 aIsAdded: bool,
3356 aContext: *mut ::std::os::raw::c_void,
3357 ),
3358>;
3359unsafe extern "C" {
3360 #[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."]
3361 pub fn otIp6SetAddressCallback(
3362 aInstance: *mut otInstance,
3363 aCallback: otIp6AddressCallback,
3364 aCallbackContext: *mut ::std::os::raw::c_void,
3365 );
3366}
3367unsafe extern "C" {
3368 #[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"]
3369 pub fn otIp6IsReceiveFilterEnabled(aInstance: *mut otInstance) -> bool;
3370}
3371unsafe extern "C" {
3372 #[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"]
3373 pub fn otIp6SetReceiveFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
3374}
3375unsafe extern "C" {
3376 #[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."]
3377 pub fn otIp6Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
3378}
3379unsafe extern "C" {
3380 #[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."]
3381 pub fn otIp6AddUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3382}
3383unsafe extern "C" {
3384 #[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."]
3385 pub fn otIp6RemoveUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3386}
3387unsafe extern "C" {
3388 #[doc = " Removes all ports from the allowed unsecure port list.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3389 pub fn otIp6RemoveAllUnsecurePorts(aInstance: *mut otInstance);
3390}
3391unsafe extern "C" {
3392 #[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."]
3393 pub fn otIp6GetUnsecurePorts(aInstance: *mut otInstance, aNumEntries: *mut u8) -> *const u16;
3394}
3395unsafe extern "C" {
3396 #[doc = " Sets whether to allow link-local unsecure IPv6 datagrams when the Thread role is disabled.\n\n Available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled. This is intended for testing. By default,\n this is disabled (i.e., unsecure traffic is always dropped regardless of the device's role).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aAllow TRUE to allow, FALSE otherwise."]
3397 pub fn otIp6SetAllowUnsecureWhenDisabled(aInstance: *mut otInstance, aAllow: bool);
3398}
3399unsafe extern "C" {
3400 #[doc = " Indicates whether allowing link-local unsecure IPv6 datagrams when the Thread role is disabled is enabled.\n\n Available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE Does allow unsecure IPv6 datagrams when the Thread role is disabled.\n @retval FALSE Does not allow unsecure IPv6 datagrams when the Thread role is disabled."]
3401 pub fn otIp6IsUnsecureAllowedWhenDisabled(aInstance: *mut otInstance) -> bool;
3402}
3403unsafe extern "C" {
3404 #[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."]
3405 pub fn otIp6IsAddressEqual(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> bool;
3406}
3407unsafe extern "C" {
3408 #[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."]
3409 pub fn otIp6IsLinkLocalUnicast(aAddress: *const otIp6Address) -> bool;
3410}
3411unsafe extern "C" {
3412 #[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."]
3413 pub fn otIp6FormLinkLocalAddressFromExtAddress(
3414 aExtAddress: *const otExtAddress,
3415 aAddress: *mut otIp6Address,
3416 );
3417}
3418unsafe extern "C" {
3419 #[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)."]
3420 pub fn otIp6ExtractExtAddressFromIp6AddressIid(
3421 aAddress: *const otIp6Address,
3422 aExtAddress: *mut otExtAddress,
3423 );
3424}
3425unsafe extern "C" {
3426 #[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."]
3427 pub fn otIp6ArePrefixesEqual(aFirst: *const otIp6Prefix, aSecond: *const otIp6Prefix) -> bool;
3428}
3429unsafe extern "C" {
3430 #[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."]
3431 pub fn otIp6AddressFromString(
3432 aString: *const ::std::os::raw::c_char,
3433 aAddress: *mut otIp6Address,
3434 ) -> otError;
3435}
3436unsafe extern "C" {
3437 #[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."]
3438 pub fn otIp6PrefixFromString(
3439 aString: *const ::std::os::raw::c_char,
3440 aPrefix: *mut otIp6Prefix,
3441 ) -> otError;
3442}
3443unsafe extern "C" {
3444 #[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`."]
3445 pub fn otIp6AddressToString(
3446 aAddress: *const otIp6Address,
3447 aBuffer: *mut ::std::os::raw::c_char,
3448 aSize: u16,
3449 );
3450}
3451unsafe extern "C" {
3452 #[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`."]
3453 pub fn otIp6SockAddrToString(
3454 aSockAddr: *const otSockAddr,
3455 aBuffer: *mut ::std::os::raw::c_char,
3456 aSize: u16,
3457 );
3458}
3459unsafe extern "C" {
3460 #[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`."]
3461 pub fn otIp6PrefixToString(
3462 aPrefix: *const otIp6Prefix,
3463 aBuffer: *mut ::std::os::raw::c_char,
3464 aSize: u16,
3465 );
3466}
3467unsafe extern "C" {
3468 #[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."]
3469 pub fn otIp6PrefixMatch(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> u8;
3470}
3471unsafe extern "C" {
3472 #[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."]
3473 pub fn otIp6GetPrefix(aAddress: *const otIp6Address, aLength: u8, aPrefix: *mut otIp6Prefix);
3474}
3475unsafe extern "C" {
3476 #[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."]
3477 pub fn otIp6IsAddressUnspecified(aAddress: *const otIp6Address) -> bool;
3478}
3479unsafe extern "C" {
3480 #[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."]
3481 pub fn otIp6SelectSourceAddress(
3482 aInstance: *mut otInstance,
3483 aMessageInfo: *mut otMessageInfo,
3484 ) -> otError;
3485}
3486unsafe extern "C" {
3487 #[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."]
3488 pub fn otIp6IsSlaacEnabled(aInstance: *mut otInstance) -> bool;
3489}
3490unsafe extern "C" {
3491 #[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."]
3492 pub fn otIp6SetSlaacEnabled(aInstance: *mut otInstance, aEnabled: bool);
3493}
3494#[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."]
3495pub type otIp6SlaacPrefixFilter = ::std::option::Option<
3496 unsafe extern "C" fn(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix) -> bool,
3497>;
3498unsafe extern "C" {
3499 #[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."]
3500 pub fn otIp6SetSlaacPrefixFilter(aInstance: *mut otInstance, aFilter: otIp6SlaacPrefixFilter);
3501}
3502#[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"]
3503pub type otIp6RegisterMulticastListenersCallback = ::std::option::Option<
3504 unsafe extern "C" fn(
3505 aContext: *mut ::std::os::raw::c_void,
3506 aError: otError,
3507 aMlrStatus: u8,
3508 aFailedAddresses: *const otIp6Address,
3509 aFailedAddressNum: u8,
3510 ),
3511>;
3512unsafe extern "C" {
3513 #[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"]
3514 pub fn otIp6RegisterMulticastListeners(
3515 aInstance: *mut otInstance,
3516 aAddresses: *const otIp6Address,
3517 aAddressNum: u8,
3518 aTimeout: *const u32,
3519 aCallback: otIp6RegisterMulticastListenersCallback,
3520 aContext: *mut ::std::os::raw::c_void,
3521 ) -> otError;
3522}
3523unsafe extern "C" {
3524 #[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."]
3525 pub fn otIp6SetMeshLocalIid(
3526 aInstance: *mut otInstance,
3527 aIid: *const otIp6InterfaceIdentifier,
3528 ) -> otError;
3529}
3530unsafe extern "C" {
3531 #[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."]
3532 pub fn otIp6ProtoToString(aIpProto: u8) -> *const ::std::os::raw::c_char;
3533}
3534#[doc = " Represents the counters for packets and bytes."]
3535#[repr(C)]
3536#[derive(Debug, Default, Copy, Clone)]
3537pub struct otPacketsAndBytes {
3538 #[doc = "< The number of packets."]
3539 pub mPackets: u64,
3540 #[doc = "< The number of bytes."]
3541 pub mBytes: u64,
3542}
3543#[doc = " Represents the counters of packets forwarded via Border Routing."]
3544#[repr(C)]
3545#[derive(Debug, Default, Copy, Clone)]
3546pub struct otBorderRoutingCounters {
3547 #[doc = "< The counters for inbound unicast."]
3548 pub mInboundUnicast: otPacketsAndBytes,
3549 #[doc = "< The counters for inbound multicast."]
3550 pub mInboundMulticast: otPacketsAndBytes,
3551 #[doc = "< The counters for outbound unicast."]
3552 pub mOutboundUnicast: otPacketsAndBytes,
3553 #[doc = "< The counters for outbound multicast."]
3554 pub mOutboundMulticast: otPacketsAndBytes,
3555 #[doc = "< The counters for inbound Internet when DHCPv6 PD enabled."]
3556 pub mInboundInternet: otPacketsAndBytes,
3557 #[doc = "< The counters for outbound Internet when DHCPv6 PD enabled."]
3558 pub mOutboundInternet: otPacketsAndBytes,
3559 #[doc = "< The number of received RA packets."]
3560 pub mRaRx: u32,
3561 #[doc = "< The number of RA packets successfully transmitted."]
3562 pub mRaTxSuccess: u32,
3563 #[doc = "< The number of RA packets failed to transmit."]
3564 pub mRaTxFailure: u32,
3565 #[doc = "< The number of received RS packets."]
3566 pub mRsRx: u32,
3567 #[doc = "< The number of RS packets successfully transmitted."]
3568 pub mRsTxSuccess: u32,
3569 #[doc = "< The number of RS packets failed to transmit."]
3570 pub mRsTxFailure: u32,
3571}
3572unsafe extern "C" {
3573 #[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."]
3574 pub fn otIp6GetBorderRoutingCounters(
3575 aInstance: *mut otInstance,
3576 ) -> *const otBorderRoutingCounters;
3577}
3578unsafe extern "C" {
3579 #[doc = " Resets the Border Routing counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3580 pub fn otIp6ResetBorderRoutingCounters(aInstance: *mut otInstance);
3581}
3582#[doc = "< Backbone function is disabled."]
3583pub const OT_BACKBONE_ROUTER_STATE_DISABLED: otBackboneRouterState = 0;
3584#[doc = "< Secondary Backbone Router."]
3585pub const OT_BACKBONE_ROUTER_STATE_SECONDARY: otBackboneRouterState = 1;
3586#[doc = "< The Primary Backbone Router."]
3587pub const OT_BACKBONE_ROUTER_STATE_PRIMARY: otBackboneRouterState = 2;
3588#[doc = " Represents the Backbone Router Status."]
3589pub type otBackboneRouterState = ::std::os::raw::c_uint;
3590unsafe extern "C" {
3591 #[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"]
3592 pub fn otBackboneRouterSetEnabled(aInstance: *mut otInstance, aEnable: bool);
3593}
3594unsafe extern "C" {
3595 #[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"]
3596 pub fn otBackboneRouterGetState(aInstance: *mut otInstance) -> otBackboneRouterState;
3597}
3598unsafe extern "C" {
3599 #[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"]
3600 pub fn otBackboneRouterGetConfig(
3601 aInstance: *mut otInstance,
3602 aConfig: *mut otBackboneRouterConfig,
3603 );
3604}
3605unsafe extern "C" {
3606 #[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"]
3607 pub fn otBackboneRouterSetConfig(
3608 aInstance: *mut otInstance,
3609 aConfig: *const otBackboneRouterConfig,
3610 ) -> otError;
3611}
3612unsafe extern "C" {
3613 #[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"]
3614 pub fn otBackboneRouterRegister(aInstance: *mut otInstance) -> otError;
3615}
3616unsafe extern "C" {
3617 #[doc = " Returns the Backbone Router registration jitter value.\n\n @returns The Backbone Router registration jitter value.\n\n @sa otBackboneRouterSetRegistrationJitter"]
3618 pub fn otBackboneRouterGetRegistrationJitter(aInstance: *mut otInstance) -> u8;
3619}
3620unsafe extern "C" {
3621 #[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"]
3622 pub fn otBackboneRouterSetRegistrationJitter(aInstance: *mut otInstance, aJitter: u8);
3623}
3624unsafe extern "C" {
3625 #[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."]
3626 pub fn otBackboneRouterConfigNextMulticastListenerRegistrationResponse(
3627 aInstance: *mut otInstance,
3628 aStatus: u8,
3629 );
3630}
3631#[doc = "< Multicast Listener was added."]
3632pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ADDED: otBackboneRouterMulticastListenerEvent = 0;
3633#[doc = "< Multicast Listener was removed or expired."]
3634pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_REMOVED: otBackboneRouterMulticastListenerEvent = 1;
3635#[doc = " Represents the Multicast Listener events."]
3636pub type otBackboneRouterMulticastListenerEvent = ::std::os::raw::c_uint;
3637#[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."]
3638pub type otBackboneRouterMulticastListenerCallback = ::std::option::Option<
3639 unsafe extern "C" fn(
3640 aContext: *mut ::std::os::raw::c_void,
3641 aEvent: otBackboneRouterMulticastListenerEvent,
3642 aAddress: *const otIp6Address,
3643 ),
3644>;
3645unsafe extern "C" {
3646 #[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."]
3647 pub fn otBackboneRouterSetMulticastListenerCallback(
3648 aInstance: *mut otInstance,
3649 aCallback: otBackboneRouterMulticastListenerCallback,
3650 aContext: *mut ::std::os::raw::c_void,
3651 );
3652}
3653unsafe extern "C" {
3654 #[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"]
3655 pub fn otBackboneRouterMulticastListenerClear(aInstance: *mut otInstance);
3656}
3657unsafe extern "C" {
3658 #[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"]
3659 pub fn otBackboneRouterMulticastListenerAdd(
3660 aInstance: *mut otInstance,
3661 aAddress: *const otIp6Address,
3662 aTimeout: u32,
3663 ) -> otError;
3664}
3665pub type otBackboneRouterMulticastListenerIterator = u16;
3666#[doc = " Represents a Backbone Router Multicast Listener info."]
3667#[repr(C)]
3668#[derive(Copy, Clone)]
3669pub struct otBackboneRouterMulticastListenerInfo {
3670 pub mAddress: otIp6Address,
3671 pub mTimeout: u32,
3672}
3673impl Default for otBackboneRouterMulticastListenerInfo {
3674 fn default() -> Self {
3675 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3676 unsafe {
3677 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3678 s.assume_init()
3679 }
3680 }
3681}
3682unsafe extern "C" {
3683 #[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"]
3684 pub fn otBackboneRouterMulticastListenerGetNext(
3685 aInstance: *mut otInstance,
3686 aIterator: *mut otBackboneRouterMulticastListenerIterator,
3687 aListenerInfo: *mut otBackboneRouterMulticastListenerInfo,
3688 ) -> otError;
3689}
3690#[doc = "< Ephemeral Key Manager is disabled."]
3691pub const OT_BORDER_AGENT_STATE_DISABLED: otBorderAgentEphemeralKeyState = 0;
3692#[doc = "< Enabled, but no ephemeral key is in use (not set or started)."]
3693pub const OT_BORDER_AGENT_STATE_STOPPED: otBorderAgentEphemeralKeyState = 1;
3694#[doc = "< Ephemeral key is set. Listening to accept secure connections."]
3695pub const OT_BORDER_AGENT_STATE_STARTED: otBorderAgentEphemeralKeyState = 2;
3696#[doc = "< Session is established with an external commissioner candidate."]
3697pub const OT_BORDER_AGENT_STATE_CONNECTED: otBorderAgentEphemeralKeyState = 3;
3698#[doc = "< Session is established and candidate is accepted as full commissioner."]
3699pub const OT_BORDER_AGENT_STATE_ACCEPTED: otBorderAgentEphemeralKeyState = 4;
3700#[doc = " Represents Border Agent's Ephemeral Key Manager state."]
3701pub type otBorderAgentEphemeralKeyState = ::std::os::raw::c_uint;
3702#[doc = " Represents a Thread Administration One-Time Passcode (TAP)."]
3703#[repr(C)]
3704#[derive(Debug, Default, Copy, Clone)]
3705pub struct otBorderAgentEphemeralKeyTap {
3706 #[doc = "< TAP string buffer (including `\\0` character)."]
3707 pub mTap: [::std::os::raw::c_char; 10usize],
3708}
3709unsafe extern "C" {
3710 #[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."]
3711 pub fn otBorderAgentEphemeralKeyGetState(
3712 aInstance: *mut otInstance,
3713 ) -> otBorderAgentEphemeralKeyState;
3714}
3715unsafe extern "C" {
3716 #[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."]
3717 pub fn otBorderAgentEphemeralKeySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
3718}
3719unsafe extern "C" {
3720 #[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)."]
3721 pub fn otBorderAgentEphemeralKeyStart(
3722 aInstance: *mut otInstance,
3723 aKeyString: *const ::std::os::raw::c_char,
3724 aTimeout: u32,
3725 aUdpPort: u16,
3726 ) -> otError;
3727}
3728unsafe extern "C" {
3729 #[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."]
3730 pub fn otBorderAgentEphemeralKeyStop(aInstance: *mut otInstance);
3731}
3732unsafe extern "C" {
3733 #[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)."]
3734 pub fn otBorderAgentEphemeralKeyGetUdpPort(aInstance: *mut otInstance) -> u16;
3735}
3736#[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)."]
3737pub type otBorderAgentEphemeralKeyCallback =
3738 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
3739unsafe extern "C" {
3740 #[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."]
3741 pub fn otBorderAgentEphemeralKeySetCallback(
3742 aInstance: *mut otInstance,
3743 aCallback: otBorderAgentEphemeralKeyCallback,
3744 aContext: *mut ::std::os::raw::c_void,
3745 );
3746}
3747unsafe extern "C" {
3748 #[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."]
3749 pub fn otBorderAgentEphemeralKeyStateToString(
3750 aState: otBorderAgentEphemeralKeyState,
3751 ) -> *const ::std::os::raw::c_char;
3752}
3753unsafe extern "C" {
3754 #[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."]
3755 pub fn otBorderAgentEphemeralKeyGenerateTap(aTap: *mut otBorderAgentEphemeralKeyTap)
3756 -> otError;
3757}
3758unsafe extern "C" {
3759 #[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."]
3760 pub fn otBorderAgentEphemeralKeyValidateTap(
3761 aTap: *const otBorderAgentEphemeralKeyTap,
3762 ) -> otError;
3763}
3764#[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)."]
3765#[repr(C)]
3766#[derive(Debug, Copy, Clone)]
3767pub struct otDnsTxtEntry {
3768 #[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."]
3769 pub mKey: *const ::std::os::raw::c_char,
3770 #[doc = "< The TXT record value or already encoded TXT-DATA (depending on `mKey`)."]
3771 pub mValue: *const u8,
3772 #[doc = "< Number of bytes in `mValue` buffer."]
3773 pub mValueLength: u16,
3774}
3775impl Default for otDnsTxtEntry {
3776 fn default() -> Self {
3777 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3778 unsafe {
3779 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3780 s.assume_init()
3781 }
3782 }
3783}
3784#[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."]
3785#[repr(C)]
3786#[derive(Debug, Copy, Clone)]
3787pub struct otDnsTxtEntryIterator {
3788 pub mPtr: *const ::std::os::raw::c_void,
3789 pub mData: [u16; 2usize],
3790 pub mChar: [::std::os::raw::c_char; 65usize],
3791}
3792impl Default for otDnsTxtEntryIterator {
3793 fn default() -> Self {
3794 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3795 unsafe {
3796 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3797 s.assume_init()
3798 }
3799 }
3800}
3801unsafe extern "C" {
3802 #[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."]
3803 pub fn otDnsInitTxtEntryIterator(
3804 aIterator: *mut otDnsTxtEntryIterator,
3805 aTxtData: *const u8,
3806 aTxtDataLength: u16,
3807 );
3808}
3809unsafe extern "C" {
3810 #[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."]
3811 pub fn otDnsGetNextTxtEntry(
3812 aIterator: *mut otDnsTxtEntryIterator,
3813 aEntry: *mut otDnsTxtEntry,
3814 ) -> otError;
3815}
3816unsafe extern "C" {
3817 #[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."]
3818 pub fn otDnsEncodeTxtData(
3819 aTxtEntries: *const otDnsTxtEntry,
3820 aNumTxtEntries: u16,
3821 aTxtData: *mut u8,
3822 aTxtDataLength: *mut u16,
3823 ) -> otError;
3824}
3825unsafe extern "C" {
3826 #[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."]
3827 pub fn otDnsSetNameCompressionEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3828}
3829unsafe extern "C" {
3830 #[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."]
3831 pub fn otDnsIsNameCompressionEnabled(aInstance: *mut otInstance) -> bool;
3832}
3833#[doc = " Represents a Border Agent Identifier."]
3834#[repr(C)]
3835#[derive(Debug, Default, Copy, Clone)]
3836pub struct otBorderAgentId {
3837 #[doc = "< Border Agent ID bytes."]
3838 pub mId: [u8; 16usize],
3839}
3840#[doc = " Defines Border Agent counters.\n\n The `mEpskc` related counters require `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`."]
3841#[repr(C)]
3842#[derive(Debug, Default, Copy, Clone)]
3843pub struct otBorderAgentCounters {
3844 #[doc = "< The number of ePSKc activations"]
3845 pub mEpskcActivations: u32,
3846 #[doc = "< The number of ePSKc deactivations via API"]
3847 pub mEpskcDeactivationClears: u32,
3848 #[doc = "< The number of ePSKc deactivations due to timeout"]
3849 pub mEpskcDeactivationTimeouts: u32,
3850 #[doc = "< The number of ePSKc deactivations due to reached max attempts"]
3851 pub mEpskcDeactivationMaxAttempts: u32,
3852 #[doc = "< The number of ePSKc deactivations due to commissioner disconnected"]
3853 pub mEpskcDeactivationDisconnects: u32,
3854 #[doc = "< The number of invalid border agent state errors at ePSKc activation"]
3855 pub mEpskcInvalidBaStateErrors: u32,
3856 #[doc = "< The number of invalid args errors at ePSKc activation"]
3857 pub mEpskcInvalidArgsErrors: u32,
3858 #[doc = "< The number of start secure session errors at ePSKc activation"]
3859 pub mEpskcStartSecureSessionErrors: u32,
3860 #[doc = "< The number of established secure sessions with ePSKc"]
3861 pub mEpskcSecureSessionSuccesses: u32,
3862 #[doc = "< The number of failed secure sessions with ePSKc"]
3863 pub mEpskcSecureSessionFailures: u32,
3864 #[doc = "< The number of successful commissioner petitions with ePSKc"]
3865 pub mEpskcCommissionerPetitions: u32,
3866 #[doc = "< The number of established secure sessions with PSKc"]
3867 pub mPskcSecureSessionSuccesses: u32,
3868 #[doc = "< The number of failed secure sessions with PSKc"]
3869 pub mPskcSecureSessionFailures: u32,
3870 #[doc = "< The number of successful commissioner petitions with PSKc"]
3871 pub mPskcCommissionerPetitions: u32,
3872 #[doc = "< The number of MGMT_ACTIVE_GET.req sent over secure sessions"]
3873 pub mMgmtActiveGets: u32,
3874 #[doc = "< The number of MGMT_PENDING_GET.req sent over secure sessions"]
3875 pub mMgmtPendingGets: u32,
3876}
3877#[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."]
3878#[repr(C)]
3879#[derive(Copy, Clone)]
3880pub struct otBorderAgentSessionInfo {
3881 #[doc = "< Socket address (IPv6 address and port number) of session peer."]
3882 pub mPeerSockAddr: otSockAddr,
3883 #[doc = "< Indicates whether the session is connected."]
3884 pub mIsConnected: bool,
3885 #[doc = "< Indicates whether the session is accepted as full commissioner."]
3886 pub mIsCommissioner: bool,
3887 #[doc = "< Milliseconds since the session was first established."]
3888 pub mLifetime: u64,
3889}
3890impl Default for otBorderAgentSessionInfo {
3891 fn default() -> Self {
3892 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3893 unsafe {
3894 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3895 s.assume_init()
3896 }
3897 }
3898}
3899#[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."]
3900#[repr(C)]
3901#[derive(Debug, Copy, Clone)]
3902pub struct otBorderAgentSessionIterator {
3903 pub mPtr: *mut ::std::os::raw::c_void,
3904 pub mData: u64,
3905}
3906impl Default for otBorderAgentSessionIterator {
3907 fn default() -> Self {
3908 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3909 unsafe {
3910 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3911 s.assume_init()
3912 }
3913 }
3914}
3915#[doc = " Represents the Border Agent MeshCoP Service TXT data."]
3916#[repr(C)]
3917#[derive(Debug, Copy, Clone)]
3918pub struct otBorderAgentMeshCoPServiceTxtData {
3919 pub mData: [u8; 256usize],
3920 pub mLength: u16,
3921}
3922impl Default for otBorderAgentMeshCoPServiceTxtData {
3923 fn default() -> Self {
3924 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3925 unsafe {
3926 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3927 s.assume_init()
3928 }
3929 }
3930}
3931unsafe extern "C" {
3932 #[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)."]
3933 pub fn otBorderAgentSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
3934}
3935unsafe extern "C" {
3936 #[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."]
3937 pub fn otBorderAgentIsEnabled(aInstance: *mut otInstance) -> bool;
3938}
3939unsafe extern "C" {
3940 #[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."]
3941 pub fn otBorderAgentIsActive(aInstance: *mut otInstance) -> bool;
3942}
3943unsafe extern "C" {
3944 #[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."]
3945 pub fn otBorderAgentGetUdpPort(aInstance: *mut otInstance) -> u16;
3946}
3947#[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."]
3948pub type otBorderAgentMeshCoPServiceChangedCallback =
3949 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
3950unsafe extern "C" {
3951 #[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."]
3952 pub fn otBorderAgentSetMeshCoPServiceChangedCallback(
3953 aInstance: *mut otInstance,
3954 aCallback: otBorderAgentMeshCoPServiceChangedCallback,
3955 aContext: *mut ::std::os::raw::c_void,
3956 );
3957}
3958unsafe extern "C" {
3959 #[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."]
3960 pub fn otBorderAgentGetMeshCoPServiceTxtData(
3961 aInstance: *mut otInstance,
3962 aTxtData: *mut otBorderAgentMeshCoPServiceTxtData,
3963 ) -> otError;
3964}
3965unsafe extern "C" {
3966 #[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 appends a suffix\n (e.g., \" #XXXX\" where \"XXXX\" represents the last two bytes of the device's Extended Address in hex) to the given\n base name. If a name conflict is detected on the network, an additional index may be appended (e.g., \" #XXXX (1)\").\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."]
3967 pub fn otBorderAgentSetMeshCoPServiceBaseName(
3968 aInstance: *mut otInstance,
3969 aBaseName: *const ::std::os::raw::c_char,
3970 ) -> otError;
3971}
3972unsafe extern "C" {
3973 #[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."]
3974 pub fn otBorderAgentSetVendorTxtData(
3975 aInstance: *mut otInstance,
3976 aVendorData: *const u8,
3977 aVendorDataLength: u16,
3978 );
3979}
3980unsafe extern "C" {
3981 #[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"]
3982 pub fn otBorderAgentGetId(aInstance: *mut otInstance, aId: *mut otBorderAgentId) -> otError;
3983}
3984unsafe extern "C" {
3985 #[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"]
3986 pub fn otBorderAgentSetId(aInstance: *mut otInstance, aId: *const otBorderAgentId) -> otError;
3987}
3988unsafe extern "C" {
3989 #[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."]
3990 pub fn otBorderAgentInitSessionIterator(
3991 aInstance: *mut otInstance,
3992 aIterator: *mut otBorderAgentSessionIterator,
3993 );
3994}
3995unsafe extern "C" {
3996 #[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."]
3997 pub fn otBorderAgentGetNextSessionInfo(
3998 aIterator: *mut otBorderAgentSessionIterator,
3999 aSessionInfo: *mut otBorderAgentSessionInfo,
4000 ) -> otError;
4001}
4002unsafe extern "C" {
4003 #[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."]
4004 pub fn otBorderAgentGetCounters(aInstance: *mut otInstance) -> *const otBorderAgentCounters;
4005}
4006unsafe extern "C" {
4007 #[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."]
4008 pub fn otBorderAgentEvictActiveCommissioner(aInstance: *mut otInstance) -> otError;
4009}
4010pub const OT_JOINER_STATE_IDLE: otJoinerState = 0;
4011pub const OT_JOINER_STATE_DISCOVER: otJoinerState = 1;
4012pub const OT_JOINER_STATE_CONNECT: otJoinerState = 2;
4013pub const OT_JOINER_STATE_CONNECTED: otJoinerState = 3;
4014pub const OT_JOINER_STATE_ENTRUST: otJoinerState = 4;
4015pub const OT_JOINER_STATE_JOINED: otJoinerState = 5;
4016#[doc = " Defines the Joiner State."]
4017pub type otJoinerState = ::std::os::raw::c_uint;
4018#[doc = " Represents a Joiner Discerner."]
4019#[repr(C)]
4020#[derive(Debug, Default, Copy, Clone)]
4021pub struct otJoinerDiscerner {
4022 #[doc = "< Discerner value (the lowest `mLength` bits specify the discerner)."]
4023 pub mValue: u64,
4024 #[doc = "< Length (number of bits) - must be non-zero and at most `OT_JOINER_MAX_DISCERNER_LENGTH`."]
4025 pub mLength: u8,
4026}
4027#[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."]
4028pub type otJoinerCallback = ::std::option::Option<
4029 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
4030>;
4031unsafe extern "C" {
4032 #[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."]
4033 pub fn otJoinerStart(
4034 aInstance: *mut otInstance,
4035 aPskd: *const ::std::os::raw::c_char,
4036 aProvisioningUrl: *const ::std::os::raw::c_char,
4037 aVendorName: *const ::std::os::raw::c_char,
4038 aVendorModel: *const ::std::os::raw::c_char,
4039 aVendorSwVersion: *const ::std::os::raw::c_char,
4040 aVendorData: *const ::std::os::raw::c_char,
4041 aCallback: otJoinerCallback,
4042 aContext: *mut ::std::os::raw::c_void,
4043 ) -> otError;
4044}
4045unsafe extern "C" {
4046 #[doc = " Disables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
4047 pub fn otJoinerStop(aInstance: *mut otInstance);
4048}
4049unsafe extern "C" {
4050 #[doc = " Gets the Joiner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The joiner state."]
4051 pub fn otJoinerGetState(aInstance: *mut otInstance) -> otJoinerState;
4052}
4053unsafe extern "C" {
4054 #[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."]
4055 pub fn otJoinerGetId(aInstance: *mut otInstance) -> *const otExtAddress;
4056}
4057unsafe extern "C" {
4058 #[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."]
4059 pub fn otJoinerSetDiscerner(
4060 aInstance: *mut otInstance,
4061 aDiscerner: *mut otJoinerDiscerner,
4062 ) -> otError;
4063}
4064unsafe extern "C" {
4065 #[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."]
4066 pub fn otJoinerGetDiscerner(aInstance: *mut otInstance) -> *const otJoinerDiscerner;
4067}
4068unsafe extern "C" {
4069 #[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."]
4070 pub fn otJoinerStateToString(aState: otJoinerState) -> *const ::std::os::raw::c_char;
4071}
4072#[doc = " Represents the steering data."]
4073#[repr(C)]
4074#[derive(Debug, Default, Copy, Clone)]
4075pub struct otSteeringData {
4076 #[doc = "< Length of Steering Data (bytes)."]
4077 pub mLength: u8,
4078 #[doc = "< Byte values."]
4079 pub m8: [u8; 16usize],
4080}
4081unsafe extern "C" {
4082 #[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."]
4083 pub fn otSteeringDataInit(aSteeringData: *mut otSteeringData, aLength: u8) -> otError;
4084}
4085unsafe extern "C" {
4086 #[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."]
4087 pub fn otSteeringDataIsValid(aSteeringData: *const otSteeringData) -> bool;
4088}
4089unsafe extern "C" {
4090 #[doc = " Sets the Steering Data to permit all joiners.\n\n @param[out] aSteeringData The Steering Data to update."]
4091 pub fn otSteeringDataSetToPermitAllJoiners(aSteeringData: *mut otSteeringData);
4092}
4093unsafe extern "C" {
4094 #[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)."]
4095 pub fn otSteeringDataUpdateWithJoinerId(
4096 aSteeringData: *mut otSteeringData,
4097 aJoinerId: *const otExtAddress,
4098 ) -> otError;
4099}
4100unsafe extern "C" {
4101 #[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)."]
4102 pub fn otSteeringDataUpdateWithDiscerner(
4103 aSteeringData: *mut otSteeringData,
4104 aDiscerner: *const otJoinerDiscerner,
4105 ) -> otError;
4106}
4107unsafe extern "C" {
4108 #[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."]
4109 pub fn otSteeringDataMerge(
4110 aSteeringData: *mut otSteeringData,
4111 aOtherSteeringData: *const otSteeringData,
4112 ) -> otError;
4113}
4114unsafe extern "C" {
4115 #[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."]
4116 pub fn otSteeringDataPermitsAllJoiners(aSteeringData: *const otSteeringData) -> bool;
4117}
4118unsafe extern "C" {
4119 #[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."]
4120 pub fn otSteeringDataIsEmpty(aSteeringData: *const otSteeringData) -> bool;
4121}
4122unsafe extern "C" {
4123 #[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."]
4124 pub fn otSteeringDataContainsJoinerId(
4125 aSteeringData: *const otSteeringData,
4126 aJoinerId: *const otExtAddress,
4127 ) -> bool;
4128}
4129unsafe extern "C" {
4130 #[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."]
4131 pub fn otSteeringDataContainsDiscerner(
4132 aSteeringData: *const otSteeringData,
4133 aDiscerner: *const otJoinerDiscerner,
4134 ) -> bool;
4135}
4136#[doc = "< Commissioner role is disabled."]
4137pub const OT_COMMISSIONER_STATE_DISABLED: otCommissionerState = 0;
4138#[doc = "< Currently petitioning to become a Commissioner."]
4139pub const OT_COMMISSIONER_STATE_PETITION: otCommissionerState = 1;
4140#[doc = "< Commissioner role is active."]
4141pub const OT_COMMISSIONER_STATE_ACTIVE: otCommissionerState = 2;
4142#[doc = " Defines the Commissioner State."]
4143pub type otCommissionerState = ::std::os::raw::c_uint;
4144pub const OT_COMMISSIONER_JOINER_START: otCommissionerJoinerEvent = 0;
4145pub const OT_COMMISSIONER_JOINER_CONNECTED: otCommissionerJoinerEvent = 1;
4146pub const OT_COMMISSIONER_JOINER_FINALIZE: otCommissionerJoinerEvent = 2;
4147pub const OT_COMMISSIONER_JOINER_END: otCommissionerJoinerEvent = 3;
4148pub const OT_COMMISSIONER_JOINER_REMOVED: otCommissionerJoinerEvent = 4;
4149#[doc = " Defines a Joiner Event on the Commissioner."]
4150pub type otCommissionerJoinerEvent = ::std::os::raw::c_uint;
4151#[doc = " Represents a Commissioning Dataset."]
4152#[repr(C)]
4153#[derive(Debug, Default, Copy, Clone)]
4154pub struct otCommissioningDataset {
4155 #[doc = "< Border Router RLOC16"]
4156 pub mLocator: u16,
4157 #[doc = "< Commissioner Session Id"]
4158 pub mSessionId: u16,
4159 #[doc = "< Steering Data"]
4160 pub mSteeringData: otSteeringData,
4161 #[doc = "< Joiner UDP Port"]
4162 pub mJoinerUdpPort: u16,
4163 pub _bitfield_align_1: [u8; 0],
4164 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4165 pub __bindgen_padding_0: u8,
4166}
4167impl otCommissioningDataset {
4168 #[inline]
4169 pub fn mIsLocatorSet(&self) -> bool {
4170 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4171 }
4172 #[inline]
4173 pub fn set_mIsLocatorSet(&mut self, val: bool) {
4174 unsafe {
4175 let val: u8 = ::std::mem::transmute(val);
4176 self._bitfield_1.set(0usize, 1u8, val as u64)
4177 }
4178 }
4179 #[inline]
4180 pub unsafe fn mIsLocatorSet_raw(this: *const Self) -> bool {
4181 unsafe {
4182 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4183 ::std::ptr::addr_of!((*this)._bitfield_1),
4184 0usize,
4185 1u8,
4186 ) as u8)
4187 }
4188 }
4189 #[inline]
4190 pub unsafe fn set_mIsLocatorSet_raw(this: *mut Self, val: bool) {
4191 unsafe {
4192 let val: u8 = ::std::mem::transmute(val);
4193 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4194 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4195 0usize,
4196 1u8,
4197 val as u64,
4198 )
4199 }
4200 }
4201 #[inline]
4202 pub fn mIsSessionIdSet(&self) -> bool {
4203 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
4204 }
4205 #[inline]
4206 pub fn set_mIsSessionIdSet(&mut self, val: bool) {
4207 unsafe {
4208 let val: u8 = ::std::mem::transmute(val);
4209 self._bitfield_1.set(1usize, 1u8, val as u64)
4210 }
4211 }
4212 #[inline]
4213 pub unsafe fn mIsSessionIdSet_raw(this: *const Self) -> bool {
4214 unsafe {
4215 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4216 ::std::ptr::addr_of!((*this)._bitfield_1),
4217 1usize,
4218 1u8,
4219 ) as u8)
4220 }
4221 }
4222 #[inline]
4223 pub unsafe fn set_mIsSessionIdSet_raw(this: *mut Self, val: bool) {
4224 unsafe {
4225 let val: u8 = ::std::mem::transmute(val);
4226 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4227 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4228 1usize,
4229 1u8,
4230 val as u64,
4231 )
4232 }
4233 }
4234 #[inline]
4235 pub fn mIsSteeringDataSet(&self) -> bool {
4236 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4237 }
4238 #[inline]
4239 pub fn set_mIsSteeringDataSet(&mut self, val: bool) {
4240 unsafe {
4241 let val: u8 = ::std::mem::transmute(val);
4242 self._bitfield_1.set(2usize, 1u8, val as u64)
4243 }
4244 }
4245 #[inline]
4246 pub unsafe fn mIsSteeringDataSet_raw(this: *const Self) -> bool {
4247 unsafe {
4248 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4249 ::std::ptr::addr_of!((*this)._bitfield_1),
4250 2usize,
4251 1u8,
4252 ) as u8)
4253 }
4254 }
4255 #[inline]
4256 pub unsafe fn set_mIsSteeringDataSet_raw(this: *mut Self, val: bool) {
4257 unsafe {
4258 let val: u8 = ::std::mem::transmute(val);
4259 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4260 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4261 2usize,
4262 1u8,
4263 val as u64,
4264 )
4265 }
4266 }
4267 #[inline]
4268 pub fn mIsJoinerUdpPortSet(&self) -> bool {
4269 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4270 }
4271 #[inline]
4272 pub fn set_mIsJoinerUdpPortSet(&mut self, val: bool) {
4273 unsafe {
4274 let val: u8 = ::std::mem::transmute(val);
4275 self._bitfield_1.set(3usize, 1u8, val as u64)
4276 }
4277 }
4278 #[inline]
4279 pub unsafe fn mIsJoinerUdpPortSet_raw(this: *const Self) -> bool {
4280 unsafe {
4281 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4282 ::std::ptr::addr_of!((*this)._bitfield_1),
4283 3usize,
4284 1u8,
4285 ) as u8)
4286 }
4287 }
4288 #[inline]
4289 pub unsafe fn set_mIsJoinerUdpPortSet_raw(this: *mut Self, val: bool) {
4290 unsafe {
4291 let val: u8 = ::std::mem::transmute(val);
4292 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4293 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4294 3usize,
4295 1u8,
4296 val as u64,
4297 )
4298 }
4299 }
4300 #[inline]
4301 pub fn mHasExtraTlv(&self) -> bool {
4302 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4303 }
4304 #[inline]
4305 pub fn set_mHasExtraTlv(&mut self, val: bool) {
4306 unsafe {
4307 let val: u8 = ::std::mem::transmute(val);
4308 self._bitfield_1.set(4usize, 1u8, val as u64)
4309 }
4310 }
4311 #[inline]
4312 pub unsafe fn mHasExtraTlv_raw(this: *const Self) -> bool {
4313 unsafe {
4314 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4315 ::std::ptr::addr_of!((*this)._bitfield_1),
4316 4usize,
4317 1u8,
4318 ) as u8)
4319 }
4320 }
4321 #[inline]
4322 pub unsafe fn set_mHasExtraTlv_raw(this: *mut Self, val: bool) {
4323 unsafe {
4324 let val: u8 = ::std::mem::transmute(val);
4325 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4326 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4327 4usize,
4328 1u8,
4329 val as u64,
4330 )
4331 }
4332 }
4333 #[inline]
4334 pub fn new_bitfield_1(
4335 mIsLocatorSet: bool,
4336 mIsSessionIdSet: bool,
4337 mIsSteeringDataSet: bool,
4338 mIsJoinerUdpPortSet: bool,
4339 mHasExtraTlv: bool,
4340 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4341 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4342 __bindgen_bitfield_unit.set(0usize, 1u8, {
4343 let mIsLocatorSet: u8 = unsafe { ::std::mem::transmute(mIsLocatorSet) };
4344 mIsLocatorSet as u64
4345 });
4346 __bindgen_bitfield_unit.set(1usize, 1u8, {
4347 let mIsSessionIdSet: u8 = unsafe { ::std::mem::transmute(mIsSessionIdSet) };
4348 mIsSessionIdSet as u64
4349 });
4350 __bindgen_bitfield_unit.set(2usize, 1u8, {
4351 let mIsSteeringDataSet: u8 = unsafe { ::std::mem::transmute(mIsSteeringDataSet) };
4352 mIsSteeringDataSet as u64
4353 });
4354 __bindgen_bitfield_unit.set(3usize, 1u8, {
4355 let mIsJoinerUdpPortSet: u8 = unsafe { ::std::mem::transmute(mIsJoinerUdpPortSet) };
4356 mIsJoinerUdpPortSet as u64
4357 });
4358 __bindgen_bitfield_unit.set(4usize, 1u8, {
4359 let mHasExtraTlv: u8 = unsafe { ::std::mem::transmute(mHasExtraTlv) };
4360 mHasExtraTlv as u64
4361 });
4362 __bindgen_bitfield_unit
4363 }
4364}
4365#[doc = " Represents a Joiner PSKd."]
4366#[repr(C)]
4367#[derive(Debug, Copy, Clone)]
4368pub struct otJoinerPskd {
4369 #[doc = "< Char string array (must be null terminated - +1 is for null char)."]
4370 pub m8: [::std::os::raw::c_char; 33usize],
4371}
4372impl Default for otJoinerPskd {
4373 fn default() -> Self {
4374 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4375 unsafe {
4376 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4377 s.assume_init()
4378 }
4379 }
4380}
4381#[doc = "< Accept any Joiner (no EUI64 or Discerner is specified)."]
4382pub const OT_JOINER_INFO_TYPE_ANY: otJoinerInfoType = 0;
4383#[doc = "< Joiner EUI-64 is specified (`mSharedId.mEui64` in `otJoinerInfo`)."]
4384pub const OT_JOINER_INFO_TYPE_EUI64: otJoinerInfoType = 1;
4385#[doc = "< Joiner Discerner is specified (`mSharedId.mDiscerner` in `otJoinerInfo`)."]
4386pub const OT_JOINER_INFO_TYPE_DISCERNER: otJoinerInfoType = 2;
4387#[doc = " Defines a Joiner Info Type."]
4388pub type otJoinerInfoType = ::std::os::raw::c_uint;
4389#[doc = " Represents a Joiner Info."]
4390#[repr(C)]
4391#[derive(Copy, Clone)]
4392pub struct otJoinerInfo {
4393 #[doc = "< Joiner type."]
4394 pub mType: otJoinerInfoType,
4395 #[doc = "< Shared fields"]
4396 pub mSharedId: otJoinerInfo__bindgen_ty_1,
4397 #[doc = "< Joiner PSKd"]
4398 pub mPskd: otJoinerPskd,
4399 #[doc = "< Joiner expiration time in msec"]
4400 pub mExpirationTime: u32,
4401}
4402#[repr(C)]
4403#[derive(Copy, Clone)]
4404pub union otJoinerInfo__bindgen_ty_1 {
4405 #[doc = "< Joiner EUI64 (when `mType` is `OT_JOINER_INFO_TYPE_EUI64`)"]
4406 pub mEui64: otExtAddress,
4407 #[doc = "< Joiner Discerner (when `mType` is `OT_JOINER_INFO_TYPE_DISCERNER`)"]
4408 pub mDiscerner: otJoinerDiscerner,
4409}
4410impl Default for otJoinerInfo__bindgen_ty_1 {
4411 fn default() -> Self {
4412 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4413 unsafe {
4414 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4415 s.assume_init()
4416 }
4417 }
4418}
4419impl Default for otJoinerInfo {
4420 fn default() -> Self {
4421 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4422 unsafe {
4423 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4424 s.assume_init()
4425 }
4426 }
4427}
4428#[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."]
4429pub type otCommissionerStateCallback = ::std::option::Option<
4430 unsafe extern "C" fn(aState: otCommissionerState, aContext: *mut ::std::os::raw::c_void),
4431>;
4432#[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."]
4433pub type otCommissionerJoinerCallback = ::std::option::Option<
4434 unsafe extern "C" fn(
4435 aEvent: otCommissionerJoinerEvent,
4436 aJoinerInfo: *const otJoinerInfo,
4437 aJoinerId: *const otExtAddress,
4438 aContext: *mut ::std::os::raw::c_void,
4439 ),
4440>;
4441unsafe extern "C" {
4442 #[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."]
4443 pub fn otCommissionerStart(
4444 aInstance: *mut otInstance,
4445 aStateCallback: otCommissionerStateCallback,
4446 aJoinerCallback: otCommissionerJoinerCallback,
4447 aCallbackContext: *mut ::std::os::raw::c_void,
4448 ) -> otError;
4449}
4450unsafe extern "C" {
4451 #[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."]
4452 pub fn otCommissionerStop(aInstance: *mut otInstance) -> otError;
4453}
4454unsafe extern "C" {
4455 #[doc = " Returns the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Commissioner Id."]
4456 pub fn otCommissionerGetId(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
4457}
4458unsafe extern "C" {
4459 #[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."]
4460 pub fn otCommissionerSetId(
4461 aInstance: *mut otInstance,
4462 aId: *const ::std::os::raw::c_char,
4463 ) -> otError;
4464}
4465unsafe extern "C" {
4466 #[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()."]
4467 pub fn otCommissionerAddJoiner(
4468 aInstance: *mut otInstance,
4469 aEui64: *const otExtAddress,
4470 aPskd: *const ::std::os::raw::c_char,
4471 aTimeout: u32,
4472 ) -> otError;
4473}
4474unsafe extern "C" {
4475 #[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()."]
4476 pub fn otCommissionerAddJoinerWithDiscerner(
4477 aInstance: *mut otInstance,
4478 aDiscerner: *const otJoinerDiscerner,
4479 aPskd: *const ::std::os::raw::c_char,
4480 aTimeout: u32,
4481 ) -> otError;
4482}
4483unsafe extern "C" {
4484 #[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."]
4485 pub fn otCommissionerGetNextJoinerInfo(
4486 aInstance: *mut otInstance,
4487 aIterator: *mut u16,
4488 aJoiner: *mut otJoinerInfo,
4489 ) -> otError;
4490}
4491unsafe extern "C" {
4492 #[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()."]
4493 pub fn otCommissionerRemoveJoiner(
4494 aInstance: *mut otInstance,
4495 aEui64: *const otExtAddress,
4496 ) -> otError;
4497}
4498unsafe extern "C" {
4499 #[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()."]
4500 pub fn otCommissionerRemoveJoinerWithDiscerner(
4501 aInstance: *mut otInstance,
4502 aDiscerner: *const otJoinerDiscerner,
4503 ) -> otError;
4504}
4505unsafe extern "C" {
4506 #[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."]
4507 pub fn otCommissionerGetProvisioningUrl(
4508 aInstance: *mut otInstance,
4509 ) -> *const ::std::os::raw::c_char;
4510}
4511unsafe extern "C" {
4512 #[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)."]
4513 pub fn otCommissionerSetProvisioningUrl(
4514 aInstance: *mut otInstance,
4515 aProvisioningUrl: *const ::std::os::raw::c_char,
4516 ) -> otError;
4517}
4518unsafe extern "C" {
4519 #[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()."]
4520 pub fn otCommissionerAnnounceBegin(
4521 aInstance: *mut otInstance,
4522 aChannelMask: u32,
4523 aCount: u8,
4524 aPeriod: u16,
4525 aAddress: *const otIp6Address,
4526 ) -> otError;
4527}
4528#[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."]
4529pub type otCommissionerEnergyReportCallback = ::std::option::Option<
4530 unsafe extern "C" fn(
4531 aChannelMask: u32,
4532 aEnergyList: *const u8,
4533 aEnergyListLength: u8,
4534 aContext: *mut ::std::os::raw::c_void,
4535 ),
4536>;
4537unsafe extern "C" {
4538 #[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()."]
4539 pub fn otCommissionerEnergyScan(
4540 aInstance: *mut otInstance,
4541 aChannelMask: u32,
4542 aCount: u8,
4543 aPeriod: u16,
4544 aScanDuration: u16,
4545 aAddress: *const otIp6Address,
4546 aCallback: otCommissionerEnergyReportCallback,
4547 aContext: *mut ::std::os::raw::c_void,
4548 ) -> otError;
4549}
4550#[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."]
4551pub type otCommissionerPanIdConflictCallback = ::std::option::Option<
4552 unsafe extern "C" fn(aPanId: u16, aChannelMask: u32, aContext: *mut ::std::os::raw::c_void),
4553>;
4554unsafe extern "C" {
4555 #[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()."]
4556 pub fn otCommissionerPanIdQuery(
4557 aInstance: *mut otInstance,
4558 aPanId: u16,
4559 aChannelMask: u32,
4560 aAddress: *const otIp6Address,
4561 aCallback: otCommissionerPanIdConflictCallback,
4562 aContext: *mut ::std::os::raw::c_void,
4563 ) -> otError;
4564}
4565unsafe extern "C" {
4566 #[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."]
4567 pub fn otCommissionerSendMgmtGet(
4568 aInstance: *mut otInstance,
4569 aTlvs: *const u8,
4570 aLength: u8,
4571 ) -> otError;
4572}
4573unsafe extern "C" {
4574 #[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."]
4575 pub fn otCommissionerSendMgmtSet(
4576 aInstance: *mut otInstance,
4577 aDataset: *const otCommissioningDataset,
4578 aTlvs: *const u8,
4579 aLength: u8,
4580 ) -> otError;
4581}
4582unsafe extern "C" {
4583 #[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."]
4584 pub fn otCommissionerGetSessionId(aInstance: *mut otInstance) -> u16;
4585}
4586unsafe extern "C" {
4587 #[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."]
4588 pub fn otCommissionerGetState(aInstance: *mut otInstance) -> otCommissionerState;
4589}
4590pub type otNetworkDataIterator = u32;
4591#[doc = " Represents a Border Router configuration."]
4592#[repr(C)]
4593#[repr(align(4))]
4594#[derive(Copy, Clone)]
4595pub struct otBorderRouterConfig {
4596 #[doc = "< The IPv6 prefix."]
4597 pub mPrefix: otIp6Prefix,
4598 pub _bitfield_align_1: [u8; 0],
4599 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
4600 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4601 pub mRloc16: u16,
4602}
4603impl Default for otBorderRouterConfig {
4604 fn default() -> Self {
4605 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4606 unsafe {
4607 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4608 s.assume_init()
4609 }
4610 }
4611}
4612impl otBorderRouterConfig {
4613 #[inline]
4614 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4615 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4616 }
4617 #[inline]
4618 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4619 unsafe {
4620 let val: u32 = ::std::mem::transmute(val);
4621 self._bitfield_1.set(0usize, 2u8, val as u64)
4622 }
4623 }
4624 #[inline]
4625 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4626 unsafe {
4627 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4628 ::std::ptr::addr_of!((*this)._bitfield_1),
4629 0usize,
4630 2u8,
4631 ) as u32)
4632 }
4633 }
4634 #[inline]
4635 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4636 unsafe {
4637 let val: u32 = ::std::mem::transmute(val);
4638 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4639 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4640 0usize,
4641 2u8,
4642 val as u64,
4643 )
4644 }
4645 }
4646 #[inline]
4647 pub fn mPreferred(&self) -> bool {
4648 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4649 }
4650 #[inline]
4651 pub fn set_mPreferred(&mut self, val: bool) {
4652 unsafe {
4653 let val: u8 = ::std::mem::transmute(val);
4654 self._bitfield_1.set(2usize, 1u8, val as u64)
4655 }
4656 }
4657 #[inline]
4658 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
4659 unsafe {
4660 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4661 ::std::ptr::addr_of!((*this)._bitfield_1),
4662 2usize,
4663 1u8,
4664 ) as u8)
4665 }
4666 }
4667 #[inline]
4668 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
4669 unsafe {
4670 let val: u8 = ::std::mem::transmute(val);
4671 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4672 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4673 2usize,
4674 1u8,
4675 val as u64,
4676 )
4677 }
4678 }
4679 #[inline]
4680 pub fn mSlaac(&self) -> bool {
4681 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4682 }
4683 #[inline]
4684 pub fn set_mSlaac(&mut self, val: bool) {
4685 unsafe {
4686 let val: u8 = ::std::mem::transmute(val);
4687 self._bitfield_1.set(3usize, 1u8, val as u64)
4688 }
4689 }
4690 #[inline]
4691 pub unsafe fn mSlaac_raw(this: *const Self) -> bool {
4692 unsafe {
4693 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4694 ::std::ptr::addr_of!((*this)._bitfield_1),
4695 3usize,
4696 1u8,
4697 ) as u8)
4698 }
4699 }
4700 #[inline]
4701 pub unsafe fn set_mSlaac_raw(this: *mut Self, val: bool) {
4702 unsafe {
4703 let val: u8 = ::std::mem::transmute(val);
4704 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4705 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4706 3usize,
4707 1u8,
4708 val as u64,
4709 )
4710 }
4711 }
4712 #[inline]
4713 pub fn mDhcp(&self) -> bool {
4714 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4715 }
4716 #[inline]
4717 pub fn set_mDhcp(&mut self, val: bool) {
4718 unsafe {
4719 let val: u8 = ::std::mem::transmute(val);
4720 self._bitfield_1.set(4usize, 1u8, val as u64)
4721 }
4722 }
4723 #[inline]
4724 pub unsafe fn mDhcp_raw(this: *const Self) -> bool {
4725 unsafe {
4726 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4727 ::std::ptr::addr_of!((*this)._bitfield_1),
4728 4usize,
4729 1u8,
4730 ) as u8)
4731 }
4732 }
4733 #[inline]
4734 pub unsafe fn set_mDhcp_raw(this: *mut Self, val: bool) {
4735 unsafe {
4736 let val: u8 = ::std::mem::transmute(val);
4737 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4738 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4739 4usize,
4740 1u8,
4741 val as u64,
4742 )
4743 }
4744 }
4745 #[inline]
4746 pub fn mConfigure(&self) -> bool {
4747 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4748 }
4749 #[inline]
4750 pub fn set_mConfigure(&mut self, val: bool) {
4751 unsafe {
4752 let val: u8 = ::std::mem::transmute(val);
4753 self._bitfield_1.set(5usize, 1u8, val as u64)
4754 }
4755 }
4756 #[inline]
4757 pub unsafe fn mConfigure_raw(this: *const Self) -> bool {
4758 unsafe {
4759 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4760 ::std::ptr::addr_of!((*this)._bitfield_1),
4761 5usize,
4762 1u8,
4763 ) as u8)
4764 }
4765 }
4766 #[inline]
4767 pub unsafe fn set_mConfigure_raw(this: *mut Self, val: bool) {
4768 unsafe {
4769 let val: u8 = ::std::mem::transmute(val);
4770 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4771 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4772 5usize,
4773 1u8,
4774 val as u64,
4775 )
4776 }
4777 }
4778 #[inline]
4779 pub fn mDefaultRoute(&self) -> bool {
4780 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
4781 }
4782 #[inline]
4783 pub fn set_mDefaultRoute(&mut self, val: bool) {
4784 unsafe {
4785 let val: u8 = ::std::mem::transmute(val);
4786 self._bitfield_1.set(6usize, 1u8, val as u64)
4787 }
4788 }
4789 #[inline]
4790 pub unsafe fn mDefaultRoute_raw(this: *const Self) -> bool {
4791 unsafe {
4792 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4793 ::std::ptr::addr_of!((*this)._bitfield_1),
4794 6usize,
4795 1u8,
4796 ) as u8)
4797 }
4798 }
4799 #[inline]
4800 pub unsafe fn set_mDefaultRoute_raw(this: *mut Self, val: bool) {
4801 unsafe {
4802 let val: u8 = ::std::mem::transmute(val);
4803 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4804 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4805 6usize,
4806 1u8,
4807 val as u64,
4808 )
4809 }
4810 }
4811 #[inline]
4812 pub fn mOnMesh(&self) -> bool {
4813 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
4814 }
4815 #[inline]
4816 pub fn set_mOnMesh(&mut self, val: bool) {
4817 unsafe {
4818 let val: u8 = ::std::mem::transmute(val);
4819 self._bitfield_1.set(7usize, 1u8, val as u64)
4820 }
4821 }
4822 #[inline]
4823 pub unsafe fn mOnMesh_raw(this: *const Self) -> bool {
4824 unsafe {
4825 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4826 ::std::ptr::addr_of!((*this)._bitfield_1),
4827 7usize,
4828 1u8,
4829 ) as u8)
4830 }
4831 }
4832 #[inline]
4833 pub unsafe fn set_mOnMesh_raw(this: *mut Self, val: bool) {
4834 unsafe {
4835 let val: u8 = ::std::mem::transmute(val);
4836 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4837 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4838 7usize,
4839 1u8,
4840 val as u64,
4841 )
4842 }
4843 }
4844 #[inline]
4845 pub fn mStable(&self) -> bool {
4846 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
4847 }
4848 #[inline]
4849 pub fn set_mStable(&mut self, val: bool) {
4850 unsafe {
4851 let val: u8 = ::std::mem::transmute(val);
4852 self._bitfield_1.set(8usize, 1u8, val as u64)
4853 }
4854 }
4855 #[inline]
4856 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4857 unsafe {
4858 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4859 ::std::ptr::addr_of!((*this)._bitfield_1),
4860 8usize,
4861 1u8,
4862 ) as u8)
4863 }
4864 }
4865 #[inline]
4866 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4867 unsafe {
4868 let val: u8 = ::std::mem::transmute(val);
4869 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4870 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4871 8usize,
4872 1u8,
4873 val as u64,
4874 )
4875 }
4876 }
4877 #[inline]
4878 pub fn mNdDns(&self) -> bool {
4879 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
4880 }
4881 #[inline]
4882 pub fn set_mNdDns(&mut self, val: bool) {
4883 unsafe {
4884 let val: u8 = ::std::mem::transmute(val);
4885 self._bitfield_1.set(9usize, 1u8, val as u64)
4886 }
4887 }
4888 #[inline]
4889 pub unsafe fn mNdDns_raw(this: *const Self) -> bool {
4890 unsafe {
4891 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4892 ::std::ptr::addr_of!((*this)._bitfield_1),
4893 9usize,
4894 1u8,
4895 ) as u8)
4896 }
4897 }
4898 #[inline]
4899 pub unsafe fn set_mNdDns_raw(this: *mut Self, val: bool) {
4900 unsafe {
4901 let val: u8 = ::std::mem::transmute(val);
4902 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4903 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4904 9usize,
4905 1u8,
4906 val as u64,
4907 )
4908 }
4909 }
4910 #[inline]
4911 pub fn mDp(&self) -> bool {
4912 unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
4913 }
4914 #[inline]
4915 pub fn set_mDp(&mut self, val: bool) {
4916 unsafe {
4917 let val: u8 = ::std::mem::transmute(val);
4918 self._bitfield_1.set(10usize, 1u8, val as u64)
4919 }
4920 }
4921 #[inline]
4922 pub unsafe fn mDp_raw(this: *const Self) -> bool {
4923 unsafe {
4924 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4925 ::std::ptr::addr_of!((*this)._bitfield_1),
4926 10usize,
4927 1u8,
4928 ) as u8)
4929 }
4930 }
4931 #[inline]
4932 pub unsafe fn set_mDp_raw(this: *mut Self, val: bool) {
4933 unsafe {
4934 let val: u8 = ::std::mem::transmute(val);
4935 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4936 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4937 10usize,
4938 1u8,
4939 val as u64,
4940 )
4941 }
4942 }
4943 #[inline]
4944 pub fn new_bitfield_1(
4945 mPreference: ::std::os::raw::c_int,
4946 mPreferred: bool,
4947 mSlaac: bool,
4948 mDhcp: bool,
4949 mConfigure: bool,
4950 mDefaultRoute: bool,
4951 mOnMesh: bool,
4952 mStable: bool,
4953 mNdDns: bool,
4954 mDp: bool,
4955 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
4956 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
4957 __bindgen_bitfield_unit.set(0usize, 2u8, {
4958 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
4959 mPreference as u64
4960 });
4961 __bindgen_bitfield_unit.set(2usize, 1u8, {
4962 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
4963 mPreferred as u64
4964 });
4965 __bindgen_bitfield_unit.set(3usize, 1u8, {
4966 let mSlaac: u8 = unsafe { ::std::mem::transmute(mSlaac) };
4967 mSlaac as u64
4968 });
4969 __bindgen_bitfield_unit.set(4usize, 1u8, {
4970 let mDhcp: u8 = unsafe { ::std::mem::transmute(mDhcp) };
4971 mDhcp as u64
4972 });
4973 __bindgen_bitfield_unit.set(5usize, 1u8, {
4974 let mConfigure: u8 = unsafe { ::std::mem::transmute(mConfigure) };
4975 mConfigure as u64
4976 });
4977 __bindgen_bitfield_unit.set(6usize, 1u8, {
4978 let mDefaultRoute: u8 = unsafe { ::std::mem::transmute(mDefaultRoute) };
4979 mDefaultRoute as u64
4980 });
4981 __bindgen_bitfield_unit.set(7usize, 1u8, {
4982 let mOnMesh: u8 = unsafe { ::std::mem::transmute(mOnMesh) };
4983 mOnMesh as u64
4984 });
4985 __bindgen_bitfield_unit.set(8usize, 1u8, {
4986 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4987 mStable as u64
4988 });
4989 __bindgen_bitfield_unit.set(9usize, 1u8, {
4990 let mNdDns: u8 = unsafe { ::std::mem::transmute(mNdDns) };
4991 mNdDns as u64
4992 });
4993 __bindgen_bitfield_unit.set(10usize, 1u8, {
4994 let mDp: u8 = unsafe { ::std::mem::transmute(mDp) };
4995 mDp as u64
4996 });
4997 __bindgen_bitfield_unit
4998 }
4999}
5000#[doc = " Represents 6LoWPAN Context ID information associated with a prefix in Network Data."]
5001#[repr(C)]
5002#[derive(Copy, Clone)]
5003pub struct otLowpanContextInfo {
5004 #[doc = "< The 6LoWPAN Context ID."]
5005 pub mContextId: u8,
5006 pub _bitfield_align_1: [u8; 0],
5007 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5008 #[doc = "< The associated IPv6 prefix."]
5009 pub mPrefix: otIp6Prefix,
5010}
5011impl Default for otLowpanContextInfo {
5012 fn default() -> Self {
5013 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5014 unsafe {
5015 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5016 s.assume_init()
5017 }
5018 }
5019}
5020impl otLowpanContextInfo {
5021 #[inline]
5022 pub fn mCompressFlag(&self) -> bool {
5023 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
5024 }
5025 #[inline]
5026 pub fn set_mCompressFlag(&mut self, val: bool) {
5027 unsafe {
5028 let val: u8 = ::std::mem::transmute(val);
5029 self._bitfield_1.set(0usize, 1u8, val as u64)
5030 }
5031 }
5032 #[inline]
5033 pub unsafe fn mCompressFlag_raw(this: *const Self) -> bool {
5034 unsafe {
5035 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5036 ::std::ptr::addr_of!((*this)._bitfield_1),
5037 0usize,
5038 1u8,
5039 ) as u8)
5040 }
5041 }
5042 #[inline]
5043 pub unsafe fn set_mCompressFlag_raw(this: *mut Self, val: bool) {
5044 unsafe {
5045 let val: u8 = ::std::mem::transmute(val);
5046 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5047 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5048 0usize,
5049 1u8,
5050 val as u64,
5051 )
5052 }
5053 }
5054 #[inline]
5055 pub fn mStable(&self) -> bool {
5056 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
5057 }
5058 #[inline]
5059 pub fn set_mStable(&mut self, val: bool) {
5060 unsafe {
5061 let val: u8 = ::std::mem::transmute(val);
5062 self._bitfield_1.set(1usize, 1u8, val as u64)
5063 }
5064 }
5065 #[inline]
5066 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5067 unsafe {
5068 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5069 ::std::ptr::addr_of!((*this)._bitfield_1),
5070 1usize,
5071 1u8,
5072 ) as u8)
5073 }
5074 }
5075 #[inline]
5076 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5077 unsafe {
5078 let val: u8 = ::std::mem::transmute(val);
5079 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5080 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5081 1usize,
5082 1u8,
5083 val as u64,
5084 )
5085 }
5086 }
5087 #[inline]
5088 pub fn new_bitfield_1(
5089 mCompressFlag: bool,
5090 mStable: bool,
5091 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5092 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5093 __bindgen_bitfield_unit.set(0usize, 1u8, {
5094 let mCompressFlag: u8 = unsafe { ::std::mem::transmute(mCompressFlag) };
5095 mCompressFlag as u64
5096 });
5097 __bindgen_bitfield_unit.set(1usize, 1u8, {
5098 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5099 mStable as u64
5100 });
5101 __bindgen_bitfield_unit
5102 }
5103}
5104#[doc = " Represents an External Route configuration."]
5105#[repr(C)]
5106#[repr(align(4))]
5107#[derive(Copy, Clone)]
5108pub struct otExternalRouteConfig {
5109 #[doc = "< The IPv6 prefix."]
5110 pub mPrefix: otIp6Prefix,
5111 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
5112 pub mRloc16: u16,
5113 pub _bitfield_align_1: [u8; 0],
5114 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5115 pub __bindgen_padding_0: [u8; 3usize],
5116}
5117impl Default for otExternalRouteConfig {
5118 fn default() -> Self {
5119 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5120 unsafe {
5121 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5122 s.assume_init()
5123 }
5124 }
5125}
5126impl otExternalRouteConfig {
5127 #[inline]
5128 pub fn mPreference(&self) -> ::std::os::raw::c_int {
5129 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
5130 }
5131 #[inline]
5132 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
5133 unsafe {
5134 let val: u32 = ::std::mem::transmute(val);
5135 self._bitfield_1.set(0usize, 2u8, val as u64)
5136 }
5137 }
5138 #[inline]
5139 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
5140 unsafe {
5141 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5142 ::std::ptr::addr_of!((*this)._bitfield_1),
5143 0usize,
5144 2u8,
5145 ) as u32)
5146 }
5147 }
5148 #[inline]
5149 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
5150 unsafe {
5151 let val: u32 = ::std::mem::transmute(val);
5152 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5153 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5154 0usize,
5155 2u8,
5156 val as u64,
5157 )
5158 }
5159 }
5160 #[inline]
5161 pub fn mNat64(&self) -> bool {
5162 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
5163 }
5164 #[inline]
5165 pub fn set_mNat64(&mut self, val: bool) {
5166 unsafe {
5167 let val: u8 = ::std::mem::transmute(val);
5168 self._bitfield_1.set(2usize, 1u8, val as u64)
5169 }
5170 }
5171 #[inline]
5172 pub unsafe fn mNat64_raw(this: *const Self) -> bool {
5173 unsafe {
5174 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5175 ::std::ptr::addr_of!((*this)._bitfield_1),
5176 2usize,
5177 1u8,
5178 ) as u8)
5179 }
5180 }
5181 #[inline]
5182 pub unsafe fn set_mNat64_raw(this: *mut Self, val: bool) {
5183 unsafe {
5184 let val: u8 = ::std::mem::transmute(val);
5185 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5186 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5187 2usize,
5188 1u8,
5189 val as u64,
5190 )
5191 }
5192 }
5193 #[inline]
5194 pub fn mStable(&self) -> bool {
5195 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
5196 }
5197 #[inline]
5198 pub fn set_mStable(&mut self, val: bool) {
5199 unsafe {
5200 let val: u8 = ::std::mem::transmute(val);
5201 self._bitfield_1.set(3usize, 1u8, val as u64)
5202 }
5203 }
5204 #[inline]
5205 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5206 unsafe {
5207 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5208 ::std::ptr::addr_of!((*this)._bitfield_1),
5209 3usize,
5210 1u8,
5211 ) as u8)
5212 }
5213 }
5214 #[inline]
5215 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5216 unsafe {
5217 let val: u8 = ::std::mem::transmute(val);
5218 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5219 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5220 3usize,
5221 1u8,
5222 val as u64,
5223 )
5224 }
5225 }
5226 #[inline]
5227 pub fn mNextHopIsThisDevice(&self) -> bool {
5228 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
5229 }
5230 #[inline]
5231 pub fn set_mNextHopIsThisDevice(&mut self, val: bool) {
5232 unsafe {
5233 let val: u8 = ::std::mem::transmute(val);
5234 self._bitfield_1.set(4usize, 1u8, val as u64)
5235 }
5236 }
5237 #[inline]
5238 pub unsafe fn mNextHopIsThisDevice_raw(this: *const Self) -> bool {
5239 unsafe {
5240 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5241 ::std::ptr::addr_of!((*this)._bitfield_1),
5242 4usize,
5243 1u8,
5244 ) as u8)
5245 }
5246 }
5247 #[inline]
5248 pub unsafe fn set_mNextHopIsThisDevice_raw(this: *mut Self, val: bool) {
5249 unsafe {
5250 let val: u8 = ::std::mem::transmute(val);
5251 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5252 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5253 4usize,
5254 1u8,
5255 val as u64,
5256 )
5257 }
5258 }
5259 #[inline]
5260 pub fn mAdvPio(&self) -> bool {
5261 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
5262 }
5263 #[inline]
5264 pub fn set_mAdvPio(&mut self, val: bool) {
5265 unsafe {
5266 let val: u8 = ::std::mem::transmute(val);
5267 self._bitfield_1.set(5usize, 1u8, val as u64)
5268 }
5269 }
5270 #[inline]
5271 pub unsafe fn mAdvPio_raw(this: *const Self) -> bool {
5272 unsafe {
5273 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5274 ::std::ptr::addr_of!((*this)._bitfield_1),
5275 5usize,
5276 1u8,
5277 ) as u8)
5278 }
5279 }
5280 #[inline]
5281 pub unsafe fn set_mAdvPio_raw(this: *mut Self, val: bool) {
5282 unsafe {
5283 let val: u8 = ::std::mem::transmute(val);
5284 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5285 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5286 5usize,
5287 1u8,
5288 val as u64,
5289 )
5290 }
5291 }
5292 #[inline]
5293 pub fn new_bitfield_1(
5294 mPreference: ::std::os::raw::c_int,
5295 mNat64: bool,
5296 mStable: bool,
5297 mNextHopIsThisDevice: bool,
5298 mAdvPio: bool,
5299 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5300 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5301 __bindgen_bitfield_unit.set(0usize, 2u8, {
5302 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
5303 mPreference as u64
5304 });
5305 __bindgen_bitfield_unit.set(2usize, 1u8, {
5306 let mNat64: u8 = unsafe { ::std::mem::transmute(mNat64) };
5307 mNat64 as u64
5308 });
5309 __bindgen_bitfield_unit.set(3usize, 1u8, {
5310 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5311 mStable as u64
5312 });
5313 __bindgen_bitfield_unit.set(4usize, 1u8, {
5314 let mNextHopIsThisDevice: u8 = unsafe { ::std::mem::transmute(mNextHopIsThisDevice) };
5315 mNextHopIsThisDevice as u64
5316 });
5317 __bindgen_bitfield_unit.set(5usize, 1u8, {
5318 let mAdvPio: u8 = unsafe { ::std::mem::transmute(mAdvPio) };
5319 mAdvPio as u64
5320 });
5321 __bindgen_bitfield_unit
5322 }
5323}
5324#[doc = "< Low route preference."]
5325pub const OT_ROUTE_PREFERENCE_LOW: otRoutePreference = -1;
5326#[doc = "< Medium route preference."]
5327pub const OT_ROUTE_PREFERENCE_MED: otRoutePreference = 0;
5328#[doc = "< High route preference."]
5329pub const OT_ROUTE_PREFERENCE_HIGH: otRoutePreference = 1;
5330#[doc = " Defines valid values for `mPreference` in `otExternalRouteConfig` and `otBorderRouterConfig`."]
5331pub type otRoutePreference = ::std::os::raw::c_int;
5332#[doc = " Represents a Server configuration."]
5333#[repr(C)]
5334#[derive(Debug, Copy, Clone)]
5335pub struct otServerConfig {
5336 pub _bitfield_align_1: [u8; 0],
5337 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5338 #[doc = "< Length of server data."]
5339 pub mServerDataLength: u8,
5340 #[doc = "< Server data bytes."]
5341 pub mServerData: [u8; 248usize],
5342 #[doc = "< The Server RLOC16."]
5343 pub mRloc16: u16,
5344}
5345impl Default for otServerConfig {
5346 fn default() -> Self {
5347 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5348 unsafe {
5349 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5350 s.assume_init()
5351 }
5352 }
5353}
5354impl otServerConfig {
5355 #[inline]
5356 pub fn mStable(&self) -> bool {
5357 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
5358 }
5359 #[inline]
5360 pub fn set_mStable(&mut self, val: bool) {
5361 unsafe {
5362 let val: u8 = ::std::mem::transmute(val);
5363 self._bitfield_1.set(0usize, 1u8, val as u64)
5364 }
5365 }
5366 #[inline]
5367 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5368 unsafe {
5369 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5370 ::std::ptr::addr_of!((*this)._bitfield_1),
5371 0usize,
5372 1u8,
5373 ) as u8)
5374 }
5375 }
5376 #[inline]
5377 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5378 unsafe {
5379 let val: u8 = ::std::mem::transmute(val);
5380 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5381 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5382 0usize,
5383 1u8,
5384 val as u64,
5385 )
5386 }
5387 }
5388 #[inline]
5389 pub fn new_bitfield_1(mStable: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5390 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5391 __bindgen_bitfield_unit.set(0usize, 1u8, {
5392 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5393 mStable as u64
5394 });
5395 __bindgen_bitfield_unit
5396 }
5397}
5398#[doc = " Represents a Service configuration."]
5399#[repr(C)]
5400#[derive(Debug, Copy, Clone)]
5401pub struct otServiceConfig {
5402 #[doc = "< Service ID (when iterating over the Network Data)."]
5403 pub mServiceId: u8,
5404 #[doc = "< IANA Enterprise Number."]
5405 pub mEnterpriseNumber: u32,
5406 #[doc = "< Length of service data."]
5407 pub mServiceDataLength: u8,
5408 #[doc = "< Service data bytes."]
5409 pub mServiceData: [u8; 252usize],
5410 #[doc = "< The Server configuration."]
5411 pub mServerConfig: otServerConfig,
5412}
5413impl Default for otServiceConfig {
5414 fn default() -> Self {
5415 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5416 unsafe {
5417 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5418 s.assume_init()
5419 }
5420 }
5421}
5422unsafe extern "C" {
5423 #[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."]
5424 pub fn otNetDataGet(
5425 aInstance: *mut otInstance,
5426 aStable: bool,
5427 aData: *mut u8,
5428 aDataLength: *mut u8,
5429 ) -> otError;
5430}
5431unsafe extern "C" {
5432 #[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."]
5433 pub fn otNetDataGetLength(aInstance: *mut otInstance) -> u8;
5434}
5435unsafe extern "C" {
5436 #[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)."]
5437 pub fn otNetDataGetMaxLength(aInstance: *mut otInstance) -> u8;
5438}
5439unsafe extern "C" {
5440 #[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"]
5441 pub fn otNetDataResetMaxLength(aInstance: *mut otInstance);
5442}
5443unsafe extern "C" {
5444 #[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."]
5445 pub fn otNetDataGetNextOnMeshPrefix(
5446 aInstance: *mut otInstance,
5447 aIterator: *mut otNetworkDataIterator,
5448 aConfig: *mut otBorderRouterConfig,
5449 ) -> otError;
5450}
5451unsafe extern "C" {
5452 #[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."]
5453 pub fn otNetDataGetNextRoute(
5454 aInstance: *mut otInstance,
5455 aIterator: *mut otNetworkDataIterator,
5456 aConfig: *mut otExternalRouteConfig,
5457 ) -> otError;
5458}
5459unsafe extern "C" {
5460 #[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."]
5461 pub fn otNetDataGetNextService(
5462 aInstance: *mut otInstance,
5463 aIterator: *mut otNetworkDataIterator,
5464 aConfig: *mut otServiceConfig,
5465 ) -> otError;
5466}
5467unsafe extern "C" {
5468 #[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."]
5469 pub fn otNetDataGetNextLowpanContextInfo(
5470 aInstance: *mut otInstance,
5471 aIterator: *mut otNetworkDataIterator,
5472 aContextInfo: *mut otLowpanContextInfo,
5473 ) -> otError;
5474}
5475unsafe extern "C" {
5476 #[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."]
5477 pub fn otNetDataGetCommissioningDataset(
5478 aInstance: *mut otInstance,
5479 aDataset: *mut otCommissioningDataset,
5480 );
5481}
5482unsafe extern "C" {
5483 #[doc = " Get the Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Network Data Version."]
5484 pub fn otNetDataGetVersion(aInstance: *mut otInstance) -> u8;
5485}
5486unsafe extern "C" {
5487 #[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."]
5488 pub fn otNetDataGetStableVersion(aInstance: *mut otInstance) -> u8;
5489}
5490unsafe extern "C" {
5491 #[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."]
5492 pub fn otNetDataSteeringDataCheckJoiner(
5493 aInstance: *mut otInstance,
5494 aEui64: *const otExtAddress,
5495 ) -> otError;
5496}
5497unsafe extern "C" {
5498 #[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."]
5499 pub fn otNetDataSteeringDataCheckJoinerWithDiscerner(
5500 aInstance: *mut otInstance,
5501 aDiscerner: *const otJoinerDiscerner,
5502 ) -> otError;
5503}
5504unsafe extern "C" {
5505 #[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."]
5506 pub fn otNetDataContainsOmrPrefix(
5507 aInstance: *mut otInstance,
5508 aPrefix: *const otIp6Prefix,
5509 ) -> bool;
5510}
5511unsafe extern "C" {
5512 #[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."]
5513 pub fn otBorderRouterGetNetData(
5514 aInstance: *mut otInstance,
5515 aStable: bool,
5516 aData: *mut u8,
5517 aDataLength: *mut u8,
5518 ) -> otError;
5519}
5520unsafe extern "C" {
5521 #[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"]
5522 pub fn otBorderRouterAddOnMeshPrefix(
5523 aInstance: *mut otInstance,
5524 aConfig: *const otBorderRouterConfig,
5525 ) -> otError;
5526}
5527unsafe extern "C" {
5528 #[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"]
5529 pub fn otBorderRouterRemoveOnMeshPrefix(
5530 aInstance: *mut otInstance,
5531 aPrefix: *const otIp6Prefix,
5532 ) -> otError;
5533}
5534unsafe extern "C" {
5535 #[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."]
5536 pub fn otBorderRouterGetNextOnMeshPrefix(
5537 aInstance: *mut otInstance,
5538 aIterator: *mut otNetworkDataIterator,
5539 aConfig: *mut otBorderRouterConfig,
5540 ) -> otError;
5541}
5542unsafe extern "C" {
5543 #[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"]
5544 pub fn otBorderRouterAddRoute(
5545 aInstance: *mut otInstance,
5546 aConfig: *const otExternalRouteConfig,
5547 ) -> otError;
5548}
5549unsafe extern "C" {
5550 #[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"]
5551 pub fn otBorderRouterRemoveRoute(
5552 aInstance: *mut otInstance,
5553 aPrefix: *const otIp6Prefix,
5554 ) -> otError;
5555}
5556unsafe extern "C" {
5557 #[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."]
5558 pub fn otBorderRouterGetNextRoute(
5559 aInstance: *mut otInstance,
5560 aIterator: *mut otNetworkDataIterator,
5561 aConfig: *mut otExternalRouteConfig,
5562 ) -> otError;
5563}
5564unsafe extern "C" {
5565 #[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"]
5566 pub fn otBorderRouterRegister(aInstance: *mut otInstance) -> otError;
5567}
5568#[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."]
5569pub type otBorderRouterNetDataFullCallback =
5570 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5571unsafe extern "C" {
5572 #[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."]
5573 pub fn otBorderRouterSetNetDataFullCallback(
5574 aInstance: *mut otInstance,
5575 aCallback: otBorderRouterNetDataFullCallback,
5576 aContext: *mut ::std::os::raw::c_void,
5577 );
5578}
5579unsafe extern "C" {
5580 #[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."]
5581 pub fn otChannelManagerRequestChannelChange(aInstance: *mut otInstance, aChannel: u8);
5582}
5583unsafe extern "C" {
5584 #[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."]
5585 pub fn otChannelManagerGetRequestedChannel(aInstance: *mut otInstance) -> u8;
5586}
5587unsafe extern "C" {
5588 #[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."]
5589 pub fn otChannelManagerGetDelay(aInstance: *mut otInstance) -> u16;
5590}
5591unsafe extern "C" {
5592 #[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."]
5593 pub fn otChannelManagerSetDelay(aInstance: *mut otInstance, aDelay: u16) -> otError;
5594}
5595unsafe extern "C" {
5596 #[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."]
5597 pub fn otChannelManagerRequestChannelSelect(
5598 aInstance: *mut otInstance,
5599 aSkipQualityCheck: bool,
5600 ) -> otError;
5601}
5602unsafe extern "C" {
5603 #[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."]
5604 pub fn otChannelManagerRequestCslChannelSelect(
5605 aInstance: *mut otInstance,
5606 aSkipQualityCheck: bool,
5607 ) -> otError;
5608}
5609unsafe extern "C" {
5610 #[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."]
5611 pub fn otChannelManagerSetAutoChannelSelectionEnabled(
5612 aInstance: *mut otInstance,
5613 aEnabled: bool,
5614 );
5615}
5616unsafe extern "C" {
5617 #[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."]
5618 pub fn otChannelManagerGetAutoChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5619}
5620unsafe extern "C" {
5621 #[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."]
5622 pub fn otChannelManagerSetAutoCslChannelSelectionEnabled(
5623 aInstance: *mut otInstance,
5624 aEnabled: bool,
5625 );
5626}
5627unsafe extern "C" {
5628 #[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."]
5629 pub fn otChannelManagerGetAutoCslChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5630}
5631unsafe extern "C" {
5632 #[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)."]
5633 pub fn otChannelManagerSetAutoChannelSelectionInterval(
5634 aInstance: *mut otInstance,
5635 aInterval: u32,
5636 ) -> otError;
5637}
5638unsafe extern "C" {
5639 #[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."]
5640 pub fn otChannelManagerGetAutoChannelSelectionInterval(aInstance: *mut otInstance) -> u32;
5641}
5642unsafe extern "C" {
5643 #[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."]
5644 pub fn otChannelManagerGetSupportedChannels(aInstance: *mut otInstance) -> u32;
5645}
5646unsafe extern "C" {
5647 #[doc = " Sets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5648 pub fn otChannelManagerSetSupportedChannels(aInstance: *mut otInstance, aChannelMask: u32);
5649}
5650unsafe extern "C" {
5651 #[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."]
5652 pub fn otChannelManagerGetFavoredChannels(aInstance: *mut otInstance) -> u32;
5653}
5654unsafe extern "C" {
5655 #[doc = " Sets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5656 pub fn otChannelManagerSetFavoredChannels(aInstance: *mut otInstance, aChannelMask: u32);
5657}
5658unsafe extern "C" {
5659 #[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%."]
5660 pub fn otChannelManagerGetCcaFailureRateThreshold(aInstance: *mut otInstance) -> u16;
5661}
5662unsafe extern "C" {
5663 #[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%."]
5664 pub fn otChannelManagerSetCcaFailureRateThreshold(aInstance: *mut otInstance, aThreshold: u16);
5665}
5666unsafe extern "C" {
5667 #[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."]
5668 pub fn otChannelMonitorSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
5669}
5670unsafe extern "C" {
5671 #[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."]
5672 pub fn otChannelMonitorIsEnabled(aInstance: *mut otInstance) -> bool;
5673}
5674unsafe extern "C" {
5675 #[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."]
5676 pub fn otChannelMonitorGetSampleInterval(aInstance: *mut otInstance) -> u32;
5677}
5678unsafe extern "C" {
5679 #[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."]
5680 pub fn otChannelMonitorGetRssiThreshold(aInstance: *mut otInstance) -> i8;
5681}
5682unsafe extern "C" {
5683 #[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."]
5684 pub fn otChannelMonitorGetSampleWindow(aInstance: *mut otInstance) -> u32;
5685}
5686unsafe extern "C" {
5687 #[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."]
5688 pub fn otChannelMonitorGetSampleCount(aInstance: *mut otInstance) -> u32;
5689}
5690unsafe extern "C" {
5691 #[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."]
5692 pub fn otChannelMonitorGetChannelOccupancy(aInstance: *mut otInstance, aChannel: u8) -> u16;
5693}
5694unsafe extern "C" {
5695 #[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."]
5696 pub fn otChildSupervisionGetInterval(aInstance: *mut otInstance) -> u16;
5697}
5698unsafe extern "C" {
5699 #[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."]
5700 pub fn otChildSupervisionSetInterval(aInstance: *mut otInstance, aInterval: u16);
5701}
5702unsafe extern "C" {
5703 #[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."]
5704 pub fn otChildSupervisionGetCheckTimeout(aInstance: *mut otInstance) -> u16;
5705}
5706unsafe extern "C" {
5707 #[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."]
5708 pub fn otChildSupervisionSetCheckTimeout(aInstance: *mut otInstance, aTimeout: u16);
5709}
5710unsafe extern "C" {
5711 #[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."]
5712 pub fn otChildSupervisionGetCheckFailureCounter(aInstance: *mut otInstance) -> u16;
5713}
5714unsafe extern "C" {
5715 #[doc = " Reset the supervision check timeout failure counter to zero."]
5716 pub fn otChildSupervisionResetCheckFailureCounter(aInstance: *mut otInstance);
5717}
5718pub type va_list = __builtin_va_list;
5719#[doc = " Represents the log level."]
5720pub type otLogLevel = ::std::os::raw::c_int;
5721#[doc = "< OpenThread API"]
5722pub const OT_LOG_REGION_API: otLogRegion = 1;
5723#[doc = "< MLE"]
5724pub const OT_LOG_REGION_MLE: otLogRegion = 2;
5725#[doc = "< EID-to-RLOC mapping."]
5726pub const OT_LOG_REGION_ARP: otLogRegion = 3;
5727#[doc = "< Network Data"]
5728pub const OT_LOG_REGION_NET_DATA: otLogRegion = 4;
5729#[doc = "< ICMPv6"]
5730pub const OT_LOG_REGION_ICMP: otLogRegion = 5;
5731#[doc = "< IPv6"]
5732pub const OT_LOG_REGION_IP6: otLogRegion = 6;
5733#[doc = "< TCP"]
5734pub const OT_LOG_REGION_TCP: otLogRegion = 7;
5735#[doc = "< IEEE 802.15.4 MAC"]
5736pub const OT_LOG_REGION_MAC: otLogRegion = 8;
5737#[doc = "< Memory"]
5738pub const OT_LOG_REGION_MEM: otLogRegion = 9;
5739#[doc = "< NCP"]
5740pub const OT_LOG_REGION_NCP: otLogRegion = 10;
5741#[doc = "< Mesh Commissioning Protocol"]
5742pub const OT_LOG_REGION_MESH_COP: otLogRegion = 11;
5743#[doc = "< Network Diagnostic"]
5744pub const OT_LOG_REGION_NET_DIAG: otLogRegion = 12;
5745#[doc = "< Platform"]
5746pub const OT_LOG_REGION_PLATFORM: otLogRegion = 13;
5747#[doc = "< CoAP"]
5748pub const OT_LOG_REGION_COAP: otLogRegion = 14;
5749#[doc = "< CLI"]
5750pub const OT_LOG_REGION_CLI: otLogRegion = 15;
5751#[doc = "< OpenThread Core"]
5752pub const OT_LOG_REGION_CORE: otLogRegion = 16;
5753#[doc = "< Utility module"]
5754pub const OT_LOG_REGION_UTIL: otLogRegion = 17;
5755#[doc = "< Backbone Router (available since Thread 1.2)"]
5756pub const OT_LOG_REGION_BBR: otLogRegion = 18;
5757#[doc = "< Multicast Listener Registration (available since Thread 1.2)"]
5758pub const OT_LOG_REGION_MLR: otLogRegion = 19;
5759#[doc = "< Domain Unicast Address (available since Thread 1.2)"]
5760pub const OT_LOG_REGION_DUA: otLogRegion = 20;
5761#[doc = "< Border Router"]
5762pub const OT_LOG_REGION_BR: otLogRegion = 21;
5763#[doc = "< Service Registration Protocol (SRP)"]
5764pub const OT_LOG_REGION_SRP: otLogRegion = 22;
5765#[doc = "< DNS"]
5766pub const OT_LOG_REGION_DNS: otLogRegion = 23;
5767#[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`."]
5768pub type otLogRegion = ::std::os::raw::c_uint;
5769unsafe extern "C" {
5770 #[doc = " Outputs logs.\n\n This platform API is used to output logs when the configuration `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE`\n is disabled. When the configuration is enabled, `otPlatLogOutput()` is used instead.\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."]
5771 pub fn otPlatLog(
5772 aLogLevel: otLogLevel,
5773 aLogRegion: otLogRegion,
5774 aFormat: *const ::std::os::raw::c_char,
5775 ...
5776 );
5777}
5778unsafe extern "C" {
5779 #[doc = " Outputs a log line.\n\n This platform API is an alternative to `otPlatLog()` and is used when the configuration\n `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is enabled.\n\n Unlike `otPlatLog()`, this API also provides a pointer to the OpenThread instance (`otInstance*`) from which the\n log is generated. This is particularly helpful in a multi-instance setup to distinguish logs from different\n instances. Additionally, it provides the log line as a fully formatted null-terminated string instead of\n a format string and variable arguments.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aLogLevel The log level.\n @param[in] aLogLine A pointer to the null-terminated string containing the log line."]
5780 pub fn otPlatLogOutput(
5781 aInstance: *mut otInstance,
5782 aLogLevel: otLogLevel,
5783 aLogLine: *const ::std::os::raw::c_char,
5784 );
5785}
5786unsafe extern "C" {
5787 #[doc = " Handles OpenThread log level changes.\n\n This platform function is optional. An empty weak implementation is provided by OpenThread core.\n\n This platform function is called whenever the OpenThread log level changes:\n - In a single-instance configuration, this is called when the log level changes.\n - In a multi-instance configuration, this is called when the global log level changes.\n\n @note Only applicable when `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n @param[in] aLogLevel The new OpenThread log level."]
5788 pub fn otPlatLogHandleLevelChanged(aLogLevel: otLogLevel);
5789}
5790unsafe extern "C" {
5791 #[doc = " Handles OpenThread instance-specific log level changes.\n\n This platform function is optional. An empty weak implementation is provided by OpenThread core.\n\n This platform function is called whenever the instance-specific log level changes:\n - In a single-instance configuration, this is called along with `otPlatLogHandleLevelChanged()`.\n - In a multi-instance configuration, if `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is used, this is called\n when the instance-specific log level changes.\n\n @param[in] aInstance A pointer to the OpenThread instance.\n @param[in] aLogLevel The new OpenThread log level for the instance."]
5792 pub fn otPlatLogHandleLogLevelChanged(aInstance: *mut otInstance, aLogLevel: otLogLevel);
5793}
5794#[repr(C)]
5795#[derive(Debug, Copy, Clone)]
5796pub struct otCliInterpreter {
5797 _unused: [u8; 0],
5798}
5799#[doc = " Pointer is called to notify about CLI interpreter 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."]
5800pub type otCliOutputCallback = ::std::option::Option<
5801 unsafe extern "C" fn(
5802 aContext: *mut ::std::os::raw::c_void,
5803 aFormat: *const ::std::os::raw::c_char,
5804 aArguments: *mut __va_list_tag,
5805 ) -> ::std::os::raw::c_int,
5806>;
5807unsafe extern "C" {
5808 #[doc = " Gets the size of the CLI interpreter object.\n\n @returns The size of the CLI interpreter object in bytes."]
5809 pub fn otCliInterpreterGetSize() -> usize;
5810}
5811unsafe extern "C" {
5812 #[doc = " Initializes a CLI interpreter.\n\n @param[in] aBuffer A pointer to a memory buffer for the CLI interpreter.\n @param[in] aSize The size of the memory buffer.\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.\n\n @returns A pointer to the initialized CLI interpreter, or `NULL` if @p aSize is too small."]
5813 pub fn otCliInterpreterInit(
5814 aBuffer: *mut ::std::os::raw::c_void,
5815 aSize: usize,
5816 aInstance: *mut otInstance,
5817 aCallback: otCliOutputCallback,
5818 aContext: *mut ::std::os::raw::c_void,
5819 ) -> *mut otCliInterpreter;
5820}
5821unsafe extern "C" {
5822 #[doc = " Configures whether or not the CLI interpreter outputs the prompt string.\n\n Requires `OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE`.\n\n It is enabled by default.\n\n @param[in] aInterpreter A pointer to a CLI interpreter.\n @param[in] aEnable TRUE to enable outputting the prompt, FALSE to disable."]
5823 pub fn otCliInterpreterSetPromptConfig(aInterpreter: *mut otCliInterpreter, aEnable: bool);
5824}
5825unsafe extern "C" {
5826 #[doc = " Feeds input to the CLI interpreter.\n\n @param[in] aInterpreter A pointer to a CLI interpreter.\n @param[in] aLine A pointer to a null-terminated string."]
5827 pub fn otCliInterpreterInputLine(
5828 aInterpreter: *mut otCliInterpreter,
5829 aLine: *mut ::std::os::raw::c_char,
5830 );
5831}
5832unsafe extern "C" {
5833 #[doc = " Finalizes the CLI interpreter.\n\n @param[in] aInterpreter A pointer to a CLI interpreter."]
5834 pub fn otCliInterpreterFinalize(aInterpreter: *mut otCliInterpreter);
5835}
5836unsafe extern "C" {
5837 #[doc = " Initialize the static CLI interpreter.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\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."]
5838 pub fn otCliInit(
5839 aInstance: *mut otInstance,
5840 aCallback: otCliOutputCallback,
5841 aContext: *mut ::std::os::raw::c_void,
5842 );
5843}
5844unsafe extern "C" {
5845 #[doc = " Gets the pointer to the static CLI interpreter.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n @returns A pointer to the static CLI interpreter."]
5846 pub fn otCliGetStaticInterpreter() -> *mut otCliInterpreter;
5847}
5848unsafe extern "C" {
5849 #[doc = " Feeds input to the static CLI interpreter.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n @param[in] aLine A pointer to a null-terminated string."]
5850 pub fn otCliInputLine(aLine: *mut ::std::os::raw::c_char);
5851}
5852#[doc = " Represents a user provided CLI command entry."]
5853#[repr(C)]
5854#[derive(Debug, Copy, Clone)]
5855pub struct otCliCommand {
5856 #[doc = "< The command string."]
5857 pub mName: *const ::std::os::raw::c_char,
5858 #[doc = "< Command handler function pointer."]
5859 pub mCommand: ::std::option::Option<
5860 unsafe extern "C" fn(
5861 aContext: *mut ::std::os::raw::c_void,
5862 aArgsLength: u8,
5863 aArgs: *mut *mut ::std::os::raw::c_char,
5864 ) -> otError,
5865 >,
5866}
5867impl Default for otCliCommand {
5868 fn default() -> Self {
5869 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5870 unsafe {
5871 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5872 s.assume_init()
5873 }
5874 }
5875}
5876unsafe extern "C" {
5877 #[doc = " Set a user command table on the static CLI interpreter.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n @param[in] aUserCommands A pointer to an array with user commands.\n @param[in] aLength The @p aUserCommands length.\n @param[in] aContext 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_NO_BUFS Maximum number of command entries have already been set."]
5878 pub fn otCliSetUserCommands(
5879 aUserCommands: *const otCliCommand,
5880 aLength: u8,
5881 aContext: *mut ::std::os::raw::c_void,
5882 ) -> otError;
5883}
5884unsafe extern "C" {
5885 #[doc = " Write a number of bytes to the static CLI interpreter output as a hex string.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n This is intended for use by user-provided CLI command handlers.\n\n @param[in] aBytes A pointer to data which should be printed.\n @param[in] aLength @p aBytes length."]
5886 pub fn otCliOutputBytes(aBytes: *const u8, aLength: u8);
5887}
5888unsafe extern "C" {
5889 #[doc = " Write formatted string to the static CLI interpreter output.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n This is intended for use by user-provided CLI command handlers.\n\n @param[in] aFmt A pointer to the format string.\n @param[in] ... A matching list of arguments."]
5890 pub fn otCliOutputFormat(aFmt: *const ::std::os::raw::c_char, ...);
5891}
5892unsafe extern "C" {
5893 #[doc = " Write a given error code as the result of previous command to the static CLI interpreter output.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`.\n\n This is intended for use by user-provided CLI command handlers.\n\n If the @p aError is `OT_ERROR_PENDING` nothing will be outputted.\n\n @param[in] aError Error code value."]
5894 pub fn otCliAppendResult(aError: otError);
5895}
5896unsafe extern "C" {
5897 #[doc = " Callback to write the OpenThread Log to the static CLI interpreter output.\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."]
5898 pub fn otCliPlatLogv(
5899 aLogLevel: otLogLevel,
5900 aLogRegion: otLogRegion,
5901 aFormat: *const ::std::os::raw::c_char,
5902 aArgs: *mut __va_list_tag,
5903 );
5904}
5905unsafe extern "C" {
5906 #[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.\n\n Requires `OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE`."]
5907 pub fn otCliVendorSetUserCommands();
5908}
5909#[doc = "< Confirmable"]
5910pub const OT_COAP_TYPE_CONFIRMABLE: otCoapType = 0;
5911#[doc = "< Non-confirmable"]
5912pub const OT_COAP_TYPE_NON_CONFIRMABLE: otCoapType = 1;
5913#[doc = "< Acknowledgment"]
5914pub const OT_COAP_TYPE_ACKNOWLEDGMENT: otCoapType = 2;
5915#[doc = "< Reset"]
5916pub const OT_COAP_TYPE_RESET: otCoapType = 3;
5917#[doc = " CoAP Type values (2 bit unsigned integer)."]
5918pub type otCoapType = ::std::os::raw::c_uint;
5919#[doc = "< Empty message code"]
5920pub const OT_COAP_CODE_EMPTY: otCoapCode = 0;
5921#[doc = "< Get"]
5922pub const OT_COAP_CODE_GET: otCoapCode = 1;
5923#[doc = "< Post"]
5924pub const OT_COAP_CODE_POST: otCoapCode = 2;
5925#[doc = "< Put"]
5926pub const OT_COAP_CODE_PUT: otCoapCode = 3;
5927#[doc = "< Delete"]
5928pub const OT_COAP_CODE_DELETE: otCoapCode = 4;
5929#[doc = "< 2.00"]
5930pub const OT_COAP_CODE_RESPONSE_MIN: otCoapCode = 64;
5931#[doc = "< Created"]
5932pub const OT_COAP_CODE_CREATED: otCoapCode = 65;
5933#[doc = "< Deleted"]
5934pub const OT_COAP_CODE_DELETED: otCoapCode = 66;
5935#[doc = "< Valid"]
5936pub const OT_COAP_CODE_VALID: otCoapCode = 67;
5937#[doc = "< Changed"]
5938pub const OT_COAP_CODE_CHANGED: otCoapCode = 68;
5939#[doc = "< Content"]
5940pub const OT_COAP_CODE_CONTENT: otCoapCode = 69;
5941#[doc = "< RFC7959 Continue"]
5942pub const OT_COAP_CODE_CONTINUE: otCoapCode = 95;
5943#[doc = "< Bad Request"]
5944pub const OT_COAP_CODE_BAD_REQUEST: otCoapCode = 128;
5945#[doc = "< Unauthorized"]
5946pub const OT_COAP_CODE_UNAUTHORIZED: otCoapCode = 129;
5947#[doc = "< Bad Option"]
5948pub const OT_COAP_CODE_BAD_OPTION: otCoapCode = 130;
5949#[doc = "< Forbidden"]
5950pub const OT_COAP_CODE_FORBIDDEN: otCoapCode = 131;
5951#[doc = "< Not Found"]
5952pub const OT_COAP_CODE_NOT_FOUND: otCoapCode = 132;
5953#[doc = "< Method Not Allowed"]
5954pub const OT_COAP_CODE_METHOD_NOT_ALLOWED: otCoapCode = 133;
5955#[doc = "< Not Acceptable"]
5956pub const OT_COAP_CODE_NOT_ACCEPTABLE: otCoapCode = 134;
5957#[doc = "< RFC7959 Request Entity Incomplete"]
5958pub const OT_COAP_CODE_REQUEST_INCOMPLETE: otCoapCode = 136;
5959#[doc = "< Precondition Failed"]
5960pub const OT_COAP_CODE_PRECONDITION_FAILED: otCoapCode = 140;
5961#[doc = "< Request Entity Too Large"]
5962pub const OT_COAP_CODE_REQUEST_TOO_LARGE: otCoapCode = 141;
5963#[doc = "< Unsupported Content-Format"]
5964pub const OT_COAP_CODE_UNSUPPORTED_FORMAT: otCoapCode = 143;
5965#[doc = "< Internal Server Error"]
5966pub const OT_COAP_CODE_INTERNAL_ERROR: otCoapCode = 160;
5967#[doc = "< Not Implemented"]
5968pub const OT_COAP_CODE_NOT_IMPLEMENTED: otCoapCode = 161;
5969#[doc = "< Bad Gateway"]
5970pub const OT_COAP_CODE_BAD_GATEWAY: otCoapCode = 162;
5971#[doc = "< Service Unavailable"]
5972pub const OT_COAP_CODE_SERVICE_UNAVAILABLE: otCoapCode = 163;
5973#[doc = "< Gateway Timeout"]
5974pub const OT_COAP_CODE_GATEWAY_TIMEOUT: otCoapCode = 164;
5975#[doc = "< Proxying Not Supported"]
5976pub const OT_COAP_CODE_PROXY_NOT_SUPPORTED: otCoapCode = 165;
5977#[doc = " CoAP Code values."]
5978pub type otCoapCode = ::std::os::raw::c_uint;
5979#[doc = "< If-Match"]
5980pub const OT_COAP_OPTION_IF_MATCH: otCoapOptionType = 1;
5981#[doc = "< Uri-Host"]
5982pub const OT_COAP_OPTION_URI_HOST: otCoapOptionType = 3;
5983#[doc = "< ETag"]
5984pub const OT_COAP_OPTION_E_TAG: otCoapOptionType = 4;
5985#[doc = "< If-None-Match"]
5986pub const OT_COAP_OPTION_IF_NONE_MATCH: otCoapOptionType = 5;
5987#[doc = "< Observe [RFC7641]"]
5988pub const OT_COAP_OPTION_OBSERVE: otCoapOptionType = 6;
5989#[doc = "< Uri-Port"]
5990pub const OT_COAP_OPTION_URI_PORT: otCoapOptionType = 7;
5991#[doc = "< Location-Path"]
5992pub const OT_COAP_OPTION_LOCATION_PATH: otCoapOptionType = 8;
5993#[doc = "< Uri-Path"]
5994pub const OT_COAP_OPTION_URI_PATH: otCoapOptionType = 11;
5995#[doc = "< Content-Format"]
5996pub const OT_COAP_OPTION_CONTENT_FORMAT: otCoapOptionType = 12;
5997#[doc = "< Max-Age"]
5998pub const OT_COAP_OPTION_MAX_AGE: otCoapOptionType = 14;
5999#[doc = "< Uri-Query"]
6000pub const OT_COAP_OPTION_URI_QUERY: otCoapOptionType = 15;
6001#[doc = "< Accept"]
6002pub const OT_COAP_OPTION_ACCEPT: otCoapOptionType = 17;
6003#[doc = "< Location-Query"]
6004pub const OT_COAP_OPTION_LOCATION_QUERY: otCoapOptionType = 20;
6005#[doc = "< Block2 (RFC7959)"]
6006pub const OT_COAP_OPTION_BLOCK2: otCoapOptionType = 23;
6007#[doc = "< Block1 (RFC7959)"]
6008pub const OT_COAP_OPTION_BLOCK1: otCoapOptionType = 27;
6009#[doc = "< Size2 (RFC7959)"]
6010pub const OT_COAP_OPTION_SIZE2: otCoapOptionType = 28;
6011#[doc = "< Proxy-Uri"]
6012pub const OT_COAP_OPTION_PROXY_URI: otCoapOptionType = 35;
6013#[doc = "< Proxy-Scheme"]
6014pub const OT_COAP_OPTION_PROXY_SCHEME: otCoapOptionType = 39;
6015#[doc = "< Size1"]
6016pub const OT_COAP_OPTION_SIZE1: otCoapOptionType = 60;
6017#[doc = " CoAP Option Numbers"]
6018pub type otCoapOptionType = ::std::os::raw::c_uint;
6019#[doc = " Represents a CoAP option."]
6020#[repr(C)]
6021#[derive(Debug, Default, Copy, Clone)]
6022pub struct otCoapOption {
6023 #[doc = "< Option Number"]
6024 pub mNumber: u16,
6025 #[doc = "< Option Length"]
6026 pub mLength: u16,
6027}
6028#[doc = " Acts as an iterator for CoAP options"]
6029#[repr(C)]
6030#[derive(Debug, Copy, Clone)]
6031pub struct otCoapOptionIterator {
6032 #[doc = "< CoAP message"]
6033 pub mMessage: *const otMessage,
6034 #[doc = "< CoAP message option"]
6035 pub mOption: otCoapOption,
6036 #[doc = "< Byte offset of next option"]
6037 pub mNextOptionOffset: u16,
6038}
6039impl Default for otCoapOptionIterator {
6040 fn default() -> Self {
6041 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6042 unsafe {
6043 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6044 s.assume_init()
6045 }
6046 }
6047}
6048#[doc = "< txt/plain; charset=utf-8: [RFC2046][RFC3676][RFC5147]"]
6049pub const OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN: otCoapOptionContentFormat = 0;
6050#[doc = "< application/cose; cose-type=\"cose-encrypt0\": [RFC8152]"]
6051pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0: otCoapOptionContentFormat = 16;
6052#[doc = "< application/cose; cose-type=\"cose-mac0\": [RFC8152]"]
6053pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0: otCoapOptionContentFormat = 17;
6054#[doc = "< application/cose; cose-type=\"cose-sign1\": [RFC8152]"]
6055pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1: otCoapOptionContentFormat = 18;
6056#[doc = "< application/link-format: [RFC6690]"]
6057pub const OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT: otCoapOptionContentFormat = 40;
6058#[doc = "< application/xml: [RFC3023]"]
6059pub const OT_COAP_OPTION_CONTENT_FORMAT_XML: otCoapOptionContentFormat = 41;
6060#[doc = "< application/octet-stream: [RFC2045][RFC2046]"]
6061pub const OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM: otCoapOptionContentFormat = 42;
6062#[doc = "< application/exi: [\"Efficient XML Interchange (EXI)\"]"]
6063pub const OT_COAP_OPTION_CONTENT_FORMAT_EXI: otCoapOptionContentFormat = 47;
6064#[doc = "< application/json: [RFC7159]"]
6065pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON: otCoapOptionContentFormat = 50;
6066#[doc = "< application/json-patch+json: [RFC6902]"]
6067pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON: otCoapOptionContentFormat = 51;
6068#[doc = "< application/merge-patch+json: [RFC7396]"]
6069pub const OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON: otCoapOptionContentFormat = 52;
6070#[doc = "< application/cbor: [RFC7049]"]
6071pub const OT_COAP_OPTION_CONTENT_FORMAT_CBOR: otCoapOptionContentFormat = 60;
6072#[doc = "< application/cwt: [RFC8392]"]
6073pub const OT_COAP_OPTION_CONTENT_FORMAT_CWT: otCoapOptionContentFormat = 61;
6074#[doc = "< application/cose; cose-type=\"cose-encrypt\": [RFC8152]"]
6075pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT: otCoapOptionContentFormat = 96;
6076#[doc = "< application/cose; cose-type=\"cose-mac\": [RFC8152]"]
6077pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC: otCoapOptionContentFormat = 97;
6078#[doc = "< application/cose; cose-type=\"cose-sign\": [RFC8152]"]
6079pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN: otCoapOptionContentFormat = 98;
6080#[doc = "< application/cose-key: [RFC8152]"]
6081pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY: otCoapOptionContentFormat = 101;
6082#[doc = "< application/cose-key-set: [RFC8152]"]
6083pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET: otCoapOptionContentFormat = 102;
6084#[doc = "< application/senml+json: [RFC8428]"]
6085pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON: otCoapOptionContentFormat = 110;
6086#[doc = "< application/sensml+json: [RFC8428]"]
6087pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON: otCoapOptionContentFormat = 111;
6088#[doc = "< application/senml+cbor: [RFC8428]"]
6089pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR: otCoapOptionContentFormat = 112;
6090#[doc = "< application/sensml+cbor: [RFC8428]"]
6091pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR: otCoapOptionContentFormat = 113;
6092#[doc = "< application/senml-exi: [RFC8428]"]
6093pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI: otCoapOptionContentFormat = 114;
6094#[doc = "< application/sensml-exi: [RFC8428]"]
6095pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI: otCoapOptionContentFormat = 115;
6096#[doc = "< application/coap-group+json: [RFC7390]"]
6097pub const OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON: otCoapOptionContentFormat = 256;
6098#[doc = "< application/senml+xml: [RFC8428]"]
6099pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML: otCoapOptionContentFormat = 310;
6100#[doc = "< application/sensml+xml: [RFC8428]"]
6101pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML: otCoapOptionContentFormat = 311;
6102#[doc = " CoAP Content Format codes. The full list is documented at\n https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats"]
6103pub type otCoapOptionContentFormat = ::std::os::raw::c_uint;
6104pub const OT_COAP_OPTION_BLOCK_SZX_16: otCoapBlockSzx = 0;
6105pub const OT_COAP_OPTION_BLOCK_SZX_32: otCoapBlockSzx = 1;
6106pub const OT_COAP_OPTION_BLOCK_SZX_64: otCoapBlockSzx = 2;
6107pub const OT_COAP_OPTION_BLOCK_SZX_128: otCoapBlockSzx = 3;
6108pub const OT_COAP_OPTION_BLOCK_SZX_256: otCoapBlockSzx = 4;
6109pub const OT_COAP_OPTION_BLOCK_SZX_512: otCoapBlockSzx = 5;
6110pub const OT_COAP_OPTION_BLOCK_SZX_1024: otCoapBlockSzx = 6;
6111#[doc = " CoAP Block Size Exponents"]
6112pub type otCoapBlockSzx = ::std::os::raw::c_uint;
6113#[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."]
6114pub type otCoapResponseHandler = ::std::option::Option<
6115 unsafe extern "C" fn(
6116 aContext: *mut ::std::os::raw::c_void,
6117 aMessage: *mut otMessage,
6118 aMessageInfo: *const otMessageInfo,
6119 aResult: otError,
6120 ),
6121>;
6122#[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."]
6123pub type otCoapRequestHandler = ::std::option::Option<
6124 unsafe extern "C" fn(
6125 aContext: *mut ::std::os::raw::c_void,
6126 aMessage: *mut otMessage,
6127 aMessageInfo: *const otMessageInfo,
6128 ),
6129>;
6130#[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."]
6131pub type otCoapResponseFallback = ::std::option::Option<
6132 unsafe extern "C" fn(
6133 aContext: *mut ::std::os::raw::c_void,
6134 aMessage: *mut otMessage,
6135 aMessageInfo: *const otMessageInfo,
6136 ) -> bool,
6137>;
6138#[doc = " Represents a CoAP message token."]
6139#[repr(C)]
6140#[derive(Debug, Default, Copy, Clone)]
6141pub struct otCoapToken {
6142 #[doc = "< The token bytes."]
6143 pub m8: [u8; 8usize],
6144 #[doc = "< The token length in bytes."]
6145 pub mLength: u8,
6146}
6147#[doc = " Represents a CoAP resource."]
6148#[repr(C)]
6149#[derive(Debug, Copy, Clone)]
6150pub struct otCoapResource {
6151 #[doc = "< The URI Path string"]
6152 pub mUriPath: *const ::std::os::raw::c_char,
6153 #[doc = "< The callback for handling a received request"]
6154 pub mHandler: otCoapRequestHandler,
6155 #[doc = "< Application-specific context"]
6156 pub mContext: *mut ::std::os::raw::c_void,
6157 #[doc = "< The next CoAP resource in the list"]
6158 pub mNext: *mut otCoapResource,
6159}
6160impl Default for otCoapResource {
6161 fn default() -> Self {
6162 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6163 unsafe {
6164 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6165 s.assume_init()
6166 }
6167 }
6168}
6169#[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."]
6170#[repr(C)]
6171#[derive(Debug, Default, Copy, Clone)]
6172pub struct otCoapTxParameters {
6173 #[doc = " Minimum spacing before first retransmission when ACK is not received, in milliseconds (RFC7252 default value is\n 2000ms)."]
6174 pub mAckTimeout: u32,
6175 #[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)."]
6176 pub mAckRandomFactorNumerator: u8,
6177 #[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)."]
6178 pub mAckRandomFactorDenominator: u8,
6179 #[doc = " Maximum number of retransmissions for CoAP Confirmable messages (RFC7252 default value is 4)."]
6180 pub mMaxRetransmit: u8,
6181}
6182unsafe extern "C" {
6183 #[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."]
6184 pub fn otCoapMessageInit(
6185 aMessage: *mut otMessage,
6186 aType: otCoapType,
6187 aCode: otCoapCode,
6188 ) -> otError;
6189}
6190unsafe extern "C" {
6191 #[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."]
6192 pub fn otCoapMessageInitResponse(
6193 aResponse: *mut otMessage,
6194 aRequest: *const otMessage,
6195 aType: otCoapType,
6196 aCode: otCoapCode,
6197 ) -> otError;
6198}
6199unsafe extern "C" {
6200 #[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."]
6201 pub fn otCoapMessageWriteToken(aMessage: *mut otMessage, aToken: *const otCoapToken)
6202 -> otError;
6203}
6204unsafe extern "C" {
6205 #[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)."]
6206 pub fn otCoapMessageGenerateToken(aMessage: *mut otMessage, aTokenLength: u8);
6207}
6208unsafe extern "C" {
6209 #[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."]
6210 pub fn otCoapMessageAppendContentFormatOption(
6211 aMessage: *mut otMessage,
6212 aContentFormat: otCoapOptionContentFormat,
6213 ) -> otError;
6214}
6215unsafe extern "C" {
6216 #[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."]
6217 pub fn otCoapMessageAppendOption(
6218 aMessage: *mut otMessage,
6219 aNumber: u16,
6220 aLength: u16,
6221 aValue: *const ::std::os::raw::c_void,
6222 ) -> otError;
6223}
6224unsafe extern "C" {
6225 #[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"]
6226 pub fn otCoapMessageAppendUintOption(
6227 aMessage: *mut otMessage,
6228 aNumber: u16,
6229 aValue: u32,
6230 ) -> otError;
6231}
6232unsafe extern "C" {
6233 #[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."]
6234 pub fn otCoapMessageAppendObserveOption(aMessage: *mut otMessage, aObserve: u32) -> otError;
6235}
6236unsafe extern "C" {
6237 #[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."]
6238 pub fn otCoapMessageAppendUriPathOptions(
6239 aMessage: *mut otMessage,
6240 aUriPath: *const ::std::os::raw::c_char,
6241 ) -> otError;
6242}
6243unsafe extern "C" {
6244 #[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."]
6245 pub fn otCoapMessageAppendUriQueryOptions(
6246 aMessage: *mut otMessage,
6247 aUriQuery: *const ::std::os::raw::c_char,
6248 ) -> otError;
6249}
6250unsafe extern "C" {
6251 #[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."]
6252 pub fn otCoapBlockSizeFromExponent(aSize: otCoapBlockSzx) -> u16;
6253}
6254unsafe extern "C" {
6255 #[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."]
6256 pub fn otCoapMessageAppendBlock2Option(
6257 aMessage: *mut otMessage,
6258 aNum: u32,
6259 aMore: bool,
6260 aSize: otCoapBlockSzx,
6261 ) -> otError;
6262}
6263unsafe extern "C" {
6264 #[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."]
6265 pub fn otCoapMessageAppendBlock1Option(
6266 aMessage: *mut otMessage,
6267 aNum: u32,
6268 aMore: bool,
6269 aSize: otCoapBlockSzx,
6270 ) -> otError;
6271}
6272unsafe extern "C" {
6273 #[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."]
6274 pub fn otCoapMessageAppendProxyUriOption(
6275 aMessage: *mut otMessage,
6276 aUriPath: *const ::std::os::raw::c_char,
6277 ) -> otError;
6278}
6279unsafe extern "C" {
6280 #[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."]
6281 pub fn otCoapMessageAppendMaxAgeOption(aMessage: *mut otMessage, aMaxAge: u32) -> otError;
6282}
6283unsafe extern "C" {
6284 #[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."]
6285 pub fn otCoapMessageAppendUriQueryOption(
6286 aMessage: *mut otMessage,
6287 aUriQuery: *const ::std::os::raw::c_char,
6288 ) -> otError;
6289}
6290unsafe extern "C" {
6291 #[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."]
6292 pub fn otCoapMessageSetPayloadMarker(aMessage: *mut otMessage) -> otError;
6293}
6294unsafe extern "C" {
6295 #[doc = " Returns the Type value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Type value."]
6296 pub fn otCoapMessageGetType(aMessage: *const otMessage) -> otCoapType;
6297}
6298unsafe extern "C" {
6299 #[doc = " Returns the Code value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Code value."]
6300 pub fn otCoapMessageGetCode(aMessage: *const otMessage) -> otCoapCode;
6301}
6302unsafe extern "C" {
6303 #[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."]
6304 pub fn otCoapMessageSetCode(aMessage: *mut otMessage, aCode: otCoapCode);
6305}
6306unsafe extern "C" {
6307 #[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."]
6308 pub fn otCoapMessageCodeToString(aMessage: *const otMessage) -> *const ::std::os::raw::c_char;
6309}
6310unsafe extern "C" {
6311 #[doc = " Returns the Message ID value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Message ID value."]
6312 pub fn otCoapMessageGetMessageId(aMessage: *const otMessage) -> u16;
6313}
6314unsafe extern "C" {
6315 #[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."]
6316 pub fn otCoapMessageReadToken(aMessage: *const otMessage, aToken: *mut otCoapToken) -> otError;
6317}
6318unsafe extern "C" {
6319 #[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."]
6320 pub fn otCoapMessageAreTokensEqual(
6321 aFirstToken: *const otCoapToken,
6322 aSecondToken: *const otCoapToken,
6323 ) -> bool;
6324}
6325unsafe extern "C" {
6326 #[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."]
6327 pub fn otCoapOptionIteratorInit(
6328 aIterator: *mut otCoapOptionIterator,
6329 aMessage: *const otMessage,
6330 ) -> otError;
6331}
6332unsafe extern "C" {
6333 #[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."]
6334 pub fn otCoapOptionIteratorGetFirstOptionMatching(
6335 aIterator: *mut otCoapOptionIterator,
6336 aOption: u16,
6337 ) -> *const otCoapOption;
6338}
6339unsafe extern "C" {
6340 #[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."]
6341 pub fn otCoapOptionIteratorGetFirstOption(
6342 aIterator: *mut otCoapOptionIterator,
6343 ) -> *const otCoapOption;
6344}
6345unsafe extern "C" {
6346 #[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."]
6347 pub fn otCoapOptionIteratorGetNextOptionMatching(
6348 aIterator: *mut otCoapOptionIterator,
6349 aOption: u16,
6350 ) -> *const otCoapOption;
6351}
6352unsafe extern "C" {
6353 #[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."]
6354 pub fn otCoapOptionIteratorGetNextOption(
6355 aIterator: *mut otCoapOptionIterator,
6356 ) -> *const otCoapOption;
6357}
6358unsafe extern "C" {
6359 #[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"]
6360 pub fn otCoapOptionIteratorGetOptionUintValue(
6361 aIterator: *mut otCoapOptionIterator,
6362 aValue: *mut u64,
6363 ) -> otError;
6364}
6365unsafe extern "C" {
6366 #[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."]
6367 pub fn otCoapOptionIteratorGetOptionValue(
6368 aIterator: *mut otCoapOptionIterator,
6369 aValue: *mut ::std::os::raw::c_void,
6370 ) -> otError;
6371}
6372unsafe extern "C" {
6373 #[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."]
6374 pub fn otCoapNewMessage(
6375 aInstance: *mut otInstance,
6376 aSettings: *const otMessageSettings,
6377 ) -> *mut otMessage;
6378}
6379unsafe extern "C" {
6380 #[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."]
6381 pub fn otCoapSendRequestWithParameters(
6382 aInstance: *mut otInstance,
6383 aMessage: *mut otMessage,
6384 aMessageInfo: *const otMessageInfo,
6385 aHandler: otCoapResponseHandler,
6386 aContext: *mut ::std::os::raw::c_void,
6387 aTxParameters: *const otCoapTxParameters,
6388 ) -> otError;
6389}
6390unsafe extern "C" {
6391 #[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."]
6392 pub fn otCoapSendRequest(
6393 aInstance: *mut otInstance,
6394 aMessage: *mut otMessage,
6395 aMessageInfo: *const otMessageInfo,
6396 aHandler: otCoapResponseHandler,
6397 aContext: *mut ::std::os::raw::c_void,
6398 ) -> otError;
6399}
6400unsafe extern "C" {
6401 #[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."]
6402 pub fn otCoapStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6403}
6404unsafe extern "C" {
6405 #[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."]
6406 pub fn otCoapStop(aInstance: *mut otInstance) -> otError;
6407}
6408unsafe extern "C" {
6409 #[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."]
6410 pub fn otCoapAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6411}
6412unsafe extern "C" {
6413 #[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."]
6414 pub fn otCoapRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6415}
6416unsafe extern "C" {
6417 #[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."]
6418 pub fn otCoapSetDefaultHandler(
6419 aInstance: *mut otInstance,
6420 aHandler: otCoapRequestHandler,
6421 aContext: *mut ::std::os::raw::c_void,
6422 );
6423}
6424unsafe extern "C" {
6425 #[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."]
6426 pub fn otCoapSetResponseFallback(
6427 aInstance: *mut otInstance,
6428 aHandler: otCoapResponseFallback,
6429 aContext: *mut ::std::os::raw::c_void,
6430 );
6431}
6432unsafe extern "C" {
6433 #[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."]
6434 pub fn otCoapSendResponseWithParameters(
6435 aInstance: *mut otInstance,
6436 aMessage: *mut otMessage,
6437 aMessageInfo: *const otMessageInfo,
6438 aTxParameters: *const otCoapTxParameters,
6439 ) -> otError;
6440}
6441unsafe extern "C" {
6442 #[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."]
6443 pub fn otCoapSendResponse(
6444 aInstance: *mut otInstance,
6445 aMessage: *mut otMessage,
6446 aMessageInfo: *const otMessageInfo,
6447 ) -> otError;
6448}
6449#[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."]
6450pub type otCoapBlockwiseReceiveHook = ::std::option::Option<
6451 unsafe extern "C" fn(
6452 aContext: *mut ::std::os::raw::c_void,
6453 aBlock: *const u8,
6454 aPosition: u32,
6455 aBlockLength: u16,
6456 aMore: bool,
6457 aTotalLength: u32,
6458 ) -> otError,
6459>;
6460#[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."]
6461pub type otCoapBlockwiseTransmitHook = ::std::option::Option<
6462 unsafe extern "C" fn(
6463 aContext: *mut ::std::os::raw::c_void,
6464 aBlock: *mut u8,
6465 aPosition: u32,
6466 aBlockLength: *mut u16,
6467 aMore: *mut bool,
6468 ) -> otError,
6469>;
6470#[doc = " Represents a CoAP resource with block-wise transfer."]
6471#[repr(C)]
6472#[derive(Debug, Copy, Clone)]
6473pub struct otCoapBlockwiseResource {
6474 #[doc = "< The URI Path string"]
6475 pub mUriPath: *const ::std::os::raw::c_char,
6476 #[doc = "< The callback for handling a received request"]
6477 pub mHandler: otCoapRequestHandler,
6478 #[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."]
6479 pub mReceiveHook: otCoapBlockwiseReceiveHook,
6480 #[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."]
6481 pub mTransmitHook: otCoapBlockwiseTransmitHook,
6482 #[doc = "< Application-specific context"]
6483 pub mContext: *mut ::std::os::raw::c_void,
6484 #[doc = "< The next CoAP resource in the list"]
6485 pub mNext: *mut otCoapBlockwiseResource,
6486}
6487impl Default for otCoapBlockwiseResource {
6488 fn default() -> Self {
6489 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6490 unsafe {
6491 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6492 s.assume_init()
6493 }
6494 }
6495}
6496unsafe extern "C" {
6497 #[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."]
6498 pub fn otCoapAddBlockWiseResource(
6499 aInstance: *mut otInstance,
6500 aResource: *mut otCoapBlockwiseResource,
6501 );
6502}
6503unsafe extern "C" {
6504 #[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."]
6505 pub fn otCoapRemoveBlockWiseResource(
6506 aInstance: *mut otInstance,
6507 aResource: *mut otCoapBlockwiseResource,
6508 );
6509}
6510unsafe extern "C" {
6511 #[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."]
6512 pub fn otCoapSendRequestBlockWiseWithParameters(
6513 aInstance: *mut otInstance,
6514 aMessage: *mut otMessage,
6515 aMessageInfo: *const otMessageInfo,
6516 aHandler: otCoapResponseHandler,
6517 aContext: *mut ::std::os::raw::c_void,
6518 aTxParameters: *const otCoapTxParameters,
6519 aTransmitHook: otCoapBlockwiseTransmitHook,
6520 aReceiveHook: otCoapBlockwiseReceiveHook,
6521 ) -> otError;
6522}
6523unsafe extern "C" {
6524 #[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."]
6525 pub fn otCoapSendRequestBlockWise(
6526 aInstance: *mut otInstance,
6527 aMessage: *mut otMessage,
6528 aMessageInfo: *const otMessageInfo,
6529 aHandler: otCoapResponseHandler,
6530 aContext: *mut ::std::os::raw::c_void,
6531 aTransmitHook: otCoapBlockwiseTransmitHook,
6532 aReceiveHook: otCoapBlockwiseReceiveHook,
6533 ) -> otError;
6534}
6535unsafe extern "C" {
6536 #[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."]
6537 pub fn otCoapSendResponseBlockWiseWithParameters(
6538 aInstance: *mut otInstance,
6539 aMessage: *mut otMessage,
6540 aMessageInfo: *const otMessageInfo,
6541 aTxParameters: *const otCoapTxParameters,
6542 aContext: *mut ::std::os::raw::c_void,
6543 aTransmitHook: otCoapBlockwiseTransmitHook,
6544 ) -> otError;
6545}
6546unsafe extern "C" {
6547 #[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."]
6548 pub fn otCoapSendResponseBlockWise(
6549 aInstance: *mut otInstance,
6550 aMessage: *mut otMessage,
6551 aMessageInfo: *const otMessageInfo,
6552 aContext: *mut ::std::os::raw::c_void,
6553 aTransmitHook: otCoapBlockwiseTransmitHook,
6554 ) -> otError;
6555}
6556unsafe extern "C" {
6557 #[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."]
6558 pub fn otCoapMessageSetToken(
6559 aMessage: *mut otMessage,
6560 aToken: *const u8,
6561 aTokenLength: u8,
6562 ) -> otError;
6563}
6564unsafe extern "C" {
6565 #[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."]
6566 pub fn otCoapMessageGetTokenLength(aMessage: *const otMessage) -> u8;
6567}
6568unsafe extern "C" {
6569 #[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."]
6570 pub fn otCoapMessageGetToken(aMessage: *const otMessage) -> *const u8;
6571}
6572#[doc = "< Connection established"]
6573pub const OT_COAP_SECURE_CONNECTED: otCoapSecureConnectEvent = 0;
6574#[doc = "< Disconnected by peer"]
6575pub const OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED: otCoapSecureConnectEvent = 1;
6576#[doc = "< Disconnected locally"]
6577pub const OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED: otCoapSecureConnectEvent = 2;
6578#[doc = "< Disconnected due to reaching the max connection attempts"]
6579pub const OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS: otCoapSecureConnectEvent = 3;
6580#[doc = "< Disconnected due to an error"]
6581pub const OT_COAP_SECURE_DISCONNECTED_ERROR: otCoapSecureConnectEvent = 4;
6582#[doc = "< Disconnected locally due to session timeout"]
6583pub const OT_COAP_SECURE_DISCONNECTED_TIMEOUT: otCoapSecureConnectEvent = 5;
6584#[doc = " CoAP secure connection event types."]
6585pub type otCoapSecureConnectEvent = ::std::os::raw::c_uint;
6586#[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."]
6587pub type otHandleCoapSecureClientConnect = ::std::option::Option<
6588 unsafe extern "C" fn(aEvent: otCoapSecureConnectEvent, aContext: *mut ::std::os::raw::c_void),
6589>;
6590#[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."]
6591pub type otCoapSecureAutoStopCallback =
6592 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
6593unsafe extern "C" {
6594 #[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."]
6595 pub fn otCoapSecureStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6596}
6597unsafe extern "C" {
6598 #[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."]
6599 pub fn otCoapSecureStartWithMaxConnAttempts(
6600 aInstance: *mut otInstance,
6601 aPort: u16,
6602 aMaxAttempts: u16,
6603 aCallback: otCoapSecureAutoStopCallback,
6604 aContext: *mut ::std::os::raw::c_void,
6605 ) -> otError;
6606}
6607unsafe extern "C" {
6608 #[doc = " Stops the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6609 pub fn otCoapSecureStop(aInstance: *mut otInstance);
6610}
6611unsafe extern "C" {
6612 #[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."]
6613 pub fn otCoapSecureSetPsk(
6614 aInstance: *mut otInstance,
6615 aPsk: *const u8,
6616 aPskLength: u16,
6617 aPskIdentity: *const u8,
6618 aPskIdLength: u16,
6619 );
6620}
6621unsafe extern "C" {
6622 #[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."]
6623 pub fn otCoapSecureGetPeerCertificateBase64(
6624 aInstance: *mut otInstance,
6625 aPeerCert: *mut ::std::os::raw::c_uchar,
6626 aCertLength: *mut usize,
6627 aCertBufferSize: usize,
6628 ) -> otError;
6629}
6630unsafe extern "C" {
6631 #[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."]
6632 pub fn otCoapSecureSetSslAuthMode(aInstance: *mut otInstance, aVerifyPeerCertificate: bool);
6633}
6634unsafe extern "C" {
6635 #[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."]
6636 pub fn otCoapSecureSetCertificate(
6637 aInstance: *mut otInstance,
6638 aX509Cert: *const u8,
6639 aX509Length: u32,
6640 aPrivateKey: *const u8,
6641 aPrivateKeyLength: u32,
6642 );
6643}
6644unsafe extern "C" {
6645 #[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."]
6646 pub fn otCoapSecureSetCaCertificateChain(
6647 aInstance: *mut otInstance,
6648 aX509CaCertificateChain: *const u8,
6649 aX509CaCertChainLength: u32,
6650 );
6651}
6652unsafe extern "C" {
6653 #[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."]
6654 pub fn otCoapSecureConnect(
6655 aInstance: *mut otInstance,
6656 aSockAddr: *const otSockAddr,
6657 aHandler: otHandleCoapSecureClientConnect,
6658 aContext: *mut ::std::os::raw::c_void,
6659 ) -> otError;
6660}
6661unsafe extern "C" {
6662 #[doc = " Stops the DTLS connection.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6663 pub fn otCoapSecureDisconnect(aInstance: *mut otInstance);
6664}
6665unsafe extern "C" {
6666 #[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."]
6667 pub fn otCoapSecureIsConnected(aInstance: *mut otInstance) -> bool;
6668}
6669unsafe extern "C" {
6670 #[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."]
6671 pub fn otCoapSecureIsConnectionActive(aInstance: *mut otInstance) -> bool;
6672}
6673unsafe extern "C" {
6674 #[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."]
6675 pub fn otCoapSecureIsClosed(aInstance: *mut otInstance) -> bool;
6676}
6677unsafe extern "C" {
6678 #[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."]
6679 pub fn otCoapSecureSendRequestBlockWise(
6680 aInstance: *mut otInstance,
6681 aMessage: *mut otMessage,
6682 aHandler: otCoapResponseHandler,
6683 aContext: *mut ::std::os::raw::c_void,
6684 aTransmitHook: otCoapBlockwiseTransmitHook,
6685 aReceiveHook: otCoapBlockwiseReceiveHook,
6686 ) -> otError;
6687}
6688unsafe extern "C" {
6689 #[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."]
6690 pub fn otCoapSecureSendRequest(
6691 aInstance: *mut otInstance,
6692 aMessage: *mut otMessage,
6693 aHandler: otCoapResponseHandler,
6694 aContext: *mut ::std::os::raw::c_void,
6695 ) -> otError;
6696}
6697unsafe extern "C" {
6698 #[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."]
6699 pub fn otCoapSecureAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6700}
6701unsafe extern "C" {
6702 #[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."]
6703 pub fn otCoapSecureRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6704}
6705unsafe extern "C" {
6706 #[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."]
6707 pub fn otCoapSecureAddBlockWiseResource(
6708 aInstance: *mut otInstance,
6709 aResource: *mut otCoapBlockwiseResource,
6710 );
6711}
6712unsafe extern "C" {
6713 #[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."]
6714 pub fn otCoapSecureRemoveBlockWiseResource(
6715 aInstance: *mut otInstance,
6716 aResource: *mut otCoapBlockwiseResource,
6717 );
6718}
6719unsafe extern "C" {
6720 #[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."]
6721 pub fn otCoapSecureSetDefaultHandler(
6722 aInstance: *mut otInstance,
6723 aHandler: otCoapRequestHandler,
6724 aContext: *mut ::std::os::raw::c_void,
6725 );
6726}
6727unsafe extern "C" {
6728 #[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."]
6729 pub fn otCoapSecureSetClientConnectEventCallback(
6730 aInstance: *mut otInstance,
6731 aHandler: otHandleCoapSecureClientConnect,
6732 aContext: *mut ::std::os::raw::c_void,
6733 );
6734}
6735unsafe extern "C" {
6736 #[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."]
6737 pub fn otCoapSecureSendResponseBlockWise(
6738 aInstance: *mut otInstance,
6739 aMessage: *mut otMessage,
6740 aMessageInfo: *const otMessageInfo,
6741 aContext: *mut ::std::os::raw::c_void,
6742 aTransmitHook: otCoapBlockwiseTransmitHook,
6743 ) -> otError;
6744}
6745unsafe extern "C" {
6746 #[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."]
6747 pub fn otCoapSecureSendResponse(
6748 aInstance: *mut otInstance,
6749 aMessage: *mut otMessage,
6750 aMessageInfo: *const otMessageInfo,
6751 ) -> otError;
6752}
6753#[doc = " @struct otNetworkKey\n\n Represents a Thread Network Key."]
6754#[repr(C, packed)]
6755#[derive(Debug, Default, Copy, Clone)]
6756pub struct otNetworkKey {
6757 #[doc = "< Byte values"]
6758 pub m8: [u8; 16usize],
6759}
6760#[doc = " This datatype represents KeyRef to NetworkKey."]
6761pub type otNetworkKeyRef = otCryptoKeyRef;
6762#[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`)."]
6763#[repr(C)]
6764#[derive(Debug, Default, Copy, Clone)]
6765pub struct otNetworkName {
6766 #[doc = "< Byte values. The `+ 1` is for null char."]
6767 pub m8: [::std::os::raw::c_char; 17usize],
6768}
6769#[doc = " Represents an Extended PAN ID."]
6770#[repr(C, packed)]
6771#[derive(Debug, Default, Copy, Clone)]
6772pub struct otExtendedPanId {
6773 #[doc = "< Byte values"]
6774 pub m8: [u8; 8usize],
6775}
6776#[doc = " Represents a Mesh Local Prefix."]
6777pub type otMeshLocalPrefix = otIp6NetworkPrefix;
6778#[doc = " Represents PSKc."]
6779#[repr(C, packed)]
6780#[derive(Debug, Default, Copy, Clone)]
6781pub struct otPskc {
6782 #[doc = "< Byte values"]
6783 pub m8: [u8; 16usize],
6784}
6785#[doc = " This datatype represents KeyRef to PSKc."]
6786pub type otPskcRef = otCryptoKeyRef;
6787#[doc = " Represent Security Policy."]
6788#[repr(C)]
6789#[derive(Debug, Default, Copy, Clone)]
6790pub struct otSecurityPolicy {
6791 #[doc = "< The value for thrKeyRotation in units of hours."]
6792 pub mRotationTime: u16,
6793 pub _bitfield_align_1: [u8; 0],
6794 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
6795}
6796impl otSecurityPolicy {
6797 #[inline]
6798 pub fn mObtainNetworkKeyEnabled(&self) -> bool {
6799 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
6800 }
6801 #[inline]
6802 pub fn set_mObtainNetworkKeyEnabled(&mut self, val: bool) {
6803 unsafe {
6804 let val: u8 = ::std::mem::transmute(val);
6805 self._bitfield_1.set(0usize, 1u8, val as u64)
6806 }
6807 }
6808 #[inline]
6809 pub unsafe fn mObtainNetworkKeyEnabled_raw(this: *const Self) -> bool {
6810 unsafe {
6811 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6812 ::std::ptr::addr_of!((*this)._bitfield_1),
6813 0usize,
6814 1u8,
6815 ) as u8)
6816 }
6817 }
6818 #[inline]
6819 pub unsafe fn set_mObtainNetworkKeyEnabled_raw(this: *mut Self, val: bool) {
6820 unsafe {
6821 let val: u8 = ::std::mem::transmute(val);
6822 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6823 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6824 0usize,
6825 1u8,
6826 val as u64,
6827 )
6828 }
6829 }
6830 #[inline]
6831 pub fn mNativeCommissioningEnabled(&self) -> bool {
6832 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
6833 }
6834 #[inline]
6835 pub fn set_mNativeCommissioningEnabled(&mut self, val: bool) {
6836 unsafe {
6837 let val: u8 = ::std::mem::transmute(val);
6838 self._bitfield_1.set(1usize, 1u8, val as u64)
6839 }
6840 }
6841 #[inline]
6842 pub unsafe fn mNativeCommissioningEnabled_raw(this: *const Self) -> bool {
6843 unsafe {
6844 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6845 ::std::ptr::addr_of!((*this)._bitfield_1),
6846 1usize,
6847 1u8,
6848 ) as u8)
6849 }
6850 }
6851 #[inline]
6852 pub unsafe fn set_mNativeCommissioningEnabled_raw(this: *mut Self, val: bool) {
6853 unsafe {
6854 let val: u8 = ::std::mem::transmute(val);
6855 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6856 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6857 1usize,
6858 1u8,
6859 val as u64,
6860 )
6861 }
6862 }
6863 #[inline]
6864 pub fn mRoutersEnabled(&self) -> bool {
6865 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
6866 }
6867 #[inline]
6868 pub fn set_mRoutersEnabled(&mut self, val: bool) {
6869 unsafe {
6870 let val: u8 = ::std::mem::transmute(val);
6871 self._bitfield_1.set(2usize, 1u8, val as u64)
6872 }
6873 }
6874 #[inline]
6875 pub unsafe fn mRoutersEnabled_raw(this: *const Self) -> bool {
6876 unsafe {
6877 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6878 ::std::ptr::addr_of!((*this)._bitfield_1),
6879 2usize,
6880 1u8,
6881 ) as u8)
6882 }
6883 }
6884 #[inline]
6885 pub unsafe fn set_mRoutersEnabled_raw(this: *mut Self, val: bool) {
6886 unsafe {
6887 let val: u8 = ::std::mem::transmute(val);
6888 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6889 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6890 2usize,
6891 1u8,
6892 val as u64,
6893 )
6894 }
6895 }
6896 #[inline]
6897 pub fn mExternalCommissioningEnabled(&self) -> bool {
6898 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
6899 }
6900 #[inline]
6901 pub fn set_mExternalCommissioningEnabled(&mut self, val: bool) {
6902 unsafe {
6903 let val: u8 = ::std::mem::transmute(val);
6904 self._bitfield_1.set(3usize, 1u8, val as u64)
6905 }
6906 }
6907 #[inline]
6908 pub unsafe fn mExternalCommissioningEnabled_raw(this: *const Self) -> bool {
6909 unsafe {
6910 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6911 ::std::ptr::addr_of!((*this)._bitfield_1),
6912 3usize,
6913 1u8,
6914 ) as u8)
6915 }
6916 }
6917 #[inline]
6918 pub unsafe fn set_mExternalCommissioningEnabled_raw(this: *mut Self, val: bool) {
6919 unsafe {
6920 let val: u8 = ::std::mem::transmute(val);
6921 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6922 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6923 3usize,
6924 1u8,
6925 val as u64,
6926 )
6927 }
6928 }
6929 #[inline]
6930 pub fn mCommercialCommissioningEnabled(&self) -> bool {
6931 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
6932 }
6933 #[inline]
6934 pub fn set_mCommercialCommissioningEnabled(&mut self, val: bool) {
6935 unsafe {
6936 let val: u8 = ::std::mem::transmute(val);
6937 self._bitfield_1.set(4usize, 1u8, val as u64)
6938 }
6939 }
6940 #[inline]
6941 pub unsafe fn mCommercialCommissioningEnabled_raw(this: *const Self) -> bool {
6942 unsafe {
6943 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6944 ::std::ptr::addr_of!((*this)._bitfield_1),
6945 4usize,
6946 1u8,
6947 ) as u8)
6948 }
6949 }
6950 #[inline]
6951 pub unsafe fn set_mCommercialCommissioningEnabled_raw(this: *mut Self, val: bool) {
6952 unsafe {
6953 let val: u8 = ::std::mem::transmute(val);
6954 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6955 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6956 4usize,
6957 1u8,
6958 val as u64,
6959 )
6960 }
6961 }
6962 #[inline]
6963 pub fn mAutonomousEnrollmentEnabled(&self) -> bool {
6964 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
6965 }
6966 #[inline]
6967 pub fn set_mAutonomousEnrollmentEnabled(&mut self, val: bool) {
6968 unsafe {
6969 let val: u8 = ::std::mem::transmute(val);
6970 self._bitfield_1.set(5usize, 1u8, val as u64)
6971 }
6972 }
6973 #[inline]
6974 pub unsafe fn mAutonomousEnrollmentEnabled_raw(this: *const Self) -> bool {
6975 unsafe {
6976 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6977 ::std::ptr::addr_of!((*this)._bitfield_1),
6978 5usize,
6979 1u8,
6980 ) as u8)
6981 }
6982 }
6983 #[inline]
6984 pub unsafe fn set_mAutonomousEnrollmentEnabled_raw(this: *mut Self, val: bool) {
6985 unsafe {
6986 let val: u8 = ::std::mem::transmute(val);
6987 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6988 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6989 5usize,
6990 1u8,
6991 val as u64,
6992 )
6993 }
6994 }
6995 #[inline]
6996 pub fn mNetworkKeyProvisioningEnabled(&self) -> bool {
6997 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
6998 }
6999 #[inline]
7000 pub fn set_mNetworkKeyProvisioningEnabled(&mut self, val: bool) {
7001 unsafe {
7002 let val: u8 = ::std::mem::transmute(val);
7003 self._bitfield_1.set(6usize, 1u8, val as u64)
7004 }
7005 }
7006 #[inline]
7007 pub unsafe fn mNetworkKeyProvisioningEnabled_raw(this: *const Self) -> bool {
7008 unsafe {
7009 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7010 ::std::ptr::addr_of!((*this)._bitfield_1),
7011 6usize,
7012 1u8,
7013 ) as u8)
7014 }
7015 }
7016 #[inline]
7017 pub unsafe fn set_mNetworkKeyProvisioningEnabled_raw(this: *mut Self, val: bool) {
7018 unsafe {
7019 let val: u8 = ::std::mem::transmute(val);
7020 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7021 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7022 6usize,
7023 1u8,
7024 val as u64,
7025 )
7026 }
7027 }
7028 #[inline]
7029 pub fn mTobleLinkEnabled(&self) -> bool {
7030 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
7031 }
7032 #[inline]
7033 pub fn set_mTobleLinkEnabled(&mut self, val: bool) {
7034 unsafe {
7035 let val: u8 = ::std::mem::transmute(val);
7036 self._bitfield_1.set(7usize, 1u8, val as u64)
7037 }
7038 }
7039 #[inline]
7040 pub unsafe fn mTobleLinkEnabled_raw(this: *const Self) -> bool {
7041 unsafe {
7042 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7043 ::std::ptr::addr_of!((*this)._bitfield_1),
7044 7usize,
7045 1u8,
7046 ) as u8)
7047 }
7048 }
7049 #[inline]
7050 pub unsafe fn set_mTobleLinkEnabled_raw(this: *mut Self, val: bool) {
7051 unsafe {
7052 let val: u8 = ::std::mem::transmute(val);
7053 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7054 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7055 7usize,
7056 1u8,
7057 val as u64,
7058 )
7059 }
7060 }
7061 #[inline]
7062 pub fn mNonCcmRoutersEnabled(&self) -> bool {
7063 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
7064 }
7065 #[inline]
7066 pub fn set_mNonCcmRoutersEnabled(&mut self, val: bool) {
7067 unsafe {
7068 let val: u8 = ::std::mem::transmute(val);
7069 self._bitfield_1.set(8usize, 1u8, val as u64)
7070 }
7071 }
7072 #[inline]
7073 pub unsafe fn mNonCcmRoutersEnabled_raw(this: *const Self) -> bool {
7074 unsafe {
7075 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7076 ::std::ptr::addr_of!((*this)._bitfield_1),
7077 8usize,
7078 1u8,
7079 ) as u8)
7080 }
7081 }
7082 #[inline]
7083 pub unsafe fn set_mNonCcmRoutersEnabled_raw(this: *mut Self, val: bool) {
7084 unsafe {
7085 let val: u8 = ::std::mem::transmute(val);
7086 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7087 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7088 8usize,
7089 1u8,
7090 val as u64,
7091 )
7092 }
7093 }
7094 #[inline]
7095 pub fn mVersionThresholdForRouting(&self) -> u8 {
7096 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 3u8) as u8) }
7097 }
7098 #[inline]
7099 pub fn set_mVersionThresholdForRouting(&mut self, val: u8) {
7100 unsafe {
7101 let val: u8 = ::std::mem::transmute(val);
7102 self._bitfield_1.set(9usize, 3u8, val as u64)
7103 }
7104 }
7105 #[inline]
7106 pub unsafe fn mVersionThresholdForRouting_raw(this: *const Self) -> u8 {
7107 unsafe {
7108 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7109 ::std::ptr::addr_of!((*this)._bitfield_1),
7110 9usize,
7111 3u8,
7112 ) as u8)
7113 }
7114 }
7115 #[inline]
7116 pub unsafe fn set_mVersionThresholdForRouting_raw(this: *mut Self, val: u8) {
7117 unsafe {
7118 let val: u8 = ::std::mem::transmute(val);
7119 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7120 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7121 9usize,
7122 3u8,
7123 val as u64,
7124 )
7125 }
7126 }
7127 #[inline]
7128 pub fn new_bitfield_1(
7129 mObtainNetworkKeyEnabled: bool,
7130 mNativeCommissioningEnabled: bool,
7131 mRoutersEnabled: bool,
7132 mExternalCommissioningEnabled: bool,
7133 mCommercialCommissioningEnabled: bool,
7134 mAutonomousEnrollmentEnabled: bool,
7135 mNetworkKeyProvisioningEnabled: bool,
7136 mTobleLinkEnabled: bool,
7137 mNonCcmRoutersEnabled: bool,
7138 mVersionThresholdForRouting: u8,
7139 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
7140 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
7141 __bindgen_bitfield_unit.set(0usize, 1u8, {
7142 let mObtainNetworkKeyEnabled: u8 =
7143 unsafe { ::std::mem::transmute(mObtainNetworkKeyEnabled) };
7144 mObtainNetworkKeyEnabled as u64
7145 });
7146 __bindgen_bitfield_unit.set(1usize, 1u8, {
7147 let mNativeCommissioningEnabled: u8 =
7148 unsafe { ::std::mem::transmute(mNativeCommissioningEnabled) };
7149 mNativeCommissioningEnabled as u64
7150 });
7151 __bindgen_bitfield_unit.set(2usize, 1u8, {
7152 let mRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mRoutersEnabled) };
7153 mRoutersEnabled as u64
7154 });
7155 __bindgen_bitfield_unit.set(3usize, 1u8, {
7156 let mExternalCommissioningEnabled: u8 =
7157 unsafe { ::std::mem::transmute(mExternalCommissioningEnabled) };
7158 mExternalCommissioningEnabled as u64
7159 });
7160 __bindgen_bitfield_unit.set(4usize, 1u8, {
7161 let mCommercialCommissioningEnabled: u8 =
7162 unsafe { ::std::mem::transmute(mCommercialCommissioningEnabled) };
7163 mCommercialCommissioningEnabled as u64
7164 });
7165 __bindgen_bitfield_unit.set(5usize, 1u8, {
7166 let mAutonomousEnrollmentEnabled: u8 =
7167 unsafe { ::std::mem::transmute(mAutonomousEnrollmentEnabled) };
7168 mAutonomousEnrollmentEnabled as u64
7169 });
7170 __bindgen_bitfield_unit.set(6usize, 1u8, {
7171 let mNetworkKeyProvisioningEnabled: u8 =
7172 unsafe { ::std::mem::transmute(mNetworkKeyProvisioningEnabled) };
7173 mNetworkKeyProvisioningEnabled as u64
7174 });
7175 __bindgen_bitfield_unit.set(7usize, 1u8, {
7176 let mTobleLinkEnabled: u8 = unsafe { ::std::mem::transmute(mTobleLinkEnabled) };
7177 mTobleLinkEnabled as u64
7178 });
7179 __bindgen_bitfield_unit.set(8usize, 1u8, {
7180 let mNonCcmRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mNonCcmRoutersEnabled) };
7181 mNonCcmRoutersEnabled as u64
7182 });
7183 __bindgen_bitfield_unit.set(9usize, 3u8, {
7184 let mVersionThresholdForRouting: u8 =
7185 unsafe { ::std::mem::transmute(mVersionThresholdForRouting) };
7186 mVersionThresholdForRouting as u64
7187 });
7188 __bindgen_bitfield_unit
7189 }
7190}
7191#[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."]
7192pub type otChannelMask = u32;
7193#[doc = " Represents presence of different components in Active or Pending Operational Dataset."]
7194#[repr(C)]
7195#[derive(Debug, Default, Copy, Clone)]
7196pub struct otOperationalDatasetComponents {
7197 #[doc = "< TRUE if Active Timestamp is present, FALSE otherwise."]
7198 pub mIsActiveTimestampPresent: bool,
7199 #[doc = "< TRUE if Pending Timestamp is present, FALSE otherwise."]
7200 pub mIsPendingTimestampPresent: bool,
7201 #[doc = "< TRUE if Network Key is present, FALSE otherwise."]
7202 pub mIsNetworkKeyPresent: bool,
7203 #[doc = "< TRUE if Network Name is present, FALSE otherwise."]
7204 pub mIsNetworkNamePresent: bool,
7205 #[doc = "< TRUE if Extended PAN ID is present, FALSE otherwise."]
7206 pub mIsExtendedPanIdPresent: bool,
7207 #[doc = "< TRUE if Mesh Local Prefix is present, FALSE otherwise."]
7208 pub mIsMeshLocalPrefixPresent: bool,
7209 #[doc = "< TRUE if Delay Timer is present, FALSE otherwise."]
7210 pub mIsDelayPresent: bool,
7211 #[doc = "< TRUE if PAN ID is present, FALSE otherwise."]
7212 pub mIsPanIdPresent: bool,
7213 #[doc = "< TRUE if Channel is present, FALSE otherwise."]
7214 pub mIsChannelPresent: bool,
7215 #[doc = "< TRUE if PSKc is present, FALSE otherwise."]
7216 pub mIsPskcPresent: bool,
7217 #[doc = "< TRUE if Security Policy is present, FALSE otherwise."]
7218 pub mIsSecurityPolicyPresent: bool,
7219 #[doc = "< TRUE if Channel Mask is present, FALSE otherwise."]
7220 pub mIsChannelMaskPresent: bool,
7221 #[doc = "< TRUE if Wake-up Channel is present, FALSE otherwise."]
7222 pub mIsWakeupChannelPresent: bool,
7223}
7224#[doc = " Represents a Thread Dataset timestamp component."]
7225#[repr(C)]
7226#[derive(Debug, Default, Copy, Clone)]
7227pub struct otTimestamp {
7228 pub mSeconds: u64,
7229 pub mTicks: u16,
7230 pub mAuthoritative: bool,
7231}
7232#[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."]
7233#[repr(C)]
7234#[derive(Debug, Default, Copy, Clone)]
7235pub struct otOperationalDataset {
7236 #[doc = "< Active Timestamp"]
7237 pub mActiveTimestamp: otTimestamp,
7238 #[doc = "< Pending Timestamp"]
7239 pub mPendingTimestamp: otTimestamp,
7240 #[doc = "< Network Key"]
7241 pub mNetworkKey: otNetworkKey,
7242 #[doc = "< Network Name"]
7243 pub mNetworkName: otNetworkName,
7244 #[doc = "< Extended PAN ID"]
7245 pub mExtendedPanId: otExtendedPanId,
7246 #[doc = "< Mesh Local Prefix"]
7247 pub mMeshLocalPrefix: otMeshLocalPrefix,
7248 #[doc = "< Delay Timer"]
7249 pub mDelay: u32,
7250 #[doc = "< PAN ID"]
7251 pub mPanId: otPanId,
7252 #[doc = "< Channel"]
7253 pub mChannel: u16,
7254 #[doc = "< Wake-up Channel"]
7255 pub mWakeupChannel: u16,
7256 #[doc = "< PSKc"]
7257 pub mPskc: otPskc,
7258 #[doc = "< Security Policy"]
7259 pub mSecurityPolicy: otSecurityPolicy,
7260 #[doc = "< Channel Mask"]
7261 pub mChannelMask: otChannelMask,
7262 #[doc = "< Specifies which components are set in the Dataset."]
7263 pub mComponents: otOperationalDatasetComponents,
7264}
7265#[doc = " Represents an Active or Pending Operational Dataset.\n\n The Operational Dataset is TLV encoded as specified by Thread."]
7266#[repr(C)]
7267#[derive(Debug, Copy, Clone)]
7268pub struct otOperationalDatasetTlvs {
7269 #[doc = "< Operational Dataset TLVs."]
7270 pub mTlvs: [u8; 254usize],
7271 #[doc = "< Size of Operational Dataset in bytes."]
7272 pub mLength: u8,
7273}
7274impl Default for otOperationalDatasetTlvs {
7275 fn default() -> Self {
7276 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7277 unsafe {
7278 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7279 s.assume_init()
7280 }
7281 }
7282}
7283#[doc = "< meshcop Channel TLV"]
7284pub const OT_MESHCOP_TLV_CHANNEL: otMeshcopTlvType = 0;
7285#[doc = "< meshcop Pan Id TLV"]
7286pub const OT_MESHCOP_TLV_PANID: otMeshcopTlvType = 1;
7287#[doc = "< meshcop Extended Pan Id TLV"]
7288pub const OT_MESHCOP_TLV_EXTPANID: otMeshcopTlvType = 2;
7289#[doc = "< meshcop Network Name TLV"]
7290pub const OT_MESHCOP_TLV_NETWORKNAME: otMeshcopTlvType = 3;
7291#[doc = "< meshcop PSKc TLV"]
7292pub const OT_MESHCOP_TLV_PSKC: otMeshcopTlvType = 4;
7293#[doc = "< meshcop Network Key TLV"]
7294pub const OT_MESHCOP_TLV_NETWORKKEY: otMeshcopTlvType = 5;
7295#[doc = "< meshcop Network Key Sequence TLV"]
7296pub const OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE: otMeshcopTlvType = 6;
7297#[doc = "< meshcop Mesh Local Prefix TLV"]
7298pub const OT_MESHCOP_TLV_MESHLOCALPREFIX: otMeshcopTlvType = 7;
7299#[doc = "< meshcop Steering Data TLV"]
7300pub const OT_MESHCOP_TLV_STEERING_DATA: otMeshcopTlvType = 8;
7301#[doc = "< meshcop Border Agent Locator TLV"]
7302pub const OT_MESHCOP_TLV_BORDER_AGENT_RLOC: otMeshcopTlvType = 9;
7303#[doc = "< meshcop Commissioner ID TLV"]
7304pub const OT_MESHCOP_TLV_COMMISSIONER_ID: otMeshcopTlvType = 10;
7305#[doc = "< meshcop Commissioner Session ID TLV"]
7306pub const OT_MESHCOP_TLV_COMM_SESSION_ID: otMeshcopTlvType = 11;
7307#[doc = "< meshcop Security Policy TLV"]
7308pub const OT_MESHCOP_TLV_SECURITYPOLICY: otMeshcopTlvType = 12;
7309#[doc = "< meshcop Get TLV"]
7310pub const OT_MESHCOP_TLV_GET: otMeshcopTlvType = 13;
7311#[doc = "< meshcop Active Timestamp TLV"]
7312pub const OT_MESHCOP_TLV_ACTIVETIMESTAMP: otMeshcopTlvType = 14;
7313#[doc = "< meshcop Commissioner UDP Port TLV"]
7314pub const OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT: otMeshcopTlvType = 15;
7315#[doc = "< meshcop State TLV"]
7316pub const OT_MESHCOP_TLV_STATE: otMeshcopTlvType = 16;
7317#[doc = "< meshcop Joiner DTLS Encapsulation TLV"]
7318pub const OT_MESHCOP_TLV_JOINER_DTLS: otMeshcopTlvType = 17;
7319#[doc = "< meshcop Joiner UDP Port TLV"]
7320pub const OT_MESHCOP_TLV_JOINER_UDP_PORT: otMeshcopTlvType = 18;
7321#[doc = "< meshcop Joiner IID TLV"]
7322pub const OT_MESHCOP_TLV_JOINER_IID: otMeshcopTlvType = 19;
7323#[doc = "< meshcop Joiner Router Locator TLV"]
7324pub const OT_MESHCOP_TLV_JOINER_RLOC: otMeshcopTlvType = 20;
7325#[doc = "< meshcop Joiner Router KEK TLV"]
7326pub const OT_MESHCOP_TLV_JOINER_ROUTER_KEK: otMeshcopTlvType = 21;
7327#[doc = "< meshcop Duration TLV"]
7328pub const OT_MESHCOP_TLV_DURATION: otMeshcopTlvType = 23;
7329#[doc = "< meshcop Provisioning URL TLV"]
7330pub const OT_MESHCOP_TLV_PROVISIONING_URL: otMeshcopTlvType = 32;
7331#[doc = "< meshcop Vendor Name TLV"]
7332pub const OT_MESHCOP_TLV_VENDOR_NAME_TLV: otMeshcopTlvType = 33;
7333#[doc = "< meshcop Vendor Model TLV"]
7334pub const OT_MESHCOP_TLV_VENDOR_MODEL_TLV: otMeshcopTlvType = 34;
7335#[doc = "< meshcop Vendor SW Version TLV"]
7336pub const OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV: otMeshcopTlvType = 35;
7337#[doc = "< meshcop Vendor Data TLV"]
7338pub const OT_MESHCOP_TLV_VENDOR_DATA_TLV: otMeshcopTlvType = 36;
7339#[doc = "< meshcop Vendor Stack Version TLV"]
7340pub const OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV: otMeshcopTlvType = 37;
7341#[doc = "< meshcop UDP encapsulation TLV"]
7342pub const OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV: otMeshcopTlvType = 48;
7343#[doc = "< meshcop IPv6 address TLV"]
7344pub const OT_MESHCOP_TLV_IPV6_ADDRESS_TLV: otMeshcopTlvType = 49;
7345#[doc = "< meshcop Pending Timestamp TLV"]
7346pub const OT_MESHCOP_TLV_PENDINGTIMESTAMP: otMeshcopTlvType = 51;
7347#[doc = "< meshcop Delay Timer TLV"]
7348pub const OT_MESHCOP_TLV_DELAYTIMER: otMeshcopTlvType = 52;
7349#[doc = "< meshcop Channel Mask TLV"]
7350pub const OT_MESHCOP_TLV_CHANNELMASK: otMeshcopTlvType = 53;
7351#[doc = "< meshcop Count TLV"]
7352pub const OT_MESHCOP_TLV_COUNT: otMeshcopTlvType = 54;
7353#[doc = "< meshcop Period TLV"]
7354pub const OT_MESHCOP_TLV_PERIOD: otMeshcopTlvType = 55;
7355#[doc = "< meshcop Scan Duration TLV"]
7356pub const OT_MESHCOP_TLV_SCAN_DURATION: otMeshcopTlvType = 56;
7357#[doc = "< meshcop Energy List TLV"]
7358pub const OT_MESHCOP_TLV_ENERGY_LIST: otMeshcopTlvType = 57;
7359#[doc = "< meshcop Thread Domain Name TLV"]
7360pub const OT_MESHCOP_TLV_THREAD_DOMAIN_NAME: otMeshcopTlvType = 59;
7361#[doc = "< meshcop Wake-up Channel TLV"]
7362pub const OT_MESHCOP_TLV_WAKEUP_CHANNEL: otMeshcopTlvType = 74;
7363#[doc = "< meshcop Admitter State TLV"]
7364pub const OT_MESHCOP_TLV_ADMITTER_STATE: otMeshcopTlvType = 90;
7365#[doc = "< meshcop Enroller ID TLV"]
7366pub const OT_MESHCOP_TLV_ENROLLER_ID: otMeshcopTlvType = 91;
7367#[doc = "< meshcop Enroller Mode TLV"]
7368pub const OT_MESHCOP_TLV_ENROLLER_MODE: otMeshcopTlvType = 92;
7369#[doc = "< meshcop Discovery Request TLV"]
7370pub const OT_MESHCOP_TLV_DISCOVERYREQUEST: otMeshcopTlvType = 128;
7371#[doc = "< meshcop Discovery Response TLV"]
7372pub const OT_MESHCOP_TLV_DISCOVERYRESPONSE: otMeshcopTlvType = 129;
7373#[doc = "< meshcop Joiner Advertisement TLV (experimental)"]
7374pub const OT_MESHCOP_TLV_JOINERADVERTISEMENT: otMeshcopTlvType = 241;
7375#[doc = " Represents meshcop TLV types."]
7376pub type otMeshcopTlvType = ::std::os::raw::c_uint;
7377#[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."]
7378pub type otDatasetMgmtSetCallback = ::std::option::Option<
7379 unsafe extern "C" fn(aResult: otError, aContext: *mut ::std::os::raw::c_void),
7380>;
7381unsafe extern "C" {
7382 #[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."]
7383 pub fn otDatasetIsCommissioned(aInstance: *mut otInstance) -> bool;
7384}
7385unsafe extern "C" {
7386 #[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."]
7387 pub fn otDatasetGetActive(
7388 aInstance: *mut otInstance,
7389 aDataset: *mut otOperationalDataset,
7390 ) -> otError;
7391}
7392unsafe extern "C" {
7393 #[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."]
7394 pub fn otDatasetGetActiveTlvs(
7395 aInstance: *mut otInstance,
7396 aDataset: *mut otOperationalDatasetTlvs,
7397 ) -> otError;
7398}
7399unsafe extern "C" {
7400 #[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."]
7401 pub fn otDatasetSetActive(
7402 aInstance: *mut otInstance,
7403 aDataset: *const otOperationalDataset,
7404 ) -> otError;
7405}
7406unsafe extern "C" {
7407 #[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."]
7408 pub fn otDatasetSetActiveTlvs(
7409 aInstance: *mut otInstance,
7410 aDataset: *const otOperationalDatasetTlvs,
7411 ) -> otError;
7412}
7413unsafe extern "C" {
7414 #[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."]
7415 pub fn otDatasetGetPending(
7416 aInstance: *mut otInstance,
7417 aDataset: *mut otOperationalDataset,
7418 ) -> otError;
7419}
7420unsafe extern "C" {
7421 #[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."]
7422 pub fn otDatasetGetPendingTlvs(
7423 aInstance: *mut otInstance,
7424 aDataset: *mut otOperationalDatasetTlvs,
7425 ) -> otError;
7426}
7427unsafe extern "C" {
7428 #[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."]
7429 pub fn otDatasetSetPending(
7430 aInstance: *mut otInstance,
7431 aDataset: *const otOperationalDataset,
7432 ) -> otError;
7433}
7434unsafe extern "C" {
7435 #[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."]
7436 pub fn otDatasetSetPendingTlvs(
7437 aInstance: *mut otInstance,
7438 aDataset: *const otOperationalDatasetTlvs,
7439 ) -> otError;
7440}
7441unsafe extern "C" {
7442 #[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."]
7443 pub fn otDatasetSendMgmtActiveGet(
7444 aInstance: *mut otInstance,
7445 aDatasetComponents: *const otOperationalDatasetComponents,
7446 aTlvTypes: *const u8,
7447 aLength: u8,
7448 aAddress: *const otIp6Address,
7449 ) -> otError;
7450}
7451unsafe extern "C" {
7452 #[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."]
7453 pub fn otDatasetSendMgmtActiveSet(
7454 aInstance: *mut otInstance,
7455 aDataset: *const otOperationalDataset,
7456 aTlvs: *const u8,
7457 aLength: u8,
7458 aCallback: otDatasetMgmtSetCallback,
7459 aContext: *mut ::std::os::raw::c_void,
7460 ) -> otError;
7461}
7462unsafe extern "C" {
7463 #[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."]
7464 pub fn otDatasetSendMgmtPendingGet(
7465 aInstance: *mut otInstance,
7466 aDatasetComponents: *const otOperationalDatasetComponents,
7467 aTlvTypes: *const u8,
7468 aLength: u8,
7469 aAddress: *const otIp6Address,
7470 ) -> otError;
7471}
7472unsafe extern "C" {
7473 #[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."]
7474 pub fn otDatasetSendMgmtPendingSet(
7475 aInstance: *mut otInstance,
7476 aDataset: *const otOperationalDataset,
7477 aTlvs: *const u8,
7478 aLength: u8,
7479 aCallback: otDatasetMgmtSetCallback,
7480 aContext: *mut ::std::os::raw::c_void,
7481 ) -> otError;
7482}
7483unsafe extern "C" {
7484 #[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."]
7485 pub fn otDatasetGeneratePskc(
7486 aPassPhrase: *const ::std::os::raw::c_char,
7487 aNetworkName: *const otNetworkName,
7488 aExtPanId: *const otExtendedPanId,
7489 aPskc: *mut otPskc,
7490 ) -> otError;
7491}
7492unsafe extern "C" {
7493 #[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)."]
7494 pub fn otNetworkNameFromString(
7495 aNetworkName: *mut otNetworkName,
7496 aNameString: *const ::std::os::raw::c_char,
7497 ) -> otError;
7498}
7499unsafe extern "C" {
7500 #[doc = " Indicates whether or not the given Operational Dataset TLVs is a valid Active or Pending Dataset.\n\n A valid Active Dataset MUST contain all the required TLVs (Active Timestamp, Channel, Channel Mask, Extended PAN ID,\n Mesh-Local Prefix, Network Key, Network Name, PAN ID, PSKc, and Security Policy).\n\n A valid Pending Dataset MUST contain all the required TLVs for an Active Dataset and additionally MUST contain\n Pending Timestamp and Delay Timer TLVs.\n\n This method also checks whether there are duplicated TLVs or the TLVs are not well-formed in the @p aDatasetTlvs.\n\n @param[in] aDatasetTlvs A pointer to dataset TLVs.\n @param[in] aActive TRUE for Active Dataset, FALSE for Pending Dataset.\n\n @returns TRUE if @p aDatasetTlvs is a valid Dataset, FALSE otherwise."]
7501 pub fn otDatasetIsValid(aDatasetTlvs: *const otOperationalDatasetTlvs, aActive: bool) -> bool;
7502}
7503unsafe extern "C" {
7504 #[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`."]
7505 pub fn otDatasetParseTlvs(
7506 aDatasetTlvs: *const otOperationalDatasetTlvs,
7507 aDataset: *mut otOperationalDataset,
7508 ) -> otError;
7509}
7510unsafe extern "C" {
7511 #[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)."]
7512 pub fn otDatasetTlvsCompare(
7513 aDatasetTlvsA: *const otOperationalDatasetTlvs,
7514 aDatasetTlvsB: *const otOperationalDatasetTlvs,
7515 ) -> bool;
7516}
7517unsafe extern "C" {
7518 #[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."]
7519 pub fn otDatasetConvertToTlvs(
7520 aDataset: *const otOperationalDataset,
7521 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7522 );
7523}
7524unsafe extern "C" {
7525 #[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."]
7526 pub fn otDatasetUpdateTlvs(
7527 aDataset: *const otOperationalDataset,
7528 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7529 ) -> otError;
7530}
7531unsafe extern "C" {
7532 #[doc = " Indicates whether or not a given Operational Dataset (in TLVs format) affects connectivity.\n\n A Dataset affects connectivity if it contains a different Channel, PAN ID, Mesh Local Prefix, Network Key, or\n Security Policy than the current values in use.\n\n The following security policy changes are considered to affect connectivity:\n - Disabling routers (R bit: 1 to 0).\n - Enabling non-CCM routers (NCR bit: 0 to 1).\n - Increasing the version threshold for routing (VR field).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDatasetTlvs A pointer to Operational Dataset TLVs.\n\n @returns TRUE if @p aDatasetTlvs affects connectivity, FALSE otherwise."]
7533 pub fn otDatasetAffectsConnectivity(
7534 aInstance: *mut otInstance,
7535 aDatasetTlvs: *const otOperationalDatasetTlvs,
7536 ) -> bool;
7537}
7538unsafe extern "C" {
7539 #[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."]
7540 pub fn otDatasetCreateNewNetwork(
7541 aInstance: *mut otInstance,
7542 aDataset: *mut otOperationalDataset,
7543 ) -> otError;
7544}
7545unsafe extern "C" {
7546 #[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)."]
7547 pub fn otDatasetGetDelayTimerMinimal(aInstance: *mut otInstance) -> u32;
7548}
7549unsafe extern "C" {
7550 #[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."]
7551 pub fn otDatasetSetDelayTimerMinimal(
7552 aInstance: *mut otInstance,
7553 aDelayTimerMinimal: u32,
7554 ) -> otError;
7555}
7556#[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()`)."]
7557pub type otDatasetUpdaterCallback = ::std::option::Option<
7558 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
7559>;
7560unsafe extern "C" {
7561 #[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."]
7562 pub fn otDatasetUpdaterRequestUpdate(
7563 aInstance: *mut otInstance,
7564 aDataset: *const otOperationalDataset,
7565 aCallback: otDatasetUpdaterCallback,
7566 aContext: *mut ::std::os::raw::c_void,
7567 ) -> otError;
7568}
7569unsafe extern "C" {
7570 #[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."]
7571 pub fn otDatasetUpdaterCancelUpdate(aInstance: *mut otInstance);
7572}
7573unsafe extern "C" {
7574 #[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."]
7575 pub fn otDatasetUpdaterIsUpdateOngoing(aInstance: *mut otInstance) -> bool;
7576}
7577#[doc = "< Input mode without pull resistor."]
7578pub const OT_GPIO_MODE_INPUT: otGpioMode = 0;
7579#[doc = "< Output mode."]
7580pub const OT_GPIO_MODE_OUTPUT: otGpioMode = 1;
7581#[doc = " Defines the gpio modes."]
7582pub type otGpioMode = ::std::os::raw::c_uint;
7583#[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."]
7584pub type otPlatDiagOutputCallback = ::std::option::Option<
7585 unsafe extern "C" fn(
7586 aFormat: *const ::std::os::raw::c_char,
7587 aArguments: *mut __va_list_tag,
7588 aContext: *mut ::std::os::raw::c_void,
7589 ),
7590>;
7591unsafe extern "C" {
7592 #[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."]
7593 pub fn otPlatDiagSetOutputCallback(
7594 aInstance: *mut otInstance,
7595 aCallback: otPlatDiagOutputCallback,
7596 aContext: *mut ::std::os::raw::c_void,
7597 );
7598}
7599unsafe extern "C" {
7600 #[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."]
7601 pub fn otPlatDiagProcess(
7602 aInstance: *mut otInstance,
7603 aArgsLength: u8,
7604 aArgs: *mut *mut ::std::os::raw::c_char,
7605 ) -> otError;
7606}
7607unsafe extern "C" {
7608 #[doc = " Enables/disables the factory diagnostics mode.\n\n @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise."]
7609 pub fn otPlatDiagModeSet(aMode: bool);
7610}
7611unsafe extern "C" {
7612 #[doc = " Indicates whether or not factory diagnostics mode is enabled.\n\n @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise."]
7613 pub fn otPlatDiagModeGet() -> bool;
7614}
7615unsafe extern "C" {
7616 #[doc = " Sets the channel to use for factory diagnostics.\n\n @param[in] aChannel The channel value."]
7617 pub fn otPlatDiagChannelSet(aChannel: u8);
7618}
7619unsafe extern "C" {
7620 #[doc = " Sets the transmit power to use for factory diagnostics.\n\n @param[in] aTxPower The transmit power value."]
7621 pub fn otPlatDiagTxPowerSet(aTxPower: i8);
7622}
7623unsafe extern "C" {
7624 #[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."]
7625 pub fn otPlatDiagRadioReceived(
7626 aInstance: *mut otInstance,
7627 aFrame: *mut otRadioFrame,
7628 aError: otError,
7629 );
7630}
7631unsafe extern "C" {
7632 #[doc = " Processes the alarm event.\n\n @param[in] aInstance The OpenThread instance for current request."]
7633 pub fn otPlatDiagAlarmCallback(aInstance: *mut otInstance);
7634}
7635unsafe extern "C" {
7636 #[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."]
7637 pub fn otPlatDiagGpioSet(aGpio: u32, aValue: bool) -> otError;
7638}
7639unsafe extern "C" {
7640 #[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."]
7641 pub fn otPlatDiagGpioGet(aGpio: u32, aValue: *mut bool) -> otError;
7642}
7643unsafe extern "C" {
7644 #[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."]
7645 pub fn otPlatDiagGpioSetMode(aGpio: u32, aMode: otGpioMode) -> otError;
7646}
7647unsafe extern "C" {
7648 #[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."]
7649 pub fn otPlatDiagGpioGetMode(aGpio: u32, aMode: *mut otGpioMode) -> otError;
7650}
7651unsafe extern "C" {
7652 #[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."]
7653 pub fn otPlatDiagRadioSetRawPowerSetting(
7654 aInstance: *mut otInstance,
7655 aRawPowerSetting: *const u8,
7656 aRawPowerSettingLength: u16,
7657 ) -> otError;
7658}
7659unsafe extern "C" {
7660 #[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."]
7661 pub fn otPlatDiagRadioGetRawPowerSetting(
7662 aInstance: *mut otInstance,
7663 aRawPowerSetting: *mut u8,
7664 aRawPowerSettingLength: *mut u16,
7665 ) -> otError;
7666}
7667unsafe extern "C" {
7668 #[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."]
7669 pub fn otPlatDiagRadioRawPowerSettingEnable(
7670 aInstance: *mut otInstance,
7671 aEnable: bool,
7672 ) -> otError;
7673}
7674unsafe extern "C" {
7675 #[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."]
7676 pub fn otPlatDiagRadioTransmitCarrier(aInstance: *mut otInstance, aEnable: bool) -> otError;
7677}
7678unsafe extern "C" {
7679 #[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."]
7680 pub fn otPlatDiagRadioTransmitStream(aInstance: *mut otInstance, aEnable: bool) -> otError;
7681}
7682unsafe extern "C" {
7683 #[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."]
7684 pub fn otPlatDiagRadioGetPowerSettings(
7685 aInstance: *mut otInstance,
7686 aChannel: u8,
7687 aTargetPower: *mut i16,
7688 aActualPower: *mut i16,
7689 aRawPowerSetting: *mut u8,
7690 aRawPowerSettingLength: *mut u16,
7691 ) -> otError;
7692}
7693#[doc = " @addtogroup api-factory-diagnostics\n\n @brief\n This module includes functions that control the Thread stack's execution.\n\n @{"]
7694pub type otDiagOutputCallback = otPlatDiagOutputCallback;
7695unsafe extern "C" {
7696 #[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."]
7697 pub fn otDiagSetOutputCallback(
7698 aInstance: *mut otInstance,
7699 aCallback: otDiagOutputCallback,
7700 aContext: *mut ::std::os::raw::c_void,
7701 );
7702}
7703unsafe extern "C" {
7704 #[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."]
7705 pub fn otDiagProcessCmd(
7706 aInstance: *mut otInstance,
7707 aArgsLength: u8,
7708 aArgs: *mut *mut ::std::os::raw::c_char,
7709 ) -> otError;
7710}
7711unsafe extern "C" {
7712 #[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."]
7713 pub fn otDiagProcessCmdLine(
7714 aInstance: *mut otInstance,
7715 aString: *const ::std::os::raw::c_char,
7716 ) -> otError;
7717}
7718unsafe extern "C" {
7719 #[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."]
7720 pub fn otDiagIsEnabled(aInstance: *mut otInstance) -> bool;
7721}
7722#[doc = "< Indicates the flag is not specified."]
7723pub const OT_DNS_FLAG_UNSPECIFIED: otDnsRecursionFlag = 0;
7724#[doc = "< Indicates DNS name server can resolve the query recursively."]
7725pub const OT_DNS_FLAG_RECURSION_DESIRED: otDnsRecursionFlag = 1;
7726#[doc = "< Indicates DNS name server can not resolve the query recursively."]
7727pub const OT_DNS_FLAG_NO_RECURSION: otDnsRecursionFlag = 2;
7728#[doc = " Type represents the \"Recursion Desired\" (RD) flag in an `otDnsQueryConfig`."]
7729pub type otDnsRecursionFlag = ::std::os::raw::c_uint;
7730#[doc = "< NAT64 mode is not specified. Use default NAT64 mode."]
7731pub const OT_DNS_NAT64_UNSPECIFIED: otDnsNat64Mode = 0;
7732#[doc = "< Allow NAT64 address translation during DNS client address resolution."]
7733pub const OT_DNS_NAT64_ALLOW: otDnsNat64Mode = 1;
7734#[doc = "< Do not allow NAT64 address translation during DNS client address resolution."]
7735pub const OT_DNS_NAT64_DISALLOW: otDnsNat64Mode = 2;
7736#[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."]
7737pub type otDnsNat64Mode = ::std::os::raw::c_uint;
7738#[doc = "< Mode is not specified. Use default service mode."]
7739pub const OT_DNS_SERVICE_MODE_UNSPECIFIED: otDnsServiceMode = 0;
7740#[doc = "< Query for SRV record only."]
7741pub const OT_DNS_SERVICE_MODE_SRV: otDnsServiceMode = 1;
7742#[doc = "< Query for TXT record only."]
7743pub const OT_DNS_SERVICE_MODE_TXT: otDnsServiceMode = 2;
7744#[doc = "< Query for both SRV and TXT records in same message."]
7745pub const OT_DNS_SERVICE_MODE_SRV_TXT: otDnsServiceMode = 3;
7746#[doc = "< Query in parallel for SRV and TXT using separate messages."]
7747pub const OT_DNS_SERVICE_MODE_SRV_TXT_SEPARATE: otDnsServiceMode = 4;
7748#[doc = "< Query for TXT/SRV together first, if fails then query separately."]
7749pub const OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE: otDnsServiceMode = 5;
7750#[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."]
7751pub type otDnsServiceMode = ::std::os::raw::c_uint;
7752pub const OT_DNS_TRANSPORT_UNSPECIFIED: otDnsTransportProto = 0;
7753#[doc = " DNS transport is unspecified."]
7754pub const OT_DNS_TRANSPORT_UDP: otDnsTransportProto = 1;
7755#[doc = " DNS query should be sent via UDP."]
7756pub const OT_DNS_TRANSPORT_TCP: otDnsTransportProto = 2;
7757#[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."]
7758pub type otDnsTransportProto = ::std::os::raw::c_uint;
7759#[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`."]
7760#[repr(C)]
7761#[derive(Copy, Clone)]
7762pub struct otDnsQueryConfig {
7763 #[doc = "< Server address (IPv6 addr/port). All zero or zero port for unspecified."]
7764 pub mServerSockAddr: otSockAddr,
7765 #[doc = "< Wait time (in msec) to rx response. Zero indicates unspecified value."]
7766 pub mResponseTimeout: u32,
7767 #[doc = "< Maximum tx attempts before reporting failure. Zero for unspecified value."]
7768 pub mMaxTxAttempts: u8,
7769 #[doc = "< Indicates whether the server can resolve the query recursively or not."]
7770 pub mRecursionFlag: otDnsRecursionFlag,
7771 #[doc = "< Allow/Disallow NAT64 address translation during address resolution."]
7772 pub mNat64Mode: otDnsNat64Mode,
7773 #[doc = "< Determines which records to query during service resolution."]
7774 pub mServiceMode: otDnsServiceMode,
7775 #[doc = "< Select default transport protocol."]
7776 pub mTransportProto: otDnsTransportProto,
7777}
7778impl Default for otDnsQueryConfig {
7779 fn default() -> Self {
7780 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7781 unsafe {
7782 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7783 s.assume_init()
7784 }
7785 }
7786}
7787unsafe extern "C" {
7788 #[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."]
7789 pub fn otDnsClientGetDefaultConfig(aInstance: *mut otInstance) -> *const otDnsQueryConfig;
7790}
7791unsafe extern "C" {
7792 #[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."]
7793 pub fn otDnsClientSetDefaultConfig(
7794 aInstance: *mut otInstance,
7795 aConfig: *const otDnsQueryConfig,
7796 );
7797}
7798#[repr(C)]
7799#[derive(Debug, Copy, Clone)]
7800pub struct otDnsAddressResponse {
7801 _unused: [u8; 0],
7802}
7803#[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"]
7804pub type otDnsAddressCallback = ::std::option::Option<
7805 unsafe extern "C" fn(
7806 aError: otError,
7807 aResponse: *const otDnsAddressResponse,
7808 aContext: *mut ::std::os::raw::c_void,
7809 ),
7810>;
7811unsafe extern "C" {
7812 #[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."]
7813 pub fn otDnsClientResolveAddress(
7814 aInstance: *mut otInstance,
7815 aHostName: *const ::std::os::raw::c_char,
7816 aCallback: otDnsAddressCallback,
7817 aContext: *mut ::std::os::raw::c_void,
7818 aConfig: *const otDnsQueryConfig,
7819 ) -> otError;
7820}
7821unsafe extern "C" {
7822 #[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."]
7823 pub fn otDnsClientResolveIp4Address(
7824 aInstance: *mut otInstance,
7825 aHostName: *const ::std::os::raw::c_char,
7826 aCallback: otDnsAddressCallback,
7827 aContext: *mut ::std::os::raw::c_void,
7828 aConfig: *const otDnsQueryConfig,
7829 ) -> otError;
7830}
7831unsafe extern "C" {
7832 #[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."]
7833 pub fn otDnsAddressResponseGetHostName(
7834 aResponse: *const otDnsAddressResponse,
7835 aNameBuffer: *mut ::std::os::raw::c_char,
7836 aNameBufferSize: u16,
7837 ) -> otError;
7838}
7839unsafe extern "C" {
7840 #[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)."]
7841 pub fn otDnsAddressResponseGetAddress(
7842 aResponse: *const otDnsAddressResponse,
7843 aIndex: u16,
7844 aAddress: *mut otIp6Address,
7845 aTtl: *mut u32,
7846 ) -> otError;
7847}
7848#[repr(C)]
7849#[derive(Debug, Copy, Clone)]
7850pub struct otDnsBrowseResponse {
7851 _unused: [u8; 0],
7852}
7853#[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()`."]
7854pub type otDnsBrowseCallback = ::std::option::Option<
7855 unsafe extern "C" fn(
7856 aError: otError,
7857 aResponse: *const otDnsBrowseResponse,
7858 aContext: *mut ::std::os::raw::c_void,
7859 ),
7860>;
7861#[doc = " Provides info for a DNS service instance."]
7862#[repr(C)]
7863#[derive(Copy, Clone)]
7864pub struct otDnsServiceInfo {
7865 #[doc = "< Service record TTL (in seconds)."]
7866 pub mTtl: u32,
7867 #[doc = "< Service port number."]
7868 pub mPort: u16,
7869 #[doc = "< Service priority."]
7870 pub mPriority: u16,
7871 #[doc = "< Service weight."]
7872 pub mWeight: u16,
7873 #[doc = "< Buffer to output the service host name (can be NULL if not needed)."]
7874 pub mHostNameBuffer: *mut ::std::os::raw::c_char,
7875 #[doc = "< Size of `mHostNameBuffer`."]
7876 pub mHostNameBufferSize: u16,
7877 #[doc = "< The host IPv6 address. Set to all zero if not available."]
7878 pub mHostAddress: otIp6Address,
7879 #[doc = "< The host address TTL."]
7880 pub mHostAddressTtl: u32,
7881 #[doc = "< Buffer to output TXT data (can be NULL if not needed)."]
7882 pub mTxtData: *mut u8,
7883 #[doc = "< On input, size of `mTxtData` buffer. On output number bytes written."]
7884 pub mTxtDataSize: u16,
7885 #[doc = "< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated."]
7886 pub mTxtDataTruncated: bool,
7887 #[doc = "< The TXT data TTL."]
7888 pub mTxtDataTtl: u32,
7889}
7890impl Default for otDnsServiceInfo {
7891 fn default() -> Self {
7892 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7893 unsafe {
7894 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7895 s.assume_init()
7896 }
7897 }
7898}
7899unsafe extern "C" {
7900 #[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."]
7901 pub fn otDnsClientBrowse(
7902 aInstance: *mut otInstance,
7903 aServiceName: *const ::std::os::raw::c_char,
7904 aCallback: otDnsBrowseCallback,
7905 aContext: *mut ::std::os::raw::c_void,
7906 aConfig: *const otDnsQueryConfig,
7907 ) -> otError;
7908}
7909unsafe extern "C" {
7910 #[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."]
7911 pub fn otDnsBrowseResponseGetServiceName(
7912 aResponse: *const otDnsBrowseResponse,
7913 aNameBuffer: *mut ::std::os::raw::c_char,
7914 aNameBufferSize: u16,
7915 ) -> otError;
7916}
7917unsafe extern "C" {
7918 #[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."]
7919 pub fn otDnsBrowseResponseGetServiceInstance(
7920 aResponse: *const otDnsBrowseResponse,
7921 aIndex: u16,
7922 aLabelBuffer: *mut ::std::os::raw::c_char,
7923 aLabelBufferSize: u8,
7924 ) -> otError;
7925}
7926unsafe extern "C" {
7927 #[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."]
7928 pub fn otDnsBrowseResponseGetServiceInfo(
7929 aResponse: *const otDnsBrowseResponse,
7930 aInstanceLabel: *const ::std::os::raw::c_char,
7931 aServiceInfo: *mut otDnsServiceInfo,
7932 ) -> otError;
7933}
7934unsafe extern "C" {
7935 #[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."]
7936 pub fn otDnsBrowseResponseGetHostAddress(
7937 aResponse: *const otDnsBrowseResponse,
7938 aHostName: *const ::std::os::raw::c_char,
7939 aIndex: u16,
7940 aAddress: *mut otIp6Address,
7941 aTtl: *mut u32,
7942 ) -> otError;
7943}
7944#[repr(C)]
7945#[derive(Debug, Copy, Clone)]
7946pub struct otDnsServiceResponse {
7947 _unused: [u8; 0],
7948}
7949#[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()`."]
7950pub type otDnsServiceCallback = ::std::option::Option<
7951 unsafe extern "C" fn(
7952 aError: otError,
7953 aResponse: *const otDnsServiceResponse,
7954 aContext: *mut ::std::os::raw::c_void,
7955 ),
7956>;
7957unsafe extern "C" {
7958 #[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."]
7959 pub fn otDnsClientResolveService(
7960 aInstance: *mut otInstance,
7961 aInstanceLabel: *const ::std::os::raw::c_char,
7962 aServiceName: *const ::std::os::raw::c_char,
7963 aCallback: otDnsServiceCallback,
7964 aContext: *mut ::std::os::raw::c_void,
7965 aConfig: *const otDnsQueryConfig,
7966 ) -> otError;
7967}
7968unsafe extern "C" {
7969 #[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."]
7970 pub fn otDnsClientResolveServiceAndHostAddress(
7971 aInstance: *mut otInstance,
7972 aInstanceLabel: *const ::std::os::raw::c_char,
7973 aServiceName: *const ::std::os::raw::c_char,
7974 aCallback: otDnsServiceCallback,
7975 aContext: *mut ::std::os::raw::c_void,
7976 aConfig: *const otDnsQueryConfig,
7977 ) -> otError;
7978}
7979unsafe extern "C" {
7980 #[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."]
7981 pub fn otDnsServiceResponseGetServiceName(
7982 aResponse: *const otDnsServiceResponse,
7983 aLabelBuffer: *mut ::std::os::raw::c_char,
7984 aLabelBufferSize: u8,
7985 aNameBuffer: *mut ::std::os::raw::c_char,
7986 aNameBufferSize: u16,
7987 ) -> otError;
7988}
7989unsafe extern "C" {
7990 #[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."]
7991 pub fn otDnsServiceResponseGetServiceInfo(
7992 aResponse: *const otDnsServiceResponse,
7993 aServiceInfo: *mut otDnsServiceInfo,
7994 ) -> otError;
7995}
7996unsafe extern "C" {
7997 #[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."]
7998 pub fn otDnsServiceResponseGetHostAddress(
7999 aResponse: *const otDnsServiceResponse,
8000 aHostName: *const ::std::os::raw::c_char,
8001 aIndex: u16,
8002 aAddress: *mut otIp6Address,
8003 aTtl: *mut u32,
8004 ) -> otError;
8005}
8006#[repr(C)]
8007#[derive(Debug, Copy, Clone)]
8008pub struct otDnsRecordResponse {
8009 _unused: [u8; 0],
8010}
8011#[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."]
8012pub type otDnsRecordCallback = ::std::option::Option<
8013 unsafe extern "C" fn(
8014 aError: otError,
8015 aResponse: *const otDnsRecordResponse,
8016 aContext: *mut ::std::os::raw::c_void,
8017 ),
8018>;
8019#[doc = "< Answer section."]
8020pub const OT_DNS_SECTION_ANSWER: otDnsRecordSection = 0;
8021#[doc = "< Authority section."]
8022pub const OT_DNS_SECTION_AUTHORITY: otDnsRecordSection = 1;
8023#[doc = "< Additional section."]
8024pub const OT_DNS_SECTION_ADDITIONAL: otDnsRecordSection = 2;
8025#[doc = " Represents a section in a DNS query/response message."]
8026pub type otDnsRecordSection = ::std::os::raw::c_uint;
8027#[doc = " Represents info for a record in an `otDnsRecordResponse`.\n\n This struct is used as input to `otDnsRecordResponseGetRecordInfo()`."]
8028#[repr(C)]
8029#[derive(Debug, Copy, Clone)]
8030pub struct otDnsRecordInfo {
8031 #[doc = "< Buffer to output the name (MUST NOT be NULL)."]
8032 pub mNameBuffer: *mut ::std::os::raw::c_char,
8033 #[doc = "< Size of `mNameBuffer`."]
8034 pub mNameBufferSize: u16,
8035 #[doc = "< The record type."]
8036 pub mRecordType: u16,
8037 #[doc = "< The record data length (in bytes)."]
8038 pub mRecordLength: u16,
8039 #[doc = "< Record TTL (in seconds)."]
8040 pub mTtl: u32,
8041 #[doc = "< Buffer to output the data (Can be NULL if data not needed)."]
8042 pub mDataBuffer: *mut u8,
8043 #[doc = "< On input, size of `mDataBuffer`. On output number of bytes written."]
8044 pub mDataBufferSize: u16,
8045 #[doc = "< Indicates the section of the record."]
8046 pub mSection: otDnsRecordSection,
8047}
8048impl Default for otDnsRecordInfo {
8049 fn default() -> Self {
8050 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8051 unsafe {
8052 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8053 s.assume_init()
8054 }
8055 }
8056}
8057unsafe extern "C" {
8058 #[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."]
8059 pub fn otDnsClientQueryRecord(
8060 aInstance: *mut otInstance,
8061 aRecordType: u16,
8062 aFirstLabel: *const ::std::os::raw::c_char,
8063 aNextLabels: *const ::std::os::raw::c_char,
8064 aCallback: otDnsRecordCallback,
8065 aContext: *mut ::std::os::raw::c_void,
8066 aConfig: *const otDnsQueryConfig,
8067 ) -> otError;
8068}
8069unsafe extern "C" {
8070 #[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."]
8071 pub fn otDnsRecordResponseGetQueryName(
8072 aResponse: *const otDnsRecordResponse,
8073 aNameBuffer: *mut ::std::os::raw::c_char,
8074 aNameBufferSize: u16,
8075 ) -> otError;
8076}
8077unsafe extern "C" {
8078 #[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."]
8079 pub fn otDnsRecordResponseGetRecordInfo(
8080 aResponse: *const otDnsRecordResponse,
8081 aIndex: u16,
8082 aRecordInfo: *mut otDnsRecordInfo,
8083 ) -> otError;
8084}
8085#[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"]
8086pub type otDnssdQuerySubscribeCallback = ::std::option::Option<
8087 unsafe extern "C" fn(
8088 aContext: *mut ::std::os::raw::c_void,
8089 aFullName: *const ::std::os::raw::c_char,
8090 ),
8091>;
8092#[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.\")."]
8093pub type otDnssdQueryUnsubscribeCallback = ::std::option::Option<
8094 unsafe extern "C" fn(
8095 aContext: *mut ::std::os::raw::c_void,
8096 aFullName: *const ::std::os::raw::c_char,
8097 ),
8098>;
8099#[doc = " This opaque type represents a DNS-SD query."]
8100pub type otDnssdQuery = ::std::os::raw::c_void;
8101#[doc = " Represents information of a discovered service instance for a DNS-SD query."]
8102#[repr(C)]
8103#[derive(Debug, Copy, Clone)]
8104pub struct otDnssdServiceInstanceInfo {
8105 #[doc = "< Full instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
8106 pub mFullName: *const ::std::os::raw::c_char,
8107 #[doc = "< Host name (e.g. \"ot-host.default.service.arpa.\")."]
8108 pub mHostName: *const ::std::os::raw::c_char,
8109 #[doc = "< Number of host IPv6 addresses."]
8110 pub mAddressNum: u8,
8111 #[doc = "< Host IPv6 addresses."]
8112 pub mAddresses: *const otIp6Address,
8113 #[doc = "< Service port."]
8114 pub mPort: u16,
8115 #[doc = "< Service priority."]
8116 pub mPriority: u16,
8117 #[doc = "< Service weight."]
8118 pub mWeight: u16,
8119 #[doc = "< Service TXT RDATA length."]
8120 pub mTxtLength: u16,
8121 #[doc = "< Service TXT RDATA."]
8122 pub mTxtData: *const u8,
8123 #[doc = "< Service TTL (in seconds)."]
8124 pub mTtl: u32,
8125}
8126impl Default for otDnssdServiceInstanceInfo {
8127 fn default() -> Self {
8128 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8129 unsafe {
8130 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8131 s.assume_init()
8132 }
8133 }
8134}
8135#[doc = " Represents information of a discovered host for a DNS-SD query."]
8136#[repr(C)]
8137#[derive(Debug, Copy, Clone)]
8138pub struct otDnssdHostInfo {
8139 #[doc = "< Number of host IPv6 addresses."]
8140 pub mAddressNum: u8,
8141 #[doc = "< Host IPv6 addresses."]
8142 pub mAddresses: *const otIp6Address,
8143 #[doc = "< Service TTL (in seconds)."]
8144 pub mTtl: u32,
8145}
8146impl Default for otDnssdHostInfo {
8147 fn default() -> Self {
8148 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8149 unsafe {
8150 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8151 s.assume_init()
8152 }
8153 }
8154}
8155#[doc = "< Service type unspecified."]
8156pub const OT_DNSSD_QUERY_TYPE_NONE: otDnssdQueryType = 0;
8157#[doc = "< Service type browse service."]
8158pub const OT_DNSSD_QUERY_TYPE_BROWSE: otDnssdQueryType = 1;
8159#[doc = "< Service type resolve service instance."]
8160pub const OT_DNSSD_QUERY_TYPE_RESOLVE: otDnssdQueryType = 2;
8161#[doc = "< Service type resolve hostname."]
8162pub const OT_DNSSD_QUERY_TYPE_RESOLVE_HOST: otDnssdQueryType = 3;
8163#[doc = " Specifies a DNS-SD query type."]
8164pub type otDnssdQueryType = ::std::os::raw::c_uint;
8165#[doc = " Represents the count of queries, responses, failures handled by upstream DNS server.\n\n Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`."]
8166#[repr(C)]
8167#[derive(Debug, Default, Copy, Clone)]
8168pub struct otUpstreamDnsCounters {
8169 #[doc = "< The number of queries forwarded."]
8170 pub mQueries: u32,
8171 #[doc = "< The number of responses forwarded."]
8172 pub mResponses: u32,
8173 #[doc = "< The number of upstream DNS failures."]
8174 pub mFailures: u32,
8175}
8176#[doc = " Contains the counters of DNS-SD server."]
8177#[repr(C)]
8178#[derive(Debug, Default, Copy, Clone)]
8179pub struct otDnssdCounters {
8180 #[doc = "< The number of successful responses."]
8181 pub mSuccessResponse: u32,
8182 #[doc = "< The number of server failure responses."]
8183 pub mServerFailureResponse: u32,
8184 #[doc = "< The number of format error responses."]
8185 pub mFormatErrorResponse: u32,
8186 #[doc = "< The number of name error responses."]
8187 pub mNameErrorResponse: u32,
8188 #[doc = "< The number of 'not implemented' responses."]
8189 pub mNotImplementedResponse: u32,
8190 #[doc = "< The number of other responses."]
8191 pub mOtherResponse: u32,
8192 #[doc = "< The number of queries resolved by the local SRP server."]
8193 pub mResolvedBySrp: u32,
8194 #[doc = "< The number of queries, responses,\n< failures handled by upstream DNS server."]
8195 pub mUpstreamDnsCounters: otUpstreamDnsCounters,
8196}
8197unsafe extern "C" {
8198 #[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."]
8199 pub fn otDnssdQuerySetCallbacks(
8200 aInstance: *mut otInstance,
8201 aSubscribe: otDnssdQuerySubscribeCallback,
8202 aUnsubscribe: otDnssdQueryUnsubscribeCallback,
8203 aContext: *mut ::std::os::raw::c_void,
8204 );
8205}
8206unsafe extern "C" {
8207 #[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."]
8208 pub fn otDnssdQueryHandleDiscoveredServiceInstance(
8209 aInstance: *mut otInstance,
8210 aServiceFullName: *const ::std::os::raw::c_char,
8211 aInstanceInfo: *mut otDnssdServiceInstanceInfo,
8212 );
8213}
8214unsafe extern "C" {
8215 #[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."]
8216 pub fn otDnssdQueryHandleDiscoveredHost(
8217 aInstance: *mut otInstance,
8218 aHostFullName: *const ::std::os::raw::c_char,
8219 aHostInfo: *mut otDnssdHostInfo,
8220 );
8221}
8222unsafe extern "C" {
8223 #[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."]
8224 pub fn otDnssdGetNextQuery(
8225 aInstance: *mut otInstance,
8226 aQuery: *const otDnssdQuery,
8227 ) -> *const otDnssdQuery;
8228}
8229unsafe extern "C" {
8230 #[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."]
8231 pub fn otDnssdGetQueryTypeAndName(
8232 aQuery: *const otDnssdQuery,
8233 aNameOutput: *mut [::std::os::raw::c_char; 255usize],
8234 ) -> otDnssdQueryType;
8235}
8236unsafe extern "C" {
8237 #[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."]
8238 pub fn otDnssdGetCounters(aInstance: *mut otInstance) -> *const otDnssdCounters;
8239}
8240unsafe extern "C" {
8241 #[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"]
8242 pub fn otDnssdUpstreamQuerySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8243}
8244unsafe extern "C" {
8245 #[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"]
8246 pub fn otDnssdUpstreamQueryIsEnabled(aInstance: *mut otInstance) -> bool;
8247}
8248unsafe extern "C" {
8249 #[doc = " @note This API is deprecated and use of it is discouraged."]
8250 pub fn otHeapCAlloc(aCount: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
8251}
8252unsafe extern "C" {
8253 #[doc = " @note This API is deprecated and use of it is discouraged."]
8254 pub fn otHeapFree(aPointer: *mut ::std::os::raw::c_void);
8255}
8256#[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()`."]
8257pub type otBorderRoutingMultiAilCallback = ::std::option::Option<
8258 unsafe extern "C" fn(aDetected: bool, aContext: *mut ::std::os::raw::c_void),
8259>;
8260unsafe extern "C" {
8261 #[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."]
8262 pub fn otBorderRoutingSetMultiAilDetectionEnabled(aInstance: *mut otInstance, aEnable: bool);
8263}
8264unsafe extern "C" {
8265 #[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."]
8266 pub fn otBorderRoutingIsMultiAilDetectionEnabled(aInstance: *mut otInstance) -> bool;
8267}
8268unsafe extern "C" {
8269 #[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."]
8270 pub fn otBorderRoutingIsMultiAilDetectionRunning(aInstance: *mut otInstance) -> bool;
8271}
8272unsafe extern "C" {
8273 #[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."]
8274 pub fn otBorderRoutingIsMultiAilDetected(aInstance: *mut otInstance) -> bool;
8275}
8276unsafe extern "C" {
8277 #[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."]
8278 pub fn otBorderRoutingSetMultiAilCallback(
8279 aInstance: *mut otInstance,
8280 aCallback: otBorderRoutingMultiAilCallback,
8281 aContext: *mut ::std::os::raw::c_void,
8282 );
8283}
8284#[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()`."]
8285#[repr(C)]
8286#[derive(Debug, Copy, Clone)]
8287pub struct otBorderRoutingPrefixTableIterator {
8288 pub mPtr1: *const ::std::os::raw::c_void,
8289 pub mPtr2: *const ::std::os::raw::c_void,
8290 pub mData0: u32,
8291 pub mData1: u32,
8292 pub mData2: u8,
8293 pub mData3: u8,
8294}
8295impl Default for otBorderRoutingPrefixTableIterator {
8296 fn default() -> Self {
8297 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8298 unsafe {
8299 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8300 s.assume_init()
8301 }
8302 }
8303}
8304#[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."]
8305#[repr(C)]
8306#[derive(Copy, Clone)]
8307pub struct otBorderRoutingRouterEntry {
8308 #[doc = "< IPv6 address of the router."]
8309 pub mAddress: otIp6Address,
8310 #[doc = "< Milliseconds since last update (any message rx) from this router."]
8311 pub mMsecSinceLastUpdate: u32,
8312 #[doc = "< The router's age in seconds (duration since its first discovery)."]
8313 pub mAge: u32,
8314 pub _bitfield_align_1: [u8; 0],
8315 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8316 pub __bindgen_padding_0: [u8; 3usize],
8317}
8318impl Default for otBorderRoutingRouterEntry {
8319 fn default() -> Self {
8320 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8321 unsafe {
8322 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8323 s.assume_init()
8324 }
8325 }
8326}
8327impl otBorderRoutingRouterEntry {
8328 #[inline]
8329 pub fn mManagedAddressConfigFlag(&self) -> bool {
8330 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
8331 }
8332 #[inline]
8333 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
8334 unsafe {
8335 let val: u8 = ::std::mem::transmute(val);
8336 self._bitfield_1.set(0usize, 1u8, val as u64)
8337 }
8338 }
8339 #[inline]
8340 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
8341 unsafe {
8342 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8343 ::std::ptr::addr_of!((*this)._bitfield_1),
8344 0usize,
8345 1u8,
8346 ) as u8)
8347 }
8348 }
8349 #[inline]
8350 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
8351 unsafe {
8352 let val: u8 = ::std::mem::transmute(val);
8353 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8354 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8355 0usize,
8356 1u8,
8357 val as u64,
8358 )
8359 }
8360 }
8361 #[inline]
8362 pub fn mOtherConfigFlag(&self) -> bool {
8363 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
8364 }
8365 #[inline]
8366 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
8367 unsafe {
8368 let val: u8 = ::std::mem::transmute(val);
8369 self._bitfield_1.set(1usize, 1u8, val as u64)
8370 }
8371 }
8372 #[inline]
8373 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
8374 unsafe {
8375 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8376 ::std::ptr::addr_of!((*this)._bitfield_1),
8377 1usize,
8378 1u8,
8379 ) as u8)
8380 }
8381 }
8382 #[inline]
8383 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
8384 unsafe {
8385 let val: u8 = ::std::mem::transmute(val);
8386 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8387 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8388 1usize,
8389 1u8,
8390 val as u64,
8391 )
8392 }
8393 }
8394 #[inline]
8395 pub fn mSnacRouterFlag(&self) -> bool {
8396 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
8397 }
8398 #[inline]
8399 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
8400 unsafe {
8401 let val: u8 = ::std::mem::transmute(val);
8402 self._bitfield_1.set(2usize, 1u8, val as u64)
8403 }
8404 }
8405 #[inline]
8406 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
8407 unsafe {
8408 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8409 ::std::ptr::addr_of!((*this)._bitfield_1),
8410 2usize,
8411 1u8,
8412 ) as u8)
8413 }
8414 }
8415 #[inline]
8416 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
8417 unsafe {
8418 let val: u8 = ::std::mem::transmute(val);
8419 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8420 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8421 2usize,
8422 1u8,
8423 val as u64,
8424 )
8425 }
8426 }
8427 #[inline]
8428 pub fn mIsLocalDevice(&self) -> bool {
8429 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
8430 }
8431 #[inline]
8432 pub fn set_mIsLocalDevice(&mut self, val: bool) {
8433 unsafe {
8434 let val: u8 = ::std::mem::transmute(val);
8435 self._bitfield_1.set(3usize, 1u8, val as u64)
8436 }
8437 }
8438 #[inline]
8439 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
8440 unsafe {
8441 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8442 ::std::ptr::addr_of!((*this)._bitfield_1),
8443 3usize,
8444 1u8,
8445 ) as u8)
8446 }
8447 }
8448 #[inline]
8449 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
8450 unsafe {
8451 let val: u8 = ::std::mem::transmute(val);
8452 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8453 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8454 3usize,
8455 1u8,
8456 val as u64,
8457 )
8458 }
8459 }
8460 #[inline]
8461 pub fn mIsReachable(&self) -> bool {
8462 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
8463 }
8464 #[inline]
8465 pub fn set_mIsReachable(&mut self, val: bool) {
8466 unsafe {
8467 let val: u8 = ::std::mem::transmute(val);
8468 self._bitfield_1.set(4usize, 1u8, val as u64)
8469 }
8470 }
8471 #[inline]
8472 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
8473 unsafe {
8474 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8475 ::std::ptr::addr_of!((*this)._bitfield_1),
8476 4usize,
8477 1u8,
8478 ) as u8)
8479 }
8480 }
8481 #[inline]
8482 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
8483 unsafe {
8484 let val: u8 = ::std::mem::transmute(val);
8485 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8486 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8487 4usize,
8488 1u8,
8489 val as u64,
8490 )
8491 }
8492 }
8493 #[inline]
8494 pub fn mIsPeerBr(&self) -> bool {
8495 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
8496 }
8497 #[inline]
8498 pub fn set_mIsPeerBr(&mut self, val: bool) {
8499 unsafe {
8500 let val: u8 = ::std::mem::transmute(val);
8501 self._bitfield_1.set(5usize, 1u8, val as u64)
8502 }
8503 }
8504 #[inline]
8505 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
8506 unsafe {
8507 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8508 ::std::ptr::addr_of!((*this)._bitfield_1),
8509 5usize,
8510 1u8,
8511 ) as u8)
8512 }
8513 }
8514 #[inline]
8515 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
8516 unsafe {
8517 let val: u8 = ::std::mem::transmute(val);
8518 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8519 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8520 5usize,
8521 1u8,
8522 val as u64,
8523 )
8524 }
8525 }
8526 #[inline]
8527 pub fn new_bitfield_1(
8528 mManagedAddressConfigFlag: bool,
8529 mOtherConfigFlag: bool,
8530 mSnacRouterFlag: bool,
8531 mIsLocalDevice: bool,
8532 mIsReachable: bool,
8533 mIsPeerBr: bool,
8534 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8535 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8536 __bindgen_bitfield_unit.set(0usize, 1u8, {
8537 let mManagedAddressConfigFlag: u8 =
8538 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
8539 mManagedAddressConfigFlag as u64
8540 });
8541 __bindgen_bitfield_unit.set(1usize, 1u8, {
8542 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
8543 mOtherConfigFlag as u64
8544 });
8545 __bindgen_bitfield_unit.set(2usize, 1u8, {
8546 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
8547 mSnacRouterFlag as u64
8548 });
8549 __bindgen_bitfield_unit.set(3usize, 1u8, {
8550 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
8551 mIsLocalDevice as u64
8552 });
8553 __bindgen_bitfield_unit.set(4usize, 1u8, {
8554 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
8555 mIsReachable as u64
8556 });
8557 __bindgen_bitfield_unit.set(5usize, 1u8, {
8558 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
8559 mIsPeerBr as u64
8560 });
8561 __bindgen_bitfield_unit
8562 }
8563}
8564#[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."]
8565#[repr(C)]
8566#[derive(Copy, Clone)]
8567pub struct otBorderRoutingPrefixTableEntry {
8568 #[doc = "< Information about the router advertising this prefix."]
8569 pub mRouter: otBorderRoutingRouterEntry,
8570 #[doc = "< The discovered IPv6 prefix."]
8571 pub mPrefix: otIp6Prefix,
8572 #[doc = "< Indicates whether the prefix is on-link or route prefix."]
8573 pub mIsOnLink: bool,
8574 #[doc = "< Milliseconds since last update of this prefix."]
8575 pub mMsecSinceLastUpdate: u32,
8576 #[doc = "< Valid lifetime of the prefix (in seconds)."]
8577 pub mValidLifetime: u32,
8578 #[doc = "< Route preference when `mIsOnlink` is false."]
8579 pub mRoutePreference: otRoutePreference,
8580 #[doc = "< Preferred lifetime of the on-link prefix when `mIsOnLink`."]
8581 pub mPreferredLifetime: u32,
8582}
8583impl Default for otBorderRoutingPrefixTableEntry {
8584 fn default() -> Self {
8585 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8586 unsafe {
8587 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8588 s.assume_init()
8589 }
8590 }
8591}
8592#[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."]
8593#[repr(C)]
8594#[derive(Copy, Clone)]
8595pub struct otBorderRoutingNat64PrefixEntry {
8596 #[doc = "< Information about the router advertising this NAT64 prefix."]
8597 pub mRouter: otBorderRoutingRouterEntry,
8598 #[doc = "< The discovered IPv6 prefix."]
8599 pub mPrefix: otIp6Prefix,
8600 #[doc = "< Milliseconds since last update of this prefix."]
8601 pub mMsecSinceLastUpdate: u32,
8602 #[doc = "< Lifetime of the prefix (in seconds)."]
8603 pub mLifetime: u32,
8604}
8605impl Default for otBorderRoutingNat64PrefixEntry {
8606 fn default() -> Self {
8607 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8608 unsafe {
8609 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8610 s.assume_init()
8611 }
8612 }
8613}
8614#[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."]
8615#[repr(C)]
8616#[derive(Copy, Clone)]
8617pub struct otBorderRoutingRdnssAddrEntry {
8618 #[doc = "< Information about the router advertising this address."]
8619 pub mRouter: otBorderRoutingRouterEntry,
8620 #[doc = "< The DNS Server IPv6 address."]
8621 pub mAddress: otIp6Address,
8622 #[doc = "< Milliseconds since last update of this address."]
8623 pub mMsecSinceLastUpdate: u32,
8624 #[doc = "< Lifetime of the address (in seconds)."]
8625 pub mLifetime: u32,
8626}
8627impl Default for otBorderRoutingRdnssAddrEntry {
8628 fn default() -> Self {
8629 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8630 unsafe {
8631 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8632 s.assume_init()
8633 }
8634 }
8635}
8636#[doc = " Represents information about a peer Border Router found in the Network Data."]
8637#[repr(C)]
8638#[derive(Debug, Default, Copy, Clone)]
8639pub struct otBorderRoutingPeerBorderRouterEntry {
8640 #[doc = "< The RLOC16 of BR."]
8641 pub mRloc16: u16,
8642 #[doc = "< Seconds since the BR appeared in the Network Data."]
8643 pub mAge: u32,
8644}
8645#[doc = " Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL)."]
8646#[repr(C)]
8647#[derive(Copy, Clone)]
8648pub struct otBorderRoutingIfAddrEntry {
8649 #[doc = "< The IPv6 address."]
8650 pub mAddress: otIp6Address,
8651 #[doc = "< Seconds since the last RA was sent from this BR using this address."]
8652 pub mSecSinceLastUse: u32,
8653}
8654impl Default for otBorderRoutingIfAddrEntry {
8655 fn default() -> Self {
8656 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8657 unsafe {
8658 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8659 s.assume_init()
8660 }
8661 }
8662}
8663#[doc = " Represents a group of data of platform-generated RA messages processed."]
8664#[repr(C)]
8665#[derive(Debug, Default, Copy, Clone)]
8666pub struct otPdProcessedRaInfo {
8667 #[doc = "< The number of platform generated RA handled by ProcessPlatformGeneratedRa."]
8668 pub mNumPlatformRaReceived: u32,
8669 #[doc = "< The number of PIO processed for adding OMR prefixes."]
8670 pub mNumPlatformPioProcessed: u32,
8671 #[doc = "< The timestamp of last processed RA message."]
8672 pub mLastPlatformRaMsec: u32,
8673}
8674#[doc = "< BR auto-generates the local OMR prefix."]
8675pub const OT_BORDER_ROUTING_OMR_CONFIG_AUTO: otBorderRoutingOmrConfig = 0;
8676#[doc = "< BR uses a given custom OMR prefix."]
8677pub const OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM: otBorderRoutingOmrConfig = 1;
8678#[doc = "< BR does not add local/PD OMR prefix in Network Data."]
8679pub const OT_BORDER_ROUTING_OMR_CONFIG_DISABLED: otBorderRoutingOmrConfig = 2;
8680#[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."]
8681pub type otBorderRoutingOmrConfig = ::std::os::raw::c_uint;
8682#[doc = "< Routing Manager is uninitialized."]
8683pub const OT_BORDER_ROUTING_STATE_UNINITIALIZED: otBorderRoutingState = 0;
8684#[doc = "< Routing Manager is initialized but disabled."]
8685pub const OT_BORDER_ROUTING_STATE_DISABLED: otBorderRoutingState = 1;
8686#[doc = "< Routing Manager in initialized and enabled but currently stopped."]
8687pub const OT_BORDER_ROUTING_STATE_STOPPED: otBorderRoutingState = 2;
8688#[doc = "< Routing Manager is initialized, enabled, and running."]
8689pub const OT_BORDER_ROUTING_STATE_RUNNING: otBorderRoutingState = 3;
8690#[doc = " Represents the state of Border Routing Manager."]
8691pub type otBorderRoutingState = ::std::os::raw::c_uint;
8692#[doc = "< DHCPv6 PD is disabled on the border router."]
8693pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED: otBorderRoutingDhcp6PdState = 0;
8694#[doc = "< DHCPv6 PD in enabled but won't try to request and publish a prefix."]
8695pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED: otBorderRoutingDhcp6PdState = 1;
8696#[doc = "< DHCPv6 PD is enabled and will try to request and publish a prefix."]
8697pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING: otBorderRoutingDhcp6PdState = 2;
8698#[doc = "< DHCPv6 PD is idle; Higher-prf prefix published by other BRs."]
8699pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE: otBorderRoutingDhcp6PdState = 3;
8700#[doc = " This enumeration represents the state of DHCPv6 Prefix Delegation State."]
8701pub type otBorderRoutingDhcp6PdState = ::std::os::raw::c_uint;
8702unsafe extern "C" {
8703 #[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."]
8704 pub fn otBorderRoutingInit(
8705 aInstance: *mut otInstance,
8706 aInfraIfIndex: u32,
8707 aInfraIfIsRunning: bool,
8708 ) -> otError;
8709}
8710unsafe extern "C" {
8711 #[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"]
8712 pub fn otBorderRoutingGetInfraIfInfo(
8713 aInstance: *mut otInstance,
8714 aInfraIfIndex: *mut u32,
8715 aInfraIfIsRunning: *mut bool,
8716 ) -> otError;
8717}
8718unsafe extern "C" {
8719 #[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."]
8720 pub fn otBorderRoutingSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
8721}
8722unsafe extern "C" {
8723 #[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."]
8724 pub fn otBorderRoutingGetState(aInstance: *mut otInstance) -> otBorderRoutingState;
8725}
8726unsafe extern "C" {
8727 #[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."]
8728 pub fn otBorderRoutingSetOmrConfig(
8729 aInstance: *mut otInstance,
8730 aConfig: otBorderRoutingOmrConfig,
8731 aOmrPrefix: *const otIp6Prefix,
8732 aPreference: otRoutePreference,
8733 ) -> otError;
8734}
8735unsafe extern "C" {
8736 #[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."]
8737 pub fn otBorderRoutingGetOmrConfig(
8738 aInstance: *mut otInstance,
8739 aOmrPrefix: *mut otIp6Prefix,
8740 aPreference: *mut otRoutePreference,
8741 ) -> otBorderRoutingOmrConfig;
8742}
8743unsafe extern "C" {
8744 #[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."]
8745 pub fn otBorderRoutingGetRouteInfoOptionPreference(
8746 aInstance: *mut otInstance,
8747 ) -> otRoutePreference;
8748}
8749unsafe extern "C" {
8750 #[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."]
8751 pub fn otBorderRoutingSetRouteInfoOptionPreference(
8752 aInstance: *mut otInstance,
8753 aPreference: otRoutePreference,
8754 );
8755}
8756unsafe extern "C" {
8757 #[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."]
8758 pub fn otBorderRoutingClearRouteInfoOptionPreference(aInstance: *mut otInstance);
8759}
8760unsafe extern "C" {
8761 #[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."]
8762 pub fn otBorderRoutingSetExtraRouterAdvertOptions(
8763 aInstance: *mut otInstance,
8764 aOptions: *const u8,
8765 aLength: u16,
8766 ) -> otError;
8767}
8768unsafe extern "C" {
8769 #[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."]
8770 pub fn otBorderRoutingGetRoutePreference(aInstance: *mut otInstance) -> otRoutePreference;
8771}
8772unsafe extern "C" {
8773 #[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."]
8774 pub fn otBorderRoutingSetRoutePreference(
8775 aInstance: *mut otInstance,
8776 aPreference: otRoutePreference,
8777 );
8778}
8779unsafe extern "C" {
8780 #[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."]
8781 pub fn otBorderRoutingClearRoutePreference(aInstance: *mut otInstance);
8782}
8783unsafe extern "C" {
8784 #[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"]
8785 pub fn otBorderRoutingGetOmrPrefix(
8786 aInstance: *mut otInstance,
8787 aPrefix: *mut otIp6Prefix,
8788 ) -> otError;
8789}
8790unsafe extern "C" {
8791 #[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"]
8792 pub fn otBorderRoutingGetPdOmrPrefix(
8793 aInstance: *mut otInstance,
8794 aPrefixInfo: *mut otBorderRoutingPrefixTableEntry,
8795 ) -> otError;
8796}
8797unsafe extern "C" {
8798 #[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."]
8799 pub fn otBorderRoutingGetPdProcessedRaInfo(
8800 aInstance: *mut otInstance,
8801 aPdProcessedRaInfo: *mut otPdProcessedRaInfo,
8802 ) -> otError;
8803}
8804unsafe extern "C" {
8805 #[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."]
8806 pub fn otBorderRoutingGetFavoredOmrPrefix(
8807 aInstance: *mut otInstance,
8808 aPrefix: *mut otIp6Prefix,
8809 aPreference: *mut otRoutePreference,
8810 ) -> otError;
8811}
8812unsafe extern "C" {
8813 #[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."]
8814 pub fn otBorderRoutingGetOnLinkPrefix(
8815 aInstance: *mut otInstance,
8816 aPrefix: *mut otIp6Prefix,
8817 ) -> otError;
8818}
8819unsafe extern "C" {
8820 #[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."]
8821 pub fn otBorderRoutingGetFavoredOnLinkPrefix(
8822 aInstance: *mut otInstance,
8823 aPrefix: *mut otIp6Prefix,
8824 ) -> otError;
8825}
8826unsafe extern "C" {
8827 #[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."]
8828 pub fn otBorderRoutingGetNat64Prefix(
8829 aInstance: *mut otInstance,
8830 aPrefix: *mut otIp6Prefix,
8831 ) -> otError;
8832}
8833unsafe extern "C" {
8834 #[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."]
8835 pub fn otBorderRoutingGetFavoredNat64Prefix(
8836 aInstance: *mut otInstance,
8837 aPrefix: *mut otIp6Prefix,
8838 aPreference: *mut otRoutePreference,
8839 ) -> otError;
8840}
8841unsafe extern "C" {
8842 #[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."]
8843 pub fn otBorderRoutingPrefixTableInitIterator(
8844 aInstance: *mut otInstance,
8845 aIterator: *mut otBorderRoutingPrefixTableIterator,
8846 );
8847}
8848unsafe extern "C" {
8849 #[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."]
8850 pub fn otBorderRoutingGetNextPrefixTableEntry(
8851 aInstance: *mut otInstance,
8852 aIterator: *mut otBorderRoutingPrefixTableIterator,
8853 aEntry: *mut otBorderRoutingPrefixTableEntry,
8854 ) -> otError;
8855}
8856unsafe extern "C" {
8857 #[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."]
8858 pub fn otBorderRoutingGetNextRouterEntry(
8859 aInstance: *mut otInstance,
8860 aIterator: *mut otBorderRoutingPrefixTableIterator,
8861 aEntry: *mut otBorderRoutingRouterEntry,
8862 ) -> otError;
8863}
8864unsafe extern "C" {
8865 #[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\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."]
8866 pub fn otBorderRoutingGetNextPeerBrEntry(
8867 aInstance: *mut otInstance,
8868 aIterator: *mut otBorderRoutingPrefixTableIterator,
8869 aEntry: *mut otBorderRoutingPeerBorderRouterEntry,
8870 ) -> otError;
8871}
8872unsafe extern "C" {
8873 #[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\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."]
8874 pub fn otBorderRoutingCountPeerBrs(aInstance: *mut otInstance, aMinAge: *mut u32) -> u16;
8875}
8876unsafe extern "C" {
8877 #[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)."]
8878 pub fn otBorderRoutingGetNextRdnssAddrEntry(
8879 aInstance: *mut otInstance,
8880 aIterator: *mut otBorderRoutingPrefixTableIterator,
8881 aEntry: *mut otBorderRoutingRdnssAddrEntry,
8882 ) -> otError;
8883}
8884unsafe extern "C" {
8885 #[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"]
8886 pub fn otBorderRoutingGetNextNat64PrefixEntry(
8887 aInstance: *mut otInstance,
8888 aIterator: *mut otBorderRoutingPrefixTableIterator,
8889 aEntry: *mut otBorderRoutingNat64PrefixEntry,
8890 ) -> otError;
8891}
8892#[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."]
8893pub type otBorderRoutingRdnssAddrCallback =
8894 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
8895unsafe extern "C" {
8896 #[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)."]
8897 pub fn otBorderRoutingSetRdnssAddrCallback(
8898 aInstance: *mut otInstance,
8899 aCallback: otBorderRoutingRdnssAddrCallback,
8900 aContext: *mut ::std::os::raw::c_void,
8901 );
8902}
8903unsafe extern "C" {
8904 #[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)."]
8905 pub fn otBorderRoutingGetNextIfAddrEntry(
8906 aInstance: *mut otInstance,
8907 aIterator: *mut otBorderRoutingPrefixTableIterator,
8908 aEntry: *mut otBorderRoutingIfAddrEntry,
8909 ) -> otError;
8910}
8911unsafe extern "C" {
8912 #[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."]
8913 pub fn otBorderRoutingDhcp6PdSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8914}
8915unsafe extern "C" {
8916 #[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."]
8917 pub fn otBorderRoutingDhcp6PdGetState(
8918 aInstance: *mut otInstance,
8919 ) -> otBorderRoutingDhcp6PdState;
8920}
8921#[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."]
8922pub type otBorderRoutingRequestDhcp6PdCallback = ::std::option::Option<
8923 unsafe extern "C" fn(
8924 aState: otBorderRoutingDhcp6PdState,
8925 aContext: *mut ::std::os::raw::c_void,
8926 ),
8927>;
8928unsafe extern "C" {
8929 #[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."]
8930 pub fn otBorderRoutingDhcp6PdSetRequestCallback(
8931 aInstance: *mut otInstance,
8932 aCallback: otBorderRoutingRequestDhcp6PdCallback,
8933 aContext: *mut ::std::os::raw::c_void,
8934 );
8935}
8936unsafe extern "C" {
8937 #[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."]
8938 pub fn otBorderRoutingSetOnLinkPrefix(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix);
8939}
8940pub type otMacFilterIterator = u8;
8941#[doc = "< Address filter is disabled."]
8942pub const OT_MAC_FILTER_ADDRESS_MODE_DISABLED: otMacFilterAddressMode = 0;
8943#[doc = "< Allowlist address filter mode is enabled."]
8944pub const OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST: otMacFilterAddressMode = 1;
8945#[doc = "< Denylist address filter mode is enabled."]
8946pub const OT_MAC_FILTER_ADDRESS_MODE_DENYLIST: otMacFilterAddressMode = 2;
8947#[doc = " Defines address mode of the mac filter."]
8948pub type otMacFilterAddressMode = ::std::os::raw::c_uint;
8949#[doc = " Represents a Mac Filter entry."]
8950#[repr(C)]
8951#[derive(Debug, Default, Copy, Clone)]
8952pub struct otMacFilterEntry {
8953 #[doc = "< IEEE 802.15.4 Extended Address"]
8954 pub mExtAddress: otExtAddress,
8955 #[doc = "< Received signal strength"]
8956 pub mRssIn: i8,
8957}
8958#[doc = " Represents the MAC layer counters."]
8959#[repr(C)]
8960#[derive(Debug, Default, Copy, Clone)]
8961pub struct otMacCounters {
8962 #[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"]
8963 pub mTxTotal: u32,
8964 #[doc = " The total number of unique unicast MAC frame transmission requests."]
8965 pub mTxUnicast: u32,
8966 #[doc = " The total number of unique broadcast MAC frame transmission requests."]
8967 pub mTxBroadcast: u32,
8968 #[doc = " The total number of unique MAC frame transmission requests with requested acknowledgment."]
8969 pub mTxAckRequested: u32,
8970 #[doc = " The total number of unique MAC frame transmission requests that were acked."]
8971 pub mTxAcked: u32,
8972 #[doc = " The total number of unique MAC frame transmission requests without requested acknowledgment."]
8973 pub mTxNoAckRequested: u32,
8974 #[doc = " The total number of unique MAC Data frame transmission requests."]
8975 pub mTxData: u32,
8976 #[doc = " The total number of unique MAC Data Poll frame transmission requests."]
8977 pub mTxDataPoll: u32,
8978 #[doc = " The total number of unique MAC Beacon frame transmission requests."]
8979 pub mTxBeacon: u32,
8980 #[doc = " The total number of unique MAC Beacon Request frame transmission requests."]
8981 pub mTxBeaconRequest: u32,
8982 #[doc = " The total number of unique other MAC frame transmission requests.\n\n This counter is currently used for counting out-of-band frames."]
8983 pub mTxOther: u32,
8984 #[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."]
8985 pub mTxRetry: u32,
8986 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for direct packets."]
8987 pub mTxDirectMaxRetryExpiry: u32,
8988 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets."]
8989 pub mTxIndirectMaxRetryExpiry: u32,
8990 #[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)."]
8991 pub mTxErrCca: u32,
8992 #[doc = " The total number of unique MAC transmission request failures cause by an abort error."]
8993 pub mTxErrAbort: u32,
8994 #[doc = " The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail)."]
8995 pub mTxErrBusyChannel: u32,
8996 #[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."]
8997 pub mRxTotal: u32,
8998 #[doc = " The total number of unicast frames received."]
8999 pub mRxUnicast: u32,
9000 #[doc = " The total number of broadcast frames received."]
9001 pub mRxBroadcast: u32,
9002 #[doc = " The total number of MAC Data frames received."]
9003 pub mRxData: u32,
9004 #[doc = " The total number of MAC Data Poll frames received."]
9005 pub mRxDataPoll: u32,
9006 #[doc = " The total number of MAC Beacon frames received."]
9007 pub mRxBeacon: u32,
9008 #[doc = " The total number of MAC Beacon Request frames received."]
9009 pub mRxBeaconRequest: u32,
9010 #[doc = " The total number of other types of frames received."]
9011 pub mRxOther: u32,
9012 #[doc = " The total number of frames dropped by MAC Filter module, for example received from denylisted node."]
9013 pub mRxAddressFiltered: u32,
9014 #[doc = " The total number of frames dropped by destination address check, for example received frame for other node."]
9015 pub mRxDestAddrFiltered: u32,
9016 #[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."]
9017 pub mRxDuplicated: u32,
9018 #[doc = " The total number of frames dropped because of missing or malformed content."]
9019 pub mRxErrNoFrame: u32,
9020 #[doc = " The total number of frames dropped due to unknown neighbor."]
9021 pub mRxErrUnknownNeighbor: u32,
9022 #[doc = " The total number of frames dropped due to invalid source address."]
9023 pub mRxErrInvalidSrcAddr: u32,
9024 #[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."]
9025 pub mRxErrSec: u32,
9026 #[doc = " The total number of frames dropped due to invalid FCS."]
9027 pub mRxErrFcs: u32,
9028 #[doc = " The total number of frames dropped due to other error."]
9029 pub mRxErrOther: u32,
9030}
9031#[doc = " Represents a received IEEE 802.15.4 Beacon."]
9032#[repr(C)]
9033#[repr(align(4))]
9034#[derive(Debug, Default, Copy, Clone)]
9035pub struct otActiveScanResult {
9036 #[doc = "< IEEE 802.15.4 Extended Address"]
9037 pub mExtAddress: otExtAddress,
9038 #[doc = "< Thread Network Name"]
9039 pub mNetworkName: otNetworkName,
9040 #[doc = "< Thread Extended PAN ID"]
9041 pub mExtendedPanId: otExtendedPanId,
9042 #[doc = "< Steering Data"]
9043 pub mSteeringData: otSteeringData,
9044 #[doc = "< IEEE 802.15.4 PAN ID"]
9045 pub mPanId: u16,
9046 #[doc = "< Joiner UDP Port"]
9047 pub mJoinerUdpPort: u16,
9048 #[doc = "< IEEE 802.15.4 Channel"]
9049 pub mChannel: u8,
9050 #[doc = "< RSSI (dBm)"]
9051 pub mRssi: i8,
9052 #[doc = "< LQI"]
9053 pub mLqi: u8,
9054 pub _bitfield_align_1: [u8; 0],
9055 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9056 pub __bindgen_padding_0: u16,
9057}
9058impl otActiveScanResult {
9059 #[inline]
9060 pub fn mVersion(&self) -> ::std::os::raw::c_uint {
9061 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) }
9062 }
9063 #[inline]
9064 pub fn set_mVersion(&mut self, val: ::std::os::raw::c_uint) {
9065 unsafe {
9066 let val: u32 = ::std::mem::transmute(val);
9067 self._bitfield_1.set(0usize, 4u8, val as u64)
9068 }
9069 }
9070 #[inline]
9071 pub unsafe fn mVersion_raw(this: *const Self) -> ::std::os::raw::c_uint {
9072 unsafe {
9073 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9074 ::std::ptr::addr_of!((*this)._bitfield_1),
9075 0usize,
9076 4u8,
9077 ) as u32)
9078 }
9079 }
9080 #[inline]
9081 pub unsafe fn set_mVersion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
9082 unsafe {
9083 let val: u32 = ::std::mem::transmute(val);
9084 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9085 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9086 0usize,
9087 4u8,
9088 val as u64,
9089 )
9090 }
9091 }
9092 #[inline]
9093 pub fn mIsNative(&self) -> bool {
9094 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
9095 }
9096 #[inline]
9097 pub fn set_mIsNative(&mut self, val: bool) {
9098 unsafe {
9099 let val: u8 = ::std::mem::transmute(val);
9100 self._bitfield_1.set(4usize, 1u8, val as u64)
9101 }
9102 }
9103 #[inline]
9104 pub unsafe fn mIsNative_raw(this: *const Self) -> bool {
9105 unsafe {
9106 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9107 ::std::ptr::addr_of!((*this)._bitfield_1),
9108 4usize,
9109 1u8,
9110 ) as u8)
9111 }
9112 }
9113 #[inline]
9114 pub unsafe fn set_mIsNative_raw(this: *mut Self, val: bool) {
9115 unsafe {
9116 let val: u8 = ::std::mem::transmute(val);
9117 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9118 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9119 4usize,
9120 1u8,
9121 val as u64,
9122 )
9123 }
9124 }
9125 #[inline]
9126 pub fn mDiscover(&self) -> bool {
9127 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
9128 }
9129 #[inline]
9130 pub fn set_mDiscover(&mut self, val: bool) {
9131 unsafe {
9132 let val: u8 = ::std::mem::transmute(val);
9133 self._bitfield_1.set(5usize, 1u8, val as u64)
9134 }
9135 }
9136 #[inline]
9137 pub unsafe fn mDiscover_raw(this: *const Self) -> bool {
9138 unsafe {
9139 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9140 ::std::ptr::addr_of!((*this)._bitfield_1),
9141 5usize,
9142 1u8,
9143 ) as u8)
9144 }
9145 }
9146 #[inline]
9147 pub unsafe fn set_mDiscover_raw(this: *mut Self, val: bool) {
9148 unsafe {
9149 let val: u8 = ::std::mem::transmute(val);
9150 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9151 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9152 5usize,
9153 1u8,
9154 val as u64,
9155 )
9156 }
9157 }
9158 #[inline]
9159 pub fn mIsJoinable(&self) -> bool {
9160 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
9161 }
9162 #[inline]
9163 pub fn set_mIsJoinable(&mut self, val: bool) {
9164 unsafe {
9165 let val: u8 = ::std::mem::transmute(val);
9166 self._bitfield_1.set(6usize, 1u8, val as u64)
9167 }
9168 }
9169 #[inline]
9170 pub unsafe fn mIsJoinable_raw(this: *const Self) -> bool {
9171 unsafe {
9172 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9173 ::std::ptr::addr_of!((*this)._bitfield_1),
9174 6usize,
9175 1u8,
9176 ) as u8)
9177 }
9178 }
9179 #[inline]
9180 pub unsafe fn set_mIsJoinable_raw(this: *mut Self, val: bool) {
9181 unsafe {
9182 let val: u8 = ::std::mem::transmute(val);
9183 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9184 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9185 6usize,
9186 1u8,
9187 val as u64,
9188 )
9189 }
9190 }
9191 #[inline]
9192 pub fn new_bitfield_1(
9193 mVersion: ::std::os::raw::c_uint,
9194 mIsNative: bool,
9195 mDiscover: bool,
9196 mIsJoinable: bool,
9197 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9198 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9199 __bindgen_bitfield_unit.set(0usize, 4u8, {
9200 let mVersion: u32 = unsafe { ::std::mem::transmute(mVersion) };
9201 mVersion as u64
9202 });
9203 __bindgen_bitfield_unit.set(4usize, 1u8, {
9204 let mIsNative: u8 = unsafe { ::std::mem::transmute(mIsNative) };
9205 mIsNative as u64
9206 });
9207 __bindgen_bitfield_unit.set(5usize, 1u8, {
9208 let mDiscover: u8 = unsafe { ::std::mem::transmute(mDiscover) };
9209 mDiscover as u64
9210 });
9211 __bindgen_bitfield_unit.set(6usize, 1u8, {
9212 let mIsJoinable: u8 = unsafe { ::std::mem::transmute(mIsJoinable) };
9213 mIsJoinable as u64
9214 });
9215 __bindgen_bitfield_unit
9216 }
9217}
9218#[doc = " Represents an energy scan result."]
9219#[repr(C)]
9220#[derive(Debug, Default, Copy, Clone)]
9221pub struct otEnergyScanResult {
9222 #[doc = "< IEEE 802.15.4 Channel"]
9223 pub mChannel: u8,
9224 #[doc = "< The max RSSI (dBm)"]
9225 pub mMaxRssi: i8,
9226}
9227#[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."]
9228pub type otHandleActiveScanResult = ::std::option::Option<
9229 unsafe extern "C" fn(aResult: *mut otActiveScanResult, aContext: *mut ::std::os::raw::c_void),
9230>;
9231unsafe extern "C" {
9232 #[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."]
9233 pub fn otLinkActiveScan(
9234 aInstance: *mut otInstance,
9235 aScanChannels: u32,
9236 aScanDuration: u16,
9237 aCallback: otHandleActiveScanResult,
9238 aCallbackContext: *mut ::std::os::raw::c_void,
9239 ) -> otError;
9240}
9241unsafe extern "C" {
9242 #[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."]
9243 pub fn otLinkIsActiveScanInProgress(aInstance: *mut otInstance) -> bool;
9244}
9245#[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."]
9246pub type otHandleEnergyScanResult = ::std::option::Option<
9247 unsafe extern "C" fn(aResult: *mut otEnergyScanResult, aContext: *mut ::std::os::raw::c_void),
9248>;
9249unsafe extern "C" {
9250 #[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."]
9251 pub fn otLinkEnergyScan(
9252 aInstance: *mut otInstance,
9253 aScanChannels: u32,
9254 aScanDuration: u16,
9255 aCallback: otHandleEnergyScanResult,
9256 aCallbackContext: *mut ::std::os::raw::c_void,
9257 ) -> otError;
9258}
9259unsafe extern "C" {
9260 #[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."]
9261 pub fn otLinkIsEnergyScanInProgress(aInstance: *mut otInstance) -> bool;
9262}
9263unsafe extern "C" {
9264 #[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."]
9265 pub fn otLinkSendDataRequest(aInstance: *mut otInstance) -> otError;
9266}
9267unsafe extern "C" {
9268 #[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."]
9269 pub fn otLinkIsInTransmitState(aInstance: *mut otInstance) -> bool;
9270}
9271unsafe extern "C" {
9272 #[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"]
9273 pub fn otLinkGetChannel(aInstance: *mut otInstance) -> u8;
9274}
9275unsafe extern "C" {
9276 #[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"]
9277 pub fn otLinkSetChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9278}
9279unsafe extern "C" {
9280 #[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."]
9281 pub fn otLinkGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
9282}
9283unsafe extern "C" {
9284 #[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."]
9285 pub fn otLinkSetSupportedChannelMask(aInstance: *mut otInstance, aChannelMask: u32) -> otError;
9286}
9287unsafe extern "C" {
9288 #[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."]
9289 pub fn otLinkGetExtendedAddress(aInstance: *mut otInstance) -> *const otExtAddress;
9290}
9291unsafe extern "C" {
9292 #[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."]
9293 pub fn otLinkSetExtendedAddress(
9294 aInstance: *mut otInstance,
9295 aExtAddress: *const otExtAddress,
9296 ) -> otError;
9297}
9298unsafe extern "C" {
9299 #[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."]
9300 pub fn otLinkGetFactoryAssignedIeeeEui64(aInstance: *mut otInstance, aEui64: *mut otExtAddress);
9301}
9302unsafe extern "C" {
9303 #[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"]
9304 pub fn otLinkGetPanId(aInstance: *mut otInstance) -> otPanId;
9305}
9306unsafe extern "C" {
9307 #[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"]
9308 pub fn otLinkSetPanId(aInstance: *mut otInstance, aPanId: otPanId) -> otError;
9309}
9310unsafe extern "C" {
9311 #[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"]
9312 pub fn otLinkGetPollPeriod(aInstance: *mut otInstance) -> u32;
9313}
9314unsafe extern "C" {
9315 #[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"]
9316 pub fn otLinkSetPollPeriod(aInstance: *mut otInstance, aPollPeriod: u32) -> otError;
9317}
9318unsafe extern "C" {
9319 #[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."]
9320 pub fn otLinkGetShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9321}
9322unsafe extern "C" {
9323 #[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."]
9324 pub fn otLinkGetAlternateShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9325}
9326unsafe extern "C" {
9327 #[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."]
9328 pub fn otLinkGetMaxFrameRetriesDirect(aInstance: *mut otInstance) -> u8;
9329}
9330unsafe extern "C" {
9331 #[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."]
9332 pub fn otLinkSetMaxFrameRetriesDirect(aInstance: *mut otInstance, aMaxFrameRetriesDirect: u8);
9333}
9334unsafe extern "C" {
9335 #[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."]
9336 pub fn otLinkGetMaxFrameRetriesIndirect(aInstance: *mut otInstance) -> u8;
9337}
9338unsafe extern "C" {
9339 #[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."]
9340 pub fn otLinkSetMaxFrameRetriesIndirect(
9341 aInstance: *mut otInstance,
9342 aMaxFrameRetriesIndirect: u8,
9343 );
9344}
9345unsafe extern "C" {
9346 #[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."]
9347 pub fn otLinkGetFrameCounter(aInstance: *mut otInstance) -> u32;
9348}
9349unsafe extern "C" {
9350 #[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."]
9351 pub fn otLinkFilterGetAddressMode(aInstance: *mut otInstance) -> otMacFilterAddressMode;
9352}
9353unsafe extern "C" {
9354 #[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."]
9355 pub fn otLinkFilterSetAddressMode(aInstance: *mut otInstance, aMode: otMacFilterAddressMode);
9356}
9357unsafe extern "C" {
9358 #[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."]
9359 pub fn otLinkFilterAddAddress(
9360 aInstance: *mut otInstance,
9361 aExtAddress: *const otExtAddress,
9362 ) -> otError;
9363}
9364unsafe extern "C" {
9365 #[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)."]
9366 pub fn otLinkFilterRemoveAddress(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9367}
9368unsafe extern "C" {
9369 #[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."]
9370 pub fn otLinkFilterClearAddresses(aInstance: *mut otInstance);
9371}
9372unsafe extern "C" {
9373 #[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."]
9374 pub fn otLinkFilterGetNextAddress(
9375 aInstance: *mut otInstance,
9376 aIterator: *mut otMacFilterIterator,
9377 aEntry: *mut otMacFilterEntry,
9378 ) -> otError;
9379}
9380unsafe extern "C" {
9381 #[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."]
9382 pub fn otLinkFilterAddRssIn(
9383 aInstance: *mut otInstance,
9384 aExtAddress: *const otExtAddress,
9385 aRss: i8,
9386 ) -> otError;
9387}
9388unsafe extern "C" {
9389 #[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."]
9390 pub fn otLinkFilterRemoveRssIn(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9391}
9392unsafe extern "C" {
9393 #[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."]
9394 pub fn otLinkFilterSetDefaultRssIn(aInstance: *mut otInstance, aRss: i8);
9395}
9396unsafe extern "C" {
9397 #[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."]
9398 pub fn otLinkFilterClearDefaultRssIn(aInstance: *mut otInstance);
9399}
9400unsafe extern "C" {
9401 #[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."]
9402 pub fn otLinkFilterClearAllRssIn(aInstance: *mut otInstance);
9403}
9404unsafe extern "C" {
9405 #[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."]
9406 pub fn otLinkFilterGetNextRssIn(
9407 aInstance: *mut otInstance,
9408 aIterator: *mut otMacFilterIterator,
9409 aEntry: *mut otMacFilterEntry,
9410 ) -> otError;
9411}
9412unsafe extern "C" {
9413 #[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"]
9414 pub fn otLinkSetRadioFilterEnabled(aInstance: *mut otInstance, aFilterEnabled: bool);
9415}
9416unsafe extern "C" {
9417 #[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."]
9418 pub fn otLinkIsRadioFilterEnabled(aInstance: *mut otInstance) -> bool;
9419}
9420unsafe extern "C" {
9421 #[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."]
9422 pub fn otLinkConvertRssToLinkQuality(aInstance: *mut otInstance, aRss: i8) -> u8;
9423}
9424unsafe extern "C" {
9425 #[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."]
9426 pub fn otLinkConvertLinkQualityToRss(aInstance: *mut otInstance, aLinkQuality: u8) -> i8;
9427}
9428unsafe extern "C" {
9429 #[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."]
9430 pub fn otLinkGetTxDirectRetrySuccessHistogram(
9431 aInstance: *mut otInstance,
9432 aNumberOfEntries: *mut u8,
9433 ) -> *const u32;
9434}
9435unsafe extern "C" {
9436 #[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."]
9437 pub fn otLinkGetTxIndirectRetrySuccessHistogram(
9438 aInstance: *mut otInstance,
9439 aNumberOfEntries: *mut u8,
9440 ) -> *const u32;
9441}
9442unsafe extern "C" {
9443 #[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."]
9444 pub fn otLinkResetTxRetrySuccessHistogram(aInstance: *mut otInstance);
9445}
9446unsafe extern "C" {
9447 #[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."]
9448 pub fn otLinkGetCounters(aInstance: *mut otInstance) -> *const otMacCounters;
9449}
9450unsafe extern "C" {
9451 #[doc = " Resets the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9452 pub fn otLinkResetCounters(aInstance: *mut otInstance);
9453}
9454#[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."]
9455pub type otLinkPcapCallback = ::std::option::Option<
9456 unsafe extern "C" fn(
9457 aFrame: *const otRadioFrame,
9458 aIsTx: bool,
9459 aContext: *mut ::std::os::raw::c_void,
9460 ),
9461>;
9462unsafe extern "C" {
9463 #[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."]
9464 pub fn otLinkSetPcapCallback(
9465 aInstance: *mut otInstance,
9466 aPcapCallback: otLinkPcapCallback,
9467 aCallbackContext: *mut ::std::os::raw::c_void,
9468 );
9469}
9470unsafe extern "C" {
9471 #[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."]
9472 pub fn otLinkIsPromiscuous(aInstance: *mut otInstance) -> bool;
9473}
9474unsafe extern "C" {
9475 #[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."]
9476 pub fn otLinkSetPromiscuous(aInstance: *mut otInstance, aPromiscuous: bool) -> otError;
9477}
9478unsafe extern "C" {
9479 #[doc = " Gets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL channel."]
9480 pub fn otLinkGetCslChannel(aInstance: *mut otInstance) -> u8;
9481}
9482unsafe extern "C" {
9483 #[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."]
9484 pub fn otLinkSetCslChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9485}
9486unsafe extern "C" {
9487 #[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."]
9488 pub fn otLinkGetCslPeriod(aInstance: *mut otInstance) -> u32;
9489}
9490unsafe extern "C" {
9491 #[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"]
9492 pub fn otLinkSetCslPeriod(aInstance: *mut otInstance, aPeriod: u32) -> otError;
9493}
9494unsafe extern "C" {
9495 #[doc = " Gets the CSL timeout.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL timeout in seconds."]
9496 pub fn otLinkGetCslTimeout(aInstance: *mut otInstance) -> u32;
9497}
9498unsafe extern "C" {
9499 #[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."]
9500 pub fn otLinkSetCslTimeout(aInstance: *mut otInstance, aTimeout: u32) -> otError;
9501}
9502unsafe extern "C" {
9503 #[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."]
9504 pub fn otLinkGetCcaFailureRate(aInstance: *mut otInstance) -> u16;
9505}
9506unsafe extern "C" {
9507 #[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."]
9508 pub fn otLinkSetEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9509}
9510unsafe extern "C" {
9511 #[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."]
9512 pub fn otLinkIsEnabled(aInstance: *mut otInstance) -> bool;
9513}
9514unsafe extern "C" {
9515 #[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."]
9516 pub fn otLinkIsCslEnabled(aInstance: *mut otInstance) -> bool;
9517}
9518unsafe extern "C" {
9519 #[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."]
9520 pub fn otLinkIsCslSupported(aInstance: *mut otInstance) -> bool;
9521}
9522unsafe extern "C" {
9523 #[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."]
9524 pub fn otLinkSendEmptyData(aInstance: *mut otInstance) -> otError;
9525}
9526unsafe extern "C" {
9527 #[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."]
9528 pub fn otLinkSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
9529}
9530unsafe extern "C" {
9531 #[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."]
9532 pub fn otLinkGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
9533}
9534unsafe extern "C" {
9535 #[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."]
9536 pub fn otLinkGetWakeupChannel(aInstance: *mut otInstance) -> u8;
9537}
9538unsafe extern "C" {
9539 #[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."]
9540 pub fn otLinkSetWakeupChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9541}
9542unsafe extern "C" {
9543 #[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."]
9544 pub fn otLinkSetWakeUpListenEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9545}
9546unsafe extern "C" {
9547 #[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."]
9548 pub fn otLinkIsWakeupListenEnabled(aInstance: *mut otInstance) -> bool;
9549}
9550unsafe extern "C" {
9551 #[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."]
9552 pub fn otLinkGetWakeupListenParameters(
9553 aInstance: *mut otInstance,
9554 aInterval: *mut u32,
9555 aDuration: *mut u32,
9556 );
9557}
9558unsafe extern "C" {
9559 #[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."]
9560 pub fn otLinkSetWakeupListenParameters(
9561 aInstance: *mut otInstance,
9562 aInterval: u32,
9563 aDuration: u32,
9564 ) -> otError;
9565}
9566unsafe extern "C" {
9567 #[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."]
9568 pub fn otLinkSetRxOnWhenIdle(aInstance: *mut otInstance, aRxOnWhenIdle: bool) -> otError;
9569}
9570#[doc = "< The Thread stack is disabled."]
9571pub const OT_DEVICE_ROLE_DISABLED: otDeviceRole = 0;
9572#[doc = "< Not currently participating in a Thread network/partition."]
9573pub const OT_DEVICE_ROLE_DETACHED: otDeviceRole = 1;
9574#[doc = "< The Thread Child role."]
9575pub const OT_DEVICE_ROLE_CHILD: otDeviceRole = 2;
9576#[doc = "< The Thread Router role."]
9577pub const OT_DEVICE_ROLE_ROUTER: otDeviceRole = 3;
9578#[doc = "< The Thread Leader role."]
9579pub const OT_DEVICE_ROLE_LEADER: otDeviceRole = 4;
9580#[doc = " Represents a Thread device role."]
9581pub type otDeviceRole = ::std::os::raw::c_uint;
9582#[doc = " Represents an MLE Link Mode configuration."]
9583#[repr(C)]
9584#[derive(Debug, Default, Copy, Clone)]
9585pub struct otLinkModeConfig {
9586 pub _bitfield_align_1: [u8; 0],
9587 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9588}
9589impl otLinkModeConfig {
9590 #[inline]
9591 pub fn mRxOnWhenIdle(&self) -> bool {
9592 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9593 }
9594 #[inline]
9595 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9596 unsafe {
9597 let val: u8 = ::std::mem::transmute(val);
9598 self._bitfield_1.set(0usize, 1u8, val as u64)
9599 }
9600 }
9601 #[inline]
9602 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9603 unsafe {
9604 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9605 ::std::ptr::addr_of!((*this)._bitfield_1),
9606 0usize,
9607 1u8,
9608 ) as u8)
9609 }
9610 }
9611 #[inline]
9612 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9613 unsafe {
9614 let val: u8 = ::std::mem::transmute(val);
9615 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9616 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9617 0usize,
9618 1u8,
9619 val as u64,
9620 )
9621 }
9622 }
9623 #[inline]
9624 pub fn mDeviceType(&self) -> bool {
9625 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9626 }
9627 #[inline]
9628 pub fn set_mDeviceType(&mut self, val: bool) {
9629 unsafe {
9630 let val: u8 = ::std::mem::transmute(val);
9631 self._bitfield_1.set(1usize, 1u8, val as u64)
9632 }
9633 }
9634 #[inline]
9635 pub unsafe fn mDeviceType_raw(this: *const Self) -> bool {
9636 unsafe {
9637 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9638 ::std::ptr::addr_of!((*this)._bitfield_1),
9639 1usize,
9640 1u8,
9641 ) as u8)
9642 }
9643 }
9644 #[inline]
9645 pub unsafe fn set_mDeviceType_raw(this: *mut Self, val: bool) {
9646 unsafe {
9647 let val: u8 = ::std::mem::transmute(val);
9648 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9649 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9650 1usize,
9651 1u8,
9652 val as u64,
9653 )
9654 }
9655 }
9656 #[inline]
9657 pub fn mNetworkData(&self) -> bool {
9658 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9659 }
9660 #[inline]
9661 pub fn set_mNetworkData(&mut self, val: bool) {
9662 unsafe {
9663 let val: u8 = ::std::mem::transmute(val);
9664 self._bitfield_1.set(2usize, 1u8, val as u64)
9665 }
9666 }
9667 #[inline]
9668 pub unsafe fn mNetworkData_raw(this: *const Self) -> bool {
9669 unsafe {
9670 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9671 ::std::ptr::addr_of!((*this)._bitfield_1),
9672 2usize,
9673 1u8,
9674 ) as u8)
9675 }
9676 }
9677 #[inline]
9678 pub unsafe fn set_mNetworkData_raw(this: *mut Self, val: bool) {
9679 unsafe {
9680 let val: u8 = ::std::mem::transmute(val);
9681 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9682 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9683 2usize,
9684 1u8,
9685 val as u64,
9686 )
9687 }
9688 }
9689 #[inline]
9690 pub fn new_bitfield_1(
9691 mRxOnWhenIdle: bool,
9692 mDeviceType: bool,
9693 mNetworkData: bool,
9694 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9695 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9696 __bindgen_bitfield_unit.set(0usize, 1u8, {
9697 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9698 mRxOnWhenIdle as u64
9699 });
9700 __bindgen_bitfield_unit.set(1usize, 1u8, {
9701 let mDeviceType: u8 = unsafe { ::std::mem::transmute(mDeviceType) };
9702 mDeviceType as u64
9703 });
9704 __bindgen_bitfield_unit.set(2usize, 1u8, {
9705 let mNetworkData: u8 = unsafe { ::std::mem::transmute(mNetworkData) };
9706 mNetworkData as u64
9707 });
9708 __bindgen_bitfield_unit
9709 }
9710}
9711#[doc = " Holds diagnostic information for a neighboring Thread node"]
9712#[repr(C)]
9713#[derive(Debug, Default, Copy, Clone)]
9714pub struct otNeighborInfo {
9715 #[doc = "< IEEE 802.15.4 Extended Address"]
9716 pub mExtAddress: otExtAddress,
9717 #[doc = "< Seconds since last heard"]
9718 pub mAge: u32,
9719 #[doc = "< Seconds since link establishment (requires `CONFIG_UPTIME_ENABLE`)"]
9720 pub mConnectionTime: u32,
9721 #[doc = "< RLOC16"]
9722 pub mRloc16: u16,
9723 #[doc = "< Link Frame Counter"]
9724 pub mLinkFrameCounter: u32,
9725 #[doc = "< MLE Frame Counter"]
9726 pub mMleFrameCounter: u32,
9727 #[doc = "< Link Quality In"]
9728 pub mLinkQualityIn: u8,
9729 #[doc = "< Average RSSI"]
9730 pub mAverageRssi: i8,
9731 #[doc = "< Last observed RSSI"]
9732 pub mLastRssi: i8,
9733 #[doc = "< Link Margin"]
9734 pub mLinkMargin: u8,
9735 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
9736 pub mFrameErrorRate: u16,
9737 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
9738 pub mMessageErrorRate: u16,
9739 #[doc = "< Thread version of the neighbor"]
9740 pub mVersion: u16,
9741 pub _bitfield_align_1: [u8; 0],
9742 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9743 pub __bindgen_padding_0: u8,
9744}
9745impl otNeighborInfo {
9746 #[inline]
9747 pub fn mRxOnWhenIdle(&self) -> bool {
9748 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9749 }
9750 #[inline]
9751 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9752 unsafe {
9753 let val: u8 = ::std::mem::transmute(val);
9754 self._bitfield_1.set(0usize, 1u8, val as u64)
9755 }
9756 }
9757 #[inline]
9758 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9759 unsafe {
9760 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9761 ::std::ptr::addr_of!((*this)._bitfield_1),
9762 0usize,
9763 1u8,
9764 ) as u8)
9765 }
9766 }
9767 #[inline]
9768 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9769 unsafe {
9770 let val: u8 = ::std::mem::transmute(val);
9771 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9772 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9773 0usize,
9774 1u8,
9775 val as u64,
9776 )
9777 }
9778 }
9779 #[inline]
9780 pub fn mFullThreadDevice(&self) -> bool {
9781 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9782 }
9783 #[inline]
9784 pub fn set_mFullThreadDevice(&mut self, val: bool) {
9785 unsafe {
9786 let val: u8 = ::std::mem::transmute(val);
9787 self._bitfield_1.set(1usize, 1u8, val as u64)
9788 }
9789 }
9790 #[inline]
9791 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
9792 unsafe {
9793 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9794 ::std::ptr::addr_of!((*this)._bitfield_1),
9795 1usize,
9796 1u8,
9797 ) as u8)
9798 }
9799 }
9800 #[inline]
9801 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
9802 unsafe {
9803 let val: u8 = ::std::mem::transmute(val);
9804 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9805 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9806 1usize,
9807 1u8,
9808 val as u64,
9809 )
9810 }
9811 }
9812 #[inline]
9813 pub fn mFullNetworkData(&self) -> bool {
9814 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9815 }
9816 #[inline]
9817 pub fn set_mFullNetworkData(&mut self, val: bool) {
9818 unsafe {
9819 let val: u8 = ::std::mem::transmute(val);
9820 self._bitfield_1.set(2usize, 1u8, val as u64)
9821 }
9822 }
9823 #[inline]
9824 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
9825 unsafe {
9826 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9827 ::std::ptr::addr_of!((*this)._bitfield_1),
9828 2usize,
9829 1u8,
9830 ) as u8)
9831 }
9832 }
9833 #[inline]
9834 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
9835 unsafe {
9836 let val: u8 = ::std::mem::transmute(val);
9837 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9838 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9839 2usize,
9840 1u8,
9841 val as u64,
9842 )
9843 }
9844 }
9845 #[inline]
9846 pub fn mIsChild(&self) -> bool {
9847 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
9848 }
9849 #[inline]
9850 pub fn set_mIsChild(&mut self, val: bool) {
9851 unsafe {
9852 let val: u8 = ::std::mem::transmute(val);
9853 self._bitfield_1.set(3usize, 1u8, val as u64)
9854 }
9855 }
9856 #[inline]
9857 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
9858 unsafe {
9859 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9860 ::std::ptr::addr_of!((*this)._bitfield_1),
9861 3usize,
9862 1u8,
9863 ) as u8)
9864 }
9865 }
9866 #[inline]
9867 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
9868 unsafe {
9869 let val: u8 = ::std::mem::transmute(val);
9870 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9871 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9872 3usize,
9873 1u8,
9874 val as u64,
9875 )
9876 }
9877 }
9878 #[inline]
9879 pub fn new_bitfield_1(
9880 mRxOnWhenIdle: bool,
9881 mFullThreadDevice: bool,
9882 mFullNetworkData: bool,
9883 mIsChild: bool,
9884 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9885 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9886 __bindgen_bitfield_unit.set(0usize, 1u8, {
9887 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9888 mRxOnWhenIdle as u64
9889 });
9890 __bindgen_bitfield_unit.set(1usize, 1u8, {
9891 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
9892 mFullThreadDevice as u64
9893 });
9894 __bindgen_bitfield_unit.set(2usize, 1u8, {
9895 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
9896 mFullNetworkData as u64
9897 });
9898 __bindgen_bitfield_unit.set(3usize, 1u8, {
9899 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
9900 mIsChild as u64
9901 });
9902 __bindgen_bitfield_unit
9903 }
9904}
9905pub type otNeighborInfoIterator = i16;
9906#[doc = " Represents the Thread Leader Data."]
9907#[repr(C)]
9908#[derive(Debug, Default, Copy, Clone)]
9909pub struct otLeaderData {
9910 #[doc = "< Partition ID"]
9911 pub mPartitionId: u32,
9912 #[doc = "< Leader Weight"]
9913 pub mWeighting: u8,
9914 #[doc = "< Full Network Data Version"]
9915 pub mDataVersion: u8,
9916 #[doc = "< Stable Network Data Version"]
9917 pub mStableDataVersion: u8,
9918 #[doc = "< Leader Router ID"]
9919 pub mLeaderRouterId: u8,
9920}
9921#[doc = " Holds diagnostic information for a Thread Router"]
9922#[repr(C)]
9923#[derive(Debug, Default, Copy, Clone)]
9924pub struct otRouterInfo {
9925 #[doc = "< IEEE 802.15.4 Extended Address"]
9926 pub mExtAddress: otExtAddress,
9927 #[doc = "< RLOC16"]
9928 pub mRloc16: u16,
9929 #[doc = "< Router ID"]
9930 pub mRouterId: u8,
9931 #[doc = "< Next hop to router"]
9932 pub mNextHop: u8,
9933 #[doc = "< Path cost to router"]
9934 pub mPathCost: u8,
9935 #[doc = "< Link Quality In"]
9936 pub mLinkQualityIn: u8,
9937 #[doc = "< Link Quality Out"]
9938 pub mLinkQualityOut: u8,
9939 #[doc = "< Time last heard"]
9940 pub mAge: u8,
9941 pub _bitfield_align_1: [u8; 0],
9942 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9943 #[doc = "< Thread version"]
9944 pub mVersion: u8,
9945 #[doc = "< CSL clock accuracy, in ± ppm"]
9946 pub mCslClockAccuracy: u8,
9947 #[doc = "< CSL uncertainty, in ±10 us"]
9948 pub mCslUncertainty: u8,
9949}
9950impl otRouterInfo {
9951 #[inline]
9952 pub fn mAllocated(&self) -> bool {
9953 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9954 }
9955 #[inline]
9956 pub fn set_mAllocated(&mut self, val: bool) {
9957 unsafe {
9958 let val: u8 = ::std::mem::transmute(val);
9959 self._bitfield_1.set(0usize, 1u8, val as u64)
9960 }
9961 }
9962 #[inline]
9963 pub unsafe fn mAllocated_raw(this: *const Self) -> bool {
9964 unsafe {
9965 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9966 ::std::ptr::addr_of!((*this)._bitfield_1),
9967 0usize,
9968 1u8,
9969 ) as u8)
9970 }
9971 }
9972 #[inline]
9973 pub unsafe fn set_mAllocated_raw(this: *mut Self, val: bool) {
9974 unsafe {
9975 let val: u8 = ::std::mem::transmute(val);
9976 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9977 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9978 0usize,
9979 1u8,
9980 val as u64,
9981 )
9982 }
9983 }
9984 #[inline]
9985 pub fn mLinkEstablished(&self) -> bool {
9986 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9987 }
9988 #[inline]
9989 pub fn set_mLinkEstablished(&mut self, val: bool) {
9990 unsafe {
9991 let val: u8 = ::std::mem::transmute(val);
9992 self._bitfield_1.set(1usize, 1u8, val as u64)
9993 }
9994 }
9995 #[inline]
9996 pub unsafe fn mLinkEstablished_raw(this: *const Self) -> bool {
9997 unsafe {
9998 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9999 ::std::ptr::addr_of!((*this)._bitfield_1),
10000 1usize,
10001 1u8,
10002 ) as u8)
10003 }
10004 }
10005 #[inline]
10006 pub unsafe fn set_mLinkEstablished_raw(this: *mut Self, val: bool) {
10007 unsafe {
10008 let val: u8 = ::std::mem::transmute(val);
10009 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10010 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10011 1usize,
10012 1u8,
10013 val as u64,
10014 )
10015 }
10016 }
10017 #[inline]
10018 pub fn new_bitfield_1(
10019 mAllocated: bool,
10020 mLinkEstablished: bool,
10021 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10022 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10023 __bindgen_bitfield_unit.set(0usize, 1u8, {
10024 let mAllocated: u8 = unsafe { ::std::mem::transmute(mAllocated) };
10025 mAllocated as u64
10026 });
10027 __bindgen_bitfield_unit.set(1usize, 1u8, {
10028 let mLinkEstablished: u8 = unsafe { ::std::mem::transmute(mLinkEstablished) };
10029 mLinkEstablished as u64
10030 });
10031 __bindgen_bitfield_unit
10032 }
10033}
10034#[doc = " Represents the IP level counters."]
10035#[repr(C)]
10036#[derive(Debug, Default, Copy, Clone)]
10037pub struct otIpCounters {
10038 #[doc = "< The number of IPv6 packets successfully transmitted."]
10039 pub mTxSuccess: u32,
10040 #[doc = "< The number of IPv6 packets successfully received."]
10041 pub mRxSuccess: u32,
10042 #[doc = "< The number of IPv6 packets failed to transmit."]
10043 pub mTxFailure: u32,
10044 #[doc = "< The number of IPv6 packets failed to receive."]
10045 pub mRxFailure: u32,
10046}
10047#[doc = " Represents the Thread MLE counters."]
10048#[repr(C)]
10049#[derive(Debug, Default, Copy, Clone)]
10050pub struct otMleCounters {
10051 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DISABLED role."]
10052 pub mDisabledRole: u16,
10053 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DETACHED role."]
10054 pub mDetachedRole: u16,
10055 #[doc = "< Number of times device entered OT_DEVICE_ROLE_CHILD role."]
10056 pub mChildRole: u16,
10057 #[doc = "< Number of times device entered OT_DEVICE_ROLE_ROUTER role."]
10058 pub mRouterRole: u16,
10059 #[doc = "< Number of times device entered OT_DEVICE_ROLE_LEADER role."]
10060 pub mLeaderRole: u16,
10061 #[doc = "< Number of attach attempts while device was detached."]
10062 pub mAttachAttempts: u16,
10063 #[doc = "< Number of changes to partition ID."]
10064 pub mPartitionIdChanges: u16,
10065 #[doc = "< Number of attempts to attach to a better partition."]
10066 pub mBetterPartitionAttachAttempts: u16,
10067 #[doc = "< Number of attempts to attach to find a better parent (parent search)."]
10068 pub mBetterParentAttachAttempts: u16,
10069 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role."]
10070 pub mDisabledTime: u64,
10071 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role."]
10072 pub mDetachedTime: u64,
10073 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role."]
10074 pub mChildTime: u64,
10075 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role."]
10076 pub mRouterTime: u64,
10077 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role."]
10078 pub mLeaderTime: u64,
10079 #[doc = "< Number of milliseconds tracked by previous counters."]
10080 pub mTrackedTime: u64,
10081 #[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)."]
10082 pub mParentChanges: u16,
10083}
10084#[doc = " Represents the MLE Parent Response data."]
10085#[repr(C)]
10086#[derive(Debug, Default, Copy, Clone)]
10087pub struct otThreadParentResponseInfo {
10088 #[doc = "< IEEE 802.15.4 Extended Address of the Parent"]
10089 pub mExtAddr: otExtAddress,
10090 #[doc = "< Short address of the Parent"]
10091 pub mRloc16: u16,
10092 #[doc = "< Rssi of the Parent"]
10093 pub mRssi: i8,
10094 #[doc = "< Parent priority"]
10095 pub mPriority: i8,
10096 #[doc = "< Parent Link Quality 3"]
10097 pub mLinkQuality3: u8,
10098 #[doc = "< Parent Link Quality 2"]
10099 pub mLinkQuality2: u8,
10100 #[doc = "< Parent Link Quality 1"]
10101 pub mLinkQuality1: u8,
10102 #[doc = "< Is the node receiving parent response attached"]
10103 pub mIsAttached: bool,
10104}
10105#[doc = " This callback informs the application that the detaching process has finished.\n\n @param[in] aContext A pointer to application-specific context."]
10106pub type otDetachGracefullyCallback =
10107 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
10108#[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."]
10109pub type otWakeupCallback = ::std::option::Option<
10110 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
10111>;
10112unsafe extern "C" {
10113 #[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."]
10114 pub fn otThreadSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
10115}
10116unsafe extern "C" {
10117 #[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."]
10118 pub fn otThreadGetVersion() -> u16;
10119}
10120unsafe extern "C" {
10121 #[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."]
10122 pub fn otThreadIsSingleton(aInstance: *mut otInstance) -> bool;
10123}
10124unsafe extern "C" {
10125 #[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."]
10126 pub fn otThreadDiscover(
10127 aInstance: *mut otInstance,
10128 aScanChannels: u32,
10129 aPanId: u16,
10130 aJoiner: bool,
10131 aEnableEui64Filtering: bool,
10132 aCallback: otHandleActiveScanResult,
10133 aCallbackContext: *mut ::std::os::raw::c_void,
10134 ) -> otError;
10135}
10136unsafe extern "C" {
10137 #[doc = " Determines if an MLE Thread Discovery is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10138 pub fn otThreadIsDiscoverInProgress(aInstance: *mut otInstance) -> bool;
10139}
10140unsafe extern "C" {
10141 #[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."]
10142 pub fn otThreadSetJoinerAdvertisement(
10143 aInstance: *mut otInstance,
10144 aOui: u32,
10145 aAdvData: *const u8,
10146 aAdvDataLength: u8,
10147 ) -> otError;
10148}
10149unsafe extern "C" {
10150 #[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"]
10151 pub fn otThreadGetChildTimeout(aInstance: *mut otInstance) -> u32;
10152}
10153unsafe extern "C" {
10154 #[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"]
10155 pub fn otThreadSetChildTimeout(aInstance: *mut otInstance, aTimeout: u32);
10156}
10157unsafe extern "C" {
10158 #[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"]
10159 pub fn otThreadGetExtendedPanId(aInstance: *mut otInstance) -> *const otExtendedPanId;
10160}
10161unsafe extern "C" {
10162 #[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"]
10163 pub fn otThreadSetExtendedPanId(
10164 aInstance: *mut otInstance,
10165 aExtendedPanId: *const otExtendedPanId,
10166 ) -> otError;
10167}
10168unsafe extern "C" {
10169 #[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."]
10170 pub fn otThreadGetLeaderRloc(
10171 aInstance: *mut otInstance,
10172 aLeaderRloc: *mut otIp6Address,
10173 ) -> otError;
10174}
10175unsafe extern "C" {
10176 #[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"]
10177 pub fn otThreadGetLinkMode(aInstance: *mut otInstance) -> otLinkModeConfig;
10178}
10179unsafe extern "C" {
10180 #[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"]
10181 pub fn otThreadSetLinkMode(aInstance: *mut otInstance, aConfig: otLinkModeConfig) -> otError;
10182}
10183unsafe extern "C" {
10184 #[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"]
10185 pub fn otThreadGetNetworkKey(aInstance: *mut otInstance, aNetworkKey: *mut otNetworkKey);
10186}
10187unsafe extern "C" {
10188 #[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"]
10189 pub fn otThreadGetNetworkKeyRef(aInstance: *mut otInstance) -> otNetworkKeyRef;
10190}
10191unsafe extern "C" {
10192 #[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"]
10193 pub fn otThreadSetNetworkKey(aInstance: *mut otInstance, aKey: *const otNetworkKey) -> otError;
10194}
10195unsafe extern "C" {
10196 #[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"]
10197 pub fn otThreadSetNetworkKeyRef(
10198 aInstance: *mut otInstance,
10199 aKeyRef: otNetworkKeyRef,
10200 ) -> otError;
10201}
10202unsafe extern "C" {
10203 #[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."]
10204 pub fn otThreadGetRloc(aInstance: *mut otInstance) -> *const otIp6Address;
10205}
10206unsafe extern "C" {
10207 #[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."]
10208 pub fn otThreadGetMeshLocalEid(aInstance: *mut otInstance) -> *const otIp6Address;
10209}
10210unsafe extern "C" {
10211 #[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."]
10212 pub fn otThreadGetMeshLocalPrefix(aInstance: *mut otInstance) -> *const otMeshLocalPrefix;
10213}
10214unsafe extern "C" {
10215 #[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."]
10216 pub fn otThreadSetMeshLocalPrefix(
10217 aInstance: *mut otInstance,
10218 aMeshLocalPrefix: *const otMeshLocalPrefix,
10219 ) -> otError;
10220}
10221unsafe extern "C" {
10222 #[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."]
10223 pub fn otThreadGetLinkLocalIp6Address(aInstance: *mut otInstance) -> *const otIp6Address;
10224}
10225unsafe extern "C" {
10226 #[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."]
10227 pub fn otThreadGetLinkLocalAllThreadNodesMulticastAddress(
10228 aInstance: *mut otInstance,
10229 ) -> *const otIp6Address;
10230}
10231unsafe extern "C" {
10232 #[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."]
10233 pub fn otThreadGetRealmLocalAllThreadNodesMulticastAddress(
10234 aInstance: *mut otInstance,
10235 ) -> *const otIp6Address;
10236}
10237unsafe extern "C" {
10238 #[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."]
10239 pub fn otThreadGetServiceAloc(
10240 aInstance: *mut otInstance,
10241 aServiceId: u8,
10242 aServiceAloc: *mut otIp6Address,
10243 ) -> otError;
10244}
10245unsafe extern "C" {
10246 #[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"]
10247 pub fn otThreadGetNetworkName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10248}
10249unsafe extern "C" {
10250 #[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"]
10251 pub fn otThreadSetNetworkName(
10252 aInstance: *mut otInstance,
10253 aNetworkName: *const ::std::os::raw::c_char,
10254 ) -> otError;
10255}
10256unsafe extern "C" {
10257 #[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"]
10258 pub fn otThreadGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10259}
10260unsafe extern "C" {
10261 #[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"]
10262 pub fn otThreadSetDomainName(
10263 aInstance: *mut otInstance,
10264 aDomainName: *const ::std::os::raw::c_char,
10265 ) -> otError;
10266}
10267unsafe extern "C" {
10268 #[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"]
10269 pub fn otThreadGetKeySequenceCounter(aInstance: *mut otInstance) -> u32;
10270}
10271unsafe extern "C" {
10272 #[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"]
10273 pub fn otThreadSetKeySequenceCounter(aInstance: *mut otInstance, aKeySequenceCounter: u32);
10274}
10275unsafe extern "C" {
10276 #[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"]
10277 pub fn otThreadGetKeySwitchGuardTime(aInstance: *mut otInstance) -> u16;
10278}
10279unsafe extern "C" {
10280 #[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"]
10281 pub fn otThreadSetKeySwitchGuardTime(aInstance: *mut otInstance, aKeySwitchGuardTime: u16);
10282}
10283unsafe extern "C" {
10284 #[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."]
10285 pub fn otThreadBecomeDetached(aInstance: *mut otInstance) -> otError;
10286}
10287unsafe extern "C" {
10288 #[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."]
10289 pub fn otThreadBecomeChild(aInstance: *mut otInstance) -> otError;
10290}
10291unsafe extern "C" {
10292 #[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."]
10293 pub fn otThreadGetNextNeighborInfo(
10294 aInstance: *mut otInstance,
10295 aIterator: *mut otNeighborInfoIterator,
10296 aInfo: *mut otNeighborInfo,
10297 ) -> otError;
10298}
10299unsafe extern "C" {
10300 #[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."]
10301 pub fn otThreadGetDeviceRole(aInstance: *mut otInstance) -> otDeviceRole;
10302}
10303unsafe extern "C" {
10304 #[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."]
10305 pub fn otThreadDeviceRoleToString(aRole: otDeviceRole) -> *const ::std::os::raw::c_char;
10306}
10307unsafe extern "C" {
10308 #[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."]
10309 pub fn otThreadGetLeaderData(
10310 aInstance: *mut otInstance,
10311 aLeaderData: *mut otLeaderData,
10312 ) -> otError;
10313}
10314unsafe extern "C" {
10315 #[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."]
10316 pub fn otThreadGetLeaderRouterId(aInstance: *mut otInstance) -> u8;
10317}
10318unsafe extern "C" {
10319 #[doc = " Get the Leader's Weight.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Weight."]
10320 pub fn otThreadGetLeaderWeight(aInstance: *mut otInstance) -> u8;
10321}
10322unsafe extern "C" {
10323 #[doc = " Get the Partition ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Partition ID."]
10324 pub fn otThreadGetPartitionId(aInstance: *mut otInstance) -> u32;
10325}
10326unsafe extern "C" {
10327 #[doc = " Get the RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RLOC16."]
10328 pub fn otThreadGetRloc16(aInstance: *mut otInstance) -> u16;
10329}
10330unsafe extern "C" {
10331 #[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."]
10332 pub fn otThreadGetParentInfo(
10333 aInstance: *mut otInstance,
10334 aParentInfo: *mut otRouterInfo,
10335 ) -> otError;
10336}
10337unsafe extern "C" {
10338 #[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."]
10339 pub fn otThreadGetParentAverageRssi(
10340 aInstance: *mut otInstance,
10341 aParentRssi: *mut i8,
10342 ) -> otError;
10343}
10344unsafe extern "C" {
10345 #[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."]
10346 pub fn otThreadGetParentLastRssi(aInstance: *mut otInstance, aLastRssi: *mut i8) -> otError;
10347}
10348unsafe extern "C" {
10349 #[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."]
10350 pub fn otThreadSearchForBetterParent(aInstance: *mut otInstance) -> otError;
10351}
10352unsafe extern "C" {
10353 #[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."]
10354 pub fn otThreadGetIp6Counters(aInstance: *mut otInstance) -> *const otIpCounters;
10355}
10356unsafe extern "C" {
10357 #[doc = " Resets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10358 pub fn otThreadResetIp6Counters(aInstance: *mut otInstance);
10359}
10360unsafe extern "C" {
10361 #[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."]
10362 pub fn otThreadGetTimeInQueueHistogram(
10363 aInstance: *mut otInstance,
10364 aNumBins: *mut u16,
10365 aBinInterval: *mut u32,
10366 ) -> *const u32;
10367}
10368unsafe extern "C" {
10369 #[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)."]
10370 pub fn otThreadGetMaxTimeInQueue(aInstance: *mut otInstance) -> u32;
10371}
10372unsafe extern "C" {
10373 #[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."]
10374 pub fn otThreadResetTimeInQueueStat(aInstance: *mut otInstance);
10375}
10376unsafe extern "C" {
10377 #[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."]
10378 pub fn otThreadGetMleCounters(aInstance: *mut otInstance) -> *const otMleCounters;
10379}
10380unsafe extern "C" {
10381 #[doc = " Resets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10382 pub fn otThreadResetMleCounters(aInstance: *mut otInstance);
10383}
10384unsafe extern "C" {
10385 #[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."]
10386 pub fn otThreadGetCurrentAttachDuration(aInstance: *mut otInstance) -> u32;
10387}
10388#[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."]
10389pub type otThreadParentResponseCallback = ::std::option::Option<
10390 unsafe extern "C" fn(
10391 aInfo: *mut otThreadParentResponseInfo,
10392 aContext: *mut ::std::os::raw::c_void,
10393 ),
10394>;
10395unsafe extern "C" {
10396 #[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."]
10397 pub fn otThreadRegisterParentResponseCallback(
10398 aInstance: *mut otInstance,
10399 aCallback: otThreadParentResponseCallback,
10400 aContext: *mut ::std::os::raw::c_void,
10401 );
10402}
10403#[doc = " Represents the Thread Discovery Request data."]
10404#[repr(C)]
10405#[derive(Debug, Default, Copy, Clone)]
10406pub struct otThreadDiscoveryRequestInfo {
10407 #[doc = "< IEEE 802.15.4 Extended Address of the requester"]
10408 pub mExtAddress: otExtAddress,
10409 pub _bitfield_align_1: [u8; 0],
10410 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10411}
10412impl otThreadDiscoveryRequestInfo {
10413 #[inline]
10414 pub fn mVersion(&self) -> u8 {
10415 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10416 }
10417 #[inline]
10418 pub fn set_mVersion(&mut self, val: u8) {
10419 unsafe {
10420 let val: u8 = ::std::mem::transmute(val);
10421 self._bitfield_1.set(0usize, 4u8, val as u64)
10422 }
10423 }
10424 #[inline]
10425 pub unsafe fn mVersion_raw(this: *const Self) -> u8 {
10426 unsafe {
10427 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10428 ::std::ptr::addr_of!((*this)._bitfield_1),
10429 0usize,
10430 4u8,
10431 ) as u8)
10432 }
10433 }
10434 #[inline]
10435 pub unsafe fn set_mVersion_raw(this: *mut Self, val: u8) {
10436 unsafe {
10437 let val: u8 = ::std::mem::transmute(val);
10438 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10439 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10440 0usize,
10441 4u8,
10442 val as u64,
10443 )
10444 }
10445 }
10446 #[inline]
10447 pub fn mIsJoiner(&self) -> bool {
10448 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10449 }
10450 #[inline]
10451 pub fn set_mIsJoiner(&mut self, val: bool) {
10452 unsafe {
10453 let val: u8 = ::std::mem::transmute(val);
10454 self._bitfield_1.set(4usize, 1u8, val as u64)
10455 }
10456 }
10457 #[inline]
10458 pub unsafe fn mIsJoiner_raw(this: *const Self) -> bool {
10459 unsafe {
10460 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10461 ::std::ptr::addr_of!((*this)._bitfield_1),
10462 4usize,
10463 1u8,
10464 ) as u8)
10465 }
10466 }
10467 #[inline]
10468 pub unsafe fn set_mIsJoiner_raw(this: *mut Self, val: bool) {
10469 unsafe {
10470 let val: u8 = ::std::mem::transmute(val);
10471 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10472 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10473 4usize,
10474 1u8,
10475 val as u64,
10476 )
10477 }
10478 }
10479 #[inline]
10480 pub fn new_bitfield_1(mVersion: u8, mIsJoiner: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10481 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10482 __bindgen_bitfield_unit.set(0usize, 4u8, {
10483 let mVersion: u8 = unsafe { ::std::mem::transmute(mVersion) };
10484 mVersion as u64
10485 });
10486 __bindgen_bitfield_unit.set(4usize, 1u8, {
10487 let mIsJoiner: u8 = unsafe { ::std::mem::transmute(mIsJoiner) };
10488 mIsJoiner as u64
10489 });
10490 __bindgen_bitfield_unit
10491 }
10492}
10493#[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."]
10494pub type otThreadDiscoveryRequestCallback = ::std::option::Option<
10495 unsafe extern "C" fn(
10496 aInfo: *const otThreadDiscoveryRequestInfo,
10497 aContext: *mut ::std::os::raw::c_void,
10498 ),
10499>;
10500unsafe extern "C" {
10501 #[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."]
10502 pub fn otThreadSetDiscoveryRequestCallback(
10503 aInstance: *mut otInstance,
10504 aCallback: otThreadDiscoveryRequestCallback,
10505 aContext: *mut ::std::os::raw::c_void,
10506 );
10507}
10508#[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)."]
10509pub type otThreadAnycastLocatorCallback = ::std::option::Option<
10510 unsafe extern "C" fn(
10511 aContext: *mut ::std::os::raw::c_void,
10512 aError: otError,
10513 aMeshLocalAddress: *const otIp6Address,
10514 aRloc16: u16,
10515 ),
10516>;
10517unsafe extern "C" {
10518 #[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."]
10519 pub fn otThreadLocateAnycastDestination(
10520 aInstance: *mut otInstance,
10521 aAnycastAddress: *const otIp6Address,
10522 aCallback: otThreadAnycastLocatorCallback,
10523 aContext: *mut ::std::os::raw::c_void,
10524 ) -> otError;
10525}
10526unsafe extern "C" {
10527 #[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."]
10528 pub fn otThreadIsAnycastLocateInProgress(aInstance: *mut otInstance) -> bool;
10529}
10530unsafe extern "C" {
10531 #[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."]
10532 pub fn otThreadSendAddressNotification(
10533 aInstance: *mut otInstance,
10534 aDestination: *mut otIp6Address,
10535 aTarget: *mut otIp6Address,
10536 aMlIid: *mut otIp6InterfaceIdentifier,
10537 );
10538}
10539unsafe extern "C" {
10540 #[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."]
10541 pub fn otThreadDetachGracefully(
10542 aInstance: *mut otInstance,
10543 aCallback: otDetachGracefullyCallback,
10544 aContext: *mut ::std::os::raw::c_void,
10545 ) -> otError;
10546}
10547unsafe extern "C" {
10548 #[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`."]
10549 pub fn otConvertDurationInSecondsToString(
10550 aDuration: u32,
10551 aBuffer: *mut ::std::os::raw::c_char,
10552 aSize: u16,
10553 );
10554}
10555unsafe extern "C" {
10556 #[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."]
10557 pub fn otThreadSetStoreFrameCounterAhead(
10558 aInstance: *mut otInstance,
10559 aStoreFrameCounterAhead: u32,
10560 );
10561}
10562unsafe extern "C" {
10563 #[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."]
10564 pub fn otThreadGetStoreFrameCounterAhead(aInstance: *mut otInstance) -> u32;
10565}
10566unsafe extern "C" {
10567 #[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."]
10568 pub fn otThreadWakeup(
10569 aInstance: *mut otInstance,
10570 aWedAddress: *const otExtAddress,
10571 aWakeupIntervalUs: u16,
10572 aWakeupDurationMs: u16,
10573 aCallback: otWakeupCallback,
10574 aCallbackContext: *mut ::std::os::raw::c_void,
10575 ) -> otError;
10576}
10577#[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()`,"]
10578#[repr(C)]
10579#[derive(Debug, Default, Copy, Clone)]
10580pub struct otHistoryTrackerIterator {
10581 pub mData32: u32,
10582 pub mData16: u16,
10583}
10584#[doc = " Represents Thread network info."]
10585#[repr(C)]
10586#[derive(Debug, Copy, Clone)]
10587pub struct otHistoryTrackerNetworkInfo {
10588 #[doc = "< Device Role."]
10589 pub mRole: otDeviceRole,
10590 #[doc = "< Device Mode."]
10591 pub mMode: otLinkModeConfig,
10592 #[doc = "< Device RLOC16."]
10593 pub mRloc16: u16,
10594 #[doc = "< Partition ID (valid when attached)."]
10595 pub mPartitionId: u32,
10596}
10597impl Default for otHistoryTrackerNetworkInfo {
10598 fn default() -> Self {
10599 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10600 unsafe {
10601 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10602 s.assume_init()
10603 }
10604 }
10605}
10606#[doc = "< Address is added."]
10607pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_ADDED: otHistoryTrackerAddressEvent = 0;
10608#[doc = "< Address is removed."]
10609pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_REMOVED: otHistoryTrackerAddressEvent = 1;
10610#[doc = " Defines the events for an IPv6 (unicast or multicast) address info (i.e., whether address is added\n or removed)."]
10611pub type otHistoryTrackerAddressEvent = ::std::os::raw::c_uint;
10612#[doc = " Represent a unicast IPv6 address info."]
10613#[repr(C)]
10614#[derive(Copy, Clone)]
10615pub struct otHistoryTrackerUnicastAddressInfo {
10616 #[doc = "< The unicast IPv6 address."]
10617 pub mAddress: otIp6Address,
10618 #[doc = "< The Prefix length (in bits)."]
10619 pub mPrefixLength: u8,
10620 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10621 pub mAddressOrigin: u8,
10622 #[doc = "< Indicates the event (address is added/removed)."]
10623 pub mEvent: otHistoryTrackerAddressEvent,
10624 pub _bitfield_align_1: [u8; 0],
10625 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10626 pub __bindgen_padding_0: [u8; 3usize],
10627}
10628impl Default for otHistoryTrackerUnicastAddressInfo {
10629 fn default() -> Self {
10630 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10631 unsafe {
10632 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10633 s.assume_init()
10634 }
10635 }
10636}
10637impl otHistoryTrackerUnicastAddressInfo {
10638 #[inline]
10639 pub fn mScope(&self) -> u8 {
10640 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10641 }
10642 #[inline]
10643 pub fn set_mScope(&mut self, val: u8) {
10644 unsafe {
10645 let val: u8 = ::std::mem::transmute(val);
10646 self._bitfield_1.set(0usize, 4u8, val as u64)
10647 }
10648 }
10649 #[inline]
10650 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
10651 unsafe {
10652 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10653 ::std::ptr::addr_of!((*this)._bitfield_1),
10654 0usize,
10655 4u8,
10656 ) as u8)
10657 }
10658 }
10659 #[inline]
10660 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
10661 unsafe {
10662 let val: u8 = ::std::mem::transmute(val);
10663 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10664 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10665 0usize,
10666 4u8,
10667 val as u64,
10668 )
10669 }
10670 }
10671 #[inline]
10672 pub fn mPreferred(&self) -> bool {
10673 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10674 }
10675 #[inline]
10676 pub fn set_mPreferred(&mut self, val: bool) {
10677 unsafe {
10678 let val: u8 = ::std::mem::transmute(val);
10679 self._bitfield_1.set(4usize, 1u8, val as u64)
10680 }
10681 }
10682 #[inline]
10683 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
10684 unsafe {
10685 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10686 ::std::ptr::addr_of!((*this)._bitfield_1),
10687 4usize,
10688 1u8,
10689 ) as u8)
10690 }
10691 }
10692 #[inline]
10693 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
10694 unsafe {
10695 let val: u8 = ::std::mem::transmute(val);
10696 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10697 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10698 4usize,
10699 1u8,
10700 val as u64,
10701 )
10702 }
10703 }
10704 #[inline]
10705 pub fn mValid(&self) -> bool {
10706 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
10707 }
10708 #[inline]
10709 pub fn set_mValid(&mut self, val: bool) {
10710 unsafe {
10711 let val: u8 = ::std::mem::transmute(val);
10712 self._bitfield_1.set(5usize, 1u8, val as u64)
10713 }
10714 }
10715 #[inline]
10716 pub unsafe fn mValid_raw(this: *const Self) -> bool {
10717 unsafe {
10718 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10719 ::std::ptr::addr_of!((*this)._bitfield_1),
10720 5usize,
10721 1u8,
10722 ) as u8)
10723 }
10724 }
10725 #[inline]
10726 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
10727 unsafe {
10728 let val: u8 = ::std::mem::transmute(val);
10729 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10730 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10731 5usize,
10732 1u8,
10733 val as u64,
10734 )
10735 }
10736 }
10737 #[inline]
10738 pub fn mRloc(&self) -> bool {
10739 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
10740 }
10741 #[inline]
10742 pub fn set_mRloc(&mut self, val: bool) {
10743 unsafe {
10744 let val: u8 = ::std::mem::transmute(val);
10745 self._bitfield_1.set(6usize, 1u8, val as u64)
10746 }
10747 }
10748 #[inline]
10749 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
10750 unsafe {
10751 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10752 ::std::ptr::addr_of!((*this)._bitfield_1),
10753 6usize,
10754 1u8,
10755 ) as u8)
10756 }
10757 }
10758 #[inline]
10759 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
10760 unsafe {
10761 let val: u8 = ::std::mem::transmute(val);
10762 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10763 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10764 6usize,
10765 1u8,
10766 val as u64,
10767 )
10768 }
10769 }
10770 #[inline]
10771 pub fn new_bitfield_1(
10772 mScope: u8,
10773 mPreferred: bool,
10774 mValid: bool,
10775 mRloc: bool,
10776 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10777 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10778 __bindgen_bitfield_unit.set(0usize, 4u8, {
10779 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
10780 mScope as u64
10781 });
10782 __bindgen_bitfield_unit.set(4usize, 1u8, {
10783 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
10784 mPreferred as u64
10785 });
10786 __bindgen_bitfield_unit.set(5usize, 1u8, {
10787 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
10788 mValid as u64
10789 });
10790 __bindgen_bitfield_unit.set(6usize, 1u8, {
10791 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
10792 mRloc as u64
10793 });
10794 __bindgen_bitfield_unit
10795 }
10796}
10797#[doc = " Represent an IPv6 multicast address info."]
10798#[repr(C)]
10799#[derive(Copy, Clone)]
10800pub struct otHistoryTrackerMulticastAddressInfo {
10801 #[doc = "< The IPv6 multicast address."]
10802 pub mAddress: otIp6Address,
10803 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10804 pub mAddressOrigin: u8,
10805 #[doc = "< Indicates the event (address is added/removed)."]
10806 pub mEvent: otHistoryTrackerAddressEvent,
10807}
10808impl Default for otHistoryTrackerMulticastAddressInfo {
10809 fn default() -> Self {
10810 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10811 unsafe {
10812 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10813 s.assume_init()
10814 }
10815 }
10816}
10817#[doc = "< Low priority level."]
10818pub const OT_HISTORY_TRACKER_MSG_PRIORITY_LOW: _bindgen_ty_10 = 0;
10819#[doc = "< Normal priority level."]
10820pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NORMAL: _bindgen_ty_10 = 1;
10821#[doc = "< High priority level."]
10822pub const OT_HISTORY_TRACKER_MSG_PRIORITY_HIGH: _bindgen_ty_10 = 2;
10823#[doc = "< Network Control priority level."]
10824pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NET: _bindgen_ty_10 = 3;
10825#[doc = " Constants representing message priority used in `otHistoryTrackerMessageInfo` struct."]
10826pub type _bindgen_ty_10 = ::std::os::raw::c_uint;
10827#[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."]
10828#[repr(C)]
10829#[derive(Copy, Clone)]
10830pub struct otHistoryTrackerMessageInfo {
10831 #[doc = "< IPv6 payload length (exclude IP6 header itself)."]
10832 pub mPayloadLength: u16,
10833 #[doc = "< RLOC16 of neighbor which sent/received the msg (`0xfffe` if no RLOC16)."]
10834 pub mNeighborRloc16: u16,
10835 #[doc = "< Source IPv6 address and port (if UDP/TCP)"]
10836 pub mSource: otSockAddr,
10837 #[doc = "< Destination IPv6 address and port (if UDP/TCP)."]
10838 pub mDestination: otSockAddr,
10839 #[doc = "< Message checksum (valid only for UDP/TCP/ICMP6)."]
10840 pub mChecksum: u16,
10841 #[doc = "< IP Protocol number (`OT_IP6_PROTO_*` enumeration)."]
10842 pub mIpProto: u8,
10843 #[doc = "< ICMP6 type if msg is ICMP6, zero otherwise (`OT_ICMP6_TYPE_*` enumeration)."]
10844 pub mIcmp6Type: u8,
10845 #[doc = "< RSS of received message or OT_RADIO_INVALID_RSSI if not known."]
10846 pub mAveRxRss: i8,
10847 pub _bitfield_align_1: [u8; 0],
10848 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10849}
10850impl Default for otHistoryTrackerMessageInfo {
10851 fn default() -> Self {
10852 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10853 unsafe {
10854 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10855 s.assume_init()
10856 }
10857 }
10858}
10859impl otHistoryTrackerMessageInfo {
10860 #[inline]
10861 pub fn mLinkSecurity(&self) -> bool {
10862 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10863 }
10864 #[inline]
10865 pub fn set_mLinkSecurity(&mut self, val: bool) {
10866 unsafe {
10867 let val: u8 = ::std::mem::transmute(val);
10868 self._bitfield_1.set(0usize, 1u8, val as u64)
10869 }
10870 }
10871 #[inline]
10872 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
10873 unsafe {
10874 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10875 ::std::ptr::addr_of!((*this)._bitfield_1),
10876 0usize,
10877 1u8,
10878 ) as u8)
10879 }
10880 }
10881 #[inline]
10882 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
10883 unsafe {
10884 let val: u8 = ::std::mem::transmute(val);
10885 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10886 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10887 0usize,
10888 1u8,
10889 val as u64,
10890 )
10891 }
10892 }
10893 #[inline]
10894 pub fn mTxSuccess(&self) -> bool {
10895 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10896 }
10897 #[inline]
10898 pub fn set_mTxSuccess(&mut self, val: bool) {
10899 unsafe {
10900 let val: u8 = ::std::mem::transmute(val);
10901 self._bitfield_1.set(1usize, 1u8, val as u64)
10902 }
10903 }
10904 #[inline]
10905 pub unsafe fn mTxSuccess_raw(this: *const Self) -> bool {
10906 unsafe {
10907 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10908 ::std::ptr::addr_of!((*this)._bitfield_1),
10909 1usize,
10910 1u8,
10911 ) as u8)
10912 }
10913 }
10914 #[inline]
10915 pub unsafe fn set_mTxSuccess_raw(this: *mut Self, val: bool) {
10916 unsafe {
10917 let val: u8 = ::std::mem::transmute(val);
10918 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10919 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10920 1usize,
10921 1u8,
10922 val as u64,
10923 )
10924 }
10925 }
10926 #[inline]
10927 pub fn mPriority(&self) -> u8 {
10928 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
10929 }
10930 #[inline]
10931 pub fn set_mPriority(&mut self, val: u8) {
10932 unsafe {
10933 let val: u8 = ::std::mem::transmute(val);
10934 self._bitfield_1.set(2usize, 2u8, val as u64)
10935 }
10936 }
10937 #[inline]
10938 pub unsafe fn mPriority_raw(this: *const Self) -> u8 {
10939 unsafe {
10940 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10941 ::std::ptr::addr_of!((*this)._bitfield_1),
10942 2usize,
10943 2u8,
10944 ) as u8)
10945 }
10946 }
10947 #[inline]
10948 pub unsafe fn set_mPriority_raw(this: *mut Self, val: u8) {
10949 unsafe {
10950 let val: u8 = ::std::mem::transmute(val);
10951 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10952 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10953 2usize,
10954 2u8,
10955 val as u64,
10956 )
10957 }
10958 }
10959 #[inline]
10960 pub fn mRadioIeee802154(&self) -> bool {
10961 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10962 }
10963 #[inline]
10964 pub fn set_mRadioIeee802154(&mut self, val: bool) {
10965 unsafe {
10966 let val: u8 = ::std::mem::transmute(val);
10967 self._bitfield_1.set(4usize, 1u8, val as u64)
10968 }
10969 }
10970 #[inline]
10971 pub unsafe fn mRadioIeee802154_raw(this: *const Self) -> bool {
10972 unsafe {
10973 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10974 ::std::ptr::addr_of!((*this)._bitfield_1),
10975 4usize,
10976 1u8,
10977 ) as u8)
10978 }
10979 }
10980 #[inline]
10981 pub unsafe fn set_mRadioIeee802154_raw(this: *mut Self, val: bool) {
10982 unsafe {
10983 let val: u8 = ::std::mem::transmute(val);
10984 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10985 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10986 4usize,
10987 1u8,
10988 val as u64,
10989 )
10990 }
10991 }
10992 #[inline]
10993 pub fn mRadioTrelUdp6(&self) -> bool {
10994 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
10995 }
10996 #[inline]
10997 pub fn set_mRadioTrelUdp6(&mut self, val: bool) {
10998 unsafe {
10999 let val: u8 = ::std::mem::transmute(val);
11000 self._bitfield_1.set(5usize, 1u8, val as u64)
11001 }
11002 }
11003 #[inline]
11004 pub unsafe fn mRadioTrelUdp6_raw(this: *const Self) -> bool {
11005 unsafe {
11006 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11007 ::std::ptr::addr_of!((*this)._bitfield_1),
11008 5usize,
11009 1u8,
11010 ) as u8)
11011 }
11012 }
11013 #[inline]
11014 pub unsafe fn set_mRadioTrelUdp6_raw(this: *mut Self, val: bool) {
11015 unsafe {
11016 let val: u8 = ::std::mem::transmute(val);
11017 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11018 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11019 5usize,
11020 1u8,
11021 val as u64,
11022 )
11023 }
11024 }
11025 #[inline]
11026 pub fn new_bitfield_1(
11027 mLinkSecurity: bool,
11028 mTxSuccess: bool,
11029 mPriority: u8,
11030 mRadioIeee802154: bool,
11031 mRadioTrelUdp6: bool,
11032 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11033 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11034 __bindgen_bitfield_unit.set(0usize, 1u8, {
11035 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
11036 mLinkSecurity as u64
11037 });
11038 __bindgen_bitfield_unit.set(1usize, 1u8, {
11039 let mTxSuccess: u8 = unsafe { ::std::mem::transmute(mTxSuccess) };
11040 mTxSuccess as u64
11041 });
11042 __bindgen_bitfield_unit.set(2usize, 2u8, {
11043 let mPriority: u8 = unsafe { ::std::mem::transmute(mPriority) };
11044 mPriority as u64
11045 });
11046 __bindgen_bitfield_unit.set(4usize, 1u8, {
11047 let mRadioIeee802154: u8 = unsafe { ::std::mem::transmute(mRadioIeee802154) };
11048 mRadioIeee802154 as u64
11049 });
11050 __bindgen_bitfield_unit.set(5usize, 1u8, {
11051 let mRadioTrelUdp6: u8 = unsafe { ::std::mem::transmute(mRadioTrelUdp6) };
11052 mRadioTrelUdp6 as u64
11053 });
11054 __bindgen_bitfield_unit
11055 }
11056}
11057#[doc = "< Neighbor is added."]
11058pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_ADDED: otHistoryTrackerNeighborEvent = 0;
11059#[doc = "< Neighbor is removed."]
11060pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_REMOVED: otHistoryTrackerNeighborEvent = 1;
11061#[doc = "< Neighbor changed (e.g., device mode flags changed)."]
11062pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_CHANGED: otHistoryTrackerNeighborEvent = 2;
11063#[doc = "< Neighbor is being restored (applicable to child only)."]
11064pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_RESTORING: otHistoryTrackerNeighborEvent = 3;
11065#[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."]
11066pub type otHistoryTrackerNeighborEvent = ::std::os::raw::c_uint;
11067#[doc = " Represents a neighbor info."]
11068#[repr(C)]
11069#[derive(Debug, Default, Copy, Clone)]
11070pub struct otHistoryTrackerNeighborInfo {
11071 #[doc = "< Neighbor's Extended Address."]
11072 pub mExtAddress: otExtAddress,
11073 #[doc = "< Neighbor's RLOC16."]
11074 pub mRloc16: u16,
11075 #[doc = "< Average RSSI of rx frames from neighbor at the time of recording entry."]
11076 pub mAverageRssi: i8,
11077 pub _bitfield_align_1: [u8; 0],
11078 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11079}
11080impl otHistoryTrackerNeighborInfo {
11081 #[inline]
11082 pub fn mEvent(&self) -> u8 {
11083 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11084 }
11085 #[inline]
11086 pub fn set_mEvent(&mut self, val: u8) {
11087 unsafe {
11088 let val: u8 = ::std::mem::transmute(val);
11089 self._bitfield_1.set(0usize, 2u8, val as u64)
11090 }
11091 }
11092 #[inline]
11093 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11094 unsafe {
11095 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11096 ::std::ptr::addr_of!((*this)._bitfield_1),
11097 0usize,
11098 2u8,
11099 ) as u8)
11100 }
11101 }
11102 #[inline]
11103 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11104 unsafe {
11105 let val: u8 = ::std::mem::transmute(val);
11106 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11107 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11108 0usize,
11109 2u8,
11110 val as u64,
11111 )
11112 }
11113 }
11114 #[inline]
11115 pub fn mRxOnWhenIdle(&self) -> bool {
11116 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11117 }
11118 #[inline]
11119 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
11120 unsafe {
11121 let val: u8 = ::std::mem::transmute(val);
11122 self._bitfield_1.set(2usize, 1u8, val as u64)
11123 }
11124 }
11125 #[inline]
11126 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
11127 unsafe {
11128 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11129 ::std::ptr::addr_of!((*this)._bitfield_1),
11130 2usize,
11131 1u8,
11132 ) as u8)
11133 }
11134 }
11135 #[inline]
11136 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
11137 unsafe {
11138 let val: u8 = ::std::mem::transmute(val);
11139 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11140 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11141 2usize,
11142 1u8,
11143 val as u64,
11144 )
11145 }
11146 }
11147 #[inline]
11148 pub fn mFullThreadDevice(&self) -> bool {
11149 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11150 }
11151 #[inline]
11152 pub fn set_mFullThreadDevice(&mut self, val: bool) {
11153 unsafe {
11154 let val: u8 = ::std::mem::transmute(val);
11155 self._bitfield_1.set(3usize, 1u8, val as u64)
11156 }
11157 }
11158 #[inline]
11159 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
11160 unsafe {
11161 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11162 ::std::ptr::addr_of!((*this)._bitfield_1),
11163 3usize,
11164 1u8,
11165 ) as u8)
11166 }
11167 }
11168 #[inline]
11169 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
11170 unsafe {
11171 let val: u8 = ::std::mem::transmute(val);
11172 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11173 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11174 3usize,
11175 1u8,
11176 val as u64,
11177 )
11178 }
11179 }
11180 #[inline]
11181 pub fn mFullNetworkData(&self) -> bool {
11182 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11183 }
11184 #[inline]
11185 pub fn set_mFullNetworkData(&mut self, val: bool) {
11186 unsafe {
11187 let val: u8 = ::std::mem::transmute(val);
11188 self._bitfield_1.set(4usize, 1u8, val as u64)
11189 }
11190 }
11191 #[inline]
11192 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
11193 unsafe {
11194 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11195 ::std::ptr::addr_of!((*this)._bitfield_1),
11196 4usize,
11197 1u8,
11198 ) as u8)
11199 }
11200 }
11201 #[inline]
11202 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
11203 unsafe {
11204 let val: u8 = ::std::mem::transmute(val);
11205 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11206 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11207 4usize,
11208 1u8,
11209 val as u64,
11210 )
11211 }
11212 }
11213 #[inline]
11214 pub fn mIsChild(&self) -> bool {
11215 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11216 }
11217 #[inline]
11218 pub fn set_mIsChild(&mut self, val: bool) {
11219 unsafe {
11220 let val: u8 = ::std::mem::transmute(val);
11221 self._bitfield_1.set(5usize, 1u8, val as u64)
11222 }
11223 }
11224 #[inline]
11225 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
11226 unsafe {
11227 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11228 ::std::ptr::addr_of!((*this)._bitfield_1),
11229 5usize,
11230 1u8,
11231 ) as u8)
11232 }
11233 }
11234 #[inline]
11235 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
11236 unsafe {
11237 let val: u8 = ::std::mem::transmute(val);
11238 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11239 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11240 5usize,
11241 1u8,
11242 val as u64,
11243 )
11244 }
11245 }
11246 #[inline]
11247 pub fn new_bitfield_1(
11248 mEvent: u8,
11249 mRxOnWhenIdle: bool,
11250 mFullThreadDevice: bool,
11251 mFullNetworkData: bool,
11252 mIsChild: bool,
11253 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11254 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11255 __bindgen_bitfield_unit.set(0usize, 2u8, {
11256 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11257 mEvent as u64
11258 });
11259 __bindgen_bitfield_unit.set(2usize, 1u8, {
11260 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
11261 mRxOnWhenIdle as u64
11262 });
11263 __bindgen_bitfield_unit.set(3usize, 1u8, {
11264 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
11265 mFullThreadDevice as u64
11266 });
11267 __bindgen_bitfield_unit.set(4usize, 1u8, {
11268 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
11269 mFullNetworkData as u64
11270 });
11271 __bindgen_bitfield_unit.set(5usize, 1u8, {
11272 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
11273 mIsChild as u64
11274 });
11275 __bindgen_bitfield_unit
11276 }
11277}
11278#[doc = "< Router is added (router ID allocated)."]
11279pub const OT_HISTORY_TRACKER_ROUTER_EVENT_ADDED: otHistoryTrackerRouterEvent = 0;
11280#[doc = "< Router entry is removed (router ID released)."]
11281pub const OT_HISTORY_TRACKER_ROUTER_EVENT_REMOVED: otHistoryTrackerRouterEvent = 1;
11282#[doc = "< Router entry next hop and cost changed."]
11283pub const OT_HISTORY_TRACKER_ROUTER_EVENT_NEXT_HOP_CHANGED: otHistoryTrackerRouterEvent = 2;
11284#[doc = "< Router entry path cost changed (next hop as before)."]
11285pub const OT_HISTORY_TRACKER_ROUTER_EVENT_COST_CHANGED: otHistoryTrackerRouterEvent = 3;
11286#[doc = " Defines the events in a router info (i.e. whether router is added, removed, or changed)."]
11287pub type otHistoryTrackerRouterEvent = ::std::os::raw::c_uint;
11288#[doc = " Represents a router table entry event."]
11289#[repr(C)]
11290#[derive(Debug, Default, Copy, Clone)]
11291pub struct otHistoryTrackerRouterInfo {
11292 pub _bitfield_align_1: [u8; 0],
11293 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11294 #[doc = "< Next Hop Router ID - `OT_HISTORY_TRACKER_NO_NEXT_HOP` if no next hop."]
11295 pub mNextHop: u8,
11296 pub _bitfield_align_2: [u8; 0],
11297 pub _bitfield_2: __BindgenBitfieldUnit<[u8; 1usize]>,
11298}
11299impl otHistoryTrackerRouterInfo {
11300 #[inline]
11301 pub fn mEvent(&self) -> u8 {
11302 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11303 }
11304 #[inline]
11305 pub fn set_mEvent(&mut self, val: u8) {
11306 unsafe {
11307 let val: u8 = ::std::mem::transmute(val);
11308 self._bitfield_1.set(0usize, 2u8, val as u64)
11309 }
11310 }
11311 #[inline]
11312 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11313 unsafe {
11314 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11315 ::std::ptr::addr_of!((*this)._bitfield_1),
11316 0usize,
11317 2u8,
11318 ) as u8)
11319 }
11320 }
11321 #[inline]
11322 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11323 unsafe {
11324 let val: u8 = ::std::mem::transmute(val);
11325 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11326 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11327 0usize,
11328 2u8,
11329 val as u64,
11330 )
11331 }
11332 }
11333 #[inline]
11334 pub fn mRouterId(&self) -> u8 {
11335 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 6u8) as u8) }
11336 }
11337 #[inline]
11338 pub fn set_mRouterId(&mut self, val: u8) {
11339 unsafe {
11340 let val: u8 = ::std::mem::transmute(val);
11341 self._bitfield_1.set(2usize, 6u8, val as u64)
11342 }
11343 }
11344 #[inline]
11345 pub unsafe fn mRouterId_raw(this: *const Self) -> u8 {
11346 unsafe {
11347 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11348 ::std::ptr::addr_of!((*this)._bitfield_1),
11349 2usize,
11350 6u8,
11351 ) as u8)
11352 }
11353 }
11354 #[inline]
11355 pub unsafe fn set_mRouterId_raw(this: *mut Self, val: u8) {
11356 unsafe {
11357 let val: u8 = ::std::mem::transmute(val);
11358 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11359 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11360 2usize,
11361 6u8,
11362 val as u64,
11363 )
11364 }
11365 }
11366 #[inline]
11367 pub fn new_bitfield_1(mEvent: u8, mRouterId: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11368 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11369 __bindgen_bitfield_unit.set(0usize, 2u8, {
11370 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11371 mEvent as u64
11372 });
11373 __bindgen_bitfield_unit.set(2usize, 6u8, {
11374 let mRouterId: u8 = unsafe { ::std::mem::transmute(mRouterId) };
11375 mRouterId as u64
11376 });
11377 __bindgen_bitfield_unit
11378 }
11379 #[inline]
11380 pub fn mOldPathCost(&self) -> u8 {
11381 unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 4u8) as u8) }
11382 }
11383 #[inline]
11384 pub fn set_mOldPathCost(&mut self, val: u8) {
11385 unsafe {
11386 let val: u8 = ::std::mem::transmute(val);
11387 self._bitfield_2.set(0usize, 4u8, val as u64)
11388 }
11389 }
11390 #[inline]
11391 pub unsafe fn mOldPathCost_raw(this: *const Self) -> u8 {
11392 unsafe {
11393 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11394 ::std::ptr::addr_of!((*this)._bitfield_2),
11395 0usize,
11396 4u8,
11397 ) as u8)
11398 }
11399 }
11400 #[inline]
11401 pub unsafe fn set_mOldPathCost_raw(this: *mut Self, val: u8) {
11402 unsafe {
11403 let val: u8 = ::std::mem::transmute(val);
11404 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11405 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11406 0usize,
11407 4u8,
11408 val as u64,
11409 )
11410 }
11411 }
11412 #[inline]
11413 pub fn mPathCost(&self) -> u8 {
11414 unsafe { ::std::mem::transmute(self._bitfield_2.get(4usize, 4u8) as u8) }
11415 }
11416 #[inline]
11417 pub fn set_mPathCost(&mut self, val: u8) {
11418 unsafe {
11419 let val: u8 = ::std::mem::transmute(val);
11420 self._bitfield_2.set(4usize, 4u8, val as u64)
11421 }
11422 }
11423 #[inline]
11424 pub unsafe fn mPathCost_raw(this: *const Self) -> u8 {
11425 unsafe {
11426 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11427 ::std::ptr::addr_of!((*this)._bitfield_2),
11428 4usize,
11429 4u8,
11430 ) as u8)
11431 }
11432 }
11433 #[inline]
11434 pub unsafe fn set_mPathCost_raw(this: *mut Self, val: u8) {
11435 unsafe {
11436 let val: u8 = ::std::mem::transmute(val);
11437 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11438 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11439 4usize,
11440 4u8,
11441 val as u64,
11442 )
11443 }
11444 }
11445 #[inline]
11446 pub fn new_bitfield_2(mOldPathCost: u8, mPathCost: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11447 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11448 __bindgen_bitfield_unit.set(0usize, 4u8, {
11449 let mOldPathCost: u8 = unsafe { ::std::mem::transmute(mOldPathCost) };
11450 mOldPathCost as u64
11451 });
11452 __bindgen_bitfield_unit.set(4usize, 4u8, {
11453 let mPathCost: u8 = unsafe { ::std::mem::transmute(mPathCost) };
11454 mPathCost as u64
11455 });
11456 __bindgen_bitfield_unit
11457 }
11458}
11459#[doc = "< Network data entry is added."]
11460pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED: otHistoryTrackerNetDataEvent = 0;
11461#[doc = "< Network data entry is removed."]
11462pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED: otHistoryTrackerNetDataEvent = 1;
11463#[doc = " Defines the events for a Network Data entry (i.e., whether an entry is added or removed)."]
11464pub type otHistoryTrackerNetDataEvent = ::std::os::raw::c_uint;
11465#[doc = " Represent a Network Data on mesh prefix info."]
11466#[repr(C)]
11467#[derive(Copy, Clone)]
11468pub struct otHistoryTrackerOnMeshPrefixInfo {
11469 #[doc = "< The on mesh prefix entry."]
11470 pub mPrefix: otBorderRouterConfig,
11471 #[doc = "< Indicates the event (added/removed)."]
11472 pub mEvent: otHistoryTrackerNetDataEvent,
11473}
11474impl Default for otHistoryTrackerOnMeshPrefixInfo {
11475 fn default() -> Self {
11476 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11477 unsafe {
11478 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11479 s.assume_init()
11480 }
11481 }
11482}
11483#[doc = " Represent a Network Data extern route info."]
11484#[repr(C)]
11485#[derive(Copy, Clone)]
11486pub struct otHistoryTrackerExternalRouteInfo {
11487 #[doc = "< The external route entry."]
11488 pub mRoute: otExternalRouteConfig,
11489 #[doc = "< Indicates the event (added/removed)."]
11490 pub mEvent: otHistoryTrackerNetDataEvent,
11491}
11492impl Default for otHistoryTrackerExternalRouteInfo {
11493 fn default() -> Self {
11494 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11495 unsafe {
11496 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11497 s.assume_init()
11498 }
11499 }
11500}
11501#[doc = "< Unicast address type local (in server data)."]
11502pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_LOCAL: otHistoryTrackerDnsSrpAddrType = 0;
11503#[doc = "< Unicast address type infrastructure (in service data)."]
11504pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_INFRA: otHistoryTrackerDnsSrpAddrType = 1;
11505#[doc = "< Anycast address type."]
11506pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_ANYCAST: otHistoryTrackerDnsSrpAddrType = 2;
11507#[doc = " Represents the DNS/SRP server address type parsed from Network Data service entries."]
11508pub type otHistoryTrackerDnsSrpAddrType = ::std::os::raw::c_uint;
11509#[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."]
11510#[repr(C)]
11511#[derive(Copy, Clone)]
11512pub struct otHistoryTrackerDnsSrpAddrInfo {
11513 #[doc = "< The server address."]
11514 pub mAddress: otIp6Address,
11515 #[doc = "< The RLOC16 of the Border Router adding/removing the entry."]
11516 pub mRloc16: u16,
11517 #[doc = "< Port number."]
11518 pub mPort: u16,
11519 #[doc = "< Anycast sequence number."]
11520 pub mSequenceNumber: u8,
11521 #[doc = "< Version number."]
11522 pub mVersion: u8,
11523 #[doc = "< Address type."]
11524 pub mType: otHistoryTrackerDnsSrpAddrType,
11525 #[doc = "< Indicates the event (added/removed)."]
11526 pub mEvent: otHistoryTrackerNetDataEvent,
11527}
11528impl Default for otHistoryTrackerDnsSrpAddrInfo {
11529 fn default() -> Self {
11530 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11531 unsafe {
11532 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11533 s.assume_init()
11534 }
11535 }
11536}
11537#[doc = "< ePSKc mode is activated."]
11538pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_ACTIVATED:
11539 otHistoryTrackerBorderAgentEpskcEvent = 0;
11540#[doc = "< Secure session is connected."]
11541pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_CONNECTED:
11542 otHistoryTrackerBorderAgentEpskcEvent = 1;
11543#[doc = "< Commissioner petition is received."]
11544pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_PETITIONED:
11545 otHistoryTrackerBorderAgentEpskcEvent = 2;
11546#[doc = "< Active dataset is retrieved."]
11547pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_ACTIVE_DATASET:
11548 otHistoryTrackerBorderAgentEpskcEvent = 3;
11549#[doc = "< Pending dataset is retrieved."]
11550pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_PENDING_DATASET:
11551 otHistoryTrackerBorderAgentEpskcEvent = 4;
11552#[doc = "< Keep alive message is received."]
11553pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_KEEP_ALIVE:
11554 otHistoryTrackerBorderAgentEpskcEvent = 5;
11555#[doc = "< Deactivated by a call to the API."]
11556pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_LOCAL_CLOSE:
11557 otHistoryTrackerBorderAgentEpskcEvent = 6;
11558#[doc = "< Disconnected by the peer."]
11559pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_REMOTE_CLOSE:
11560 otHistoryTrackerBorderAgentEpskcEvent = 7;
11561#[doc = "< Disconnected due to some error."]
11562pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_ERROR:
11563 otHistoryTrackerBorderAgentEpskcEvent = 8;
11564#[doc = "< Disconnected due to timeout."]
11565pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_TIMEOUT:
11566 otHistoryTrackerBorderAgentEpskcEvent = 9;
11567#[doc = "< Max allowed attempts reached."]
11568pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_MAX_ATTEMPTS:
11569 otHistoryTrackerBorderAgentEpskcEvent = 10;
11570#[doc = "< ePSKc mode timed out."]
11571pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_EPSKC_TIMEOUT:
11572 otHistoryTrackerBorderAgentEpskcEvent = 11;
11573#[doc = "< Deactivated for an unknown reason."]
11574pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_UNKNOWN:
11575 otHistoryTrackerBorderAgentEpskcEvent = 12;
11576#[doc = " Represents events during the Border Agent's ePSKc journey."]
11577pub type otHistoryTrackerBorderAgentEpskcEvent = ::std::os::raw::c_uint;
11578#[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."]
11579#[repr(C)]
11580#[repr(align(4))]
11581#[derive(Copy, Clone)]
11582pub struct otHistoryTrackerFavoredOmrPrefix {
11583 #[doc = "< The OMR prefix."]
11584 pub mOmrPrefix: otIp6Prefix,
11585 pub _bitfield_align_1: [u8; 0],
11586 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11587 pub __bindgen_padding_0: u16,
11588}
11589impl Default for otHistoryTrackerFavoredOmrPrefix {
11590 fn default() -> Self {
11591 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11592 unsafe {
11593 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11594 s.assume_init()
11595 }
11596 }
11597}
11598impl otHistoryTrackerFavoredOmrPrefix {
11599 #[inline]
11600 pub fn mPreference(&self) -> ::std::os::raw::c_int {
11601 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
11602 }
11603 #[inline]
11604 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
11605 unsafe {
11606 let val: u32 = ::std::mem::transmute(val);
11607 self._bitfield_1.set(0usize, 2u8, val as u64)
11608 }
11609 }
11610 #[inline]
11611 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
11612 unsafe {
11613 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11614 ::std::ptr::addr_of!((*this)._bitfield_1),
11615 0usize,
11616 2u8,
11617 ) as u32)
11618 }
11619 }
11620 #[inline]
11621 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
11622 unsafe {
11623 let val: u32 = ::std::mem::transmute(val);
11624 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11625 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11626 0usize,
11627 2u8,
11628 val as u64,
11629 )
11630 }
11631 }
11632 #[inline]
11633 pub fn mIsLocal(&self) -> bool {
11634 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11635 }
11636 #[inline]
11637 pub fn set_mIsLocal(&mut self, val: bool) {
11638 unsafe {
11639 let val: u8 = ::std::mem::transmute(val);
11640 self._bitfield_1.set(2usize, 1u8, val as u64)
11641 }
11642 }
11643 #[inline]
11644 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11645 unsafe {
11646 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11647 ::std::ptr::addr_of!((*this)._bitfield_1),
11648 2usize,
11649 1u8,
11650 ) as u8)
11651 }
11652 }
11653 #[inline]
11654 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11655 unsafe {
11656 let val: u8 = ::std::mem::transmute(val);
11657 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11658 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11659 2usize,
11660 1u8,
11661 val as u64,
11662 )
11663 }
11664 }
11665 #[inline]
11666 pub fn new_bitfield_1(
11667 mPreference: ::std::os::raw::c_int,
11668 mIsLocal: bool,
11669 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11670 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11671 __bindgen_bitfield_unit.set(0usize, 2u8, {
11672 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
11673 mPreference as u64
11674 });
11675 __bindgen_bitfield_unit.set(2usize, 1u8, {
11676 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11677 mIsLocal as u64
11678 });
11679 __bindgen_bitfield_unit
11680 }
11681}
11682#[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."]
11683#[repr(C)]
11684#[derive(Copy, Clone)]
11685pub struct otHistoryTrackerFavoredOnLinkPrefix {
11686 #[doc = "< The on-link prefix."]
11687 pub mOnLinkPrefix: otIp6Prefix,
11688 pub _bitfield_align_1: [u8; 0],
11689 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11690}
11691impl Default for otHistoryTrackerFavoredOnLinkPrefix {
11692 fn default() -> Self {
11693 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11694 unsafe {
11695 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11696 s.assume_init()
11697 }
11698 }
11699}
11700impl otHistoryTrackerFavoredOnLinkPrefix {
11701 #[inline]
11702 pub fn mIsLocal(&self) -> bool {
11703 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11704 }
11705 #[inline]
11706 pub fn set_mIsLocal(&mut self, val: bool) {
11707 unsafe {
11708 let val: u8 = ::std::mem::transmute(val);
11709 self._bitfield_1.set(0usize, 1u8, val as u64)
11710 }
11711 }
11712 #[inline]
11713 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11714 unsafe {
11715 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11716 ::std::ptr::addr_of!((*this)._bitfield_1),
11717 0usize,
11718 1u8,
11719 ) as u8)
11720 }
11721 }
11722 #[inline]
11723 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11724 unsafe {
11725 let val: u8 = ::std::mem::transmute(val);
11726 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11727 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11728 0usize,
11729 1u8,
11730 val as u64,
11731 )
11732 }
11733 }
11734 #[inline]
11735 pub fn new_bitfield_1(mIsLocal: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11736 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11737 __bindgen_bitfield_unit.set(0usize, 1u8, {
11738 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11739 mIsLocal as u64
11740 });
11741 __bindgen_bitfield_unit
11742 }
11743}
11744#[doc = " Represents the DHCPv6-PD state and delegated prefix (if any) by a device acting as Border Router (BR)."]
11745#[repr(C)]
11746#[derive(Copy, Clone)]
11747pub struct otHistoryTrackerDhcp6PdInfo {
11748 #[doc = "< The delegated prefix if any. If none, it is set to `::/0`."]
11749 pub mPrefix: otIp6Prefix,
11750 #[doc = "< The DHCPv6 state."]
11751 pub mState: otBorderRoutingDhcp6PdState,
11752}
11753impl Default for otHistoryTrackerDhcp6PdInfo {
11754 fn default() -> Self {
11755 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11756 unsafe {
11757 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11758 s.assume_init()
11759 }
11760 }
11761}
11762#[doc = "< A new AIL router is discovered."]
11763pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_ADDED: otHistoryTrackerAilRouterEvent = 0;
11764#[doc = "< A property in the router's information has changed."]
11765pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_CHANGED: otHistoryTrackerAilRouterEvent = 1;
11766#[doc = "< The AIL router is removed and no longer tracked."]
11767pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_REMOVED: otHistoryTrackerAilRouterEvent = 2;
11768#[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."]
11769pub type otHistoryTrackerAilRouterEvent = ::std::os::raw::c_uint;
11770#[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)."]
11771#[repr(C)]
11772#[derive(Copy, Clone)]
11773pub struct otHistoryTrackerAilRouter {
11774 #[doc = "< The event type (e.g., added, changed, removed)."]
11775 pub mEvent: otHistoryTrackerAilRouterEvent,
11776 #[doc = "< Def route preference."]
11777 pub mDefRoutePreference: i8,
11778 #[doc = "< The IPv6 address of the AIL router."]
11779 pub mAddress: otIp6Address,
11780 #[doc = "< The favored on-link prefix, if any."]
11781 pub mFavoredOnLinkPrefix: otIp6Prefix,
11782 pub _bitfield_align_1: [u8; 0],
11783 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11784 pub __bindgen_padding_0: u8,
11785}
11786impl Default for otHistoryTrackerAilRouter {
11787 fn default() -> Self {
11788 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11789 unsafe {
11790 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11791 s.assume_init()
11792 }
11793 }
11794}
11795impl otHistoryTrackerAilRouter {
11796 #[inline]
11797 pub fn mProvidesDefaultRoute(&self) -> bool {
11798 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11799 }
11800 #[inline]
11801 pub fn set_mProvidesDefaultRoute(&mut self, val: bool) {
11802 unsafe {
11803 let val: u8 = ::std::mem::transmute(val);
11804 self._bitfield_1.set(0usize, 1u8, val as u64)
11805 }
11806 }
11807 #[inline]
11808 pub unsafe fn mProvidesDefaultRoute_raw(this: *const Self) -> bool {
11809 unsafe {
11810 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11811 ::std::ptr::addr_of!((*this)._bitfield_1),
11812 0usize,
11813 1u8,
11814 ) as u8)
11815 }
11816 }
11817 #[inline]
11818 pub unsafe fn set_mProvidesDefaultRoute_raw(this: *mut Self, val: bool) {
11819 unsafe {
11820 let val: u8 = ::std::mem::transmute(val);
11821 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11822 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11823 0usize,
11824 1u8,
11825 val as u64,
11826 )
11827 }
11828 }
11829 #[inline]
11830 pub fn mManagedAddressConfigFlag(&self) -> bool {
11831 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
11832 }
11833 #[inline]
11834 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
11835 unsafe {
11836 let val: u8 = ::std::mem::transmute(val);
11837 self._bitfield_1.set(1usize, 1u8, val as u64)
11838 }
11839 }
11840 #[inline]
11841 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
11842 unsafe {
11843 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11844 ::std::ptr::addr_of!((*this)._bitfield_1),
11845 1usize,
11846 1u8,
11847 ) as u8)
11848 }
11849 }
11850 #[inline]
11851 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
11852 unsafe {
11853 let val: u8 = ::std::mem::transmute(val);
11854 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11855 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11856 1usize,
11857 1u8,
11858 val as u64,
11859 )
11860 }
11861 }
11862 #[inline]
11863 pub fn mOtherConfigFlag(&self) -> bool {
11864 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11865 }
11866 #[inline]
11867 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
11868 unsafe {
11869 let val: u8 = ::std::mem::transmute(val);
11870 self._bitfield_1.set(2usize, 1u8, val as u64)
11871 }
11872 }
11873 #[inline]
11874 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
11875 unsafe {
11876 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11877 ::std::ptr::addr_of!((*this)._bitfield_1),
11878 2usize,
11879 1u8,
11880 ) as u8)
11881 }
11882 }
11883 #[inline]
11884 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
11885 unsafe {
11886 let val: u8 = ::std::mem::transmute(val);
11887 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11888 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11889 2usize,
11890 1u8,
11891 val as u64,
11892 )
11893 }
11894 }
11895 #[inline]
11896 pub fn mSnacRouterFlag(&self) -> bool {
11897 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11898 }
11899 #[inline]
11900 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
11901 unsafe {
11902 let val: u8 = ::std::mem::transmute(val);
11903 self._bitfield_1.set(3usize, 1u8, val as u64)
11904 }
11905 }
11906 #[inline]
11907 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
11908 unsafe {
11909 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11910 ::std::ptr::addr_of!((*this)._bitfield_1),
11911 3usize,
11912 1u8,
11913 ) as u8)
11914 }
11915 }
11916 #[inline]
11917 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
11918 unsafe {
11919 let val: u8 = ::std::mem::transmute(val);
11920 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11921 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11922 3usize,
11923 1u8,
11924 val as u64,
11925 )
11926 }
11927 }
11928 #[inline]
11929 pub fn mIsLocalDevice(&self) -> bool {
11930 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11931 }
11932 #[inline]
11933 pub fn set_mIsLocalDevice(&mut self, val: bool) {
11934 unsafe {
11935 let val: u8 = ::std::mem::transmute(val);
11936 self._bitfield_1.set(4usize, 1u8, val as u64)
11937 }
11938 }
11939 #[inline]
11940 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
11941 unsafe {
11942 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11943 ::std::ptr::addr_of!((*this)._bitfield_1),
11944 4usize,
11945 1u8,
11946 ) as u8)
11947 }
11948 }
11949 #[inline]
11950 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
11951 unsafe {
11952 let val: u8 = ::std::mem::transmute(val);
11953 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11954 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11955 4usize,
11956 1u8,
11957 val as u64,
11958 )
11959 }
11960 }
11961 #[inline]
11962 pub fn mIsReachable(&self) -> bool {
11963 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11964 }
11965 #[inline]
11966 pub fn set_mIsReachable(&mut self, val: bool) {
11967 unsafe {
11968 let val: u8 = ::std::mem::transmute(val);
11969 self._bitfield_1.set(5usize, 1u8, val as u64)
11970 }
11971 }
11972 #[inline]
11973 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
11974 unsafe {
11975 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11976 ::std::ptr::addr_of!((*this)._bitfield_1),
11977 5usize,
11978 1u8,
11979 ) as u8)
11980 }
11981 }
11982 #[inline]
11983 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
11984 unsafe {
11985 let val: u8 = ::std::mem::transmute(val);
11986 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11987 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11988 5usize,
11989 1u8,
11990 val as u64,
11991 )
11992 }
11993 }
11994 #[inline]
11995 pub fn mIsPeerBr(&self) -> bool {
11996 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
11997 }
11998 #[inline]
11999 pub fn set_mIsPeerBr(&mut self, val: bool) {
12000 unsafe {
12001 let val: u8 = ::std::mem::transmute(val);
12002 self._bitfield_1.set(6usize, 1u8, val as u64)
12003 }
12004 }
12005 #[inline]
12006 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
12007 unsafe {
12008 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12009 ::std::ptr::addr_of!((*this)._bitfield_1),
12010 6usize,
12011 1u8,
12012 ) as u8)
12013 }
12014 }
12015 #[inline]
12016 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
12017 unsafe {
12018 let val: u8 = ::std::mem::transmute(val);
12019 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12020 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12021 6usize,
12022 1u8,
12023 val as u64,
12024 )
12025 }
12026 }
12027 #[inline]
12028 pub fn new_bitfield_1(
12029 mProvidesDefaultRoute: bool,
12030 mManagedAddressConfigFlag: bool,
12031 mOtherConfigFlag: bool,
12032 mSnacRouterFlag: bool,
12033 mIsLocalDevice: bool,
12034 mIsReachable: bool,
12035 mIsPeerBr: bool,
12036 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12037 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12038 __bindgen_bitfield_unit.set(0usize, 1u8, {
12039 let mProvidesDefaultRoute: u8 = unsafe { ::std::mem::transmute(mProvidesDefaultRoute) };
12040 mProvidesDefaultRoute as u64
12041 });
12042 __bindgen_bitfield_unit.set(1usize, 1u8, {
12043 let mManagedAddressConfigFlag: u8 =
12044 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
12045 mManagedAddressConfigFlag as u64
12046 });
12047 __bindgen_bitfield_unit.set(2usize, 1u8, {
12048 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
12049 mOtherConfigFlag as u64
12050 });
12051 __bindgen_bitfield_unit.set(3usize, 1u8, {
12052 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
12053 mSnacRouterFlag as u64
12054 });
12055 __bindgen_bitfield_unit.set(4usize, 1u8, {
12056 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
12057 mIsLocalDevice as u64
12058 });
12059 __bindgen_bitfield_unit.set(5usize, 1u8, {
12060 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
12061 mIsReachable as u64
12062 });
12063 __bindgen_bitfield_unit.set(6usize, 1u8, {
12064 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
12065 mIsPeerBr as u64
12066 });
12067 __bindgen_bitfield_unit
12068 }
12069}
12070unsafe extern "C" {
12071 #[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)."]
12072 pub fn otHistoryTrackerInitIterator(aIterator: *mut otHistoryTrackerIterator);
12073}
12074unsafe extern "C" {
12075 #[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."]
12076 pub fn otHistoryTrackerIterateNetInfoHistory(
12077 aInstance: *mut otInstance,
12078 aIterator: *mut otHistoryTrackerIterator,
12079 aEntryAge: *mut u32,
12080 ) -> *const otHistoryTrackerNetworkInfo;
12081}
12082unsafe extern "C" {
12083 #[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."]
12084 pub fn otHistoryTrackerIterateUnicastAddressHistory(
12085 aInstance: *mut otInstance,
12086 aIterator: *mut otHistoryTrackerIterator,
12087 aEntryAge: *mut u32,
12088 ) -> *const otHistoryTrackerUnicastAddressInfo;
12089}
12090unsafe extern "C" {
12091 #[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."]
12092 pub fn otHistoryTrackerIterateMulticastAddressHistory(
12093 aInstance: *mut otInstance,
12094 aIterator: *mut otHistoryTrackerIterator,
12095 aEntryAge: *mut u32,
12096 ) -> *const otHistoryTrackerMulticastAddressInfo;
12097}
12098unsafe extern "C" {
12099 #[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."]
12100 pub fn otHistoryTrackerIterateRxHistory(
12101 aInstance: *mut otInstance,
12102 aIterator: *mut otHistoryTrackerIterator,
12103 aEntryAge: *mut u32,
12104 ) -> *const otHistoryTrackerMessageInfo;
12105}
12106unsafe extern "C" {
12107 #[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."]
12108 pub fn otHistoryTrackerIterateTxHistory(
12109 aInstance: *mut otInstance,
12110 aIterator: *mut otHistoryTrackerIterator,
12111 aEntryAge: *mut u32,
12112 ) -> *const otHistoryTrackerMessageInfo;
12113}
12114unsafe extern "C" {
12115 #[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."]
12116 pub fn otHistoryTrackerIterateNeighborHistory(
12117 aInstance: *mut otInstance,
12118 aIterator: *mut otHistoryTrackerIterator,
12119 aEntryAge: *mut u32,
12120 ) -> *const otHistoryTrackerNeighborInfo;
12121}
12122unsafe extern "C" {
12123 #[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."]
12124 pub fn otHistoryTrackerIterateRouterHistory(
12125 aInstance: *mut otInstance,
12126 aIterator: *mut otHistoryTrackerIterator,
12127 aEntryAge: *mut u32,
12128 ) -> *const otHistoryTrackerRouterInfo;
12129}
12130unsafe extern "C" {
12131 #[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."]
12132 pub fn otHistoryTrackerIterateOnMeshPrefixHistory(
12133 aInstance: *mut otInstance,
12134 aIterator: *mut otHistoryTrackerIterator,
12135 aEntryAge: *mut u32,
12136 ) -> *const otHistoryTrackerOnMeshPrefixInfo;
12137}
12138unsafe extern "C" {
12139 #[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."]
12140 pub fn otHistoryTrackerIterateExternalRouteHistory(
12141 aInstance: *mut otInstance,
12142 aIterator: *mut otHistoryTrackerIterator,
12143 aEntryAge: *mut u32,
12144 ) -> *const otHistoryTrackerExternalRouteInfo;
12145}
12146unsafe extern "C" {
12147 #[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."]
12148 pub fn otHistoryTrackerIterateDnsSrpAddrHistory(
12149 aInstance: *mut otInstance,
12150 aIterator: *mut otHistoryTrackerIterator,
12151 aEntryAge: *mut u32,
12152 ) -> *const otHistoryTrackerDnsSrpAddrInfo;
12153}
12154unsafe extern "C" {
12155 #[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."]
12156 pub fn otHistoryTrackerIterateBorderAgentEpskcEventHistory(
12157 aInstance: *mut otInstance,
12158 aIterator: *mut otHistoryTrackerIterator,
12159 aEntryAge: *mut u32,
12160 ) -> *const otHistoryTrackerBorderAgentEpskcEvent;
12161}
12162unsafe extern "C" {
12163 #[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."]
12164 pub fn otHistoryTrackerIterateFavoredOmrPrefixHistory(
12165 aInstance: *mut otInstance,
12166 aIterator: *mut otHistoryTrackerIterator,
12167 aEntryAge: *mut u32,
12168 ) -> *const otHistoryTrackerFavoredOmrPrefix;
12169}
12170unsafe extern "C" {
12171 #[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."]
12172 pub fn otHistoryTrackerIterateFavoredOnLinkPrefixHistory(
12173 aInstance: *mut otInstance,
12174 aIterator: *mut otHistoryTrackerIterator,
12175 aEntryAge: *mut u32,
12176 ) -> *const otHistoryTrackerFavoredOnLinkPrefix;
12177}
12178unsafe extern "C" {
12179 #[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."]
12180 pub fn otHistoryTrackerIterateDhcp6PdHistory(
12181 aInstance: *mut otInstance,
12182 aIterator: *mut otHistoryTrackerIterator,
12183 aEntryAge: *mut u32,
12184 ) -> *const otHistoryTrackerDhcp6PdInfo;
12185}
12186unsafe extern "C" {
12187 #[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."]
12188 pub fn otHistoryTrackerIterateAilRoutersHistory(
12189 aInstance: *mut otInstance,
12190 aIterator: *mut otHistoryTrackerIterator,
12191 aEntryAge: *mut u32,
12192 ) -> *const otHistoryTrackerAilRouter;
12193}
12194unsafe extern "C" {
12195 #[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`."]
12196 pub fn otHistoryTrackerEntryAgeToString(
12197 aEntryAge: u32,
12198 aBuffer: *mut ::std::os::raw::c_char,
12199 aSize: u16,
12200 );
12201}
12202#[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."]
12203pub type otHistoryTrackerNetInfoCallback = ::std::option::Option<
12204 unsafe extern "C" fn(
12205 aError: otError,
12206 aNetworkInfo: *const otHistoryTrackerNetworkInfo,
12207 aEntryAge: u32,
12208 aContext: *mut ::std::os::raw::c_void,
12209 ),
12210>;
12211unsafe extern "C" {
12212 #[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."]
12213 pub fn otHistoryTrackerQueryNetInfo(
12214 aInstance: *mut otInstance,
12215 aRloc16: u16,
12216 aMaxEntries: u16,
12217 aMaxEntryAge: u32,
12218 aCallback: otHistoryTrackerNetInfoCallback,
12219 aContext: *mut ::std::os::raw::c_void,
12220 ) -> otError;
12221}
12222unsafe extern "C" {
12223 #[doc = " Cancels any ongoing query.\n\n Requires `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE`.\n\n @param[in] aInstance The OpenThread instance."]
12224 pub fn otHistoryTrackerCancelQuery(aInstance: *mut otInstance);
12225}
12226#[doc = "< Destination Unreachable"]
12227pub const OT_ICMP6_TYPE_DST_UNREACH: otIcmp6Type = 1;
12228#[doc = "< Packet To Big"]
12229pub const OT_ICMP6_TYPE_PACKET_TO_BIG: otIcmp6Type = 2;
12230#[doc = "< Time Exceeded"]
12231pub const OT_ICMP6_TYPE_TIME_EXCEEDED: otIcmp6Type = 3;
12232#[doc = "< Parameter Problem"]
12233pub const OT_ICMP6_TYPE_PARAMETER_PROBLEM: otIcmp6Type = 4;
12234#[doc = "< Echo Request"]
12235pub const OT_ICMP6_TYPE_ECHO_REQUEST: otIcmp6Type = 128;
12236#[doc = "< Echo Reply"]
12237pub const OT_ICMP6_TYPE_ECHO_REPLY: otIcmp6Type = 129;
12238#[doc = "< Router Solicitation"]
12239pub const OT_ICMP6_TYPE_ROUTER_SOLICIT: otIcmp6Type = 133;
12240#[doc = "< Router Advertisement"]
12241pub const OT_ICMP6_TYPE_ROUTER_ADVERT: otIcmp6Type = 134;
12242#[doc = "< Neighbor Solicitation"]
12243pub const OT_ICMP6_TYPE_NEIGHBOR_SOLICIT: otIcmp6Type = 135;
12244#[doc = "< Neighbor Advertisement"]
12245pub const OT_ICMP6_TYPE_NEIGHBOR_ADVERT: otIcmp6Type = 136;
12246#[doc = " ICMPv6 Message Types"]
12247pub type otIcmp6Type = ::std::os::raw::c_uint;
12248#[doc = "< Destination Unreachable (Type 1) - No Route"]
12249pub const OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE: otIcmp6Code = 0;
12250#[doc = "< Destination Unreachable (Type 1) - Administratively Prohibited"]
12251pub const OT_ICMP6_CODE_DST_UNREACH_PROHIBITED: otIcmp6Code = 1;
12252#[doc = "< Time Exceeded (Type 3) - Fragment Reassembly"]
12253pub const OT_ICMP6_CODE_FRAGM_REAS_TIME_EX: otIcmp6Code = 1;
12254#[doc = " ICMPv6 Message Codes"]
12255pub type otIcmp6Code = ::std::os::raw::c_uint;
12256#[doc = " @struct otIcmp6Header\n\n Represents an ICMPv6 header."]
12257#[repr(C, packed)]
12258#[derive(Copy, Clone)]
12259pub struct otIcmp6Header {
12260 #[doc = "< Type"]
12261 pub mType: u8,
12262 #[doc = "< Code"]
12263 pub mCode: u8,
12264 #[doc = "< Checksum"]
12265 pub mChecksum: u16,
12266 #[doc = "< Message-specific data"]
12267 pub mData: otIcmp6Header__bindgen_ty_1,
12268}
12269#[repr(C, packed)]
12270#[derive(Copy, Clone)]
12271pub union otIcmp6Header__bindgen_ty_1 {
12272 pub m8: [u8; 4usize],
12273 pub m16: [u16; 2usize],
12274 pub m32: [u32; 1usize],
12275}
12276impl Default for otIcmp6Header__bindgen_ty_1 {
12277 fn default() -> Self {
12278 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12279 unsafe {
12280 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12281 s.assume_init()
12282 }
12283 }
12284}
12285impl Default for otIcmp6Header {
12286 fn default() -> Self {
12287 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12288 unsafe {
12289 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12290 s.assume_init()
12291 }
12292 }
12293}
12294#[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."]
12295pub type otIcmp6ReceiveCallback = ::std::option::Option<
12296 unsafe extern "C" fn(
12297 aContext: *mut ::std::os::raw::c_void,
12298 aMessage: *mut otMessage,
12299 aMessageInfo: *const otMessageInfo,
12300 aIcmpHeader: *const otIcmp6Header,
12301 ),
12302>;
12303#[doc = " Implements ICMPv6 message handler."]
12304#[repr(C)]
12305#[derive(Debug, Copy, Clone)]
12306pub struct otIcmp6Handler {
12307 #[doc = "< The ICMPv6 received callback"]
12308 pub mReceiveCallback: otIcmp6ReceiveCallback,
12309 #[doc = "< A pointer to arbitrary context information."]
12310 pub mContext: *mut ::std::os::raw::c_void,
12311 #[doc = "< A pointer to the next handler in the list."]
12312 pub mNext: *mut otIcmp6Handler,
12313}
12314impl Default for otIcmp6Handler {
12315 fn default() -> Self {
12316 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12317 unsafe {
12318 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12319 s.assume_init()
12320 }
12321 }
12322}
12323#[doc = "< ICMPv6 Echo processing disabled"]
12324pub const OT_ICMP6_ECHO_HANDLER_DISABLED: otIcmp6EchoMode = 0;
12325#[doc = "< ICMPv6 Echo processing enabled only for unicast requests only"]
12326pub const OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: otIcmp6EchoMode = 1;
12327#[doc = "< ICMPv6 Echo processing enabled only for multicast requests only"]
12328pub const OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: otIcmp6EchoMode = 2;
12329#[doc = "< ICMPv6 Echo processing enabled for unicast and multicast requests"]
12330pub const OT_ICMP6_ECHO_HANDLER_ALL: otIcmp6EchoMode = 3;
12331#[doc = "< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only"]
12332pub const OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: otIcmp6EchoMode = 4;
12333#[doc = " ICMPv6 Echo Reply Modes"]
12334pub type otIcmp6EchoMode = ::std::os::raw::c_uint;
12335unsafe extern "C" {
12336 #[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"]
12337 pub fn otIcmp6GetEchoMode(aInstance: *mut otInstance) -> otIcmp6EchoMode;
12338}
12339unsafe extern "C" {
12340 #[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."]
12341 pub fn otIcmp6SetEchoMode(aInstance: *mut otInstance, aMode: otIcmp6EchoMode);
12342}
12343unsafe extern "C" {
12344 #[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."]
12345 pub fn otIcmp6RegisterHandler(
12346 aInstance: *mut otInstance,
12347 aHandler: *mut otIcmp6Handler,
12348 ) -> otError;
12349}
12350unsafe extern "C" {
12351 #[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."]
12352 pub fn otIcmp6SendEchoRequest(
12353 aInstance: *mut otInstance,
12354 aMessage: *mut otMessage,
12355 aMessageInfo: *const otMessageInfo,
12356 aIdentifier: u16,
12357 ) -> otError;
12358}
12359#[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."]
12360pub type otJamDetectionCallback = ::std::option::Option<
12361 unsafe extern "C" fn(aJamState: bool, aContext: *mut ::std::os::raw::c_void),
12362>;
12363unsafe extern "C" {
12364 #[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."]
12365 pub fn otJamDetectionSetRssiThreshold(
12366 aInstance: *mut otInstance,
12367 aRssiThreshold: i8,
12368 ) -> otError;
12369}
12370unsafe extern "C" {
12371 #[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."]
12372 pub fn otJamDetectionGetRssiThreshold(aInstance: *mut otInstance) -> i8;
12373}
12374unsafe extern "C" {
12375 #[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)"]
12376 pub fn otJamDetectionSetWindow(aInstance: *mut otInstance, aWindow: u8) -> otError;
12377}
12378unsafe extern "C" {
12379 #[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."]
12380 pub fn otJamDetectionGetWindow(aInstance: *mut otInstance) -> u8;
12381}
12382unsafe extern "C" {
12383 #[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."]
12384 pub fn otJamDetectionSetBusyPeriod(aInstance: *mut otInstance, aBusyPeriod: u8) -> otError;
12385}
12386unsafe extern "C" {
12387 #[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."]
12388 pub fn otJamDetectionGetBusyPeriod(aInstance: *mut otInstance) -> u8;
12389}
12390unsafe extern "C" {
12391 #[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."]
12392 pub fn otJamDetectionStart(
12393 aInstance: *mut otInstance,
12394 aCallback: otJamDetectionCallback,
12395 aContext: *mut ::std::os::raw::c_void,
12396 ) -> otError;
12397}
12398unsafe extern "C" {
12399 #[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."]
12400 pub fn otJamDetectionStop(aInstance: *mut otInstance) -> otError;
12401}
12402unsafe extern "C" {
12403 #[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)."]
12404 pub fn otJamDetectionIsEnabled(aInstance: *mut otInstance) -> bool;
12405}
12406unsafe extern "C" {
12407 #[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)."]
12408 pub fn otJamDetectionGetState(aInstance: *mut otInstance) -> bool;
12409}
12410unsafe extern "C" {
12411 #[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."]
12412 pub fn otJamDetectionGetHistoryBitmap(aInstance: *mut otInstance) -> u64;
12413}
12414#[doc = " Represents the result (value) for a Link Metrics query."]
12415#[repr(C)]
12416#[derive(Debug, Default, Copy, Clone)]
12417pub struct otLinkMetricsValues {
12418 #[doc = "< Specifies which metrics values are present/included."]
12419 pub mMetrics: otLinkMetrics,
12420 #[doc = "< The value of Pdu Count."]
12421 pub mPduCountValue: u32,
12422 #[doc = "< The value LQI."]
12423 pub mLqiValue: u8,
12424 #[doc = "< The value of Link Margin."]
12425 pub mLinkMarginValue: u8,
12426 #[doc = "< The value of Rssi."]
12427 pub mRssiValue: i8,
12428}
12429#[doc = " Represents which frames are accounted in a Forward Tracking Series."]
12430#[repr(C)]
12431#[derive(Debug, Default, Copy, Clone)]
12432pub struct otLinkMetricsSeriesFlags {
12433 pub _bitfield_align_1: [u8; 0],
12434 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
12435}
12436impl otLinkMetricsSeriesFlags {
12437 #[inline]
12438 pub fn mLinkProbe(&self) -> bool {
12439 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
12440 }
12441 #[inline]
12442 pub fn set_mLinkProbe(&mut self, val: bool) {
12443 unsafe {
12444 let val: u8 = ::std::mem::transmute(val);
12445 self._bitfield_1.set(0usize, 1u8, val as u64)
12446 }
12447 }
12448 #[inline]
12449 pub unsafe fn mLinkProbe_raw(this: *const Self) -> bool {
12450 unsafe {
12451 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12452 ::std::ptr::addr_of!((*this)._bitfield_1),
12453 0usize,
12454 1u8,
12455 ) as u8)
12456 }
12457 }
12458 #[inline]
12459 pub unsafe fn set_mLinkProbe_raw(this: *mut Self, val: bool) {
12460 unsafe {
12461 let val: u8 = ::std::mem::transmute(val);
12462 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12463 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12464 0usize,
12465 1u8,
12466 val as u64,
12467 )
12468 }
12469 }
12470 #[inline]
12471 pub fn mMacData(&self) -> bool {
12472 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
12473 }
12474 #[inline]
12475 pub fn set_mMacData(&mut self, val: bool) {
12476 unsafe {
12477 let val: u8 = ::std::mem::transmute(val);
12478 self._bitfield_1.set(1usize, 1u8, val as u64)
12479 }
12480 }
12481 #[inline]
12482 pub unsafe fn mMacData_raw(this: *const Self) -> bool {
12483 unsafe {
12484 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12485 ::std::ptr::addr_of!((*this)._bitfield_1),
12486 1usize,
12487 1u8,
12488 ) as u8)
12489 }
12490 }
12491 #[inline]
12492 pub unsafe fn set_mMacData_raw(this: *mut Self, val: bool) {
12493 unsafe {
12494 let val: u8 = ::std::mem::transmute(val);
12495 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12496 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12497 1usize,
12498 1u8,
12499 val as u64,
12500 )
12501 }
12502 }
12503 #[inline]
12504 pub fn mMacDataRequest(&self) -> bool {
12505 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
12506 }
12507 #[inline]
12508 pub fn set_mMacDataRequest(&mut self, val: bool) {
12509 unsafe {
12510 let val: u8 = ::std::mem::transmute(val);
12511 self._bitfield_1.set(2usize, 1u8, val as u64)
12512 }
12513 }
12514 #[inline]
12515 pub unsafe fn mMacDataRequest_raw(this: *const Self) -> bool {
12516 unsafe {
12517 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12518 ::std::ptr::addr_of!((*this)._bitfield_1),
12519 2usize,
12520 1u8,
12521 ) as u8)
12522 }
12523 }
12524 #[inline]
12525 pub unsafe fn set_mMacDataRequest_raw(this: *mut Self, val: bool) {
12526 unsafe {
12527 let val: u8 = ::std::mem::transmute(val);
12528 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12529 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12530 2usize,
12531 1u8,
12532 val as u64,
12533 )
12534 }
12535 }
12536 #[inline]
12537 pub fn mMacAck(&self) -> bool {
12538 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
12539 }
12540 #[inline]
12541 pub fn set_mMacAck(&mut self, val: bool) {
12542 unsafe {
12543 let val: u8 = ::std::mem::transmute(val);
12544 self._bitfield_1.set(3usize, 1u8, val as u64)
12545 }
12546 }
12547 #[inline]
12548 pub unsafe fn mMacAck_raw(this: *const Self) -> bool {
12549 unsafe {
12550 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12551 ::std::ptr::addr_of!((*this)._bitfield_1),
12552 3usize,
12553 1u8,
12554 ) as u8)
12555 }
12556 }
12557 #[inline]
12558 pub unsafe fn set_mMacAck_raw(this: *mut Self, val: bool) {
12559 unsafe {
12560 let val: u8 = ::std::mem::transmute(val);
12561 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12562 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12563 3usize,
12564 1u8,
12565 val as u64,
12566 )
12567 }
12568 }
12569 #[inline]
12570 pub fn new_bitfield_1(
12571 mLinkProbe: bool,
12572 mMacData: bool,
12573 mMacDataRequest: bool,
12574 mMacAck: bool,
12575 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12576 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12577 __bindgen_bitfield_unit.set(0usize, 1u8, {
12578 let mLinkProbe: u8 = unsafe { ::std::mem::transmute(mLinkProbe) };
12579 mLinkProbe as u64
12580 });
12581 __bindgen_bitfield_unit.set(1usize, 1u8, {
12582 let mMacData: u8 = unsafe { ::std::mem::transmute(mMacData) };
12583 mMacData as u64
12584 });
12585 __bindgen_bitfield_unit.set(2usize, 1u8, {
12586 let mMacDataRequest: u8 = unsafe { ::std::mem::transmute(mMacDataRequest) };
12587 mMacDataRequest as u64
12588 });
12589 __bindgen_bitfield_unit.set(3usize, 1u8, {
12590 let mMacAck: u8 = unsafe { ::std::mem::transmute(mMacAck) };
12591 mMacAck as u64
12592 });
12593 __bindgen_bitfield_unit
12594 }
12595}
12596#[doc = "< Clear."]
12597pub const OT_LINK_METRICS_ENH_ACK_CLEAR: otLinkMetricsEnhAckFlags = 0;
12598#[doc = "< Register."]
12599pub const OT_LINK_METRICS_ENH_ACK_REGISTER: otLinkMetricsEnhAckFlags = 1;
12600#[doc = " Enhanced-ACK Flags.\n\n These are used in Enhanced-ACK Based Probing to indicate whether to register or clear the probing."]
12601pub type otLinkMetricsEnhAckFlags = ::std::os::raw::c_uint;
12602pub const OT_LINK_METRICS_STATUS_SUCCESS: otLinkMetricsStatus = 0;
12603pub const OT_LINK_METRICS_STATUS_CANNOT_SUPPORT_NEW_SERIES: otLinkMetricsStatus = 1;
12604pub const OT_LINK_METRICS_STATUS_SERIESID_ALREADY_REGISTERED: otLinkMetricsStatus = 2;
12605pub const OT_LINK_METRICS_STATUS_SERIESID_NOT_RECOGNIZED: otLinkMetricsStatus = 3;
12606pub const OT_LINK_METRICS_STATUS_NO_MATCHING_FRAMES_RECEIVED: otLinkMetricsStatus = 4;
12607pub const OT_LINK_METRICS_STATUS_OTHER_ERROR: otLinkMetricsStatus = 254;
12608#[doc = " Link Metrics Status values."]
12609pub type otLinkMetricsStatus = ::std::os::raw::c_uint;
12610#[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."]
12611pub type otLinkMetricsReportCallback = ::std::option::Option<
12612 unsafe extern "C" fn(
12613 aSource: *const otIp6Address,
12614 aMetricsValues: *const otLinkMetricsValues,
12615 aStatus: otLinkMetricsStatus,
12616 aContext: *mut ::std::os::raw::c_void,
12617 ),
12618>;
12619#[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."]
12620pub type otLinkMetricsMgmtResponseCallback = ::std::option::Option<
12621 unsafe extern "C" fn(
12622 aSource: *const otIp6Address,
12623 aStatus: otLinkMetricsStatus,
12624 aContext: *mut ::std::os::raw::c_void,
12625 ),
12626>;
12627#[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."]
12628pub type otLinkMetricsEnhAckProbingIeReportCallback = ::std::option::Option<
12629 unsafe extern "C" fn(
12630 aShortAddress: otShortAddress,
12631 aExtAddress: *const otExtAddress,
12632 aMetricsValues: *const otLinkMetricsValues,
12633 aContext: *mut ::std::os::raw::c_void,
12634 ),
12635>;
12636unsafe extern "C" {
12637 #[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."]
12638 pub fn otLinkMetricsQuery(
12639 aInstance: *mut otInstance,
12640 aDestination: *const otIp6Address,
12641 aSeriesId: u8,
12642 aLinkMetricsFlags: *const otLinkMetrics,
12643 aCallback: otLinkMetricsReportCallback,
12644 aCallbackContext: *mut ::std::os::raw::c_void,
12645 ) -> otError;
12646}
12647unsafe extern "C" {
12648 #[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."]
12649 pub fn otLinkMetricsConfigForwardTrackingSeries(
12650 aInstance: *mut otInstance,
12651 aDestination: *const otIp6Address,
12652 aSeriesId: u8,
12653 aSeriesFlags: otLinkMetricsSeriesFlags,
12654 aLinkMetricsFlags: *const otLinkMetrics,
12655 aCallback: otLinkMetricsMgmtResponseCallback,
12656 aCallbackContext: *mut ::std::os::raw::c_void,
12657 ) -> otError;
12658}
12659unsafe extern "C" {
12660 #[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."]
12661 pub fn otLinkMetricsConfigEnhAckProbing(
12662 aInstance: *mut otInstance,
12663 aDestination: *const otIp6Address,
12664 aEnhAckFlags: otLinkMetricsEnhAckFlags,
12665 aLinkMetricsFlags: *const otLinkMetrics,
12666 aCallback: otLinkMetricsMgmtResponseCallback,
12667 aCallbackContext: *mut ::std::os::raw::c_void,
12668 aEnhAckCallback: otLinkMetricsEnhAckProbingIeReportCallback,
12669 aEnhAckCallbackContext: *mut ::std::os::raw::c_void,
12670 ) -> otError;
12671}
12672unsafe extern "C" {
12673 #[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."]
12674 pub fn otLinkMetricsSendLinkProbe(
12675 aInstance: *mut otInstance,
12676 aDestination: *const otIp6Address,
12677 aSeriesId: u8,
12678 aLength: u8,
12679 ) -> otError;
12680}
12681unsafe extern "C" {
12682 #[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."]
12683 pub fn otLinkMetricsManagerIsEnabled(aInstance: *mut otInstance) -> bool;
12684}
12685unsafe extern "C" {
12686 #[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."]
12687 pub fn otLinkMetricsManagerSetEnabled(aInstance: *mut otInstance, aEnable: bool);
12688}
12689unsafe extern "C" {
12690 #[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."]
12691 pub fn otLinkMetricsManagerGetMetricsValueByExtAddr(
12692 aInstance: *mut otInstance,
12693 aExtAddress: *const otExtAddress,
12694 aLinkMetricsValues: *mut otLinkMetricsValues,
12695 ) -> otError;
12696}
12697#[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."]
12698pub type otLinkRawReceiveDone = ::std::option::Option<
12699 unsafe extern "C" fn(aInstance: *mut otInstance, aFrame: *mut otRadioFrame, aError: otError),
12700>;
12701unsafe extern "C" {
12702 #[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."]
12703 pub fn otLinkRawSetReceiveDone(
12704 aInstance: *mut otInstance,
12705 aCallback: otLinkRawReceiveDone,
12706 ) -> otError;
12707}
12708unsafe extern "C" {
12709 #[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."]
12710 pub fn otLinkRawIsEnabled(aInstance: *mut otInstance) -> bool;
12711}
12712unsafe extern "C" {
12713 #[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."]
12714 pub fn otLinkRawGetPromiscuous(aInstance: *mut otInstance) -> bool;
12715}
12716unsafe extern "C" {
12717 #[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."]
12718 pub fn otLinkRawSetPromiscuous(aInstance: *mut otInstance, aEnable: bool) -> otError;
12719}
12720unsafe extern "C" {
12721 #[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."]
12722 pub fn otLinkRawSetShortAddress(aInstance: *mut otInstance, aShortAddress: u16) -> otError;
12723}
12724unsafe extern "C" {
12725 #[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."]
12726 pub fn otLinkRawSetAlternateShortAddress(
12727 aInstance: *mut otInstance,
12728 aShortAddress: otShortAddress,
12729 ) -> otError;
12730}
12731unsafe extern "C" {
12732 #[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"]
12733 pub fn otLinkRawSleep(aInstance: *mut otInstance) -> otError;
12734}
12735unsafe extern "C" {
12736 #[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."]
12737 pub fn otLinkRawReceive(aInstance: *mut otInstance) -> otError;
12738}
12739unsafe extern "C" {
12740 #[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."]
12741 pub fn otLinkRawGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
12742}
12743#[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."]
12744pub type otLinkRawTransmitDone = ::std::option::Option<
12745 unsafe extern "C" fn(
12746 aInstance: *mut otInstance,
12747 aFrame: *mut otRadioFrame,
12748 aAckFrame: *mut otRadioFrame,
12749 aError: otError,
12750 ),
12751>;
12752unsafe extern "C" {
12753 #[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."]
12754 pub fn otLinkRawTransmit(
12755 aInstance: *mut otInstance,
12756 aCallback: otLinkRawTransmitDone,
12757 ) -> otError;
12758}
12759unsafe extern "C" {
12760 #[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."]
12761 pub fn otLinkRawGetRssi(aInstance: *mut otInstance) -> i8;
12762}
12763unsafe extern "C" {
12764 #[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."]
12765 pub fn otLinkRawGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
12766}
12767#[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."]
12768pub type otLinkRawEnergyScanDone =
12769 ::std::option::Option<unsafe extern "C" fn(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8)>;
12770unsafe extern "C" {
12771 #[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."]
12772 pub fn otLinkRawEnergyScan(
12773 aInstance: *mut otInstance,
12774 aScanChannel: u8,
12775 aScanDuration: u16,
12776 aCallback: otLinkRawEnergyScanDone,
12777 ) -> otError;
12778}
12779unsafe extern "C" {
12780 #[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."]
12781 pub fn otLinkRawSrcMatchEnable(aInstance: *mut otInstance, aEnable: bool) -> otError;
12782}
12783unsafe extern "C" {
12784 #[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."]
12785 pub fn otLinkRawSrcMatchAddShortEntry(
12786 aInstance: *mut otInstance,
12787 aShortAddress: u16,
12788 ) -> otError;
12789}
12790unsafe extern "C" {
12791 #[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."]
12792 pub fn otLinkRawSrcMatchAddExtEntry(
12793 aInstance: *mut otInstance,
12794 aExtAddress: *const otExtAddress,
12795 ) -> otError;
12796}
12797unsafe extern "C" {
12798 #[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."]
12799 pub fn otLinkRawSrcMatchClearShortEntry(
12800 aInstance: *mut otInstance,
12801 aShortAddress: u16,
12802 ) -> otError;
12803}
12804unsafe extern "C" {
12805 #[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."]
12806 pub fn otLinkRawSrcMatchClearExtEntry(
12807 aInstance: *mut otInstance,
12808 aExtAddress: *const otExtAddress,
12809 ) -> otError;
12810}
12811unsafe extern "C" {
12812 #[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."]
12813 pub fn otLinkRawSrcMatchClearShortEntries(aInstance: *mut otInstance) -> otError;
12814}
12815unsafe extern "C" {
12816 #[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."]
12817 pub fn otLinkRawSrcMatchClearExtEntries(aInstance: *mut otInstance) -> otError;
12818}
12819unsafe extern "C" {
12820 #[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."]
12821 pub fn otLinkRawSetMacKey(
12822 aInstance: *mut otInstance,
12823 aKeyIdMode: u8,
12824 aKeyId: u8,
12825 aPrevKey: *const otMacKey,
12826 aCurrKey: *const otMacKey,
12827 aNextKey: *const otMacKey,
12828 ) -> otError;
12829}
12830unsafe extern "C" {
12831 #[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."]
12832 pub fn otLinkRawSetMacFrameCounter(
12833 aInstance: *mut otInstance,
12834 aMacFrameCounter: u32,
12835 ) -> otError;
12836}
12837unsafe extern "C" {
12838 #[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."]
12839 pub fn otLinkRawSetMacFrameCounterIfLarger(
12840 aInstance: *mut otInstance,
12841 aMacFrameCounter: u32,
12842 ) -> otError;
12843}
12844unsafe extern "C" {
12845 #[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."]
12846 pub fn otLinkRawGetRadioTime(aInstance: *mut otInstance) -> u64;
12847}
12848unsafe extern "C" {
12849 #[doc = " Returns the current log level for a given OpenThread instance.\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:\n - In a single-instance configuration, it returns the instance's log level.\n - In a multi-instance configuration, it returns the instance-specific log level if it has been explicitly set\n (see `otSetLogLevel()`). Otherwise, it returns the global log level (see `otLoggingGetLevel()`).\n\n If the dynamic log level feature is not enabled, this function returns the build-time configured log level.\n\n @param[in] aInstance The OpenThread instance.\n\n @returns The log level."]
12850 pub fn otGetLogLevel(aInstance: *mut otInstance) -> otLogLevel;
12851}
12852unsafe extern "C" {
12853 #[doc = " Sets the log level for a given OpenThread instance.\n\n @note This function requires `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n In a single-instance configuration, this function sets the log level for the instance.\n\n In a multi-instance configuration (`OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE`), if\n `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is not enabled, this function returns `OT_ERROR_NOT_CAPABLE`.\n When the log level is explicitly set on an instance, it overrides the global log level set using\n `otLoggingSetLevel()`.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aLogLevel The log level.\n\n @retval OT_ERROR_NONE Successfully updated the log level.\n @retval OT_ERROR_INVALID_ARGS Log level value is invalid.\n @retval OT_ERROR_NOT_CAPABLE Instance-aware logging is not enabled in a multi-instance configuration."]
12854 pub fn otSetLogLevel(aInstance: *mut otInstance, aLogLevel: otLogLevel) -> otError;
12855}
12856unsafe extern "C" {
12857 #[doc = " Returns the current global log level.\n\n In a single-instance configuration, this function behaves the same as `otGetLogLevel()`.\n In a multi-instance configuration, it returns the global log level which is used for all instances.\n\n @returns The global log level."]
12858 pub fn otLoggingGetLevel() -> otLogLevel;
12859}
12860unsafe extern "C" {
12861 #[doc = " Sets the global log level.\n\n @note This function requires `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n In a single-instance configuration, this function behaves the same as `otSetLogLevel()` (which is the recommended\n function to use).\n\n In a multi-instance configuration, it sets the global log level which is used by all instances. The log level can\n be explicitly set on a specific instance using `otSetLogLevel()`, which will then be used instead of the global\n value.\n\n @param[in] aLogLevel The log level.\n\n @retval OT_ERROR_NONE Successfully updated the log level.\n @retval OT_ERROR_INVALID_ARGS Log level value is invalid."]
12862 pub fn otLoggingSetLevel(aLogLevel: otLogLevel) -> otError;
12863}
12864unsafe extern "C" {
12865 #[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."]
12866 pub fn otLogCritPlat(aFormat: *const ::std::os::raw::c_char, ...);
12867}
12868unsafe extern "C" {
12869 #[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."]
12870 pub fn otLogWarnPlat(aFormat: *const ::std::os::raw::c_char, ...);
12871}
12872unsafe extern "C" {
12873 #[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."]
12874 pub fn otLogNotePlat(aFormat: *const ::std::os::raw::c_char, ...);
12875}
12876unsafe extern "C" {
12877 #[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."]
12878 pub fn otLogInfoPlat(aFormat: *const ::std::os::raw::c_char, ...);
12879}
12880unsafe extern "C" {
12881 #[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."]
12882 pub fn otLogDebgPlat(aFormat: *const ::std::os::raw::c_char, ...);
12883}
12884unsafe extern "C" {
12885 #[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."]
12886 pub fn otDumpCritPlat(
12887 aText: *const ::std::os::raw::c_char,
12888 aData: *const ::std::os::raw::c_void,
12889 aDataLength: u16,
12890 );
12891}
12892unsafe extern "C" {
12893 #[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."]
12894 pub fn otDumpWarnPlat(
12895 aText: *const ::std::os::raw::c_char,
12896 aData: *const ::std::os::raw::c_void,
12897 aDataLength: u16,
12898 );
12899}
12900unsafe extern "C" {
12901 #[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."]
12902 pub fn otDumpNotePlat(
12903 aText: *const ::std::os::raw::c_char,
12904 aData: *const ::std::os::raw::c_void,
12905 aDataLength: u16,
12906 );
12907}
12908unsafe extern "C" {
12909 #[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."]
12910 pub fn otDumpInfoPlat(
12911 aText: *const ::std::os::raw::c_char,
12912 aData: *const ::std::os::raw::c_void,
12913 aDataLength: u16,
12914 );
12915}
12916unsafe extern "C" {
12917 #[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."]
12918 pub fn otDumpDebgPlat(
12919 aText: *const ::std::os::raw::c_char,
12920 aData: *const ::std::os::raw::c_void,
12921 aDataLength: u16,
12922 );
12923}
12924unsafe extern "C" {
12925 #[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."]
12926 pub fn otLogPlat(
12927 aLogLevel: otLogLevel,
12928 aPlatModuleName: *const ::std::os::raw::c_char,
12929 aFormat: *const ::std::os::raw::c_char,
12930 ...
12931 );
12932}
12933unsafe extern "C" {
12934 #[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."]
12935 pub fn otLogPlatArgs(
12936 aLogLevel: otLogLevel,
12937 aPlatModuleName: *const ::std::os::raw::c_char,
12938 aFormat: *const ::std::os::raw::c_char,
12939 aArgs: *mut __va_list_tag,
12940 );
12941}
12942unsafe extern "C" {
12943 #[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."]
12944 pub fn otLogCli(aLogLevel: otLogLevel, aFormat: *const ::std::os::raw::c_char, ...);
12945}
12946#[doc = " Represents information used for generating hex dump output."]
12947#[repr(C)]
12948#[derive(Debug, Copy, Clone)]
12949pub struct otLogHexDumpInfo {
12950 #[doc = "< The data byes."]
12951 pub mDataBytes: *const u8,
12952 #[doc = "< The data length (number of bytes in @p mDataBytes)"]
12953 pub mDataLength: u16,
12954 #[doc = "< Title string to add table header (MUST NOT be `NULL`)."]
12955 pub mTitle: *const ::std::os::raw::c_char,
12956 #[doc = "< Buffer to output one line of generated hex dump."]
12957 pub mLine: [::std::os::raw::c_char; 73usize],
12958 #[doc = "< Iterator used by OT stack. MUST be initialized to zero."]
12959 pub mIterator: u16,
12960}
12961impl Default for otLogHexDumpInfo {
12962 fn default() -> Self {
12963 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12964 unsafe {
12965 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12966 s.assume_init()
12967 }
12968 }
12969}
12970unsafe extern "C" {
12971 #[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."]
12972 pub fn otLogGenerateNextHexDumpLine(aInfo: *mut otLogHexDumpInfo) -> otError;
12973}
12974#[doc = " Represents information associated with a radio link."]
12975#[repr(C)]
12976#[derive(Debug, Default, Copy, Clone)]
12977pub struct otRadioLinkInfo {
12978 #[doc = "< Preference level of radio link"]
12979 pub mPreference: u8,
12980}
12981#[doc = " Represents multi radio link information associated with a neighbor."]
12982#[repr(C)]
12983#[derive(Debug, Default, Copy, Clone)]
12984pub struct otMultiRadioNeighborInfo {
12985 pub _bitfield_align_1: [u8; 0],
12986 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
12987 #[doc = "< Additional info for 15.4 radio link (applicable when supported)."]
12988 pub mIeee802154Info: otRadioLinkInfo,
12989 #[doc = "< Additional info for TREL radio link (applicable when supported)."]
12990 pub mTrelUdp6Info: otRadioLinkInfo,
12991}
12992impl otMultiRadioNeighborInfo {
12993 #[inline]
12994 pub fn mSupportsIeee802154(&self) -> bool {
12995 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
12996 }
12997 #[inline]
12998 pub fn set_mSupportsIeee802154(&mut self, val: bool) {
12999 unsafe {
13000 let val: u8 = ::std::mem::transmute(val);
13001 self._bitfield_1.set(0usize, 1u8, val as u64)
13002 }
13003 }
13004 #[inline]
13005 pub unsafe fn mSupportsIeee802154_raw(this: *const Self) -> bool {
13006 unsafe {
13007 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13008 ::std::ptr::addr_of!((*this)._bitfield_1),
13009 0usize,
13010 1u8,
13011 ) as u8)
13012 }
13013 }
13014 #[inline]
13015 pub unsafe fn set_mSupportsIeee802154_raw(this: *mut Self, val: bool) {
13016 unsafe {
13017 let val: u8 = ::std::mem::transmute(val);
13018 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13019 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13020 0usize,
13021 1u8,
13022 val as u64,
13023 )
13024 }
13025 }
13026 #[inline]
13027 pub fn mSupportsTrelUdp6(&self) -> bool {
13028 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13029 }
13030 #[inline]
13031 pub fn set_mSupportsTrelUdp6(&mut self, val: bool) {
13032 unsafe {
13033 let val: u8 = ::std::mem::transmute(val);
13034 self._bitfield_1.set(1usize, 1u8, val as u64)
13035 }
13036 }
13037 #[inline]
13038 pub unsafe fn mSupportsTrelUdp6_raw(this: *const Self) -> bool {
13039 unsafe {
13040 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13041 ::std::ptr::addr_of!((*this)._bitfield_1),
13042 1usize,
13043 1u8,
13044 ) as u8)
13045 }
13046 }
13047 #[inline]
13048 pub unsafe fn set_mSupportsTrelUdp6_raw(this: *mut Self, val: bool) {
13049 unsafe {
13050 let val: u8 = ::std::mem::transmute(val);
13051 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13052 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13053 1usize,
13054 1u8,
13055 val as u64,
13056 )
13057 }
13058 }
13059 #[inline]
13060 pub fn new_bitfield_1(
13061 mSupportsIeee802154: bool,
13062 mSupportsTrelUdp6: bool,
13063 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13064 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13065 __bindgen_bitfield_unit.set(0usize, 1u8, {
13066 let mSupportsIeee802154: u8 = unsafe { ::std::mem::transmute(mSupportsIeee802154) };
13067 mSupportsIeee802154 as u64
13068 });
13069 __bindgen_bitfield_unit.set(1usize, 1u8, {
13070 let mSupportsTrelUdp6: u8 = unsafe { ::std::mem::transmute(mSupportsTrelUdp6) };
13071 mSupportsTrelUdp6 as u64
13072 });
13073 __bindgen_bitfield_unit
13074 }
13075}
13076unsafe extern "C" {
13077 #[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."]
13078 pub fn otMultiRadioGetNeighborInfo(
13079 aInstance: *mut otInstance,
13080 aExtAddress: *const otExtAddress,
13081 aNeighborInfo: *mut otMultiRadioNeighborInfo,
13082 ) -> otError;
13083}
13084#[doc = " @struct otIp4Address\n\n Represents an IPv4 address."]
13085#[repr(C, packed)]
13086#[derive(Copy, Clone)]
13087pub struct otIp4Address {
13088 pub mFields: otIp4Address__bindgen_ty_1,
13089}
13090#[repr(C, packed)]
13091#[derive(Copy, Clone)]
13092pub union otIp4Address__bindgen_ty_1 {
13093 #[doc = "< 8-bit fields"]
13094 pub m8: [u8; 4usize],
13095 #[doc = "< 32-bit representation"]
13096 pub m32: u32,
13097}
13098impl Default for otIp4Address__bindgen_ty_1 {
13099 fn default() -> Self {
13100 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13101 unsafe {
13102 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13103 s.assume_init()
13104 }
13105 }
13106}
13107impl Default for otIp4Address {
13108 fn default() -> Self {
13109 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13110 unsafe {
13111 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13112 s.assume_init()
13113 }
13114 }
13115}
13116#[doc = " @struct otIp4Cidr\n\n Represents an IPv4 CIDR block."]
13117#[repr(C)]
13118#[derive(Copy, Clone)]
13119pub struct otIp4Cidr {
13120 pub mAddress: otIp4Address,
13121 pub mLength: u8,
13122}
13123impl Default for otIp4Cidr {
13124 fn default() -> Self {
13125 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13126 unsafe {
13127 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13128 s.assume_init()
13129 }
13130 }
13131}
13132#[doc = " Represents the counters for NAT64."]
13133#[repr(C)]
13134#[derive(Debug, Default, Copy, Clone)]
13135pub struct otNat64Counters {
13136 #[doc = "< Number of packets translated from IPv4 to IPv6."]
13137 pub m4To6Packets: u64,
13138 #[doc = "< Sum of size of packets translated from IPv4 to IPv6."]
13139 pub m4To6Bytes: u64,
13140 #[doc = "< Number of packets translated from IPv6 to IPv4."]
13141 pub m6To4Packets: u64,
13142 #[doc = "< Sum of size of packets translated from IPv6 to IPv4."]
13143 pub m6To4Bytes: u64,
13144}
13145#[doc = " Represents the counters for the protocols supported by NAT64."]
13146#[repr(C)]
13147#[derive(Debug, Default, Copy, Clone)]
13148pub struct otNat64ProtocolCounters {
13149 #[doc = "< Counters for sum of all protocols."]
13150 pub mTotal: otNat64Counters,
13151 #[doc = "< Counters for ICMP and ICMPv6."]
13152 pub mIcmp: otNat64Counters,
13153 #[doc = "< Counters for UDP."]
13154 pub mUdp: otNat64Counters,
13155 #[doc = "< Counters for TCP."]
13156 pub mTcp: otNat64Counters,
13157}
13158#[doc = "< Packet drop for unknown reasons."]
13159pub const OT_NAT64_DROP_REASON_UNKNOWN: otNat64DropReason = 0;
13160#[doc = "< Packet drop due to failed to parse the datagram."]
13161pub const OT_NAT64_DROP_REASON_ILLEGAL_PACKET: otNat64DropReason = 1;
13162#[doc = "< Packet drop due to unsupported IP protocol."]
13163pub const OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO: otNat64DropReason = 2;
13164#[doc = "< Packet drop due to no mappings found or mapping pool exhausted."]
13165pub const OT_NAT64_DROP_REASON_NO_MAPPING: otNat64DropReason = 3;
13166pub const OT_NAT64_DROP_REASON_COUNT: otNat64DropReason = 4;
13167#[doc = " Packet drop reasons."]
13168pub type otNat64DropReason = ::std::os::raw::c_uint;
13169#[doc = " Represents the counters of dropped packets due to errors when handling NAT64 packets."]
13170#[repr(C)]
13171#[derive(Debug, Default, Copy, Clone)]
13172pub struct otNat64ErrorCounters {
13173 #[doc = "< Errors translating IPv4 packets."]
13174 pub mCount4To6: [u64; 4usize],
13175 #[doc = "< Errors translating IPv6 packets."]
13176 pub mCount6To4: [u64; 4usize],
13177}
13178unsafe extern "C" {
13179 #[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."]
13180 pub fn otNat64GetCounters(aInstance: *mut otInstance, aCounters: *mut otNat64ProtocolCounters);
13181}
13182unsafe extern "C" {
13183 #[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."]
13184 pub fn otNat64GetErrorCounters(
13185 aInstance: *mut otInstance,
13186 aCounters: *mut otNat64ErrorCounters,
13187 );
13188}
13189#[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."]
13190#[repr(C)]
13191#[derive(Copy, Clone)]
13192pub struct otNat64AddressMapping {
13193 #[doc = "< The unique id for a mapping session."]
13194 pub mId: u64,
13195 #[doc = "< The IPv4 address of the mapping."]
13196 pub mIp4: otIp4Address,
13197 #[doc = "< The IPv6 address of the mapping."]
13198 pub mIp6: otIp6Address,
13199 #[doc = " The source port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13200 pub mSrcPortOrId: u16,
13201 #[doc = " The translated port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13202 pub mTranslatedPortOrId: u16,
13203 #[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."]
13204 pub mRemainingTimeMs: u32,
13205 #[doc = "< Counters."]
13206 pub mCounters: otNat64ProtocolCounters,
13207}
13208impl Default for otNat64AddressMapping {
13209 fn default() -> Self {
13210 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13211 unsafe {
13212 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13213 s.assume_init()
13214 }
13215 }
13216}
13217#[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."]
13218#[repr(C)]
13219#[derive(Debug, Copy, Clone)]
13220pub struct otNat64AddressMappingIterator {
13221 pub mPtr: *const ::std::os::raw::c_void,
13222 pub mData32: u32,
13223}
13224impl Default for otNat64AddressMappingIterator {
13225 fn default() -> Self {
13226 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13227 unsafe {
13228 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13229 s.assume_init()
13230 }
13231 }
13232}
13233unsafe extern "C" {
13234 #[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."]
13235 pub fn otNat64InitAddressMappingIterator(
13236 aInstance: *mut otInstance,
13237 aIterator: *mut otNat64AddressMappingIterator,
13238 );
13239}
13240unsafe extern "C" {
13241 #[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."]
13242 pub fn otNat64GetNextAddressMapping(
13243 aInstance: *mut otInstance,
13244 aIterator: *mut otNat64AddressMappingIterator,
13245 aMapping: *mut otNat64AddressMapping,
13246 ) -> otError;
13247}
13248#[doc = "< NAT64 is disabled."]
13249pub const OT_NAT64_STATE_DISABLED: otNat64State = 0;
13250#[doc = "< NAT64 is enabled, but one or more dependencies of NAT64 are not running."]
13251pub const OT_NAT64_STATE_NOT_RUNNING: otNat64State = 1;
13252#[doc = "< NAT64 is enabled, but this BR is not an active NAT64 BR."]
13253pub const OT_NAT64_STATE_IDLE: otNat64State = 2;
13254#[doc = "< The BR is publishing a NAT64 prefix and/or translating packets."]
13255pub const OT_NAT64_STATE_ACTIVE: otNat64State = 3;
13256#[doc = " States of NAT64."]
13257pub type otNat64State = ::std::os::raw::c_uint;
13258unsafe extern "C" {
13259 #[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."]
13260 pub fn otNat64GetTranslatorState(aInstance: *mut otInstance) -> otNat64State;
13261}
13262unsafe extern "C" {
13263 #[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."]
13264 pub fn otNat64GetPrefixManagerState(aInstance: *mut otInstance) -> otNat64State;
13265}
13266unsafe extern "C" {
13267 #[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"]
13268 pub fn otNat64SetEnabled(aInstance: *mut otInstance, aEnabled: bool);
13269}
13270unsafe extern "C" {
13271 #[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"]
13272 pub fn otIp4NewMessage(
13273 aInstance: *mut otInstance,
13274 aSettings: *const otMessageSettings,
13275 ) -> *mut otMessage;
13276}
13277unsafe extern "C" {
13278 #[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"]
13279 pub fn otNat64SetIp4Cidr(aInstance: *mut otInstance, aCidr: *const otIp4Cidr) -> otError;
13280}
13281unsafe extern "C" {
13282 #[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"]
13283 pub fn otNat64ClearIp4Cidr(aInstance: *mut otInstance);
13284}
13285unsafe extern "C" {
13286 #[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."]
13287 pub fn otNat64Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
13288}
13289#[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."]
13290pub type otNat64ReceiveIp4Callback = ::std::option::Option<
13291 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
13292>;
13293unsafe extern "C" {
13294 #[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."]
13295 pub fn otNat64SetReceiveIp4Callback(
13296 aInstance: *mut otInstance,
13297 aCallback: otNat64ReceiveIp4Callback,
13298 aContext: *mut ::std::os::raw::c_void,
13299 );
13300}
13301unsafe extern "C" {
13302 #[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."]
13303 pub fn otNat64GetCidr(aInstance: *mut otInstance, aCidr: *mut otIp4Cidr) -> otError;
13304}
13305unsafe extern "C" {
13306 #[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."]
13307 pub fn otIp4IsAddressEqual(aFirst: *const otIp4Address, aSecond: *const otIp4Address) -> bool;
13308}
13309unsafe extern "C" {
13310 #[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."]
13311 pub fn otIp4ExtractFromIp6Address(
13312 aPrefixLength: u8,
13313 aIp6Address: *const otIp6Address,
13314 aIp4Address: *mut otIp4Address,
13315 );
13316}
13317unsafe extern "C" {
13318 #[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."]
13319 pub fn otIp4FromIp4MappedIp6Address(
13320 aIp6Address: *const otIp6Address,
13321 aIp4Address: *mut otIp4Address,
13322 ) -> otError;
13323}
13324unsafe extern "C" {
13325 #[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."]
13326 pub fn otIp4ToIp4MappedIp6Address(
13327 aIp4Address: *const otIp4Address,
13328 aIp6Address: *mut otIp6Address,
13329 );
13330}
13331unsafe extern "C" {
13332 #[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)."]
13333 pub fn otIp4AddressToString(
13334 aAddress: *const otIp4Address,
13335 aBuffer: *mut ::std::os::raw::c_char,
13336 aSize: u16,
13337 );
13338}
13339unsafe extern "C" {
13340 #[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."]
13341 pub fn otIp4CidrFromString(
13342 aString: *const ::std::os::raw::c_char,
13343 aCidr: *mut otIp4Cidr,
13344 ) -> otError;
13345}
13346unsafe extern "C" {
13347 #[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)."]
13348 pub fn otIp4CidrToString(
13349 aCidr: *const otIp4Cidr,
13350 aBuffer: *mut ::std::os::raw::c_char,
13351 aSize: u16,
13352 );
13353}
13354unsafe extern "C" {
13355 #[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."]
13356 pub fn otIp4AddressFromString(
13357 aString: *const ::std::os::raw::c_char,
13358 aAddress: *mut otIp4Address,
13359 ) -> otError;
13360}
13361unsafe extern "C" {
13362 #[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."]
13363 pub fn otNat64SynthesizeIp6Address(
13364 aInstance: *mut otInstance,
13365 aIp4Address: *const otIp4Address,
13366 aIp6Address: *mut otIp6Address,
13367 ) -> otError;
13368}
13369unsafe extern "C" {
13370 #[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."]
13371 pub fn otNat64StateToString(aState: otNat64State) -> *const ::std::os::raw::c_char;
13372}
13373#[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."]
13374pub type otNcpHdlcSendCallback = ::std::option::Option<
13375 unsafe extern "C" fn(aBuf: *const u8, aBufLength: u16) -> ::std::os::raw::c_int,
13376>;
13377unsafe extern "C" {
13378 #[doc = " Is called after NCP send finished."]
13379 pub fn otNcpHdlcSendDone();
13380}
13381unsafe extern "C" {
13382 #[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."]
13383 pub fn otNcpHdlcReceive(aBuf: *const u8, aBufLength: u16);
13384}
13385unsafe extern "C" {
13386 #[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."]
13387 pub fn otNcpHdlcInit(aInstance: *mut otInstance, aSendCallback: otNcpHdlcSendCallback);
13388}
13389unsafe extern "C" {
13390 #[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."]
13391 pub fn otNcpHdlcInitMulti(
13392 aInstance: *mut *mut otInstance,
13393 aCount: u8,
13394 aSendCallback: otNcpHdlcSendCallback,
13395 );
13396}
13397unsafe extern "C" {
13398 #[doc = " Initialize the NCP based on SPI framing.\n\n @param[in] aInstance The OpenThread instance structure."]
13399 pub fn otNcpSpiInit(aInstance: *mut otInstance);
13400}
13401unsafe extern "C" {
13402 #[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."]
13403 pub fn otNcpStreamWrite(
13404 aStreamId: ::std::os::raw::c_int,
13405 aDataPtr: *const u8,
13406 aDataLen: ::std::os::raw::c_int,
13407 ) -> otError;
13408}
13409unsafe extern "C" {
13410 #[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."]
13411 pub fn otNcpPlatLogv(
13412 aLogLevel: otLogLevel,
13413 aLogRegion: otLogRegion,
13414 aFormat: *const ::std::os::raw::c_char,
13415 aArgs: *mut __va_list_tag,
13416 );
13417}
13418#[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."]
13419pub type otNcpDelegateAllowPeekPoke =
13420 ::std::option::Option<unsafe extern "C" fn(aAddress: u32, aCount: u16) -> bool>;
13421unsafe extern "C" {
13422 #[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."]
13423 pub fn otNcpRegisterPeekPokeDelegates(
13424 aAllowPeekDelegate: otNcpDelegateAllowPeekPoke,
13425 aAllowPokeDelegate: otNcpDelegateAllowPeekPoke,
13426 );
13427}
13428pub type otNetworkDiagIterator = u16;
13429#[doc = " Represents a Network Diagnostics IPv6 Address List TLV value."]
13430#[repr(C)]
13431#[derive(Copy, Clone)]
13432pub struct otNetworkDiagIp6AddrList {
13433 #[doc = "< Number of IPv6 addresses."]
13434 pub mCount: u8,
13435 #[doc = "< Array of IPv6 addresses."]
13436 pub mList: [otIp6Address; 15usize],
13437}
13438impl Default for otNetworkDiagIp6AddrList {
13439 fn default() -> Self {
13440 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13441 unsafe {
13442 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13443 s.assume_init()
13444 }
13445 }
13446}
13447#[doc = " Represents a Network Diagnostic TLV Data."]
13448#[repr(C)]
13449#[derive(Debug, Copy, Clone)]
13450pub struct otNetworkDiagData {
13451 #[doc = "< Number of bytes in the data."]
13452 pub mCount: u8,
13453 #[doc = "< Array containing the data bytes."]
13454 pub m8: [u8; 254usize],
13455}
13456impl Default for otNetworkDiagData {
13457 fn default() -> Self {
13458 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13459 unsafe {
13460 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13461 s.assume_init()
13462 }
13463 }
13464}
13465#[doc = " Represents a Network Diagnostic Connectivity value."]
13466#[repr(C)]
13467#[derive(Debug, Default, Copy, Clone)]
13468pub struct otNetworkDiagConnectivity {
13469 #[doc = "< The priority of the sender as a parent."]
13470 pub mParentPriority: i8,
13471 #[doc = "< Number of neighbors with link of quality 3."]
13472 pub mLinkQuality3: u8,
13473 #[doc = "< Number of neighbors with link of quality 2."]
13474 pub mLinkQuality2: u8,
13475 #[doc = "< Number of neighbors with link of quality 1."]
13476 pub mLinkQuality1: u8,
13477 #[doc = "< Cost to the Leader."]
13478 pub mLeaderCost: u8,
13479 #[doc = "< Most recent received ID seq number."]
13480 pub mIdSequence: u8,
13481 #[doc = "< Number of active routers."]
13482 pub mActiveRouters: u8,
13483 #[doc = "< Buffer capacity in bytes for SEDs. Optional."]
13484 pub mSedBufferSize: u16,
13485 #[doc = "< Queue capacity (number of IPv6 datagrams) per SED. Optional."]
13486 pub mSedDatagramCount: u8,
13487}
13488#[doc = " Represents a Network Diagnostic Route data."]
13489#[repr(C)]
13490#[derive(Debug, Default, Copy, Clone)]
13491pub struct otNetworkDiagRouteData {
13492 #[doc = "< The Assigned Router ID."]
13493 pub mRouterId: u8,
13494 pub _bitfield_align_1: [u8; 0],
13495 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13496}
13497impl otNetworkDiagRouteData {
13498 #[inline]
13499 pub fn mLinkQualityOut(&self) -> u8 {
13500 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
13501 }
13502 #[inline]
13503 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13504 unsafe {
13505 let val: u8 = ::std::mem::transmute(val);
13506 self._bitfield_1.set(0usize, 2u8, val as u64)
13507 }
13508 }
13509 #[inline]
13510 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13511 unsafe {
13512 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13513 ::std::ptr::addr_of!((*this)._bitfield_1),
13514 0usize,
13515 2u8,
13516 ) as u8)
13517 }
13518 }
13519 #[inline]
13520 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13521 unsafe {
13522 let val: u8 = ::std::mem::transmute(val);
13523 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13524 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13525 0usize,
13526 2u8,
13527 val as u64,
13528 )
13529 }
13530 }
13531 #[inline]
13532 pub fn mLinkQualityIn(&self) -> u8 {
13533 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13534 }
13535 #[inline]
13536 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13537 unsafe {
13538 let val: u8 = ::std::mem::transmute(val);
13539 self._bitfield_1.set(2usize, 2u8, val as u64)
13540 }
13541 }
13542 #[inline]
13543 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13544 unsafe {
13545 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13546 ::std::ptr::addr_of!((*this)._bitfield_1),
13547 2usize,
13548 2u8,
13549 ) as u8)
13550 }
13551 }
13552 #[inline]
13553 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13554 unsafe {
13555 let val: u8 = ::std::mem::transmute(val);
13556 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13557 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13558 2usize,
13559 2u8,
13560 val as u64,
13561 )
13562 }
13563 }
13564 #[inline]
13565 pub fn mRouteCost(&self) -> u8 {
13566 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) }
13567 }
13568 #[inline]
13569 pub fn set_mRouteCost(&mut self, val: u8) {
13570 unsafe {
13571 let val: u8 = ::std::mem::transmute(val);
13572 self._bitfield_1.set(4usize, 4u8, val as u64)
13573 }
13574 }
13575 #[inline]
13576 pub unsafe fn mRouteCost_raw(this: *const Self) -> u8 {
13577 unsafe {
13578 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13579 ::std::ptr::addr_of!((*this)._bitfield_1),
13580 4usize,
13581 4u8,
13582 ) as u8)
13583 }
13584 }
13585 #[inline]
13586 pub unsafe fn set_mRouteCost_raw(this: *mut Self, val: u8) {
13587 unsafe {
13588 let val: u8 = ::std::mem::transmute(val);
13589 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13590 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13591 4usize,
13592 4u8,
13593 val as u64,
13594 )
13595 }
13596 }
13597 #[inline]
13598 pub fn new_bitfield_1(
13599 mLinkQualityOut: u8,
13600 mLinkQualityIn: u8,
13601 mRouteCost: u8,
13602 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13603 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13604 __bindgen_bitfield_unit.set(0usize, 2u8, {
13605 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13606 mLinkQualityOut as u64
13607 });
13608 __bindgen_bitfield_unit.set(2usize, 2u8, {
13609 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13610 mLinkQualityIn as u64
13611 });
13612 __bindgen_bitfield_unit.set(4usize, 4u8, {
13613 let mRouteCost: u8 = unsafe { ::std::mem::transmute(mRouteCost) };
13614 mRouteCost as u64
13615 });
13616 __bindgen_bitfield_unit
13617 }
13618}
13619#[doc = " Represents a Network Diagnostic Route64 TLV value."]
13620#[repr(C)]
13621#[derive(Debug, Copy, Clone)]
13622pub struct otNetworkDiagRoute {
13623 #[doc = "< Sequence number for Router ID assignments."]
13624 pub mIdSequence: u8,
13625 #[doc = "< Number of routes."]
13626 pub mRouteCount: u8,
13627 #[doc = "< Link Quality and Routing Cost data."]
13628 pub mRouteData: [otNetworkDiagRouteData; 63usize],
13629}
13630impl Default for otNetworkDiagRoute {
13631 fn default() -> Self {
13632 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13633 unsafe {
13634 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13635 s.assume_init()
13636 }
13637 }
13638}
13639#[doc = " Represents a Network Diagnostic Enhanced Route data."]
13640#[repr(C)]
13641#[derive(Debug, Default, Copy, Clone)]
13642pub struct otNetworkDiagEnhRouteData {
13643 #[doc = "< The Router ID."]
13644 pub mRouterId: u8,
13645 pub _bitfield_align_1: [u8; 0],
13646 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13647 #[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."]
13648 pub mNextHop: u8,
13649 #[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."]
13650 pub mNextHopCost: u8,
13651}
13652impl otNetworkDiagEnhRouteData {
13653 #[inline]
13654 pub fn mIsSelf(&self) -> bool {
13655 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13656 }
13657 #[inline]
13658 pub fn set_mIsSelf(&mut self, val: bool) {
13659 unsafe {
13660 let val: u8 = ::std::mem::transmute(val);
13661 self._bitfield_1.set(0usize, 1u8, val as u64)
13662 }
13663 }
13664 #[inline]
13665 pub unsafe fn mIsSelf_raw(this: *const Self) -> bool {
13666 unsafe {
13667 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13668 ::std::ptr::addr_of!((*this)._bitfield_1),
13669 0usize,
13670 1u8,
13671 ) as u8)
13672 }
13673 }
13674 #[inline]
13675 pub unsafe fn set_mIsSelf_raw(this: *mut Self, val: bool) {
13676 unsafe {
13677 let val: u8 = ::std::mem::transmute(val);
13678 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13679 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13680 0usize,
13681 1u8,
13682 val as u64,
13683 )
13684 }
13685 }
13686 #[inline]
13687 pub fn mHasLink(&self) -> bool {
13688 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13689 }
13690 #[inline]
13691 pub fn set_mHasLink(&mut self, val: bool) {
13692 unsafe {
13693 let val: u8 = ::std::mem::transmute(val);
13694 self._bitfield_1.set(1usize, 1u8, val as u64)
13695 }
13696 }
13697 #[inline]
13698 pub unsafe fn mHasLink_raw(this: *const Self) -> bool {
13699 unsafe {
13700 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13701 ::std::ptr::addr_of!((*this)._bitfield_1),
13702 1usize,
13703 1u8,
13704 ) as u8)
13705 }
13706 }
13707 #[inline]
13708 pub unsafe fn set_mHasLink_raw(this: *mut Self, val: bool) {
13709 unsafe {
13710 let val: u8 = ::std::mem::transmute(val);
13711 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13712 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13713 1usize,
13714 1u8,
13715 val as u64,
13716 )
13717 }
13718 }
13719 #[inline]
13720 pub fn mLinkQualityOut(&self) -> u8 {
13721 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13722 }
13723 #[inline]
13724 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13725 unsafe {
13726 let val: u8 = ::std::mem::transmute(val);
13727 self._bitfield_1.set(2usize, 2u8, val as u64)
13728 }
13729 }
13730 #[inline]
13731 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13732 unsafe {
13733 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13734 ::std::ptr::addr_of!((*this)._bitfield_1),
13735 2usize,
13736 2u8,
13737 ) as u8)
13738 }
13739 }
13740 #[inline]
13741 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13742 unsafe {
13743 let val: u8 = ::std::mem::transmute(val);
13744 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13745 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13746 2usize,
13747 2u8,
13748 val as u64,
13749 )
13750 }
13751 }
13752 #[inline]
13753 pub fn mLinkQualityIn(&self) -> u8 {
13754 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
13755 }
13756 #[inline]
13757 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13758 unsafe {
13759 let val: u8 = ::std::mem::transmute(val);
13760 self._bitfield_1.set(4usize, 2u8, val as u64)
13761 }
13762 }
13763 #[inline]
13764 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13765 unsafe {
13766 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13767 ::std::ptr::addr_of!((*this)._bitfield_1),
13768 4usize,
13769 2u8,
13770 ) as u8)
13771 }
13772 }
13773 #[inline]
13774 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13775 unsafe {
13776 let val: u8 = ::std::mem::transmute(val);
13777 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13778 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13779 4usize,
13780 2u8,
13781 val as u64,
13782 )
13783 }
13784 }
13785 #[inline]
13786 pub fn new_bitfield_1(
13787 mIsSelf: bool,
13788 mHasLink: bool,
13789 mLinkQualityOut: u8,
13790 mLinkQualityIn: u8,
13791 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13792 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13793 __bindgen_bitfield_unit.set(0usize, 1u8, {
13794 let mIsSelf: u8 = unsafe { ::std::mem::transmute(mIsSelf) };
13795 mIsSelf as u64
13796 });
13797 __bindgen_bitfield_unit.set(1usize, 1u8, {
13798 let mHasLink: u8 = unsafe { ::std::mem::transmute(mHasLink) };
13799 mHasLink as u64
13800 });
13801 __bindgen_bitfield_unit.set(2usize, 2u8, {
13802 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13803 mLinkQualityOut as u64
13804 });
13805 __bindgen_bitfield_unit.set(4usize, 2u8, {
13806 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13807 mLinkQualityIn as u64
13808 });
13809 __bindgen_bitfield_unit
13810 }
13811}
13812#[doc = " Represents a Network Diagnostic Enhanced Route TLV value."]
13813#[repr(C)]
13814#[derive(Debug, Copy, Clone)]
13815pub struct otNetworkDiagEnhRoute {
13816 #[doc = "< Number of `mRouteData` entries."]
13817 pub mRouteCount: u8,
13818 #[doc = "< Route Data per router."]
13819 pub mRouteData: [otNetworkDiagEnhRouteData; 63usize],
13820}
13821impl Default for otNetworkDiagEnhRoute {
13822 fn default() -> Self {
13823 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13824 unsafe {
13825 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13826 s.assume_init()
13827 }
13828 }
13829}
13830#[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."]
13831#[repr(C)]
13832#[derive(Debug, Default, Copy, Clone)]
13833pub struct otNetworkDiagMacCounters {
13834 pub mIfInUnknownProtos: u32,
13835 pub mIfInErrors: u32,
13836 pub mIfOutErrors: u32,
13837 pub mIfInUcastPkts: u32,
13838 pub mIfInBroadcastPkts: u32,
13839 pub mIfInDiscards: u32,
13840 pub mIfOutUcastPkts: u32,
13841 pub mIfOutBroadcastPkts: u32,
13842 pub mIfOutDiscards: u32,
13843}
13844#[doc = " Represents a Network Diagnostics MLE Counters value."]
13845#[repr(C)]
13846#[derive(Debug, Default, Copy, Clone)]
13847pub struct otNetworkDiagMleCounters {
13848 #[doc = "< Number of times device entered disabled role."]
13849 pub mDisabledRole: u16,
13850 #[doc = "< Number of times device entered detached role."]
13851 pub mDetachedRole: u16,
13852 #[doc = "< Number of times device entered child role."]
13853 pub mChildRole: u16,
13854 #[doc = "< Number of times device entered router role."]
13855 pub mRouterRole: u16,
13856 #[doc = "< Number of times device entered leader role."]
13857 pub mLeaderRole: u16,
13858 #[doc = "< Number of attach attempts while device was detached."]
13859 pub mAttachAttempts: u16,
13860 #[doc = "< Number of changes to partition ID."]
13861 pub mPartitionIdChanges: u16,
13862 #[doc = "< Number of attempts to attach to a better partition."]
13863 pub mBetterPartitionAttachAttempts: u16,
13864 #[doc = "< Number of time device changed its parent."]
13865 pub mParentChanges: u16,
13866 #[doc = "< Milliseconds tracked by next counters (zero if not supported)."]
13867 pub mTrackedTime: u64,
13868 #[doc = "< Milliseconds device has been in disabled role."]
13869 pub mDisabledTime: u64,
13870 #[doc = "< Milliseconds device has been in detached role."]
13871 pub mDetachedTime: u64,
13872 #[doc = "< Milliseconds device has been in child role."]
13873 pub mChildTime: u64,
13874 #[doc = "< Milliseconds device has been in router role."]
13875 pub mRouterTime: u64,
13876 #[doc = "< Milliseconds device has been in leader role."]
13877 pub mLeaderTime: u64,
13878}
13879#[doc = " Represents a Network Diagnostic Child Table Entry."]
13880#[repr(C)]
13881#[derive(Debug, Default, Copy, Clone)]
13882pub struct otNetworkDiagChildEntry {
13883 pub _bitfield_align_1: [u16; 0],
13884 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
13885 #[doc = "< Link mode."]
13886 pub mMode: otLinkModeConfig,
13887}
13888impl otNetworkDiagChildEntry {
13889 #[inline]
13890 pub fn mTimeout(&self) -> u16 {
13891 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 5u8) as u16) }
13892 }
13893 #[inline]
13894 pub fn set_mTimeout(&mut self, val: u16) {
13895 unsafe {
13896 let val: u16 = ::std::mem::transmute(val);
13897 self._bitfield_1.set(0usize, 5u8, val as u64)
13898 }
13899 }
13900 #[inline]
13901 pub unsafe fn mTimeout_raw(this: *const Self) -> u16 {
13902 unsafe {
13903 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13904 ::std::ptr::addr_of!((*this)._bitfield_1),
13905 0usize,
13906 5u8,
13907 ) as u16)
13908 }
13909 }
13910 #[inline]
13911 pub unsafe fn set_mTimeout_raw(this: *mut Self, val: u16) {
13912 unsafe {
13913 let val: u16 = ::std::mem::transmute(val);
13914 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13915 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13916 0usize,
13917 5u8,
13918 val as u64,
13919 )
13920 }
13921 }
13922 #[inline]
13923 pub fn mLinkQuality(&self) -> u8 {
13924 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u8) }
13925 }
13926 #[inline]
13927 pub fn set_mLinkQuality(&mut self, val: u8) {
13928 unsafe {
13929 let val: u8 = ::std::mem::transmute(val);
13930 self._bitfield_1.set(5usize, 2u8, val as u64)
13931 }
13932 }
13933 #[inline]
13934 pub unsafe fn mLinkQuality_raw(this: *const Self) -> u8 {
13935 unsafe {
13936 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13937 ::std::ptr::addr_of!((*this)._bitfield_1),
13938 5usize,
13939 2u8,
13940 ) as u8)
13941 }
13942 }
13943 #[inline]
13944 pub unsafe fn set_mLinkQuality_raw(this: *mut Self, val: u8) {
13945 unsafe {
13946 let val: u8 = ::std::mem::transmute(val);
13947 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13948 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13949 5usize,
13950 2u8,
13951 val as u64,
13952 )
13953 }
13954 }
13955 #[inline]
13956 pub fn mChildId(&self) -> u16 {
13957 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u16) }
13958 }
13959 #[inline]
13960 pub fn set_mChildId(&mut self, val: u16) {
13961 unsafe {
13962 let val: u16 = ::std::mem::transmute(val);
13963 self._bitfield_1.set(7usize, 9u8, val as u64)
13964 }
13965 }
13966 #[inline]
13967 pub unsafe fn mChildId_raw(this: *const Self) -> u16 {
13968 unsafe {
13969 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13970 ::std::ptr::addr_of!((*this)._bitfield_1),
13971 7usize,
13972 9u8,
13973 ) as u16)
13974 }
13975 }
13976 #[inline]
13977 pub unsafe fn set_mChildId_raw(this: *mut Self, val: u16) {
13978 unsafe {
13979 let val: u16 = ::std::mem::transmute(val);
13980 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13981 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13982 7usize,
13983 9u8,
13984 val as u64,
13985 )
13986 }
13987 }
13988 #[inline]
13989 pub fn new_bitfield_1(
13990 mTimeout: u16,
13991 mLinkQuality: u8,
13992 mChildId: u16,
13993 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
13994 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
13995 __bindgen_bitfield_unit.set(0usize, 5u8, {
13996 let mTimeout: u16 = unsafe { ::std::mem::transmute(mTimeout) };
13997 mTimeout as u64
13998 });
13999 __bindgen_bitfield_unit.set(5usize, 2u8, {
14000 let mLinkQuality: u8 = unsafe { ::std::mem::transmute(mLinkQuality) };
14001 mLinkQuality as u64
14002 });
14003 __bindgen_bitfield_unit.set(7usize, 9u8, {
14004 let mChildId: u16 = unsafe { ::std::mem::transmute(mChildId) };
14005 mChildId as u64
14006 });
14007 __bindgen_bitfield_unit
14008 }
14009}
14010#[doc = " Represents a Network Diagnostic Child Table TLV value."]
14011#[repr(C)]
14012#[derive(Debug, Copy, Clone)]
14013pub struct otNetworkDiagChildTable {
14014 #[doc = "< Number of child entries in the table."]
14015 pub mCount: u8,
14016 #[doc = "< Child table."]
14017 pub mTable: [otNetworkDiagChildEntry; 63usize],
14018}
14019impl Default for otNetworkDiagChildTable {
14020 fn default() -> Self {
14021 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14022 unsafe {
14023 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14024 s.assume_init()
14025 }
14026 }
14027}
14028#[doc = " Represents a Border Router State TLV value."]
14029pub use self::otBorderRoutingState as otNetworkDiagBrState;
14030#[doc = " Represents a Thread Vendor OUI (Organizationally Unique Identifier) which can have different lengths.\n\n A Vendor OUI can be assigned in one of the following formats:\n\n - 24-bit Prefix (MA-L): Exactly 3 bytes (24 bits).\n Example: `00-1A-2B` is represented with `mBitLength = 24` and `mBytes = [0x00, 0x1A, 0x2B, 0x00, 0x00]`.\n\n - 28-bit Prefix (MA-M): Exactly 3.5 bytes (28 bits).\n The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 4th byte.\n The Least Significant Nibble of the 4th byte is set to zero.\n Example: `00-1A-2B-3` is represented with `mBitLength = 28` and `mBytes = [0x00, 0x1A, 0x2B, 0x30, 0x00]`.\n\n - 36-bit Prefix (MA-S): Exactly 4.5 bytes (36 bits).\n The half-byte (4 bits) at the end of the prefix occupies the Most Significant Nibble of the 5th byte.\n The Least Significant Nibble of the 5th byte is set to zero.\n Example: `00-1A-2B-3C-4` is represented with `mBitLength = 36` and `mBytes = [0x00, 0x1A, 0x2B, 0x3C, 0x40]`."]
14031#[repr(C)]
14032#[derive(Debug, Default, Copy, Clone)]
14033pub struct otThreadVendorOui {
14034 #[doc = "< The OUI prefix length in bits (24, 28, or 36)."]
14035 pub mBitLength: u8,
14036 #[doc = "< The OUI bytes in big-endian order."]
14037 pub mBytes: [u8; 5usize],
14038}
14039#[doc = " Represents a Network Diagnostic TLV."]
14040#[repr(C)]
14041#[derive(Copy, Clone)]
14042pub struct otNetworkDiagTlv {
14043 #[doc = "< The Network Diagnostic TLV type."]
14044 pub mType: u8,
14045 pub mData: otNetworkDiagTlv__bindgen_ty_1,
14046}
14047#[repr(C)]
14048#[derive(Copy, Clone)]
14049pub union otNetworkDiagTlv__bindgen_ty_1 {
14050 pub mExtAddress: otExtAddress,
14051 pub mEui64: otExtAddress,
14052 pub mAddr16: u16,
14053 pub mMode: otLinkModeConfig,
14054 pub mTimeout: u32,
14055 pub mConnectivity: otNetworkDiagConnectivity,
14056 pub mRoute: otNetworkDiagRoute,
14057 pub mEnhRoute: otNetworkDiagEnhRoute,
14058 pub mLeaderData: otLeaderData,
14059 pub mNetworkData: otNetworkDiagData,
14060 pub mIp6AddrList: otNetworkDiagIp6AddrList,
14061 pub mMacCounters: otNetworkDiagMacCounters,
14062 pub mMleCounters: otNetworkDiagMleCounters,
14063 pub mBatteryLevel: u8,
14064 pub mSupplyVoltage: u16,
14065 pub mMaxChildTimeout: u32,
14066 pub mVersion: u16,
14067 pub mVendorName: [::std::os::raw::c_char; 33usize],
14068 pub mVendorModel: [::std::os::raw::c_char; 33usize],
14069 pub mVendorSwVersion: [::std::os::raw::c_char; 17usize],
14070 pub mThreadStackVersion: [::std::os::raw::c_char; 65usize],
14071 pub mVendorAppUrl: [::std::os::raw::c_char; 97usize],
14072 pub mVendorOui: otThreadVendorOui,
14073 pub mNonPreferredChannels: otChannelMask,
14074 pub mChannelPages: otNetworkDiagData,
14075 pub mChildTable: otNetworkDiagChildTable,
14076 pub mBrState: otNetworkDiagBrState,
14077 pub mBrIfAddrList: otNetworkDiagIp6AddrList,
14078 pub mBrPrefix: otIp6NetworkPrefix,
14079}
14080impl Default for otNetworkDiagTlv__bindgen_ty_1 {
14081 fn default() -> Self {
14082 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14083 unsafe {
14084 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14085 s.assume_init()
14086 }
14087 }
14088}
14089impl Default for otNetworkDiagTlv {
14090 fn default() -> Self {
14091 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14092 unsafe {
14093 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14094 s.assume_init()
14095 }
14096 }
14097}
14098unsafe extern "C" {
14099 #[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."]
14100 pub fn otThreadGetNextDiagnosticTlv(
14101 aMessage: *const otMessage,
14102 aIterator: *mut otNetworkDiagIterator,
14103 aNetworkDiagTlv: *mut otNetworkDiagTlv,
14104 ) -> otError;
14105}
14106#[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."]
14107pub type otReceiveDiagnosticGetCallback = ::std::option::Option<
14108 unsafe extern "C" fn(
14109 aError: otError,
14110 aMessage: *mut otMessage,
14111 aMessageInfo: *const otMessageInfo,
14112 aContext: *mut ::std::os::raw::c_void,
14113 ),
14114>;
14115unsafe extern "C" {
14116 #[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."]
14117 pub fn otThreadSendDiagnosticGet(
14118 aInstance: *mut otInstance,
14119 aDestination: *const otIp6Address,
14120 aTlvTypes: *const u8,
14121 aCount: u8,
14122 aCallback: otReceiveDiagnosticGetCallback,
14123 aCallbackContext: *mut ::std::os::raw::c_void,
14124 ) -> otError;
14125}
14126unsafe extern "C" {
14127 #[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."]
14128 pub fn otThreadSendDiagnosticReset(
14129 aInstance: *mut otInstance,
14130 aDestination: *const otIp6Address,
14131 aTlvTypes: *const u8,
14132 aCount: u8,
14133 ) -> otError;
14134}
14135unsafe extern "C" {
14136 #[doc = " Get the vendor name string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor name string."]
14137 pub fn otThreadGetVendorName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14138}
14139unsafe extern "C" {
14140 #[doc = " Get the vendor model string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor model string."]
14141 pub fn otThreadGetVendorModel(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14142}
14143unsafe extern "C" {
14144 #[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."]
14145 pub fn otThreadGetVendorSwVersion(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14146}
14147unsafe extern "C" {
14148 #[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."]
14149 pub fn otThreadGetVendorAppUrl(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14150}
14151unsafe extern "C" {
14152 #[doc = " Gets the vendor OUI.\n\n If no vendor OUI is yet set/configured on device, the `mBitLength` in @p aOui will be zero.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aOui A pointer to an `otThreadVendorOui` to return the vendor OUI."]
14153 pub fn otThreadGetVendorOuiInfo(aInstance: *mut otInstance, aOui: *mut otThreadVendorOui);
14154}
14155unsafe extern "C" {
14156 #[doc = " Sets the vendor OUI.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aOui A pointer to the `otThreadVendorOui` to set.\n\n @retval OT_ERROR_NONE Successfully set the vendor OUI.\n @retval OT_ERROR_INVALID_ARGS @p aOui has an invalid length."]
14157 pub fn otThreadSetVendorOuiInfo(
14158 aInstance: *mut otInstance,
14159 aOui: *const otThreadVendorOui,
14160 ) -> otError;
14161}
14162unsafe extern "C" {
14163 #[doc = " Converts a given vendor OUI to a human-readable string.\n\n The generated string format is hyphen-separated uppercase hexadecimal bytes (e.g., \"00-1A-2B\" for a 24-bit OUI).\n For 28-bit and 36-bit OUIs, the trailing 4-bit nibble is appended as a single hexadecimal digit (e.g., \"00-1A-2B-3\"\n for a 28-bit OUI). If @p aOui is invalid or unspecified, the string \"unspecified\" is returned.\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] aOui The vendor OUI to convert.\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_THREAD_VENDOR_OUI_STRING_SIZE`."]
14164 pub fn otThreadVendorOuiToString(
14165 aOui: *const otThreadVendorOui,
14166 aBuffer: *mut ::std::os::raw::c_char,
14167 aSize: u16,
14168 );
14169}
14170unsafe extern "C" {
14171 #[doc = " Gets the vendor OUI-24.\n\n @deprecated This function is deprecated. Use `otThreadGetVendorOuiInfo()` instead.\n\n If the configured Vendor OUI has a prefix length greater than 24 bits, this function returns the most significant\n 24 bits (first 3 bytes) of the OUI to maintain backward compatibility.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor OUI-24 value, or `OT_THREAD_UNSPECIFIED_VENDOR_OUI` if not specified."]
14172 pub fn otThreadGetVendorOui(aInstance: *mut otInstance) -> u32;
14173}
14174unsafe extern "C" {
14175 #[doc = " Sets the vendor OUI-24.\n\n @deprecated This function is deprecated. Use `otThreadSetVendorOuiInfo()` instead.\n\n Requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aVendorOui The vendor OUI-24 value in Hexadecimal representation (e.g., OUI 64-16-66 is represented as\n `0x641666`). Must be a 24-bit value.\n\n @retval OT_ERROR_NONE Successfully set the vendor OUI.\n @retval OT_ERROR_INVALID_ARGS @p aVendorOui is not a valid 24-bit value."]
14176 pub fn otThreadSetVendorOui(aInstance: *mut otInstance, aVendorOui: u32) -> otError;
14177}
14178unsafe extern "C" {
14179 #[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."]
14180 pub fn otThreadSetVendorName(
14181 aInstance: *mut otInstance,
14182 aVendorName: *const ::std::os::raw::c_char,
14183 ) -> otError;
14184}
14185unsafe extern "C" {
14186 #[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)."]
14187 pub fn otThreadSetVendorModel(
14188 aInstance: *mut otInstance,
14189 aVendorModel: *const ::std::os::raw::c_char,
14190 ) -> otError;
14191}
14192unsafe extern "C" {
14193 #[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)."]
14194 pub fn otThreadSetVendorSwVersion(
14195 aInstance: *mut otInstance,
14196 aVendorSwVersion: *const ::std::os::raw::c_char,
14197 ) -> otError;
14198}
14199unsafe extern "C" {
14200 #[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)."]
14201 pub fn otThreadSetVendorAppUrl(
14202 aInstance: *mut otInstance,
14203 aVendorAppUrl: *const ::std::os::raw::c_char,
14204 ) -> otError;
14205}
14206#[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."]
14207pub type otThreadNonPreferredChannelsResetCallback =
14208 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14209unsafe extern "C" {
14210 #[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."]
14211 pub fn otThreadSetNonPreferredChannels(aInstance: *mut otInstance, aChannelMask: otChannelMask);
14212}
14213unsafe extern "C" {
14214 #[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."]
14215 pub fn otThreadGetNonPreferredChannels(aInstance: *mut otInstance) -> otChannelMask;
14216}
14217unsafe extern "C" {
14218 #[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."]
14219 pub fn otThreadSetNonPreferredChannelsResetCallback(
14220 aInstance: *mut otInstance,
14221 aCallback: otThreadNonPreferredChannelsResetCallback,
14222 aContext: *mut ::std::os::raw::c_void,
14223 );
14224}
14225#[doc = "< The device hasn't attached to a network."]
14226pub const OT_NETWORK_TIME_UNSYNCHRONIZED: otNetworkTimeStatus = -1;
14227#[doc = "< The device hasn’t received time sync for more than two periods time."]
14228pub const OT_NETWORK_TIME_RESYNC_NEEDED: otNetworkTimeStatus = 0;
14229#[doc = "< The device network time is synchronized."]
14230pub const OT_NETWORK_TIME_SYNCHRONIZED: otNetworkTimeStatus = 1;
14231#[doc = " Represents OpenThread time synchronization status."]
14232pub type otNetworkTimeStatus = ::std::os::raw::c_int;
14233#[doc = " Pointer is called when a network time sync or status change occurs."]
14234pub type otNetworkTimeSyncCallbackFn =
14235 ::std::option::Option<unsafe extern "C" fn(aCallbackContext: *mut ::std::os::raw::c_void)>;
14236unsafe extern "C" {
14237 #[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."]
14238 pub fn otNetworkTimeGet(
14239 aInstance: *mut otInstance,
14240 aNetworkTime: *mut u64,
14241 ) -> otNetworkTimeStatus;
14242}
14243unsafe extern "C" {
14244 #[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."]
14245 pub fn otNetworkTimeSetSyncPeriod(aInstance: *mut otInstance, aTimeSyncPeriod: u16) -> otError;
14246}
14247unsafe extern "C" {
14248 #[doc = " Get the time synchronization period.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The time synchronization period."]
14249 pub fn otNetworkTimeGetSyncPeriod(aInstance: *mut otInstance) -> u16;
14250}
14251unsafe extern "C" {
14252 #[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."]
14253 pub fn otNetworkTimeSetXtalThreshold(
14254 aInstance: *mut otInstance,
14255 aXTALThreshold: u16,
14256 ) -> otError;
14257}
14258unsafe extern "C" {
14259 #[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."]
14260 pub fn otNetworkTimeGetXtalThreshold(aInstance: *mut otInstance) -> u16;
14261}
14262unsafe extern "C" {
14263 #[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"]
14264 pub fn otNetworkTimeSyncSetCallback(
14265 aInstance: *mut otInstance,
14266 aCallbackFn: otNetworkTimeSyncCallbackFn,
14267 aCallbackContext: *mut ::std::os::raw::c_void,
14268 );
14269}
14270#[doc = " Represents a ping reply."]
14271#[repr(C)]
14272#[derive(Copy, Clone)]
14273pub struct otPingSenderReply {
14274 #[doc = "< Sender IPv6 address (address from which ping reply was received)."]
14275 pub mSenderAddress: otIp6Address,
14276 #[doc = "< Round trip time in msec."]
14277 pub mRoundTripTime: u16,
14278 #[doc = "< Data size (number of bytes) in reply (excluding IPv6 and ICMP6 headers)."]
14279 pub mSize: u16,
14280 #[doc = "< Sequence number."]
14281 pub mSequenceNumber: u16,
14282 #[doc = "< Hop limit."]
14283 pub mHopLimit: u8,
14284}
14285impl Default for otPingSenderReply {
14286 fn default() -> Self {
14287 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14288 unsafe {
14289 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14290 s.assume_init()
14291 }
14292 }
14293}
14294#[doc = " Represents statistics of a ping request."]
14295#[repr(C)]
14296#[derive(Debug, Default, Copy, Clone)]
14297pub struct otPingSenderStatistics {
14298 #[doc = "< The number of ping requests already sent."]
14299 pub mSentCount: u16,
14300 #[doc = "< The number of ping replies received."]
14301 pub mReceivedCount: u16,
14302 #[doc = "< The total round trip time of ping requests."]
14303 pub mTotalRoundTripTime: u32,
14304 #[doc = "< The min round trip time among ping requests."]
14305 pub mMinRoundTripTime: u16,
14306 #[doc = "< The max round trip time among ping requests."]
14307 pub mMaxRoundTripTime: u16,
14308 #[doc = "< Whether this is a multicast ping request."]
14309 pub mIsMulticast: bool,
14310}
14311#[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."]
14312pub type otPingSenderReplyCallback = ::std::option::Option<
14313 unsafe extern "C" fn(aReply: *const otPingSenderReply, aContext: *mut ::std::os::raw::c_void),
14314>;
14315#[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."]
14316pub type otPingSenderStatisticsCallback = ::std::option::Option<
14317 unsafe extern "C" fn(
14318 aStatistics: *const otPingSenderStatistics,
14319 aContext: *mut ::std::os::raw::c_void,
14320 ),
14321>;
14322#[doc = " Represents a ping request configuration."]
14323#[repr(C)]
14324#[derive(Copy, Clone)]
14325pub struct otPingSenderConfig {
14326 #[doc = "< Source address of the ping."]
14327 pub mSource: otIp6Address,
14328 #[doc = "< Destination address to ping."]
14329 pub mDestination: otIp6Address,
14330 #[doc = "< Callback function to report replies (can be NULL if not needed)."]
14331 pub mReplyCallback: otPingSenderReplyCallback,
14332 #[doc = "< Callback function to report statistics (can be NULL if not needed)."]
14333 pub mStatisticsCallback: otPingSenderStatisticsCallback,
14334 #[doc = "< A pointer to the callback application-specific context."]
14335 pub mCallbackContext: *mut ::std::os::raw::c_void,
14336 #[doc = "< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default."]
14337 pub mSize: u16,
14338 #[doc = "< Number of ping messages to send. Zero to use default."]
14339 pub mCount: u16,
14340 #[doc = "< Ping tx interval in milliseconds. Zero to use default."]
14341 pub mInterval: u32,
14342 #[doc = "< Time in milliseconds to wait for final reply after sending final request.\n< Zero to use default."]
14343 pub mTimeout: u16,
14344 #[doc = "< Hop limit (used if `mAllowZeroHopLimit` is false). Zero for default."]
14345 pub mHopLimit: u8,
14346 #[doc = "< Indicates whether hop limit is zero."]
14347 pub mAllowZeroHopLimit: bool,
14348 #[doc = "< Allow looping back pings to multicast address that device is subscribed to."]
14349 pub mMulticastLoop: bool,
14350}
14351impl Default for otPingSenderConfig {
14352 fn default() -> Self {
14353 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14354 unsafe {
14355 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14356 s.assume_init()
14357 }
14358 }
14359}
14360unsafe extern "C" {
14361 #[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"]
14362 pub fn otPingSenderPing(
14363 aInstance: *mut otInstance,
14364 aConfig: *const otPingSenderConfig,
14365 ) -> otError;
14366}
14367unsafe extern "C" {
14368 #[doc = " Stops an ongoing ping.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
14369 pub fn otPingSenderStop(aInstance: *mut otInstance);
14370}
14371unsafe extern "C" {
14372 #[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."]
14373 pub fn otPlatAlarmMicroStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14374}
14375unsafe extern "C" {
14376 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14377 pub fn otPlatAlarmMicroStop(aInstance: *mut otInstance);
14378}
14379unsafe extern "C" {
14380 #[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."]
14381 pub fn otPlatAlarmMicroGetNow() -> u32;
14382}
14383unsafe extern "C" {
14384 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14385 pub fn otPlatAlarmMicroFired(aInstance: *mut otInstance);
14386}
14387unsafe extern "C" {
14388 #[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."]
14389 pub fn otPlatAlarmMilliStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14390}
14391unsafe extern "C" {
14392 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14393 pub fn otPlatAlarmMilliStop(aInstance: *mut otInstance);
14394}
14395unsafe extern "C" {
14396 #[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."]
14397 pub fn otPlatAlarmMilliGetNow() -> u32;
14398}
14399unsafe extern "C" {
14400 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14401 pub fn otPlatAlarmMilliFired(aInstance: *mut otInstance);
14402}
14403unsafe extern "C" {
14404 #[doc = " Signal diagnostics module that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14405 pub fn otPlatDiagAlarmFired(aInstance: *mut otInstance);
14406}
14407unsafe extern "C" {
14408 #[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."]
14409 pub fn otPlatBorderRoutingProcessIcmp6Ra(
14410 aInstance: *mut otInstance,
14411 aMessage: *const u8,
14412 aLength: u16,
14413 );
14414}
14415unsafe extern "C" {
14416 #[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."]
14417 pub fn otPlatBorderRoutingProcessDhcp6PdPrefix(
14418 aInstance: *mut otInstance,
14419 aPrefixInfo: *const otBorderRoutingPrefixTableEntry,
14420 );
14421}
14422unsafe extern "C" {
14423 #[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."]
14424 pub fn otPlatDebugUart_printf(fmt: *const ::std::os::raw::c_char, ...);
14425}
14426unsafe extern "C" {
14427 #[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."]
14428 pub fn otPlatDebugUart_vprintf(fmt: *const ::std::os::raw::c_char, ap: *mut __va_list_tag);
14429}
14430unsafe extern "C" {
14431 #[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"]
14432 pub fn otPlatDebugUart_putchar_raw(c: ::std::os::raw::c_int);
14433}
14434unsafe extern "C" {
14435 #[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."]
14436 pub fn otPlatDebugUart_kbhit() -> ::std::os::raw::c_int;
14437}
14438unsafe extern "C" {
14439 #[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"]
14440 pub fn otPlatDebugUart_getc() -> ::std::os::raw::c_int;
14441}
14442unsafe extern "C" {
14443 #[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"]
14444 pub fn otPlatDebugUart_putchar(c: ::std::os::raw::c_int);
14445}
14446unsafe extern "C" {
14447 #[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"]
14448 pub fn otPlatDebugUart_puts(s: *const ::std::os::raw::c_char);
14449}
14450unsafe extern "C" {
14451 #[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."]
14452 pub fn otPlatDebugUart_write_bytes(pBytes: *const u8, nBytes: ::std::os::raw::c_int);
14453}
14454unsafe extern "C" {
14455 #[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()"]
14456 pub fn otPlatDebugUart_puts_no_nl(s: *const ::std::os::raw::c_char);
14457}
14458unsafe extern "C" {
14459 #[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."]
14460 pub fn otPlatDebugUart_logfile(filename: *const ::std::os::raw::c_char) -> otError;
14461}
14462#[repr(C)]
14463#[derive(Debug, Copy, Clone)]
14464pub struct otPlatDnsUpstreamQuery {
14465 _unused: [u8; 0],
14466}
14467unsafe extern "C" {
14468 #[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."]
14469 pub fn otPlatDnsIsUpstreamQueryAvailable(aInstance: *mut otInstance) -> bool;
14470}
14471unsafe extern "C" {
14472 #[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."]
14473 pub fn otPlatDnsStartUpstreamQuery(
14474 aInstance: *mut otInstance,
14475 aTxn: *mut otPlatDnsUpstreamQuery,
14476 aQuery: *const otMessage,
14477 );
14478}
14479unsafe extern "C" {
14480 #[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."]
14481 pub fn otPlatDnsCancelUpstreamQuery(
14482 aInstance: *mut otInstance,
14483 aTxn: *mut otPlatDnsUpstreamQuery,
14484 );
14485}
14486unsafe extern "C" {
14487 #[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."]
14488 pub fn otPlatDnsUpstreamQueryDone(
14489 aInstance: *mut otInstance,
14490 aTxn: *mut otPlatDnsUpstreamQuery,
14491 aResponse: *mut otMessage,
14492 );
14493}
14494unsafe extern "C" {
14495 #[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."]
14496 pub fn otPlatEntropyGet(aOutput: *mut u8, aOutputLength: u16) -> otError;
14497}
14498unsafe extern "C" {
14499 #[doc = " Initializes the flash driver.\n\n @param[in] aInstance The OpenThread instance structure."]
14500 pub fn otPlatFlashInit(aInstance: *mut otInstance);
14501}
14502unsafe extern "C" {
14503 #[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."]
14504 pub fn otPlatFlashGetSwapSize(aInstance: *mut otInstance) -> u32;
14505}
14506unsafe extern "C" {
14507 #[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."]
14508 pub fn otPlatFlashErase(aInstance: *mut otInstance, aSwapIndex: u8);
14509}
14510unsafe extern "C" {
14511 #[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."]
14512 pub fn otPlatFlashRead(
14513 aInstance: *mut otInstance,
14514 aSwapIndex: u8,
14515 aOffset: u32,
14516 aData: *mut ::std::os::raw::c_void,
14517 aSize: u32,
14518 );
14519}
14520unsafe extern "C" {
14521 #[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."]
14522 pub fn otPlatFlashWrite(
14523 aInstance: *mut otInstance,
14524 aSwapIndex: u8,
14525 aOffset: u32,
14526 aData: *const ::std::os::raw::c_void,
14527 aSize: u32,
14528 );
14529}
14530#[doc = " Represents an InfraIf Link-Layer Address."]
14531#[repr(C)]
14532#[derive(Debug, Default, Copy, Clone)]
14533pub struct otPlatInfraIfLinkLayerAddress {
14534 #[doc = "< The link-layer address bytes."]
14535 pub mAddress: [u8; 16usize],
14536 #[doc = "< The address length (number of bytes)."]
14537 pub mLength: u8,
14538}
14539unsafe extern "C" {
14540 #[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."]
14541 pub fn otPlatInfraIfHasAddress(
14542 aInstance: *mut otInstance,
14543 aInfraIfIndex: u32,
14544 aAddress: *const otIp6Address,
14545 ) -> bool;
14546}
14547unsafe extern "C" {
14548 #[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."]
14549 pub fn otPlatInfraIfSendIcmp6Nd(
14550 aInstance: *mut otInstance,
14551 aInfraIfIndex: u32,
14552 aDestAddress: *const otIp6Address,
14553 aBuffer: *const u8,
14554 aBufferLength: u16,
14555 ) -> otError;
14556}
14557unsafe extern "C" {
14558 #[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."]
14559 pub fn otPlatInfraIfRecvIcmp6Nd(
14560 aInstance: *mut otInstance,
14561 aInfraIfIndex: u32,
14562 aSrcAddress: *const otIp6Address,
14563 aBuffer: *const u8,
14564 aBufferLength: u16,
14565 );
14566}
14567unsafe extern "C" {
14568 #[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."]
14569 pub fn otPlatInfraIfStateChanged(
14570 aInstance: *mut otInstance,
14571 aInfraIfIndex: u32,
14572 aIsRunning: bool,
14573 ) -> otError;
14574}
14575unsafe extern "C" {
14576 #[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)."]
14577 pub fn otPlatInfraIfDiscoverNat64Prefix(
14578 aInstance: *mut otInstance,
14579 aInfraIfIndex: u32,
14580 ) -> otError;
14581}
14582unsafe extern "C" {
14583 #[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)."]
14584 pub fn otPlatInfraIfDiscoverNat64PrefixDone(
14585 aInstance: *mut otInstance,
14586 aInfraIfIndex: u32,
14587 aIp6Prefix: *const otIp6Prefix,
14588 );
14589}
14590unsafe extern "C" {
14591 #[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."]
14592 pub fn otPlatGetInfraIfLinkLayerAddress(
14593 aInstance: *mut otInstance,
14594 aIfIndex: u32,
14595 aInfraIfLinkLayerAddress: *mut otPlatInfraIfLinkLayerAddress,
14596 ) -> otError;
14597}
14598unsafe extern "C" {
14599 #[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."]
14600 pub fn otPlatInfraIfDhcp6PdClientSetListeningEnabled(
14601 aInstance: *mut otInstance,
14602 aEnable: bool,
14603 aInfraIfIndex: u32,
14604 );
14605}
14606unsafe extern "C" {
14607 #[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."]
14608 pub fn otPlatInfraIfDhcp6PdClientSend(
14609 aInstance: *mut otInstance,
14610 aMessage: *mut otMessage,
14611 aDestAddress: *mut otIp6Address,
14612 aInfraIfIndex: u32,
14613 );
14614}
14615unsafe extern "C" {
14616 #[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.."]
14617 pub fn otPlatInfraIfDhcp6PdClientHandleReceived(
14618 aInstance: *mut otInstance,
14619 aMessage: *mut otMessage,
14620 aInfraIfIndex: u32,
14621 );
14622}
14623unsafe extern "C" {
14624 #[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."]
14625 pub fn otPlatCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
14626}
14627unsafe extern "C" {
14628 #[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."]
14629 pub fn otPlatFree(aPtr: *mut ::std::os::raw::c_void);
14630}
14631#[doc = " Represents an OpenThread message buffer."]
14632#[repr(C)]
14633#[derive(Debug, Copy, Clone)]
14634pub struct otMessageBuffer {
14635 #[doc = "< Pointer to the next buffer."]
14636 pub mNext: *mut otMessageBuffer,
14637}
14638impl Default for otMessageBuffer {
14639 fn default() -> Self {
14640 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14641 unsafe {
14642 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14643 s.assume_init()
14644 }
14645 }
14646}
14647unsafe extern "C" {
14648 #[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."]
14649 pub fn otPlatMessagePoolInit(
14650 aInstance: *mut otInstance,
14651 aMinNumFreeBuffers: u16,
14652 aBufferSize: usize,
14653 );
14654}
14655unsafe extern "C" {
14656 #[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."]
14657 pub fn otPlatMessagePoolNew(aInstance: *mut otInstance) -> *mut otMessageBuffer;
14658}
14659unsafe extern "C" {
14660 #[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."]
14661 pub fn otPlatMessagePoolFree(aInstance: *mut otInstance, aBuffer: *mut otMessageBuffer);
14662}
14663unsafe extern "C" {
14664 #[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."]
14665 pub fn otPlatMessagePoolNumFreeBuffers(aInstance: *mut otInstance) -> u16;
14666}
14667unsafe extern "C" {
14668 #[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."]
14669 pub fn otPlatMessagePoolDeinit(aInstance: *mut otInstance);
14670}
14671unsafe extern "C" {
14672 #[doc = " Performs a software reset on the platform, if supported.\n\n @param[in] aInstance The OpenThread instance structure."]
14673 pub fn otPlatReset(aInstance: *mut otInstance);
14674}
14675unsafe extern "C" {
14676 #[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."]
14677 pub fn otPlatResetToBootloader(aInstance: *mut otInstance) -> otError;
14678}
14679pub const OT_PLAT_RESET_REASON_POWER_ON: otPlatResetReason = 0;
14680pub const OT_PLAT_RESET_REASON_EXTERNAL: otPlatResetReason = 1;
14681pub const OT_PLAT_RESET_REASON_SOFTWARE: otPlatResetReason = 2;
14682pub const OT_PLAT_RESET_REASON_FAULT: otPlatResetReason = 3;
14683pub const OT_PLAT_RESET_REASON_CRASH: otPlatResetReason = 4;
14684pub const OT_PLAT_RESET_REASON_ASSERT: otPlatResetReason = 5;
14685pub const OT_PLAT_RESET_REASON_OTHER: otPlatResetReason = 6;
14686pub const OT_PLAT_RESET_REASON_UNKNOWN: otPlatResetReason = 7;
14687pub const OT_PLAT_RESET_REASON_WATCHDOG: otPlatResetReason = 8;
14688pub const OT_PLAT_RESET_REASON_COUNT: otPlatResetReason = 9;
14689#[doc = " Enumeration of possible reset reason codes.\n\n These are in the same order as the Spinel reset reason codes."]
14690pub type otPlatResetReason = ::std::os::raw::c_uint;
14691unsafe extern "C" {
14692 #[doc = " Returns the reason for the last platform reset.\n\n @param[in] aInstance The OpenThread instance structure."]
14693 pub fn otPlatGetResetReason(aInstance: *mut otInstance) -> otPlatResetReason;
14694}
14695unsafe extern "C" {
14696 #[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."]
14697 pub fn otPlatAssertFail(
14698 aFilename: *const ::std::os::raw::c_char,
14699 aLineNumber: ::std::os::raw::c_int,
14700 );
14701}
14702unsafe extern "C" {
14703 #[doc = " Performs a platform specific operation to wake the host MCU.\n This is used only for NCP configurations."]
14704 pub fn otPlatWakeHost();
14705}
14706#[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."]
14707pub const OT_PLAT_MCU_POWER_STATE_ON: otPlatMcuPowerState = 0;
14708#[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."]
14709pub const OT_PLAT_MCU_POWER_STATE_LOW_POWER: otPlatMcuPowerState = 1;
14710#[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."]
14711pub const OT_PLAT_MCU_POWER_STATE_OFF: otPlatMcuPowerState = 2;
14712#[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`."]
14713pub type otPlatMcuPowerState = ::std::os::raw::c_uint;
14714unsafe extern "C" {
14715 #[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."]
14716 pub fn otPlatSetMcuPowerState(
14717 aInstance: *mut otInstance,
14718 aState: otPlatMcuPowerState,
14719 ) -> otError;
14720}
14721unsafe extern "C" {
14722 #[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."]
14723 pub fn otPlatGetMcuPowerState(aInstance: *mut otInstance) -> otPlatMcuPowerState;
14724}
14725unsafe extern "C" {
14726 #[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"]
14727 pub fn otPlatLogCrashDump() -> otError;
14728}
14729unsafe extern "C" {
14730 #[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."]
14731 pub fn otPlatOtnsStatus(aStatus: *const ::std::os::raw::c_char);
14732}
14733#[doc = "< Active Operational Dataset."]
14734pub const OT_SETTINGS_KEY_ACTIVE_DATASET: _bindgen_ty_11 = 1;
14735#[doc = "< Pending Operational Dataset."]
14736pub const OT_SETTINGS_KEY_PENDING_DATASET: _bindgen_ty_11 = 2;
14737#[doc = "< Thread network information."]
14738pub const OT_SETTINGS_KEY_NETWORK_INFO: _bindgen_ty_11 = 3;
14739#[doc = "< Parent information."]
14740pub const OT_SETTINGS_KEY_PARENT_INFO: _bindgen_ty_11 = 4;
14741#[doc = "< Child information."]
14742pub const OT_SETTINGS_KEY_CHILD_INFO: _bindgen_ty_11 = 5;
14743#[doc = "< SLAAC key to generate semantically opaque IID."]
14744pub const OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY: _bindgen_ty_11 = 7;
14745#[doc = "< Duplicate Address Detection (DAD) information."]
14746pub const OT_SETTINGS_KEY_DAD_INFO: _bindgen_ty_11 = 8;
14747#[doc = "< SRP client ECDSA public/private key pair."]
14748pub const OT_SETTINGS_KEY_SRP_ECDSA_KEY: _bindgen_ty_11 = 11;
14749#[doc = "< The SRP client info (selected SRP server address)."]
14750pub const OT_SETTINGS_KEY_SRP_CLIENT_INFO: _bindgen_ty_11 = 12;
14751#[doc = "< The SRP server info (UDP port)."]
14752pub const OT_SETTINGS_KEY_SRP_SERVER_INFO: _bindgen_ty_11 = 13;
14753#[doc = "< BR ULA prefix."]
14754pub const OT_SETTINGS_KEY_BR_ULA_PREFIX: _bindgen_ty_11 = 15;
14755#[doc = "< BR local on-link prefixes."]
14756pub const OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES: _bindgen_ty_11 = 16;
14757#[doc = "< Unique Border Agent/Router ID."]
14758pub const OT_SETTINGS_KEY_BORDER_AGENT_ID: _bindgen_ty_11 = 17;
14759#[doc = "< TCAT Commissioner certificate"]
14760pub const OT_SETTINGS_KEY_TCAT_COMMR_CERT: _bindgen_ty_11 = 18;
14761pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MIN: _bindgen_ty_11 = 32768;
14762pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MAX: _bindgen_ty_11 = 65535;
14763#[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()`."]
14764pub type _bindgen_ty_11 = ::std::os::raw::c_uint;
14765unsafe extern "C" {
14766 #[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."]
14767 pub fn otPlatSettingsInit(
14768 aInstance: *mut otInstance,
14769 aSensitiveKeys: *const u16,
14770 aSensitiveKeysLength: u16,
14771 );
14772}
14773unsafe extern "C" {
14774 #[doc = " Performs any de-initialization for the settings subsystem, if necessary.\n\n @param[in] aInstance The OpenThread instance structure."]
14775 pub fn otPlatSettingsDeinit(aInstance: *mut otInstance);
14776}
14777unsafe extern "C" {
14778 #[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."]
14779 pub fn otPlatSettingsGet(
14780 aInstance: *mut otInstance,
14781 aKey: u16,
14782 aIndex: ::std::os::raw::c_int,
14783 aValue: *mut u8,
14784 aValueLength: *mut u16,
14785 ) -> otError;
14786}
14787unsafe extern "C" {
14788 #[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."]
14789 pub fn otPlatSettingsSet(
14790 aInstance: *mut otInstance,
14791 aKey: u16,
14792 aValue: *const u8,
14793 aValueLength: u16,
14794 ) -> otError;
14795}
14796unsafe extern "C" {
14797 #[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."]
14798 pub fn otPlatSettingsAdd(
14799 aInstance: *mut otInstance,
14800 aKey: u16,
14801 aValue: *const u8,
14802 aValueLength: u16,
14803 ) -> otError;
14804}
14805unsafe extern "C" {
14806 #[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."]
14807 pub fn otPlatSettingsDelete(
14808 aInstance: *mut otInstance,
14809 aKey: u16,
14810 aIndex: ::std::os::raw::c_int,
14811 ) -> otError;
14812}
14813unsafe extern "C" {
14814 #[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."]
14815 pub fn otPlatSettingsWipe(aInstance: *mut otInstance);
14816}
14817#[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."]
14818pub type otPlatSpiSlaveTransactionCompleteCallback = ::std::option::Option<
14819 unsafe extern "C" fn(
14820 aContext: *mut ::std::os::raw::c_void,
14821 aOutputBuf: *mut u8,
14822 aOutputBufLen: u16,
14823 aInputBuf: *mut u8,
14824 aInputBufLen: u16,
14825 aTransactionLength: u16,
14826 ) -> bool,
14827>;
14828#[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()`."]
14829pub type otPlatSpiSlaveTransactionProcessCallback =
14830 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14831unsafe extern "C" {
14832 #[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."]
14833 pub fn otPlatSpiSlaveEnable(
14834 aCompleteCallback: otPlatSpiSlaveTransactionCompleteCallback,
14835 aProcessCallback: otPlatSpiSlaveTransactionProcessCallback,
14836 aContext: *mut ::std::os::raw::c_void,
14837 ) -> otError;
14838}
14839unsafe extern "C" {
14840 #[doc = " Shutdown and disable the SPI slave interface."]
14841 pub fn otPlatSpiSlaveDisable();
14842}
14843unsafe extern "C" {
14844 #[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."]
14845 pub fn otPlatSpiSlavePrepareTransaction(
14846 aOutputBuf: *mut u8,
14847 aOutputBufLen: u16,
14848 aInputBuf: *mut u8,
14849 aInputBufLen: u16,
14850 aRequestTransactionFlag: bool,
14851 ) -> otError;
14852}
14853unsafe extern "C" {
14854 #[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."]
14855 pub fn otPlatTimeGet() -> u64;
14856}
14857unsafe extern "C" {
14858 #[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."]
14859 pub fn otPlatTimeGetXtalAccuracy() -> u16;
14860}
14861unsafe extern "C" {
14862 #[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."]
14863 pub fn otPlatTrelEnable(aInstance: *mut otInstance, aUdpPort: *mut u16);
14864}
14865unsafe extern "C" {
14866 #[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."]
14867 pub fn otPlatTrelDisable(aInstance: *mut otInstance);
14868}
14869#[doc = " Represents a TREL peer info discovered using DNS-SD browse on the service name \"_trel._udp\"."]
14870#[repr(C)]
14871#[derive(Copy, Clone)]
14872pub struct otPlatTrelPeerInfo {
14873 #[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."]
14874 pub mRemoved: bool,
14875 #[doc = " The TXT record data (encoded as specified by DNS-SD) from the SRV record of the discovered TREL peer service\n instance."]
14876 pub mTxtData: *const u8,
14877 #[doc = "< Number of bytes in @p mTxtData buffer."]
14878 pub mTxtLength: u16,
14879 #[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."]
14880 pub mSockAddr: otSockAddr,
14881}
14882impl Default for otPlatTrelPeerInfo {
14883 fn default() -> Self {
14884 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14885 unsafe {
14886 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14887 s.assume_init()
14888 }
14889 }
14890}
14891unsafe extern "C" {
14892 #[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."]
14893 pub fn otPlatTrelHandleDiscoveredPeerInfo(
14894 aInstance: *mut otInstance,
14895 aInfo: *const otPlatTrelPeerInfo,
14896 );
14897}
14898unsafe extern "C" {
14899 #[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)."]
14900 pub fn otPlatTrelNotifyPeerSocketAddressDifference(
14901 aInstance: *mut otInstance,
14902 aPeerSockAddr: *const otSockAddr,
14903 aRxSockAddr: *const otSockAddr,
14904 );
14905}
14906unsafe extern "C" {
14907 #[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)."]
14908 pub fn otPlatTrelRegisterService(
14909 aInstance: *mut otInstance,
14910 aPort: u16,
14911 aTxtData: *const u8,
14912 aTxtLength: u8,
14913 );
14914}
14915unsafe extern "C" {
14916 #[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."]
14917 pub fn otPlatTrelSend(
14918 aInstance: *mut otInstance,
14919 aUdpPayload: *const u8,
14920 aUdpPayloadLen: u16,
14921 aDestSockAddr: *const otSockAddr,
14922 );
14923}
14924unsafe extern "C" {
14925 #[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."]
14926 pub fn otPlatTrelHandleReceived(
14927 aInstance: *mut otInstance,
14928 aBuffer: *mut u8,
14929 aLength: u16,
14930 aSenderAddr: *const otSockAddr,
14931 );
14932}
14933#[doc = " Represents a group of TREL related counters in the platform layer."]
14934#[repr(C)]
14935#[derive(Debug, Default, Copy, Clone)]
14936pub struct otPlatTrelCounters {
14937 #[doc = "< Number of packets successfully transmitted through TREL."]
14938 pub mTxPackets: u64,
14939 #[doc = "< Sum of size of packets successfully transmitted through TREL."]
14940 pub mTxBytes: u64,
14941 #[doc = "< Number of packet transmission failures through TREL."]
14942 pub mTxFailure: u64,
14943 #[doc = "< Number of packets received through TREL."]
14944 pub mRxPackets: u64,
14945 #[doc = "< Sum of size of packets received through TREL."]
14946 pub mRxBytes: u64,
14947}
14948unsafe extern "C" {
14949 #[doc = " Gets the pointer to the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
14950 pub fn otPlatTrelGetCounters(aInstance: *mut otInstance) -> *const otPlatTrelCounters;
14951}
14952unsafe extern "C" {
14953 #[doc = " Resets the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
14954 pub fn otPlatTrelResetCounters(aInstance: *mut otInstance);
14955}
14956#[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."]
14957pub type otUdpHandler = ::std::option::Option<
14958 unsafe extern "C" fn(
14959 aContext: *mut ::std::os::raw::c_void,
14960 aMessage: *const otMessage,
14961 aMessageInfo: *const otMessageInfo,
14962 ) -> bool,
14963>;
14964#[doc = " Represents a UDP receiver."]
14965#[repr(C)]
14966#[derive(Debug, Copy, Clone)]
14967pub struct otUdpReceiver {
14968 #[doc = "< A pointer to the next UDP receiver (internal use only)."]
14969 pub mNext: *mut otUdpReceiver,
14970 #[doc = "< A function pointer to the receiver callback."]
14971 pub mHandler: otUdpHandler,
14972 #[doc = "< A pointer to application-specific context."]
14973 pub mContext: *mut ::std::os::raw::c_void,
14974}
14975impl Default for otUdpReceiver {
14976 fn default() -> Self {
14977 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14978 unsafe {
14979 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14980 s.assume_init()
14981 }
14982 }
14983}
14984unsafe extern "C" {
14985 #[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."]
14986 pub fn otUdpAddReceiver(
14987 aInstance: *mut otInstance,
14988 aUdpReceiver: *mut otUdpReceiver,
14989 ) -> otError;
14990}
14991unsafe extern "C" {
14992 #[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."]
14993 pub fn otUdpRemoveReceiver(
14994 aInstance: *mut otInstance,
14995 aUdpReceiver: *mut otUdpReceiver,
14996 ) -> otError;
14997}
14998unsafe extern "C" {
14999 #[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."]
15000 pub fn otUdpSendDatagram(
15001 aInstance: *mut otInstance,
15002 aMessage: *mut otMessage,
15003 aMessageInfo: *mut otMessageInfo,
15004 ) -> otError;
15005}
15006#[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."]
15007pub type otUdpReceive = ::std::option::Option<
15008 unsafe extern "C" fn(
15009 aContext: *mut ::std::os::raw::c_void,
15010 aMessage: *mut otMessage,
15011 aMessageInfo: *const otMessageInfo,
15012 ),
15013>;
15014#[doc = "< Unspecified network interface."]
15015pub const OT_NETIF_UNSPECIFIED: otNetifIdentifier = 0;
15016#[doc = "< The host Thread interface - allow use of platform UDP."]
15017pub const OT_NETIF_THREAD_HOST: otNetifIdentifier = 1;
15018#[doc = "< The internal Thread interface (within OpenThread) - do not use platform UDP."]
15019pub const OT_NETIF_THREAD_INTERNAL: otNetifIdentifier = 2;
15020#[doc = "< The Backbone interface."]
15021pub const OT_NETIF_BACKBONE: otNetifIdentifier = 3;
15022#[doc = " Defines the OpenThread network interface identifiers."]
15023pub type otNetifIdentifier = ::std::os::raw::c_uint;
15024#[doc = " Represents a UDP socket."]
15025#[repr(C)]
15026#[derive(Copy, Clone)]
15027pub struct otUdpSocket {
15028 #[doc = "< The local IPv6 socket address."]
15029 pub mSockName: otSockAddr,
15030 #[doc = "< The peer IPv6 socket address."]
15031 pub mPeerName: otSockAddr,
15032 #[doc = "< A function pointer to the application callback."]
15033 pub mHandler: otUdpReceive,
15034 #[doc = "< A pointer to application-specific context."]
15035 pub mContext: *mut ::std::os::raw::c_void,
15036 #[doc = "< A handle to platform's UDP."]
15037 pub mHandle: *mut ::std::os::raw::c_void,
15038 #[doc = "< A pointer to the next UDP socket (internal use only)."]
15039 pub mNext: *mut otUdpSocket,
15040 #[doc = "< The network interface identifier."]
15041 pub mNetifId: otNetifIdentifier,
15042}
15043impl Default for otUdpSocket {
15044 fn default() -> Self {
15045 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15046 unsafe {
15047 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15048 s.assume_init()
15049 }
15050 }
15051}
15052unsafe extern "C" {
15053 #[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"]
15054 pub fn otUdpNewMessage(
15055 aInstance: *mut otInstance,
15056 aSettings: *const otMessageSettings,
15057 ) -> *mut otMessage;
15058}
15059unsafe extern "C" {
15060 #[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."]
15061 pub fn otUdpOpen(
15062 aInstance: *mut otInstance,
15063 aSocket: *mut otUdpSocket,
15064 aCallback: otUdpReceive,
15065 aContext: *mut ::std::os::raw::c_void,
15066 ) -> otError;
15067}
15068unsafe extern "C" {
15069 #[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."]
15070 pub fn otUdpIsOpen(aInstance: *mut otInstance, aSocket: *const otUdpSocket) -> bool;
15071}
15072unsafe extern "C" {
15073 #[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."]
15074 pub fn otUdpClose(aInstance: *mut otInstance, aSocket: *mut otUdpSocket) -> otError;
15075}
15076unsafe extern "C" {
15077 #[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."]
15078 pub fn otUdpBind(
15079 aInstance: *mut otInstance,
15080 aSocket: *mut otUdpSocket,
15081 aSockName: *const otSockAddr,
15082 aNetif: otNetifIdentifier,
15083 ) -> otError;
15084}
15085unsafe extern "C" {
15086 #[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."]
15087 pub fn otUdpConnect(
15088 aInstance: *mut otInstance,
15089 aSocket: *mut otUdpSocket,
15090 aSockName: *const otSockAddr,
15091 ) -> otError;
15092}
15093unsafe extern "C" {
15094 #[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."]
15095 pub fn otUdpSend(
15096 aInstance: *mut otInstance,
15097 aSocket: *mut otUdpSocket,
15098 aMessage: *mut otMessage,
15099 aMessageInfo: *const otMessageInfo,
15100 ) -> otError;
15101}
15102unsafe extern "C" {
15103 #[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."]
15104 pub fn otUdpGetSockets(aInstance: *mut otInstance) -> *mut otUdpSocket;
15105}
15106#[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."]
15107pub type otUdpForwarder = ::std::option::Option<
15108 unsafe extern "C" fn(
15109 aMessage: *mut otMessage,
15110 aPeerPort: u16,
15111 aPeerAddr: *mut otIp6Address,
15112 aSockPort: u16,
15113 aContext: *mut ::std::os::raw::c_void,
15114 ),
15115>;
15116unsafe extern "C" {
15117 #[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."]
15118 pub fn otUdpForwardSetForwarder(
15119 aInstance: *mut otInstance,
15120 aForwarder: otUdpForwarder,
15121 aContext: *mut ::std::os::raw::c_void,
15122 );
15123}
15124unsafe extern "C" {
15125 #[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."]
15126 pub fn otUdpForwardReceive(
15127 aInstance: *mut otInstance,
15128 aMessage: *mut otMessage,
15129 aPeerPort: u16,
15130 aPeerAddr: *const otIp6Address,
15131 aSockPort: u16,
15132 );
15133}
15134unsafe extern "C" {
15135 #[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)."]
15136 pub fn otUdpIsPortInUse(aInstance: *mut otInstance, port: u16) -> bool;
15137}
15138unsafe extern "C" {
15139 #[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."]
15140 pub fn otPlatUdpSocket(aUdpSocket: *mut otUdpSocket) -> otError;
15141}
15142unsafe extern "C" {
15143 #[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."]
15144 pub fn otPlatUdpClose(aUdpSocket: *mut otUdpSocket) -> otError;
15145}
15146unsafe extern "C" {
15147 #[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."]
15148 pub fn otPlatUdpBind(aUdpSocket: *mut otUdpSocket) -> otError;
15149}
15150unsafe extern "C" {
15151 #[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."]
15152 pub fn otPlatUdpBindToNetif(
15153 aUdpSocket: *mut otUdpSocket,
15154 aNetifIdentifier: otNetifIdentifier,
15155 ) -> otError;
15156}
15157unsafe extern "C" {
15158 #[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."]
15159 pub fn otPlatUdpConnect(aUdpSocket: *mut otUdpSocket) -> otError;
15160}
15161unsafe extern "C" {
15162 #[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."]
15163 pub fn otPlatUdpSend(
15164 aUdpSocket: *mut otUdpSocket,
15165 aMessage: *mut otMessage,
15166 aMessageInfo: *const otMessageInfo,
15167 ) -> otError;
15168}
15169unsafe extern "C" {
15170 #[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."]
15171 pub fn otPlatUdpJoinMulticastGroup(
15172 aUdpSocket: *mut otUdpSocket,
15173 aNetifIdentifier: otNetifIdentifier,
15174 aAddress: *const otIp6Address,
15175 ) -> otError;
15176}
15177unsafe extern "C" {
15178 #[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."]
15179 pub fn otPlatUdpLeaveMulticastGroup(
15180 aUdpSocket: *mut otUdpSocket,
15181 aNetifIdentifier: otNetifIdentifier,
15182 aAddress: *const otIp6Address,
15183 ) -> otError;
15184}
15185unsafe extern "C" {
15186 #[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)."]
15187 pub fn otRandomCryptoFillBuffer(aBuffer: *mut u8, aSize: u16) -> otError;
15188}
15189unsafe extern "C" {
15190 #[doc = " Generates and returns a random `uint32_t` value.\n\n @returns A random `uint32_t` value."]
15191 pub fn otRandomNonCryptoGetUint32() -> u32;
15192}
15193unsafe extern "C" {
15194 #[doc = " Generates and returns a random byte.\n\n @returns A random `uint8_t` value."]
15195 pub fn otRandomNonCryptoGetUint8() -> u8;
15196}
15197unsafe extern "C" {
15198 #[doc = " Generates and returns a random `uint16_t` value.\n\n @returns A random `uint16_t` value."]
15199 pub fn otRandomNonCryptoGetUint16() -> u16;
15200}
15201unsafe extern "C" {
15202 #[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)."]
15203 pub fn otRandomNonCryptoGetUint8InRange(aMin: u8, aMax: u8) -> u8;
15204}
15205unsafe extern "C" {
15206 #[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)."]
15207 pub fn otRandomNonCryptoGetUint16InRange(aMin: u16, aMax: u16) -> u16;
15208}
15209unsafe extern "C" {
15210 #[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)."]
15211 pub fn otRandomNonCryptoGetUint32InRange(aMin: u32, aMax: u32) -> u32;
15212}
15213unsafe extern "C" {
15214 #[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)."]
15215 pub fn otRandomNonCryptoFillBuffer(aBuffer: *mut u8, aSize: u16);
15216}
15217unsafe extern "C" {
15218 #[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."]
15219 pub fn otRandomNonCryptoAddJitter(aValue: u32, aJitter: u16) -> u32;
15220}
15221unsafe extern "C" {
15222 #[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."]
15223 pub fn otServerGetNetDataLocal(
15224 aInstance: *mut otInstance,
15225 aStable: bool,
15226 aData: *mut u8,
15227 aDataLength: *mut u8,
15228 ) -> otError;
15229}
15230unsafe extern "C" {
15231 #[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"]
15232 pub fn otServerAddService(
15233 aInstance: *mut otInstance,
15234 aConfig: *const otServiceConfig,
15235 ) -> otError;
15236}
15237unsafe extern "C" {
15238 #[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"]
15239 pub fn otServerRemoveService(
15240 aInstance: *mut otInstance,
15241 aEnterpriseNumber: u32,
15242 aServiceData: *const u8,
15243 aServiceDataLength: u8,
15244 ) -> otError;
15245}
15246unsafe extern "C" {
15247 #[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."]
15248 pub fn otServerGetNextService(
15249 aInstance: *mut otInstance,
15250 aIterator: *mut otNetworkDataIterator,
15251 aConfig: *mut otServiceConfig,
15252 ) -> otError;
15253}
15254unsafe extern "C" {
15255 #[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"]
15256 pub fn otServerRegister(aInstance: *mut otInstance) -> otError;
15257}
15258#[doc = " Implements SNTP Query parameters."]
15259#[repr(C)]
15260#[derive(Debug, Copy, Clone)]
15261pub struct otSntpQuery {
15262 #[doc = "< A reference to the message info related with SNTP Server."]
15263 pub mMessageInfo: *const otMessageInfo,
15264}
15265impl Default for otSntpQuery {
15266 fn default() -> Self {
15267 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15268 unsafe {
15269 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15270 s.assume_init()
15271 }
15272 }
15273}
15274#[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."]
15275pub type otSntpResponseHandler = ::std::option::Option<
15276 unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void, aTime: u64, aResult: otError),
15277>;
15278unsafe extern "C" {
15279 #[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."]
15280 pub fn otSntpClientQuery(
15281 aInstance: *mut otInstance,
15282 aQuery: *const otSntpQuery,
15283 aHandler: otSntpResponseHandler,
15284 aContext: *mut ::std::os::raw::c_void,
15285 ) -> otError;
15286}
15287unsafe extern "C" {
15288 #[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."]
15289 pub fn otSntpClientSetUnixEra(aInstance: *mut otInstance, aUnixEra: u32);
15290}
15291#[doc = "< Item to be added/registered."]
15292pub const OT_SRP_CLIENT_ITEM_STATE_TO_ADD: otSrpClientItemState = 0;
15293#[doc = "< Item is being added/registered."]
15294pub const OT_SRP_CLIENT_ITEM_STATE_ADDING: otSrpClientItemState = 1;
15295#[doc = "< Item to be refreshed (re-register to renew lease)."]
15296pub const OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: otSrpClientItemState = 2;
15297#[doc = "< Item is being refreshed."]
15298pub const OT_SRP_CLIENT_ITEM_STATE_REFRESHING: otSrpClientItemState = 3;
15299#[doc = "< Item to be removed."]
15300pub const OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: otSrpClientItemState = 4;
15301#[doc = "< Item is being removed."]
15302pub const OT_SRP_CLIENT_ITEM_STATE_REMOVING: otSrpClientItemState = 5;
15303#[doc = "< Item is registered with server."]
15304pub const OT_SRP_CLIENT_ITEM_STATE_REGISTERED: otSrpClientItemState = 6;
15305#[doc = "< Item is removed."]
15306pub const OT_SRP_CLIENT_ITEM_STATE_REMOVED: otSrpClientItemState = 7;
15307#[doc = " Specifies an SRP client item (service or host info) state."]
15308pub type otSrpClientItemState = ::std::os::raw::c_uint;
15309#[doc = " Represents an SRP client host info."]
15310#[repr(C)]
15311#[derive(Debug, Copy, Clone)]
15312pub struct otSrpClientHostInfo {
15313 #[doc = "< Host name (label) string (NULL if not yet set)."]
15314 pub mName: *const ::std::os::raw::c_char,
15315 #[doc = "< Array of host IPv6 addresses (NULL if not set or auto address is enabled)."]
15316 pub mAddresses: *const otIp6Address,
15317 #[doc = "< Number of IPv6 addresses in `mAddresses` array."]
15318 pub mNumAddresses: u8,
15319 #[doc = "< Indicates whether auto address mode is enabled or not."]
15320 pub mAutoAddress: bool,
15321 #[doc = "< Host info state."]
15322 pub mState: otSrpClientItemState,
15323}
15324impl Default for otSrpClientHostInfo {
15325 fn default() -> Self {
15326 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15327 unsafe {
15328 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15329 s.assume_init()
15330 }
15331 }
15332}
15333#[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."]
15334#[repr(C)]
15335#[derive(Debug, Copy, Clone)]
15336pub struct otSrpClientService {
15337 #[doc = "< The service labels (e.g., \"_mt._udp\", not the full domain name)."]
15338 pub mName: *const ::std::os::raw::c_char,
15339 #[doc = "< The service instance name label (not the full name)."]
15340 pub mInstanceName: *const ::std::os::raw::c_char,
15341 #[doc = "< Array of sub-type labels (must end with `NULL` or can be `NULL`)."]
15342 pub mSubTypeLabels: *const *const ::std::os::raw::c_char,
15343 #[doc = "< Array of TXT entries (`mNumTxtEntries` gives num of entries)."]
15344 pub mTxtEntries: *const otDnsTxtEntry,
15345 #[doc = "< The service port number."]
15346 pub mPort: u16,
15347 #[doc = "< The service priority."]
15348 pub mPriority: u16,
15349 #[doc = "< The service weight."]
15350 pub mWeight: u16,
15351 #[doc = "< Number of entries in the `mTxtEntries` array."]
15352 pub mNumTxtEntries: u8,
15353 #[doc = "< Service state (managed by OT core)."]
15354 pub mState: otSrpClientItemState,
15355 #[doc = "< Internal data (used by OT core)."]
15356 pub mData: u32,
15357 #[doc = "< Pointer to next entry in a linked-list (managed by OT core)."]
15358 pub mNext: *mut otSrpClientService,
15359 #[doc = "< Desired lease interval in sec - zero to use default."]
15360 pub mLease: u32,
15361 #[doc = "< Desired key lease interval in sec - zero to use default."]
15362 pub mKeyLease: u32,
15363}
15364impl Default for otSrpClientService {
15365 fn default() -> Self {
15366 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15367 unsafe {
15368 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15369 s.assume_init()
15370 }
15371 }
15372}
15373#[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)."]
15374pub type otSrpClientCallback = ::std::option::Option<
15375 unsafe extern "C" fn(
15376 aError: otError,
15377 aHostInfo: *const otSrpClientHostInfo,
15378 aServices: *const otSrpClientService,
15379 aRemovedServices: *const otSrpClientService,
15380 aContext: *mut ::std::os::raw::c_void,
15381 ),
15382>;
15383#[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)."]
15384pub type otSrpClientAutoStartCallback = ::std::option::Option<
15385 unsafe extern "C" fn(aServerSockAddr: *const otSockAddr, aContext: *mut ::std::os::raw::c_void),
15386>;
15387unsafe extern "C" {
15388 #[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."]
15389 pub fn otSrpClientStart(
15390 aInstance: *mut otInstance,
15391 aServerSockAddr: *const otSockAddr,
15392 ) -> otError;
15393}
15394unsafe extern "C" {
15395 #[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."]
15396 pub fn otSrpClientStop(aInstance: *mut otInstance);
15397}
15398unsafe extern "C" {
15399 #[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."]
15400 pub fn otSrpClientIsRunning(aInstance: *mut otInstance) -> bool;
15401}
15402unsafe extern "C" {
15403 #[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)."]
15404 pub fn otSrpClientGetServerAddress(aInstance: *mut otInstance) -> *const otSockAddr;
15405}
15406unsafe extern "C" {
15407 #[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."]
15408 pub fn otSrpClientSetCallback(
15409 aInstance: *mut otInstance,
15410 aCallback: otSrpClientCallback,
15411 aContext: *mut ::std::os::raw::c_void,
15412 );
15413}
15414unsafe extern "C" {
15415 #[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."]
15416 pub fn otSrpClientEnableAutoStartMode(
15417 aInstance: *mut otInstance,
15418 aCallback: otSrpClientAutoStartCallback,
15419 aContext: *mut ::std::os::raw::c_void,
15420 );
15421}
15422unsafe extern "C" {
15423 #[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."]
15424 pub fn otSrpClientDisableAutoStartMode(aInstance: *mut otInstance);
15425}
15426unsafe extern "C" {
15427 #[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."]
15428 pub fn otSrpClientIsAutoStartModeEnabled(aInstance: *mut otInstance) -> bool;
15429}
15430unsafe extern "C" {
15431 #[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)."]
15432 pub fn otSrpClientGetTtl(aInstance: *mut otInstance) -> u32;
15433}
15434unsafe extern "C" {
15435 #[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."]
15436 pub fn otSrpClientSetTtl(aInstance: *mut otInstance, aTtl: u32);
15437}
15438unsafe extern "C" {
15439 #[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)."]
15440 pub fn otSrpClientGetLeaseInterval(aInstance: *mut otInstance) -> u32;
15441}
15442unsafe extern "C" {
15443 #[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."]
15444 pub fn otSrpClientSetLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15445}
15446unsafe extern "C" {
15447 #[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)."]
15448 pub fn otSrpClientGetKeyLeaseInterval(aInstance: *mut otInstance) -> u32;
15449}
15450unsafe extern "C" {
15451 #[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."]
15452 pub fn otSrpClientSetKeyLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15453}
15454unsafe extern "C" {
15455 #[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."]
15456 pub fn otSrpClientGetHostInfo(aInstance: *mut otInstance) -> *const otSrpClientHostInfo;
15457}
15458unsafe extern "C" {
15459 #[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."]
15460 pub fn otSrpClientSetHostName(
15461 aInstance: *mut otInstance,
15462 aName: *const ::std::os::raw::c_char,
15463 ) -> otError;
15464}
15465unsafe extern "C" {
15466 #[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."]
15467 pub fn otSrpClientEnableAutoHostAddress(aInstance: *mut otInstance) -> otError;
15468}
15469unsafe extern "C" {
15470 #[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."]
15471 pub fn otSrpClientSetHostAddresses(
15472 aInstance: *mut otInstance,
15473 aIp6Addresses: *const otIp6Address,
15474 aNumAddresses: u8,
15475 ) -> otError;
15476}
15477unsafe extern "C" {
15478 #[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`)."]
15479 pub fn otSrpClientAddService(
15480 aInstance: *mut otInstance,
15481 aService: *mut otSrpClientService,
15482 ) -> otError;
15483}
15484unsafe extern "C" {
15485 #[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."]
15486 pub fn otSrpClientRemoveService(
15487 aInstance: *mut otInstance,
15488 aService: *mut otSrpClientService,
15489 ) -> otError;
15490}
15491unsafe extern "C" {
15492 #[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."]
15493 pub fn otSrpClientClearService(
15494 aInstance: *mut otInstance,
15495 aService: *mut otSrpClientService,
15496 ) -> otError;
15497}
15498unsafe extern "C" {
15499 #[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."]
15500 pub fn otSrpClientGetServices(aInstance: *mut otInstance) -> *const otSrpClientService;
15501}
15502unsafe extern "C" {
15503 #[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."]
15504 pub fn otSrpClientRemoveHostAndServices(
15505 aInstance: *mut otInstance,
15506 aRemoveKeyLease: bool,
15507 aSendUnregToServer: bool,
15508 ) -> otError;
15509}
15510unsafe extern "C" {
15511 #[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."]
15512 pub fn otSrpClientClearHostAndServices(aInstance: *mut otInstance);
15513}
15514unsafe extern "C" {
15515 #[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."]
15516 pub fn otSrpClientGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15517}
15518unsafe extern "C" {
15519 #[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."]
15520 pub fn otSrpClientSetDomainName(
15521 aInstance: *mut otInstance,
15522 aName: *const ::std::os::raw::c_char,
15523 ) -> otError;
15524}
15525unsafe extern "C" {
15526 #[doc = " Converts a `otSrpClientItemState` to a string.\n\n @param[in] aItemState An item state.\n\n @returns A string representation of @p aItemState."]
15527 pub fn otSrpClientItemStateToString(
15528 aItemState: otSrpClientItemState,
15529 ) -> *const ::std::os::raw::c_char;
15530}
15531unsafe extern "C" {
15532 #[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."]
15533 pub fn otSrpClientSetServiceKeyRecordEnabled(aInstance: *mut otInstance, aEnabled: bool);
15534}
15535unsafe extern "C" {
15536 #[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."]
15537 pub fn otSrpClientIsServiceKeyRecordEnabled(aInstance: *mut otInstance) -> bool;
15538}
15539#[doc = " Represents a SRP client service pool entry."]
15540#[repr(C)]
15541#[derive(Debug, Copy, Clone)]
15542pub struct otSrpClientBuffersServiceEntry {
15543 #[doc = "< The SRP client service structure."]
15544 pub mService: otSrpClientService,
15545 #[doc = "< The SRP client TXT entry."]
15546 pub mTxtEntry: otDnsTxtEntry,
15547}
15548impl Default for otSrpClientBuffersServiceEntry {
15549 fn default() -> Self {
15550 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15551 unsafe {
15552 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15553 s.assume_init()
15554 }
15555 }
15556}
15557unsafe extern "C" {
15558 #[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."]
15559 pub fn otSrpClientBuffersGetHostNameString(
15560 aInstance: *mut otInstance,
15561 aSize: *mut u16,
15562 ) -> *mut ::std::os::raw::c_char;
15563}
15564unsafe extern "C" {
15565 #[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)."]
15566 pub fn otSrpClientBuffersGetHostAddressesArray(
15567 aInstance: *mut otInstance,
15568 aArrayLength: *mut u8,
15569 ) -> *mut otIp6Address;
15570}
15571unsafe extern "C" {
15572 #[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."]
15573 pub fn otSrpClientBuffersAllocateService(
15574 aInstance: *mut otInstance,
15575 ) -> *mut otSrpClientBuffersServiceEntry;
15576}
15577unsafe extern "C" {
15578 #[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)."]
15579 pub fn otSrpClientBuffersFreeService(
15580 aInstance: *mut otInstance,
15581 aService: *mut otSrpClientBuffersServiceEntry,
15582 );
15583}
15584unsafe extern "C" {
15585 #[doc = " Frees all previously allocated service entries.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15586 pub fn otSrpClientBuffersFreeAllServices(aInstance: *mut otInstance);
15587}
15588unsafe extern "C" {
15589 #[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."]
15590 pub fn otSrpClientBuffersGetServiceEntryServiceNameString(
15591 aEntry: *mut otSrpClientBuffersServiceEntry,
15592 aSize: *mut u16,
15593 ) -> *mut ::std::os::raw::c_char;
15594}
15595unsafe extern "C" {
15596 #[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."]
15597 pub fn otSrpClientBuffersGetServiceEntryInstanceNameString(
15598 aEntry: *mut otSrpClientBuffersServiceEntry,
15599 aSize: *mut u16,
15600 ) -> *mut ::std::os::raw::c_char;
15601}
15602unsafe extern "C" {
15603 #[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."]
15604 pub fn otSrpClientBuffersGetServiceEntryTxtBuffer(
15605 aEntry: *mut otSrpClientBuffersServiceEntry,
15606 aSize: *mut u16,
15607 ) -> *mut u8;
15608}
15609unsafe extern "C" {
15610 #[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."]
15611 pub fn otSrpClientBuffersGetSubTypeLabelsArray(
15612 aEntry: *mut otSrpClientBuffersServiceEntry,
15613 aArrayLength: *mut u16,
15614 ) -> *mut *const ::std::os::raw::c_char;
15615}
15616#[repr(C)]
15617#[derive(Debug, Copy, Clone)]
15618pub struct otSrpServerHost {
15619 _unused: [u8; 0],
15620}
15621#[repr(C)]
15622#[derive(Debug, Copy, Clone)]
15623pub struct otSrpServerService {
15624 _unused: [u8; 0],
15625}
15626#[doc = " The ID of a SRP service update transaction on the SRP Server."]
15627pub type otSrpServerServiceUpdateId = u32;
15628#[doc = "< The SRP server is disabled."]
15629pub const OT_SRP_SERVER_STATE_DISABLED: otSrpServerState = 0;
15630#[doc = "< The SRP server is enabled and running."]
15631pub const OT_SRP_SERVER_STATE_RUNNING: otSrpServerState = 1;
15632#[doc = "< The SRP server is enabled but stopped."]
15633pub const OT_SRP_SERVER_STATE_STOPPED: otSrpServerState = 2;
15634#[doc = " Represents the state of the SRP server."]
15635pub type otSrpServerState = ::std::os::raw::c_uint;
15636#[doc = "< Unicast address mode. Use Network Data publisher."]
15637pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST: otSrpServerAddressMode = 0;
15638#[doc = "< Anycast address mode. Use Network Data publisher"]
15639pub const OT_SRP_SERVER_ADDRESS_MODE_ANYCAST: otSrpServerAddressMode = 1;
15640#[doc = "< Unicast address mode. Immediately force add to Network Data."]
15641pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD: otSrpServerAddressMode = 2;
15642#[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."]
15643pub type otSrpServerAddressMode = ::std::os::raw::c_uint;
15644#[doc = " Includes SRP server TTL configurations."]
15645#[repr(C)]
15646#[derive(Debug, Default, Copy, Clone)]
15647pub struct otSrpServerTtlConfig {
15648 #[doc = "< The minimum TTL in seconds."]
15649 pub mMinTtl: u32,
15650 #[doc = "< The maximum TTL in seconds."]
15651 pub mMaxTtl: u32,
15652}
15653#[doc = " Includes SRP server LEASE and KEY-LEASE configurations."]
15654#[repr(C)]
15655#[derive(Debug, Default, Copy, Clone)]
15656pub struct otSrpServerLeaseConfig {
15657 #[doc = "< The minimum LEASE interval in seconds."]
15658 pub mMinLease: u32,
15659 #[doc = "< The maximum LEASE interval in seconds."]
15660 pub mMaxLease: u32,
15661 #[doc = "< The minimum KEY-LEASE interval in seconds."]
15662 pub mMinKeyLease: u32,
15663 #[doc = "< The maximum KEY-LEASE interval in seconds."]
15664 pub mMaxKeyLease: u32,
15665}
15666#[doc = " Includes SRP server lease information of a host/service."]
15667#[repr(C)]
15668#[derive(Debug, Default, Copy, Clone)]
15669pub struct otSrpServerLeaseInfo {
15670 #[doc = "< The lease time of a host/service in milliseconds."]
15671 pub mLease: u32,
15672 #[doc = "< The key lease time of a host/service in milliseconds."]
15673 pub mKeyLease: u32,
15674 #[doc = "< The remaining lease time of the host/service in milliseconds."]
15675 pub mRemainingLease: u32,
15676 #[doc = "< The remaining key lease time of a host/service in milliseconds."]
15677 pub mRemainingKeyLease: u32,
15678}
15679#[doc = " Includes the statistics of SRP server responses."]
15680#[repr(C)]
15681#[derive(Debug, Default, Copy, Clone)]
15682pub struct otSrpServerResponseCounters {
15683 #[doc = "< The number of successful responses."]
15684 pub mSuccess: u32,
15685 #[doc = "< The number of server failure responses."]
15686 pub mServerFailure: u32,
15687 #[doc = "< The number of format error responses."]
15688 pub mFormatError: u32,
15689 #[doc = "< The number of 'name exists' responses."]
15690 pub mNameExists: u32,
15691 #[doc = "< The number of refused responses."]
15692 pub mRefused: u32,
15693 #[doc = "< The number of other responses."]
15694 pub mOther: u32,
15695}
15696unsafe extern "C" {
15697 #[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."]
15698 pub fn otSrpServerGetDomain(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15699}
15700unsafe extern "C" {
15701 #[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."]
15702 pub fn otSrpServerSetDomain(
15703 aInstance: *mut otInstance,
15704 aDomain: *const ::std::os::raw::c_char,
15705 ) -> otError;
15706}
15707unsafe extern "C" {
15708 #[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."]
15709 pub fn otSrpServerGetState(aInstance: *mut otInstance) -> otSrpServerState;
15710}
15711unsafe extern "C" {
15712 #[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."]
15713 pub fn otSrpServerGetPort(aInstance: *mut otInstance) -> u16;
15714}
15715unsafe extern "C" {
15716 #[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."]
15717 pub fn otSrpServerGetAddressMode(aInstance: *mut otInstance) -> otSrpServerAddressMode;
15718}
15719unsafe extern "C" {
15720 #[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."]
15721 pub fn otSrpServerSetAddressMode(
15722 aInstance: *mut otInstance,
15723 aMode: otSrpServerAddressMode,
15724 ) -> otError;
15725}
15726unsafe extern "C" {
15727 #[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."]
15728 pub fn otSrpServerGetAnycastModeSequenceNumber(aInstance: *mut otInstance) -> u8;
15729}
15730unsafe extern "C" {
15731 #[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."]
15732 pub fn otSrpServerSetAnycastModeSequenceNumber(
15733 aInstance: *mut otInstance,
15734 aSequenceNumber: u8,
15735 ) -> otError;
15736}
15737unsafe extern "C" {
15738 #[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."]
15739 pub fn otSrpServerSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
15740}
15741unsafe extern "C" {
15742 #[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."]
15743 pub fn otSrpServerSetAutoEnableMode(aInstance: *mut otInstance, aEnabled: bool);
15744}
15745unsafe extern "C" {
15746 #[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."]
15747 pub fn otSrpServerIsAutoEnableMode(aInstance: *mut otInstance) -> bool;
15748}
15749unsafe extern "C" {
15750 #[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)."]
15751 pub fn otSrpServerEnableFastStartMode(aInstance: *mut otInstance) -> otError;
15752}
15753unsafe extern "C" {
15754 #[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."]
15755 pub fn otSrpServerIsFastStartModeEnabled(aInstance: *mut otInstance) -> bool;
15756}
15757unsafe extern "C" {
15758 #[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."]
15759 pub fn otSrpServerGetTtlConfig(
15760 aInstance: *mut otInstance,
15761 aTtlConfig: *mut otSrpServerTtlConfig,
15762 );
15763}
15764unsafe extern "C" {
15765 #[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."]
15766 pub fn otSrpServerSetTtlConfig(
15767 aInstance: *mut otInstance,
15768 aTtlConfig: *const otSrpServerTtlConfig,
15769 ) -> otError;
15770}
15771unsafe extern "C" {
15772 #[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."]
15773 pub fn otSrpServerGetLeaseConfig(
15774 aInstance: *mut otInstance,
15775 aLeaseConfig: *mut otSrpServerLeaseConfig,
15776 );
15777}
15778unsafe extern "C" {
15779 #[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."]
15780 pub fn otSrpServerSetLeaseConfig(
15781 aInstance: *mut otInstance,
15782 aLeaseConfig: *const otSrpServerLeaseConfig,
15783 ) -> otError;
15784}
15785#[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"]
15786pub type otSrpServerServiceUpdateHandler = ::std::option::Option<
15787 unsafe extern "C" fn(
15788 aId: otSrpServerServiceUpdateId,
15789 aHost: *const otSrpServerHost,
15790 aTimeout: u32,
15791 aContext: *mut ::std::os::raw::c_void,
15792 ),
15793>;
15794unsafe extern "C" {
15795 #[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."]
15796 pub fn otSrpServerSetServiceUpdateHandler(
15797 aInstance: *mut otInstance,
15798 aServiceHandler: otSrpServerServiceUpdateHandler,
15799 aContext: *mut ::std::os::raw::c_void,
15800 );
15801}
15802unsafe extern "C" {
15803 #[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."]
15804 pub fn otSrpServerHandleServiceUpdateResult(
15805 aInstance: *mut otInstance,
15806 aId: otSrpServerServiceUpdateId,
15807 aError: otError,
15808 );
15809}
15810unsafe extern "C" {
15811 #[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."]
15812 pub fn otSrpServerGetNextHost(
15813 aInstance: *mut otInstance,
15814 aHost: *const otSrpServerHost,
15815 ) -> *const otSrpServerHost;
15816}
15817unsafe extern "C" {
15818 #[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."]
15819 pub fn otSrpServerGetResponseCounters(
15820 aInstance: *mut otInstance,
15821 ) -> *const otSrpServerResponseCounters;
15822}
15823unsafe extern "C" {
15824 #[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."]
15825 pub fn otSrpServerHostIsDeleted(aHost: *const otSrpServerHost) -> bool;
15826}
15827unsafe extern "C" {
15828 #[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."]
15829 pub fn otSrpServerHostGetFullName(
15830 aHost: *const otSrpServerHost,
15831 ) -> *const ::std::os::raw::c_char;
15832}
15833unsafe extern "C" {
15834 #[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."]
15835 pub fn otSrpServerHostMatchesFullName(
15836 aHost: *const otSrpServerHost,
15837 aFullName: *const ::std::os::raw::c_char,
15838 ) -> bool;
15839}
15840unsafe extern "C" {
15841 #[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."]
15842 pub fn otSrpServerHostGetAddresses(
15843 aHost: *const otSrpServerHost,
15844 aAddressesNum: *mut u8,
15845 ) -> *const otIp6Address;
15846}
15847unsafe extern "C" {
15848 #[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."]
15849 pub fn otSrpServerHostGetLeaseInfo(
15850 aHost: *const otSrpServerHost,
15851 aLeaseInfo: *mut otSrpServerLeaseInfo,
15852 );
15853}
15854unsafe extern "C" {
15855 #[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."]
15856 pub fn otSrpServerHostGetNextService(
15857 aHost: *const otSrpServerHost,
15858 aService: *const otSrpServerService,
15859 ) -> *const otSrpServerService;
15860}
15861unsafe extern "C" {
15862 #[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."]
15863 pub fn otSrpServerServiceIsDeleted(aService: *const otSrpServerService) -> bool;
15864}
15865unsafe extern "C" {
15866 #[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."]
15867 pub fn otSrpServerServiceGetInstanceName(
15868 aService: *const otSrpServerService,
15869 ) -> *const ::std::os::raw::c_char;
15870}
15871unsafe extern "C" {
15872 #[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."]
15873 pub fn otSrpServerServiceMatchesInstanceName(
15874 aService: *const otSrpServerService,
15875 aInstanceName: *const ::std::os::raw::c_char,
15876 ) -> bool;
15877}
15878unsafe extern "C" {
15879 #[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.."]
15880 pub fn otSrpServerServiceGetInstanceLabel(
15881 aService: *const otSrpServerService,
15882 ) -> *const ::std::os::raw::c_char;
15883}
15884unsafe extern "C" {
15885 #[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."]
15886 pub fn otSrpServerServiceGetServiceName(
15887 aService: *const otSrpServerService,
15888 ) -> *const ::std::os::raw::c_char;
15889}
15890unsafe extern "C" {
15891 #[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."]
15892 pub fn otSrpServerServiceMatchesServiceName(
15893 aService: *const otSrpServerService,
15894 aServiceName: *const ::std::os::raw::c_char,
15895 ) -> bool;
15896}
15897unsafe extern "C" {
15898 #[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."]
15899 pub fn otSrpServerServiceGetNumberOfSubTypes(aService: *const otSrpServerService) -> u16;
15900}
15901unsafe extern "C" {
15902 #[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."]
15903 pub fn otSrpServerServiceGetSubTypeServiceNameAt(
15904 aService: *const otSrpServerService,
15905 aIndex: u16,
15906 ) -> *const ::std::os::raw::c_char;
15907}
15908unsafe extern "C" {
15909 #[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."]
15910 pub fn otSrpServerServiceHasSubTypeServiceName(
15911 aService: *const otSrpServerService,
15912 aSubTypeServiceName: *const ::std::os::raw::c_char,
15913 ) -> bool;
15914}
15915unsafe extern "C" {
15916 #[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."]
15917 pub fn otSrpServerParseSubTypeServiceName(
15918 aSubTypeServiceName: *const ::std::os::raw::c_char,
15919 aLabel: *mut ::std::os::raw::c_char,
15920 aLabelSize: u8,
15921 ) -> otError;
15922}
15923unsafe extern "C" {
15924 #[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."]
15925 pub fn otSrpServerServiceGetPort(aService: *const otSrpServerService) -> u16;
15926}
15927unsafe extern "C" {
15928 #[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."]
15929 pub fn otSrpServerServiceGetWeight(aService: *const otSrpServerService) -> u16;
15930}
15931unsafe extern "C" {
15932 #[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."]
15933 pub fn otSrpServerServiceGetPriority(aService: *const otSrpServerService) -> u16;
15934}
15935unsafe extern "C" {
15936 #[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.."]
15937 pub fn otSrpServerServiceGetTtl(aService: *const otSrpServerService) -> u32;
15938}
15939unsafe extern "C" {
15940 #[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)."]
15941 pub fn otSrpServerServiceGetTxtData(
15942 aService: *const otSrpServerService,
15943 aDataLength: *mut u16,
15944 ) -> *const u8;
15945}
15946unsafe extern "C" {
15947 #[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."]
15948 pub fn otSrpServerServiceGetHost(aService: *const otSrpServerService)
15949 -> *const otSrpServerHost;
15950}
15951unsafe extern "C" {
15952 #[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."]
15953 pub fn otSrpServerServiceGetLeaseInfo(
15954 aService: *const otSrpServerService,
15955 aLeaseInfo: *mut otSrpServerLeaseInfo,
15956 );
15957}
15958unsafe extern "C" {
15959 #[doc = " Run all queued OpenThread tasklets at the time this is called.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
15960 pub fn otTaskletsProcess(aInstance: *mut otInstance);
15961}
15962unsafe extern "C" {
15963 #[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."]
15964 pub fn otTaskletsArePending(aInstance: *mut otInstance) -> bool;
15965}
15966unsafe extern "C" {
15967 #[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."]
15968 pub fn otTaskletsSignalPending(aInstance: *mut otInstance);
15969}
15970#[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."]
15971#[repr(C)]
15972#[derive(Debug, Copy, Clone)]
15973pub struct otLinkedBuffer {
15974 #[doc = "< Pointer to the next linked buffer in the chain, or NULL if it is the end."]
15975 pub mNext: *mut otLinkedBuffer,
15976 #[doc = "< Pointer to data referenced by this linked buffer."]
15977 pub mData: *const u8,
15978 #[doc = "< Length of this linked buffer (number of bytes)."]
15979 pub mLength: usize,
15980}
15981impl Default for otLinkedBuffer {
15982 fn default() -> Self {
15983 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15984 unsafe {
15985 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15986 s.assume_init()
15987 }
15988 }
15989}
15990#[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."]
15991pub type otTcpEstablished =
15992 ::std::option::Option<unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint)>;
15993#[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."]
15994pub type otTcpSendDone = ::std::option::Option<
15995 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aData: *mut otLinkedBuffer),
15996>;
15997#[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)."]
15998pub type otTcpForwardProgress = ::std::option::Option<
15999 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aInSendBuffer: usize, aBacklog: usize),
16000>;
16001#[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."]
16002pub type otTcpReceiveAvailable = ::std::option::Option<
16003 unsafe extern "C" fn(
16004 aEndpoint: *mut otTcpEndpoint,
16005 aBytesAvailable: usize,
16006 aEndOfStream: bool,
16007 aBytesRemaining: usize,
16008 ),
16009>;
16010pub const OT_TCP_DISCONNECTED_REASON_NORMAL: otTcpDisconnectedReason = 0;
16011pub const OT_TCP_DISCONNECTED_REASON_REFUSED: otTcpDisconnectedReason = 1;
16012pub const OT_TCP_DISCONNECTED_REASON_RESET: otTcpDisconnectedReason = 2;
16013pub const OT_TCP_DISCONNECTED_REASON_TIME_WAIT: otTcpDisconnectedReason = 3;
16014pub const OT_TCP_DISCONNECTED_REASON_TIMED_OUT: otTcpDisconnectedReason = 4;
16015pub type otTcpDisconnectedReason = ::std::os::raw::c_uint;
16016#[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."]
16017pub type otTcpDisconnected = ::std::option::Option<
16018 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aReason: otTcpDisconnectedReason),
16019>;
16020#[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."]
16021#[repr(C)]
16022#[derive(Copy, Clone)]
16023pub struct otTcpEndpoint {
16024 pub mTcb: otTcpEndpoint__bindgen_ty_1,
16025 #[doc = "< A pointer to the next TCP endpoint (internal use only)"]
16026 pub mNext: *mut otTcpEndpoint,
16027 #[doc = "< A pointer to application-specific context"]
16028 pub mContext: *mut ::std::os::raw::c_void,
16029 #[doc = "< \"Established\" callback function"]
16030 pub mEstablishedCallback: otTcpEstablished,
16031 #[doc = "< \"Send done\" callback function"]
16032 pub mSendDoneCallback: otTcpSendDone,
16033 #[doc = "< \"Forward progress\" callback function"]
16034 pub mForwardProgressCallback: otTcpForwardProgress,
16035 #[doc = "< \"Receive available\" callback function"]
16036 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
16037 #[doc = "< \"Disconnected\" callback function"]
16038 pub mDisconnectedCallback: otTcpDisconnected,
16039 pub mTimers: [u32; 4usize],
16040 pub mReceiveLinks: [otLinkedBuffer; 2usize],
16041 pub mSockAddr: otSockAddr,
16042 pub mPendingCallbacks: u8,
16043}
16044#[repr(C)]
16045#[derive(Copy, Clone)]
16046pub union otTcpEndpoint__bindgen_ty_1 {
16047 pub mSize: [u8; 680usize],
16048 pub mAlign: u64,
16049}
16050impl Default for otTcpEndpoint__bindgen_ty_1 {
16051 fn default() -> Self {
16052 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16053 unsafe {
16054 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16055 s.assume_init()
16056 }
16057 }
16058}
16059impl Default for otTcpEndpoint {
16060 fn default() -> Self {
16061 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16062 unsafe {
16063 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16064 s.assume_init()
16065 }
16066 }
16067}
16068#[doc = " Contains arguments to the otTcpEndpointInitialize() function."]
16069#[repr(C)]
16070#[derive(Debug, Copy, Clone)]
16071pub struct otTcpEndpointInitializeArgs {
16072 #[doc = "< Pointer to application-specific context"]
16073 pub mContext: *mut ::std::os::raw::c_void,
16074 #[doc = "< \"Established\" callback function"]
16075 pub mEstablishedCallback: otTcpEstablished,
16076 #[doc = "< \"Send done\" callback function"]
16077 pub mSendDoneCallback: otTcpSendDone,
16078 #[doc = "< \"Forward progress\" callback function"]
16079 pub mForwardProgressCallback: otTcpForwardProgress,
16080 #[doc = "< \"Receive available\" callback function"]
16081 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
16082 #[doc = "< \"Disconnected\" callback function"]
16083 pub mDisconnectedCallback: otTcpDisconnected,
16084 #[doc = "< Pointer to memory provided to the system for the TCP receive buffer"]
16085 pub mReceiveBuffer: *mut ::std::os::raw::c_void,
16086 #[doc = "< Size of memory provided to the system for the TCP receive buffer"]
16087 pub mReceiveBufferSize: usize,
16088}
16089impl Default for otTcpEndpointInitializeArgs {
16090 fn default() -> Self {
16091 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16092 unsafe {
16093 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16094 s.assume_init()
16095 }
16096 }
16097}
16098unsafe extern "C" {
16099 #[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."]
16100 pub fn otTcpEndpointInitialize(
16101 aInstance: *mut otInstance,
16102 aEndpoint: *mut otTcpEndpoint,
16103 aArgs: *const otTcpEndpointInitializeArgs,
16104 ) -> otError;
16105}
16106unsafe extern "C" {
16107 #[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."]
16108 pub fn otTcpEndpointGetInstance(aEndpoint: *mut otTcpEndpoint) -> *mut otInstance;
16109}
16110unsafe extern "C" {
16111 #[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."]
16112 pub fn otTcpEndpointGetContext(aEndpoint: *mut otTcpEndpoint) -> *mut ::std::os::raw::c_void;
16113}
16114unsafe extern "C" {
16115 #[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."]
16116 pub fn otTcpGetLocalAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16117}
16118unsafe extern "C" {
16119 #[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."]
16120 pub fn otTcpGetPeerAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16121}
16122unsafe extern "C" {
16123 #[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."]
16124 pub fn otTcpBind(aEndpoint: *mut otTcpEndpoint, aSockName: *const otSockAddr) -> otError;
16125}
16126pub const OT_TCP_CONNECT_NO_FAST_OPEN: _bindgen_ty_12 = 1;
16127#[doc = " Defines flags passed to otTcpConnect()."]
16128pub type _bindgen_ty_12 = ::std::os::raw::c_uint;
16129unsafe extern "C" {
16130 #[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."]
16131 pub fn otTcpConnect(
16132 aEndpoint: *mut otTcpEndpoint,
16133 aSockName: *const otSockAddr,
16134 aFlags: u32,
16135 ) -> otError;
16136}
16137pub const OT_TCP_SEND_MORE_TO_COME: _bindgen_ty_13 = 1;
16138#[doc = " Defines flags passed to @p otTcpSendByReference."]
16139pub type _bindgen_ty_13 = ::std::os::raw::c_uint;
16140unsafe extern "C" {
16141 #[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."]
16142 pub fn otTcpSendByReference(
16143 aEndpoint: *mut otTcpEndpoint,
16144 aBuffer: *mut otLinkedBuffer,
16145 aFlags: u32,
16146 ) -> otError;
16147}
16148unsafe extern "C" {
16149 #[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."]
16150 pub fn otTcpSendByExtension(
16151 aEndpoint: *mut otTcpEndpoint,
16152 aNumBytes: usize,
16153 aFlags: u32,
16154 ) -> otError;
16155}
16156unsafe extern "C" {
16157 #[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."]
16158 pub fn otTcpReceiveByReference(
16159 aEndpoint: *mut otTcpEndpoint,
16160 aBuffer: *mut *const otLinkedBuffer,
16161 ) -> otError;
16162}
16163unsafe extern "C" {
16164 #[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."]
16165 pub fn otTcpReceiveContiguify(aEndpoint: *mut otTcpEndpoint) -> otError;
16166}
16167unsafe extern "C" {
16168 #[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."]
16169 pub fn otTcpCommitReceive(
16170 aEndpoint: *mut otTcpEndpoint,
16171 aNumBytes: usize,
16172 aFlags: u32,
16173 ) -> otError;
16174}
16175unsafe extern "C" {
16176 #[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."]
16177 pub fn otTcpSendEndOfStream(aEndpoint: *mut otTcpEndpoint) -> otError;
16178}
16179unsafe extern "C" {
16180 #[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."]
16181 pub fn otTcpAbort(aEndpoint: *mut otTcpEndpoint) -> otError;
16182}
16183unsafe extern "C" {
16184 #[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."]
16185 pub fn otTcpEndpointDeinitialize(aEndpoint: *mut otTcpEndpoint) -> otError;
16186}
16187#[doc = "< Accept the incoming connection."]
16188pub const OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT: otTcpIncomingConnectionAction = 0;
16189#[doc = "< Defer (silently ignore) the incoming connection."]
16190pub const OT_TCP_INCOMING_CONNECTION_ACTION_DEFER: otTcpIncomingConnectionAction = 1;
16191#[doc = "< Refuse the incoming connection."]
16192pub const OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE: otTcpIncomingConnectionAction = 2;
16193#[doc = " Defines incoming connection actions.\n\n This is used in otTcpAcceptReady() callback."]
16194pub type otTcpIncomingConnectionAction = ::std::os::raw::c_uint;
16195#[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."]
16196pub type otTcpAcceptReady = ::std::option::Option<
16197 unsafe extern "C" fn(
16198 aListener: *mut otTcpListener,
16199 aPeer: *const otSockAddr,
16200 aAcceptInto: *mut *mut otTcpEndpoint,
16201 ) -> otTcpIncomingConnectionAction,
16202>;
16203#[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."]
16204pub type otTcpAcceptDone = ::std::option::Option<
16205 unsafe extern "C" fn(
16206 aListener: *mut otTcpListener,
16207 aEndpoint: *mut otTcpEndpoint,
16208 aPeer: *const otSockAddr,
16209 ),
16210>;
16211#[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."]
16212#[repr(C)]
16213#[derive(Copy, Clone)]
16214pub struct otTcpListener {
16215 pub mTcbListen: otTcpListener__bindgen_ty_1,
16216 #[doc = "< A pointer to the next TCP listener (internal use only)"]
16217 pub mNext: *mut otTcpListener,
16218 #[doc = "< A pointer to application-specific context"]
16219 pub mContext: *mut ::std::os::raw::c_void,
16220 #[doc = "< \"Accept ready\" callback function"]
16221 pub mAcceptReadyCallback: otTcpAcceptReady,
16222 #[doc = "< \"Accept done\" callback function"]
16223 pub mAcceptDoneCallback: otTcpAcceptDone,
16224}
16225#[repr(C)]
16226#[derive(Copy, Clone)]
16227pub union otTcpListener__bindgen_ty_1 {
16228 pub mSize: [u8; 40usize],
16229 pub mAlign: *mut ::std::os::raw::c_void,
16230}
16231impl Default for otTcpListener__bindgen_ty_1 {
16232 fn default() -> Self {
16233 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16234 unsafe {
16235 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16236 s.assume_init()
16237 }
16238 }
16239}
16240impl Default for otTcpListener {
16241 fn default() -> Self {
16242 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16243 unsafe {
16244 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16245 s.assume_init()
16246 }
16247 }
16248}
16249#[doc = " Contains arguments to the otTcpListenerInitialize() function."]
16250#[repr(C)]
16251#[derive(Debug, Copy, Clone)]
16252pub struct otTcpListenerInitializeArgs {
16253 #[doc = "< Pointer to application-specific context"]
16254 pub mContext: *mut ::std::os::raw::c_void,
16255 #[doc = "< \"Accept ready\" callback function"]
16256 pub mAcceptReadyCallback: otTcpAcceptReady,
16257 #[doc = "< \"Accept done\" callback function"]
16258 pub mAcceptDoneCallback: otTcpAcceptDone,
16259}
16260impl Default for otTcpListenerInitializeArgs {
16261 fn default() -> Self {
16262 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16263 unsafe {
16264 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16265 s.assume_init()
16266 }
16267 }
16268}
16269unsafe extern "C" {
16270 #[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."]
16271 pub fn otTcpListenerInitialize(
16272 aInstance: *mut otInstance,
16273 aListener: *mut otTcpListener,
16274 aArgs: *const otTcpListenerInitializeArgs,
16275 ) -> otError;
16276}
16277unsafe extern "C" {
16278 #[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."]
16279 pub fn otTcpListenerGetInstance(aListener: *mut otTcpListener) -> *mut otInstance;
16280}
16281unsafe extern "C" {
16282 #[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."]
16283 pub fn otTcpListenerGetContext(aListener: *mut otTcpListener) -> *mut ::std::os::raw::c_void;
16284}
16285unsafe extern "C" {
16286 #[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."]
16287 pub fn otTcpListen(aListener: *mut otTcpListener, aSockName: *const otSockAddr) -> otError;
16288}
16289unsafe extern "C" {
16290 #[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."]
16291 pub fn otTcpStopListening(aListener: *mut otTcpListener) -> otError;
16292}
16293unsafe extern "C" {
16294 #[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."]
16295 pub fn otTcpListenerDeinitialize(aListener: *mut otTcpListener) -> otError;
16296}
16297#[doc = " Holds diagnostic information for a Thread Child"]
16298#[repr(C)]
16299#[derive(Debug, Default, Copy, Clone)]
16300pub struct otChildInfo {
16301 #[doc = "< IEEE 802.15.4 Extended Address"]
16302 pub mExtAddress: otExtAddress,
16303 #[doc = "< Timeout"]
16304 pub mTimeout: u32,
16305 #[doc = "< Seconds since last heard"]
16306 pub mAge: u32,
16307 #[doc = "< Seconds since attach"]
16308 pub mConnectionTime: u64,
16309 #[doc = "< RLOC16"]
16310 pub mRloc16: u16,
16311 #[doc = "< Child ID"]
16312 pub mChildId: u16,
16313 #[doc = "< Network Data Version"]
16314 pub mNetworkDataVersion: u8,
16315 #[doc = "< Link Quality In"]
16316 pub mLinkQualityIn: u8,
16317 #[doc = "< Average RSSI"]
16318 pub mAverageRssi: i8,
16319 #[doc = "< Last observed RSSI"]
16320 pub mLastRssi: i8,
16321 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
16322 pub mFrameErrorRate: u16,
16323 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
16324 pub mMessageErrorRate: u16,
16325 #[doc = "< Number of queued messages for the child."]
16326 pub mQueuedMessageCnt: u16,
16327 #[doc = "< Supervision interval (in seconds)."]
16328 pub mSupervisionInterval: u16,
16329 #[doc = "< MLE version"]
16330 pub mVersion: u8,
16331 pub _bitfield_align_1: [u8; 0],
16332 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16333 pub __bindgen_padding_0: [u16; 3usize],
16334}
16335impl otChildInfo {
16336 #[inline]
16337 pub fn mRxOnWhenIdle(&self) -> bool {
16338 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16339 }
16340 #[inline]
16341 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
16342 unsafe {
16343 let val: u8 = ::std::mem::transmute(val);
16344 self._bitfield_1.set(0usize, 1u8, val as u64)
16345 }
16346 }
16347 #[inline]
16348 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
16349 unsafe {
16350 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16351 ::std::ptr::addr_of!((*this)._bitfield_1),
16352 0usize,
16353 1u8,
16354 ) as u8)
16355 }
16356 }
16357 #[inline]
16358 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
16359 unsafe {
16360 let val: u8 = ::std::mem::transmute(val);
16361 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16362 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16363 0usize,
16364 1u8,
16365 val as u64,
16366 )
16367 }
16368 }
16369 #[inline]
16370 pub fn mFullThreadDevice(&self) -> bool {
16371 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16372 }
16373 #[inline]
16374 pub fn set_mFullThreadDevice(&mut self, val: bool) {
16375 unsafe {
16376 let val: u8 = ::std::mem::transmute(val);
16377 self._bitfield_1.set(1usize, 1u8, val as u64)
16378 }
16379 }
16380 #[inline]
16381 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
16382 unsafe {
16383 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16384 ::std::ptr::addr_of!((*this)._bitfield_1),
16385 1usize,
16386 1u8,
16387 ) as u8)
16388 }
16389 }
16390 #[inline]
16391 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
16392 unsafe {
16393 let val: u8 = ::std::mem::transmute(val);
16394 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16395 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16396 1usize,
16397 1u8,
16398 val as u64,
16399 )
16400 }
16401 }
16402 #[inline]
16403 pub fn mFullNetworkData(&self) -> bool {
16404 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16405 }
16406 #[inline]
16407 pub fn set_mFullNetworkData(&mut self, val: bool) {
16408 unsafe {
16409 let val: u8 = ::std::mem::transmute(val);
16410 self._bitfield_1.set(2usize, 1u8, val as u64)
16411 }
16412 }
16413 #[inline]
16414 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
16415 unsafe {
16416 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16417 ::std::ptr::addr_of!((*this)._bitfield_1),
16418 2usize,
16419 1u8,
16420 ) as u8)
16421 }
16422 }
16423 #[inline]
16424 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
16425 unsafe {
16426 let val: u8 = ::std::mem::transmute(val);
16427 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16428 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16429 2usize,
16430 1u8,
16431 val as u64,
16432 )
16433 }
16434 }
16435 #[inline]
16436 pub fn mIsStateRestoring(&self) -> bool {
16437 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
16438 }
16439 #[inline]
16440 pub fn set_mIsStateRestoring(&mut self, val: bool) {
16441 unsafe {
16442 let val: u8 = ::std::mem::transmute(val);
16443 self._bitfield_1.set(3usize, 1u8, val as u64)
16444 }
16445 }
16446 #[inline]
16447 pub unsafe fn mIsStateRestoring_raw(this: *const Self) -> bool {
16448 unsafe {
16449 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16450 ::std::ptr::addr_of!((*this)._bitfield_1),
16451 3usize,
16452 1u8,
16453 ) as u8)
16454 }
16455 }
16456 #[inline]
16457 pub unsafe fn set_mIsStateRestoring_raw(this: *mut Self, val: bool) {
16458 unsafe {
16459 let val: u8 = ::std::mem::transmute(val);
16460 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16461 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16462 3usize,
16463 1u8,
16464 val as u64,
16465 )
16466 }
16467 }
16468 #[inline]
16469 pub fn mIsCslSynced(&self) -> bool {
16470 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
16471 }
16472 #[inline]
16473 pub fn set_mIsCslSynced(&mut self, val: bool) {
16474 unsafe {
16475 let val: u8 = ::std::mem::transmute(val);
16476 self._bitfield_1.set(4usize, 1u8, val as u64)
16477 }
16478 }
16479 #[inline]
16480 pub unsafe fn mIsCslSynced_raw(this: *const Self) -> bool {
16481 unsafe {
16482 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16483 ::std::ptr::addr_of!((*this)._bitfield_1),
16484 4usize,
16485 1u8,
16486 ) as u8)
16487 }
16488 }
16489 #[inline]
16490 pub unsafe fn set_mIsCslSynced_raw(this: *mut Self, val: bool) {
16491 unsafe {
16492 let val: u8 = ::std::mem::transmute(val);
16493 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16494 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16495 4usize,
16496 1u8,
16497 val as u64,
16498 )
16499 }
16500 }
16501 #[inline]
16502 pub fn new_bitfield_1(
16503 mRxOnWhenIdle: bool,
16504 mFullThreadDevice: bool,
16505 mFullNetworkData: bool,
16506 mIsStateRestoring: bool,
16507 mIsCslSynced: bool,
16508 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16509 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16510 __bindgen_bitfield_unit.set(0usize, 1u8, {
16511 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
16512 mRxOnWhenIdle as u64
16513 });
16514 __bindgen_bitfield_unit.set(1usize, 1u8, {
16515 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
16516 mFullThreadDevice as u64
16517 });
16518 __bindgen_bitfield_unit.set(2usize, 1u8, {
16519 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
16520 mFullNetworkData as u64
16521 });
16522 __bindgen_bitfield_unit.set(3usize, 1u8, {
16523 let mIsStateRestoring: u8 = unsafe { ::std::mem::transmute(mIsStateRestoring) };
16524 mIsStateRestoring as u64
16525 });
16526 __bindgen_bitfield_unit.set(4usize, 1u8, {
16527 let mIsCslSynced: u8 = unsafe { ::std::mem::transmute(mIsCslSynced) };
16528 mIsCslSynced as u64
16529 });
16530 __bindgen_bitfield_unit
16531 }
16532}
16533pub type otChildIp6AddressIterator = u16;
16534pub const OT_CACHE_ENTRY_STATE_CACHED: otCacheEntryState = 0;
16535pub const OT_CACHE_ENTRY_STATE_SNOOPED: otCacheEntryState = 1;
16536pub const OT_CACHE_ENTRY_STATE_QUERY: otCacheEntryState = 2;
16537pub const OT_CACHE_ENTRY_STATE_RETRY_QUERY: otCacheEntryState = 3;
16538#[doc = " Defines the EID cache entry state."]
16539pub type otCacheEntryState = ::std::os::raw::c_uint;
16540#[doc = " Represents an EID cache entry."]
16541#[repr(C)]
16542#[derive(Copy, Clone)]
16543pub struct otCacheEntryInfo {
16544 #[doc = "< Target EID"]
16545 pub mTarget: otIp6Address,
16546 #[doc = "< RLOC16"]
16547 pub mRloc16: otShortAddress,
16548 #[doc = "< Entry state"]
16549 pub mState: otCacheEntryState,
16550 pub _bitfield_align_1: [u8; 0],
16551 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16552 #[doc = "< Last transaction time (applicable in cached state)."]
16553 pub mLastTransTime: u32,
16554 #[doc = "< Mesh Local EID (applicable if entry in cached state)."]
16555 pub mMeshLocalEid: otIp6Address,
16556 #[doc = "< Timeout in seconds (applicable if in snooped/query/retry-query states)."]
16557 pub mTimeout: u16,
16558 #[doc = "< Retry delay in seconds (applicable if in query-retry state)."]
16559 pub mRetryDelay: u16,
16560}
16561impl Default for otCacheEntryInfo {
16562 fn default() -> Self {
16563 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16564 unsafe {
16565 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16566 s.assume_init()
16567 }
16568 }
16569}
16570impl otCacheEntryInfo {
16571 #[inline]
16572 pub fn mCanEvict(&self) -> bool {
16573 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16574 }
16575 #[inline]
16576 pub fn set_mCanEvict(&mut self, val: bool) {
16577 unsafe {
16578 let val: u8 = ::std::mem::transmute(val);
16579 self._bitfield_1.set(0usize, 1u8, val as u64)
16580 }
16581 }
16582 #[inline]
16583 pub unsafe fn mCanEvict_raw(this: *const Self) -> bool {
16584 unsafe {
16585 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16586 ::std::ptr::addr_of!((*this)._bitfield_1),
16587 0usize,
16588 1u8,
16589 ) as u8)
16590 }
16591 }
16592 #[inline]
16593 pub unsafe fn set_mCanEvict_raw(this: *mut Self, val: bool) {
16594 unsafe {
16595 let val: u8 = ::std::mem::transmute(val);
16596 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16597 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16598 0usize,
16599 1u8,
16600 val as u64,
16601 )
16602 }
16603 }
16604 #[inline]
16605 pub fn mRampDown(&self) -> bool {
16606 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16607 }
16608 #[inline]
16609 pub fn set_mRampDown(&mut self, val: bool) {
16610 unsafe {
16611 let val: u8 = ::std::mem::transmute(val);
16612 self._bitfield_1.set(1usize, 1u8, val as u64)
16613 }
16614 }
16615 #[inline]
16616 pub unsafe fn mRampDown_raw(this: *const Self) -> bool {
16617 unsafe {
16618 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16619 ::std::ptr::addr_of!((*this)._bitfield_1),
16620 1usize,
16621 1u8,
16622 ) as u8)
16623 }
16624 }
16625 #[inline]
16626 pub unsafe fn set_mRampDown_raw(this: *mut Self, val: bool) {
16627 unsafe {
16628 let val: u8 = ::std::mem::transmute(val);
16629 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16630 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16631 1usize,
16632 1u8,
16633 val as u64,
16634 )
16635 }
16636 }
16637 #[inline]
16638 pub fn mValidLastTrans(&self) -> bool {
16639 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16640 }
16641 #[inline]
16642 pub fn set_mValidLastTrans(&mut self, val: bool) {
16643 unsafe {
16644 let val: u8 = ::std::mem::transmute(val);
16645 self._bitfield_1.set(2usize, 1u8, val as u64)
16646 }
16647 }
16648 #[inline]
16649 pub unsafe fn mValidLastTrans_raw(this: *const Self) -> bool {
16650 unsafe {
16651 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16652 ::std::ptr::addr_of!((*this)._bitfield_1),
16653 2usize,
16654 1u8,
16655 ) as u8)
16656 }
16657 }
16658 #[inline]
16659 pub unsafe fn set_mValidLastTrans_raw(this: *mut Self, val: bool) {
16660 unsafe {
16661 let val: u8 = ::std::mem::transmute(val);
16662 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16663 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16664 2usize,
16665 1u8,
16666 val as u64,
16667 )
16668 }
16669 }
16670 #[inline]
16671 pub fn new_bitfield_1(
16672 mCanEvict: bool,
16673 mRampDown: bool,
16674 mValidLastTrans: bool,
16675 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16676 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16677 __bindgen_bitfield_unit.set(0usize, 1u8, {
16678 let mCanEvict: u8 = unsafe { ::std::mem::transmute(mCanEvict) };
16679 mCanEvict as u64
16680 });
16681 __bindgen_bitfield_unit.set(1usize, 1u8, {
16682 let mRampDown: u8 = unsafe { ::std::mem::transmute(mRampDown) };
16683 mRampDown as u64
16684 });
16685 __bindgen_bitfield_unit.set(2usize, 1u8, {
16686 let mValidLastTrans: u8 = unsafe { ::std::mem::transmute(mValidLastTrans) };
16687 mValidLastTrans as u64
16688 });
16689 __bindgen_bitfield_unit
16690 }
16691}
16692#[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)."]
16693#[repr(C)]
16694#[derive(Debug, Copy, Clone)]
16695pub struct otCacheEntryIterator {
16696 #[doc = "< Opaque data used by the core implementation. Should not be changed by user."]
16697 pub mData: [*const ::std::os::raw::c_void; 2usize],
16698}
16699impl Default for otCacheEntryIterator {
16700 fn default() -> Self {
16701 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16702 unsafe {
16703 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16704 s.assume_init()
16705 }
16706 }
16707}
16708unsafe extern "C" {
16709 #[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"]
16710 pub fn otThreadGetMaxAllowedChildren(aInstance: *mut otInstance) -> u16;
16711}
16712unsafe extern "C" {
16713 #[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"]
16714 pub fn otThreadSetMaxAllowedChildren(aInstance: *mut otInstance, aMaxChildren: u16) -> otError;
16715}
16716unsafe extern "C" {
16717 #[doc = " Indicates whether or not the device is allowed to take router or leader roles.\n\n A device is allowed to become a router if it is a Full Thread Device (FTD), is currently configured to be\n router-eligible (see `otThreadSetRouterEligible(true)`), and the active Security Policy permits routers.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If the router role is allowed.\n @retval FALSE If the router role is not allowed."]
16718 pub fn otThreadIsRouterEligible(aInstance: *mut otInstance) -> bool;
16719}
16720unsafe extern "C" {
16721 #[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."]
16722 pub fn otThreadSetRouterEligible(aInstance: *mut otInstance, aEligible: bool) -> otError;
16723}
16724unsafe extern "C" {
16725 #[doc = " Sets the preferred Router Id.\n\n Requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`.\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 this API will render a\n 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)"]
16726 pub fn otThreadSetPreferredRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
16727}
16728#[doc = "< Battery powered."]
16729pub const OT_POWER_SUPPLY_BATTERY: otPowerSupply = 0;
16730#[doc = "< Externally powered (mains-powered)."]
16731pub const OT_POWER_SUPPLY_EXTERNAL: otPowerSupply = 1;
16732#[doc = "< Stable external power with a battery backup or UPS."]
16733pub const OT_POWER_SUPPLY_EXTERNAL_STABLE: otPowerSupply = 2;
16734#[doc = "< Potentially unstable ext power (e.g. light bulb powered via a switch)."]
16735pub const OT_POWER_SUPPLY_EXTERNAL_UNSTABLE: otPowerSupply = 3;
16736#[doc = " Represents the power supply property on a device.\n\n This is used as a property in `otDeviceProperties` to calculate the leader weight."]
16737pub type otPowerSupply = ::std::os::raw::c_uint;
16738#[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."]
16739#[repr(C)]
16740#[derive(Debug, Copy, Clone)]
16741pub struct otDeviceProperties {
16742 #[doc = "< Power supply config."]
16743 pub mPowerSupply: otPowerSupply,
16744 pub _bitfield_align_1: [u8; 0],
16745 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16746 #[doc = "< Weight adjustment. Should be -16 to +16 (clamped otherwise)."]
16747 pub mLeaderWeightAdjustment: i8,
16748}
16749impl Default for otDeviceProperties {
16750 fn default() -> Self {
16751 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16752 unsafe {
16753 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16754 s.assume_init()
16755 }
16756 }
16757}
16758impl otDeviceProperties {
16759 #[inline]
16760 pub fn mIsBorderRouter(&self) -> bool {
16761 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16762 }
16763 #[inline]
16764 pub fn set_mIsBorderRouter(&mut self, val: bool) {
16765 unsafe {
16766 let val: u8 = ::std::mem::transmute(val);
16767 self._bitfield_1.set(0usize, 1u8, val as u64)
16768 }
16769 }
16770 #[inline]
16771 pub unsafe fn mIsBorderRouter_raw(this: *const Self) -> bool {
16772 unsafe {
16773 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16774 ::std::ptr::addr_of!((*this)._bitfield_1),
16775 0usize,
16776 1u8,
16777 ) as u8)
16778 }
16779 }
16780 #[inline]
16781 pub unsafe fn set_mIsBorderRouter_raw(this: *mut Self, val: bool) {
16782 unsafe {
16783 let val: u8 = ::std::mem::transmute(val);
16784 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16785 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16786 0usize,
16787 1u8,
16788 val as u64,
16789 )
16790 }
16791 }
16792 #[inline]
16793 pub fn mSupportsCcm(&self) -> bool {
16794 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16795 }
16796 #[inline]
16797 pub fn set_mSupportsCcm(&mut self, val: bool) {
16798 unsafe {
16799 let val: u8 = ::std::mem::transmute(val);
16800 self._bitfield_1.set(1usize, 1u8, val as u64)
16801 }
16802 }
16803 #[inline]
16804 pub unsafe fn mSupportsCcm_raw(this: *const Self) -> bool {
16805 unsafe {
16806 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16807 ::std::ptr::addr_of!((*this)._bitfield_1),
16808 1usize,
16809 1u8,
16810 ) as u8)
16811 }
16812 }
16813 #[inline]
16814 pub unsafe fn set_mSupportsCcm_raw(this: *mut Self, val: bool) {
16815 unsafe {
16816 let val: u8 = ::std::mem::transmute(val);
16817 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16818 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16819 1usize,
16820 1u8,
16821 val as u64,
16822 )
16823 }
16824 }
16825 #[inline]
16826 pub fn mIsUnstable(&self) -> bool {
16827 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16828 }
16829 #[inline]
16830 pub fn set_mIsUnstable(&mut self, val: bool) {
16831 unsafe {
16832 let val: u8 = ::std::mem::transmute(val);
16833 self._bitfield_1.set(2usize, 1u8, val as u64)
16834 }
16835 }
16836 #[inline]
16837 pub unsafe fn mIsUnstable_raw(this: *const Self) -> bool {
16838 unsafe {
16839 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16840 ::std::ptr::addr_of!((*this)._bitfield_1),
16841 2usize,
16842 1u8,
16843 ) as u8)
16844 }
16845 }
16846 #[inline]
16847 pub unsafe fn set_mIsUnstable_raw(this: *mut Self, val: bool) {
16848 unsafe {
16849 let val: u8 = ::std::mem::transmute(val);
16850 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16851 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16852 2usize,
16853 1u8,
16854 val as u64,
16855 )
16856 }
16857 }
16858 #[inline]
16859 pub fn new_bitfield_1(
16860 mIsBorderRouter: bool,
16861 mSupportsCcm: bool,
16862 mIsUnstable: bool,
16863 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16864 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16865 __bindgen_bitfield_unit.set(0usize, 1u8, {
16866 let mIsBorderRouter: u8 = unsafe { ::std::mem::transmute(mIsBorderRouter) };
16867 mIsBorderRouter as u64
16868 });
16869 __bindgen_bitfield_unit.set(1usize, 1u8, {
16870 let mSupportsCcm: u8 = unsafe { ::std::mem::transmute(mSupportsCcm) };
16871 mSupportsCcm as u64
16872 });
16873 __bindgen_bitfield_unit.set(2usize, 1u8, {
16874 let mIsUnstable: u8 = unsafe { ::std::mem::transmute(mIsUnstable) };
16875 mIsUnstable as u64
16876 });
16877 __bindgen_bitfield_unit
16878 }
16879}
16880unsafe extern "C" {
16881 #[doc = " Get the current device properties.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @returns The device properties `otDeviceProperties`."]
16882 pub fn otThreadGetDeviceProperties(aInstance: *mut otInstance) -> *const otDeviceProperties;
16883}
16884unsafe extern "C" {
16885 #[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."]
16886 pub fn otThreadSetDeviceProperties(
16887 aInstance: *mut otInstance,
16888 aDeviceProperties: *const otDeviceProperties,
16889 );
16890}
16891unsafe extern "C" {
16892 #[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"]
16893 pub fn otThreadGetLocalLeaderWeight(aInstance: *mut otInstance) -> u8;
16894}
16895unsafe extern "C" {
16896 #[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"]
16897 pub fn otThreadSetLocalLeaderWeight(aInstance: *mut otInstance, aWeight: u8);
16898}
16899unsafe extern "C" {
16900 #[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."]
16901 pub fn otThreadGetPreferredLeaderPartitionId(aInstance: *mut otInstance) -> u32;
16902}
16903unsafe extern "C" {
16904 #[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."]
16905 pub fn otThreadSetPreferredLeaderPartitionId(aInstance: *mut otInstance, aPartitionId: u32);
16906}
16907unsafe extern "C" {
16908 #[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"]
16909 pub fn otThreadGetJoinerUdpPort(aInstance: *mut otInstance) -> u16;
16910}
16911unsafe extern "C" {
16912 #[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"]
16913 pub fn otThreadSetJoinerUdpPort(aInstance: *mut otInstance, aJoinerUdpPort: u16) -> otError;
16914}
16915unsafe extern "C" {
16916 #[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."]
16917 pub fn otThreadSetSteeringData(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
16918}
16919unsafe extern "C" {
16920 #[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"]
16921 pub fn otThreadGetContextIdReuseDelay(aInstance: *mut otInstance) -> u32;
16922}
16923unsafe extern "C" {
16924 #[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"]
16925 pub fn otThreadSetContextIdReuseDelay(aInstance: *mut otInstance, aDelay: u32);
16926}
16927unsafe extern "C" {
16928 #[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"]
16929 pub fn otThreadGetNetworkIdTimeout(aInstance: *mut otInstance) -> u8;
16930}
16931unsafe extern "C" {
16932 #[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"]
16933 pub fn otThreadSetNetworkIdTimeout(aInstance: *mut otInstance, aTimeout: u8);
16934}
16935unsafe extern "C" {
16936 #[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"]
16937 pub fn otThreadGetRouterUpgradeThreshold(aInstance: *mut otInstance) -> u8;
16938}
16939unsafe extern "C" {
16940 #[doc = " Sets the ROUTER_UPGRADE_THRESHOLD 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 This API historically set a single threshold value that was used for both local role transitions (deciding when\n the device itself should upgrade to a router) and by the leader (deciding whether to allow other devices to\n upgrade). These behaviors have now been separated into distinct router and leader thresholds. To preserve backward\n compatibility with existing applications and test scripts, this function continues to configure both thresholds\n (both the local router upgrade threshold and the leader upgrade threshold).\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.\n\n @sa otThreadGetRouterUpgradeThreshold"]
16941 pub fn otThreadSetRouterUpgradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
16942}
16943unsafe extern "C" {
16944 #[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"]
16945 pub fn otThreadGetChildRouterLinks(aInstance: *mut otInstance) -> u8;
16946}
16947unsafe extern "C" {
16948 #[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"]
16949 pub fn otThreadSetChildRouterLinks(
16950 aInstance: *mut otInstance,
16951 aChildRouterLinks: u8,
16952 ) -> otError;
16953}
16954unsafe extern "C" {
16955 #[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."]
16956 pub fn otThreadReleaseRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
16957}
16958unsafe extern "C" {
16959 #[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."]
16960 pub fn otThreadBecomeRouter(aInstance: *mut otInstance) -> otError;
16961}
16962unsafe extern "C" {
16963 #[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."]
16964 pub fn otThreadBecomeLeader(aInstance: *mut otInstance) -> otError;
16965}
16966unsafe extern "C" {
16967 #[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"]
16968 pub fn otThreadGetRouterDowngradeThreshold(aInstance: *mut otInstance) -> u8;
16969}
16970unsafe extern "C" {
16971 #[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"]
16972 pub fn otThreadSetRouterDowngradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
16973}
16974unsafe extern "C" {
16975 #[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"]
16976 pub fn otThreadGetRouterSelectionJitter(aInstance: *mut otInstance) -> u8;
16977}
16978unsafe extern "C" {
16979 #[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"]
16980 pub fn otThreadSetRouterSelectionJitter(aInstance: *mut otInstance, aRouterJitter: u8);
16981}
16982unsafe extern "C" {
16983 #[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."]
16984 pub fn otThreadGetChildInfoById(
16985 aInstance: *mut otInstance,
16986 aChildId: u16,
16987 aChildInfo: *mut otChildInfo,
16988 ) -> otError;
16989}
16990unsafe extern "C" {
16991 #[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"]
16992 pub fn otThreadGetChildInfoByIndex(
16993 aInstance: *mut otInstance,
16994 aChildIndex: u16,
16995 aChildInfo: *mut otChildInfo,
16996 ) -> otError;
16997}
16998unsafe extern "C" {
16999 #[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"]
17000 pub fn otThreadGetChildNextIp6Address(
17001 aInstance: *mut otInstance,
17002 aChildIndex: u16,
17003 aIterator: *mut otChildIp6AddressIterator,
17004 aAddress: *mut otIp6Address,
17005 ) -> otError;
17006}
17007unsafe extern "C" {
17008 #[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."]
17009 pub fn otThreadGetRouterIdSequence(aInstance: *mut otInstance) -> u8;
17010}
17011unsafe extern "C" {
17012 #[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."]
17013 pub fn otThreadGetMaxRouterId(aInstance: *mut otInstance) -> u8;
17014}
17015unsafe extern "C" {
17016 #[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."]
17017 pub fn otThreadGetRouterInfo(
17018 aInstance: *mut otInstance,
17019 aRouterId: u16,
17020 aRouterInfo: *mut otRouterInfo,
17021 ) -> otError;
17022}
17023unsafe extern "C" {
17024 #[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."]
17025 pub fn otThreadGetNextCacheEntry(
17026 aInstance: *mut otInstance,
17027 aEntryInfo: *mut otCacheEntryInfo,
17028 aIterator: *mut otCacheEntryIterator,
17029 ) -> otError;
17030}
17031unsafe extern "C" {
17032 #[doc = " Clears the EID cache.\n\n Intended for testing only.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
17033 pub fn otThreadClearEidCache(aInstance: *mut otInstance);
17034}
17035unsafe extern "C" {
17036 #[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"]
17037 pub fn otThreadGetPskc(aInstance: *mut otInstance, aPskc: *mut otPskc);
17038}
17039unsafe extern "C" {
17040 #[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"]
17041 pub fn otThreadGetPskcRef(aInstance: *mut otInstance) -> otPskcRef;
17042}
17043unsafe extern "C" {
17044 #[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"]
17045 pub fn otThreadSetPskc(aInstance: *mut otInstance, aPskc: *const otPskc) -> otError;
17046}
17047unsafe extern "C" {
17048 #[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"]
17049 pub fn otThreadSetPskcRef(aInstance: *mut otInstance, aKeyRef: otPskcRef) -> otError;
17050}
17051unsafe extern "C" {
17052 #[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"]
17053 pub fn otThreadGetParentPriority(aInstance: *mut otInstance) -> i8;
17054}
17055unsafe extern "C" {
17056 #[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"]
17057 pub fn otThreadSetParentPriority(aInstance: *mut otInstance, aParentPriority: i8) -> otError;
17058}
17059unsafe extern "C" {
17060 #[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"]
17061 pub fn otThreadGetMaxChildIpAddresses(aInstance: *mut otInstance) -> u8;
17062}
17063unsafe extern "C" {
17064 #[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"]
17065 pub fn otThreadSetMaxChildIpAddresses(
17066 aInstance: *mut otInstance,
17067 aMaxIpAddresses: u8,
17068 ) -> otError;
17069}
17070#[doc = "< A child is being added."]
17071pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED: otNeighborTableEvent = 0;
17072#[doc = "< A child is being removed."]
17073pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED: otNeighborTableEvent = 1;
17074#[doc = "< An existing child's mode is changed."]
17075pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED: otNeighborTableEvent = 2;
17076#[doc = "< A router is being added."]
17077pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED: otNeighborTableEvent = 3;
17078#[doc = "< A router is being removed."]
17079pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED: otNeighborTableEvent = 4;
17080#[doc = " Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table."]
17081pub type otNeighborTableEvent = ::std::os::raw::c_uint;
17082#[doc = " Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table\n callback `otNeighborTableCallback`."]
17083#[repr(C)]
17084#[derive(Copy, Clone)]
17085pub struct otNeighborTableEntryInfo {
17086 #[doc = "< The OpenThread instance."]
17087 pub mInstance: *mut otInstance,
17088 pub mInfo: otNeighborTableEntryInfo__bindgen_ty_1,
17089}
17090#[repr(C)]
17091#[derive(Copy, Clone)]
17092pub union otNeighborTableEntryInfo__bindgen_ty_1 {
17093 #[doc = "< The child neighbor info."]
17094 pub mChild: otChildInfo,
17095 #[doc = "< The router neighbor info."]
17096 pub mRouter: otNeighborInfo,
17097}
17098impl Default for otNeighborTableEntryInfo__bindgen_ty_1 {
17099 fn default() -> Self {
17100 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17101 unsafe {
17102 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17103 s.assume_init()
17104 }
17105 }
17106}
17107impl Default for otNeighborTableEntryInfo {
17108 fn default() -> Self {
17109 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17110 unsafe {
17111 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17112 s.assume_init()
17113 }
17114 }
17115}
17116#[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."]
17117pub type otNeighborTableCallback = ::std::option::Option<
17118 unsafe extern "C" fn(aEvent: otNeighborTableEvent, aEntryInfo: *const otNeighborTableEntryInfo),
17119>;
17120unsafe extern "C" {
17121 #[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."]
17122 pub fn otThreadRegisterNeighborTableCallback(
17123 aInstance: *mut otInstance,
17124 aCallback: otNeighborTableCallback,
17125 );
17126}
17127unsafe extern "C" {
17128 #[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."]
17129 pub fn otThreadSetCcmEnabled(aInstance: *mut otInstance, aEnabled: bool);
17130}
17131unsafe extern "C" {
17132 #[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."]
17133 pub fn otThreadSetThreadVersionCheckEnabled(aInstance: *mut otInstance, aEnabled: bool);
17134}
17135unsafe extern "C" {
17136 #[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."]
17137 pub fn otThreadSetTmfOriginFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
17138}
17139unsafe extern "C" {
17140 #[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."]
17141 pub fn otThreadIsTmfOriginFilterEnabled(aInstance: *mut otInstance) -> bool;
17142}
17143unsafe extern "C" {
17144 #[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"]
17145 pub fn otThreadGetRouterIdRange(
17146 aInstance: *mut otInstance,
17147 aMinRouterId: *mut u8,
17148 aMaxRouterId: *mut u8,
17149 );
17150}
17151unsafe extern "C" {
17152 #[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"]
17153 pub fn otThreadSetRouterIdRange(
17154 aInstance: *mut otInstance,
17155 aMinRouterId: u8,
17156 aMaxRouterId: u8,
17157 ) -> otError;
17158}
17159unsafe extern "C" {
17160 #[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."]
17161 pub fn otThreadGetAdvertisementTrickleIntervalMax(aInstance: *mut otInstance) -> u32;
17162}
17163unsafe extern "C" {
17164 #[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."]
17165 pub fn otThreadIsRouterIdAllocated(aInstance: *mut otInstance, aRouterId: u8) -> bool;
17166}
17167unsafe extern "C" {
17168 #[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."]
17169 pub fn otThreadGetNextHopAndPathCost(
17170 aInstance: *mut otInstance,
17171 aDestRloc16: u16,
17172 aNextHopRloc16: *mut u16,
17173 aPathCost: *mut u8,
17174 );
17175}
17176#[doc = " Represents a TREL peer."]
17177#[repr(C)]
17178#[derive(Copy, Clone)]
17179pub struct otTrelPeer {
17180 #[doc = "< The Extended MAC Address of TREL peer."]
17181 pub mExtAddress: otExtAddress,
17182 #[doc = "< The Extended PAN Identifier of TREL peer."]
17183 pub mExtPanId: otExtendedPanId,
17184 #[doc = "< The IPv6 socket address of TREL peer."]
17185 pub mSockAddr: otSockAddr,
17186}
17187impl Default for otTrelPeer {
17188 fn default() -> Self {
17189 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17190 unsafe {
17191 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17192 s.assume_init()
17193 }
17194 }
17195}
17196#[doc = " Represents an iterator for iterating over TREL peer table entries."]
17197pub type otTrelPeerIterator = *const ::std::os::raw::c_void;
17198unsafe extern "C" {
17199 #[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."]
17200 pub fn otTrelSetEnabled(aInstance: *mut otInstance, aEnable: bool);
17201}
17202unsafe extern "C" {
17203 #[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."]
17204 pub fn otTrelIsEnabled(aInstance: *mut otInstance) -> bool;
17205}
17206unsafe extern "C" {
17207 #[doc = " Initializes a peer table iterator.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
17208 pub fn otTrelInitPeerIterator(aInstance: *mut otInstance, aIterator: *mut otTrelPeerIterator);
17209}
17210unsafe extern "C" {
17211 #[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."]
17212 pub fn otTrelGetNextPeer(
17213 aInstance: *mut otInstance,
17214 aIterator: *mut otTrelPeerIterator,
17215 ) -> *const otTrelPeer;
17216}
17217unsafe extern "C" {
17218 #[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."]
17219 pub fn otTrelGetNumberOfPeers(aInstance: *mut otInstance) -> u16;
17220}
17221unsafe extern "C" {
17222 #[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."]
17223 pub fn otTrelSetFilterEnabled(aInstance: *mut otInstance, aEnable: bool);
17224}
17225unsafe extern "C" {
17226 #[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."]
17227 pub fn otTrelIsFilterEnabled(aInstance: *mut otInstance) -> bool;
17228}
17229#[doc = " Represents a group of TREL related counters."]
17230pub type otTrelCounters = otPlatTrelCounters;
17231unsafe extern "C" {
17232 #[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."]
17233 pub fn otTrelGetCounters(aInstance: *mut otInstance) -> *const otTrelCounters;
17234}
17235unsafe extern "C" {
17236 #[doc = " Resets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
17237 pub fn otTrelResetCounters(aInstance: *mut otInstance);
17238}
17239unsafe extern "C" {
17240 #[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."]
17241 pub fn otTrelGetUdpPort(aInstance: *mut otInstance) -> u16;
17242}
17243unsafe extern "C" {
17244 #[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`."]
17245 pub fn otVerhoeffChecksumCalculate(
17246 aDecimalString: *const ::std::os::raw::c_char,
17247 aChecksum: *mut ::std::os::raw::c_char,
17248 ) -> otError;
17249}
17250unsafe extern "C" {
17251 #[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`."]
17252 pub fn otVerhoeffChecksumValidate(aDecimalString: *const ::std::os::raw::c_char) -> otError;
17253}
17254pub type __builtin_va_list = [__va_list_tag; 1usize];
17255#[repr(C)]
17256#[derive(Debug, Copy, Clone)]
17257pub struct __va_list_tag {
17258 pub gp_offset: ::std::os::raw::c_uint,
17259 pub fp_offset: ::std::os::raw::c_uint,
17260 pub overflow_arg_area: *mut ::std::os::raw::c_void,
17261 pub reg_save_area: *mut ::std::os::raw::c_void,
17262}
17263impl Default for __va_list_tag {
17264 fn default() -> Self {
17265 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17266 unsafe {
17267 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17268 s.assume_init()
17269 }
17270 }
17271}