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 = 626;
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 = " Check whether a given key reference is valid.\n\n This API does not check whether a key is currently stored under @p aKeyRef. Instead, use `otPlatCryptoHasKey()` for\n existence checks.\n\n @note This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled.\n\n @param[in] aKeyRef The Key Ref to check.\n\n @retval TRUE @p aKeyRef is valid.\n @retval FALSE @p aKeyRef is not valid."]
1033 pub fn otPlatCryptoIsKeyRefValid(aKeyRef: otCryptoKeyRef) -> bool;
1034}
1035unsafe extern "C" {
1036 #[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."]
1037 pub fn otPlatCryptoImportKey(
1038 aKeyRef: *mut otCryptoKeyRef,
1039 aKeyType: otCryptoKeyType,
1040 aKeyAlgorithm: otCryptoKeyAlgorithm,
1041 aKeyUsage: ::std::os::raw::c_int,
1042 aKeyPersistence: otCryptoKeyStorage,
1043 aKey: *const u8,
1044 aKeyLen: usize,
1045 ) -> otError;
1046}
1047unsafe extern "C" {
1048 #[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."]
1049 pub fn otPlatCryptoExportKey(
1050 aKeyRef: otCryptoKeyRef,
1051 aBuffer: *mut u8,
1052 aBufferLen: usize,
1053 aKeyLen: *mut usize,
1054 ) -> otError;
1055}
1056unsafe extern "C" {
1057 #[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."]
1058 pub fn otPlatCryptoDestroyKey(aKeyRef: otCryptoKeyRef) -> otError;
1059}
1060unsafe extern "C" {
1061 #[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."]
1062 pub fn otPlatCryptoHasKey(aKeyRef: otCryptoKeyRef) -> bool;
1063}
1064unsafe extern "C" {
1065 #[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."]
1066 pub fn otPlatCryptoCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
1067}
1068unsafe extern "C" {
1069 #[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."]
1070 pub fn otPlatCryptoFree(aPtr: *mut ::std::os::raw::c_void);
1071}
1072unsafe extern "C" {
1073 #[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."]
1074 pub fn otPlatCryptoHmacSha256Init(aContext: *mut otCryptoContext) -> otError;
1075}
1076unsafe extern "C" {
1077 #[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"]
1078 pub fn otPlatCryptoHmacSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1079}
1080unsafe extern "C" {
1081 #[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"]
1082 pub fn otPlatCryptoHmacSha256Start(
1083 aContext: *mut otCryptoContext,
1084 aKey: *const otCryptoKey,
1085 ) -> otError;
1086}
1087unsafe extern "C" {
1088 #[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"]
1089 pub fn otPlatCryptoHmacSha256Update(
1090 aContext: *mut otCryptoContext,
1091 aBuf: *const ::std::os::raw::c_void,
1092 aBufLength: u16,
1093 ) -> otError;
1094}
1095unsafe extern "C" {
1096 #[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"]
1097 pub fn otPlatCryptoHmacSha256Finish(
1098 aContext: *mut otCryptoContext,
1099 aBuf: *mut u8,
1100 aBufLength: usize,
1101 ) -> otError;
1102}
1103unsafe extern "C" {
1104 #[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."]
1105 pub fn otPlatCryptoAesInit(aContext: *mut otCryptoContext) -> otError;
1106}
1107unsafe extern "C" {
1108 #[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"]
1109 pub fn otPlatCryptoAesSetKey(
1110 aContext: *mut otCryptoContext,
1111 aKey: *const otCryptoKey,
1112 ) -> otError;
1113}
1114unsafe extern "C" {
1115 #[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"]
1116 pub fn otPlatCryptoAesEncrypt(
1117 aContext: *mut otCryptoContext,
1118 aInput: *const u8,
1119 aOutput: *mut u8,
1120 ) -> otError;
1121}
1122unsafe extern "C" {
1123 #[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"]
1124 pub fn otPlatCryptoAesFree(aContext: *mut otCryptoContext) -> otError;
1125}
1126unsafe extern "C" {
1127 #[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"]
1128 pub fn otPlatCryptoHkdfInit(aContext: *mut otCryptoContext) -> otError;
1129}
1130unsafe extern "C" {
1131 #[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"]
1132 pub fn otPlatCryptoHkdfExpand(
1133 aContext: *mut otCryptoContext,
1134 aInfo: *const u8,
1135 aInfoLength: u16,
1136 aOutputKey: *mut u8,
1137 aOutputKeyLength: u16,
1138 ) -> otError;
1139}
1140unsafe extern "C" {
1141 #[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."]
1142 pub fn otPlatCryptoHkdfExtract(
1143 aContext: *mut otCryptoContext,
1144 aSalt: *const u8,
1145 aSaltLength: u16,
1146 aInputKey: *const otCryptoKey,
1147 ) -> otError;
1148}
1149unsafe extern "C" {
1150 #[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"]
1151 pub fn otPlatCryptoHkdfDeinit(aContext: *mut otCryptoContext) -> otError;
1152}
1153unsafe extern "C" {
1154 #[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."]
1155 pub fn otPlatCryptoSha256Init(aContext: *mut otCryptoContext) -> otError;
1156}
1157unsafe extern "C" {
1158 #[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"]
1159 pub fn otPlatCryptoSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1160}
1161unsafe extern "C" {
1162 #[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"]
1163 pub fn otPlatCryptoSha256Start(aContext: *mut otCryptoContext) -> otError;
1164}
1165unsafe extern "C" {
1166 #[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"]
1167 pub fn otPlatCryptoSha256Update(
1168 aContext: *mut otCryptoContext,
1169 aBuf: *const ::std::os::raw::c_void,
1170 aBufLength: u16,
1171 ) -> otError;
1172}
1173unsafe extern "C" {
1174 #[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"]
1175 pub fn otPlatCryptoSha256Finish(
1176 aContext: *mut otCryptoContext,
1177 aHash: *mut u8,
1178 aHashSize: u16,
1179 ) -> otError;
1180}
1181unsafe extern "C" {
1182 #[doc = " Initialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1183 pub fn otPlatCryptoRandomInit();
1184}
1185unsafe extern "C" {
1186 #[doc = " Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1187 pub fn otPlatCryptoRandomDeinit();
1188}
1189unsafe extern "C" {
1190 #[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."]
1191 pub fn otPlatCryptoRandomGet(aBuffer: *mut u8, aSize: u16) -> otError;
1192}
1193unsafe extern "C" {
1194 #[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."]
1195 pub fn otPlatCryptoEcdsaGenerateKey(aKeyPair: *mut otPlatCryptoEcdsaKeyPair) -> otError;
1196}
1197unsafe extern "C" {
1198 #[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."]
1199 pub fn otPlatCryptoEcdsaGetPublicKey(
1200 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1201 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1202 ) -> otError;
1203}
1204unsafe extern "C" {
1205 #[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."]
1206 pub fn otPlatCryptoEcdsaSign(
1207 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1208 aHash: *const otPlatCryptoSha256Hash,
1209 aSignature: *mut otPlatCryptoEcdsaSignature,
1210 ) -> otError;
1211}
1212unsafe extern "C" {
1213 #[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."]
1214 pub fn otPlatCryptoEcdsaVerify(
1215 aPublicKey: *const otPlatCryptoEcdsaPublicKey,
1216 aHash: *const otPlatCryptoSha256Hash,
1217 aSignature: *const otPlatCryptoEcdsaSignature,
1218 ) -> otError;
1219}
1220unsafe extern "C" {
1221 #[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."]
1222 pub fn otPlatCryptoEcdsaSignUsingKeyRef(
1223 aKeyRef: otCryptoKeyRef,
1224 aHash: *const otPlatCryptoSha256Hash,
1225 aSignature: *mut otPlatCryptoEcdsaSignature,
1226 ) -> otError;
1227}
1228unsafe extern "C" {
1229 #[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."]
1230 pub fn otPlatCryptoEcdsaExportPublicKey(
1231 aKeyRef: otCryptoKeyRef,
1232 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1233 ) -> otError;
1234}
1235unsafe extern "C" {
1236 #[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."]
1237 pub fn otPlatCryptoEcdsaGenerateAndImportKey(aKeyRef: otCryptoKeyRef) -> otError;
1238}
1239unsafe extern "C" {
1240 #[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."]
1241 pub fn otPlatCryptoEcdsaVerifyUsingKeyRef(
1242 aKeyRef: otCryptoKeyRef,
1243 aHash: *const otPlatCryptoSha256Hash,
1244 aSignature: *const otPlatCryptoEcdsaSignature,
1245 ) -> otError;
1246}
1247unsafe extern "C" {
1248 #[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."]
1249 pub fn otPlatCryptoPbkdf2GenerateKey(
1250 aPassword: *const u8,
1251 aPasswordLen: u16,
1252 aSalt: *const u8,
1253 aSaltLen: u16,
1254 aIterationCounter: u32,
1255 aKeyLen: u16,
1256 aKey: *mut u8,
1257 ) -> otError;
1258}
1259#[doc = " @struct otPlatCryptoAesCcmConfig\n\n Holds the parameters for a one-shot AES-CCM* operation passed to `otPlatCryptoAesCcmProcessOneShot`."]
1260#[repr(C)]
1261#[derive(Debug, Copy, Clone)]
1262pub struct otPlatCryptoAesCcmConfig {
1263 #[doc = "< The encryption key."]
1264 pub mKey: otCryptoKey,
1265 #[doc = "< Pointer to the nonce buffer (IEEE 802.15.4 CCM* format, 13 bytes)."]
1266 pub mNonce: *const u8,
1267 #[doc = "< Length of @p mNonce in bytes."]
1268 pub mNonceLength: u8,
1269 #[doc = "< Authentication tag length in bytes (even)"]
1270 pub mTagLength: u8,
1271 #[doc = "< Length of the additional authenticated data (header) in bytes."]
1272 pub mHeaderLength: u32,
1273 #[doc = "< Payload length in bytes (excluding tag)."]
1274 pub mPlainTextLength: u32,
1275}
1276impl Default for otPlatCryptoAesCcmConfig {
1277 fn default() -> Self {
1278 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1279 unsafe {
1280 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1281 s.assume_init()
1282 }
1283 }
1284}
1285unsafe extern "C" {
1286 #[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."]
1287 pub fn otPlatCryptoAesCcmProcessOneShot(
1288 aEncrypt: bool,
1289 aConfig: *const otPlatCryptoAesCcmConfig,
1290 aHeader: *const u8,
1291 aData: *mut u8,
1292 ) -> otError;
1293}
1294#[doc = "< aMaxPHYPacketSize (IEEE 802.15.4-2006)"]
1295pub const OT_RADIO_FRAME_MAX_SIZE: _bindgen_ty_2 = 127;
1296#[doc = "< Minimal size of frame FCS + CONTROL"]
1297pub const OT_RADIO_FRAME_MIN_SIZE: _bindgen_ty_2 = 3;
1298#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1299pub const OT_RADIO_SYMBOLS_PER_OCTET: _bindgen_ty_2 = 2;
1300#[doc = "< 2.4 GHz IEEE 802.15.4 (bits per second)"]
1301pub const OT_RADIO_BIT_RATE: _bindgen_ty_2 = 250000;
1302#[doc = "< Number of bits per octet"]
1303pub const OT_RADIO_BITS_PER_OCTET: _bindgen_ty_2 = 8;
1304#[doc = "< The O-QPSK PHY symbol rate when operating in the 780MHz, 915MHz, 2380MHz, 2450MHz"]
1305pub const OT_RADIO_SYMBOL_RATE: _bindgen_ty_2 = 62500;
1306#[doc = "< Symbol duration time in unit of microseconds"]
1307pub const OT_RADIO_SYMBOL_TIME: _bindgen_ty_2 = 16;
1308#[doc = "< Time for 10 symbols in unit of microseconds"]
1309pub const OT_RADIO_TEN_SYMBOLS_TIME: _bindgen_ty_2 = 160;
1310#[doc = "< LQI measurement not supported"]
1311pub const OT_RADIO_LQI_NONE: _bindgen_ty_2 = 0;
1312#[doc = "< Invalid or unknown RSSI value"]
1313pub const OT_RADIO_RSSI_INVALID: _bindgen_ty_2 = 127;
1314#[doc = "< Invalid or unknown power value"]
1315pub const OT_RADIO_POWER_INVALID: _bindgen_ty_2 = 127;
1316#[doc = "< Invalid short address."]
1317pub const OT_RADIO_INVALID_SHORT_ADDR: _bindgen_ty_2 = 65534;
1318#[doc = "< Broadcast short address."]
1319pub const OT_RADIO_BROADCAST_SHORT_ADDR: _bindgen_ty_2 = 65535;
1320#[doc = " @defgroup radio-types Radio Types\n\n @brief\n This module includes the platform abstraction for a radio frame.\n\n @{"]
1321pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
1322#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1323pub const OT_RADIO_CHANNEL_PAGE_0: _bindgen_ty_3 = 0;
1324#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1325pub const OT_RADIO_CHANNEL_PAGE_0_MASK: _bindgen_ty_3 = 1;
1326#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1327pub const OT_RADIO_CHANNEL_PAGE_2: _bindgen_ty_3 = 2;
1328#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1329pub const OT_RADIO_CHANNEL_PAGE_2_MASK: _bindgen_ty_3 = 4;
1330#[doc = " Defines the channel page."]
1331pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
1332#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1333pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 1;
1334#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1335pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 10;
1336#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1337pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 2046;
1338#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1339pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 11;
1340#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1341pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 26;
1342#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1343pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 134215680;
1344#[doc = " Defines the frequency band channel range."]
1345pub type _bindgen_ty_4 = ::std::os::raw::c_uint;
1346#[doc = " Represents radio capabilities.\n\n The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions."]
1347pub type otRadioCaps = u16;
1348#[doc = "< Radio supports no capability."]
1349pub const OT_RADIO_CAPS_NONE: _bindgen_ty_5 = 0;
1350#[doc = "< Radio supports AckTime event."]
1351pub const OT_RADIO_CAPS_ACK_TIMEOUT: _bindgen_ty_5 = 1;
1352#[doc = "< Radio supports Energy Scans."]
1353pub const OT_RADIO_CAPS_ENERGY_SCAN: _bindgen_ty_5 = 2;
1354#[doc = "< Radio supports tx retry logic with collision avoidance (CSMA)."]
1355pub const OT_RADIO_CAPS_TRANSMIT_RETRIES: _bindgen_ty_5 = 4;
1356#[doc = "< Radio supports CSMA backoff for frame tx (but no retry)."]
1357pub const OT_RADIO_CAPS_CSMA_BACKOFF: _bindgen_ty_5 = 8;
1358#[doc = "< Radio supports direct transition from sleep to TX with CSMA."]
1359pub const OT_RADIO_CAPS_SLEEP_TO_TX: _bindgen_ty_5 = 16;
1360#[doc = "< Radio supports tx security."]
1361pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_5 = 32;
1362#[doc = "< Radio supports tx at specific time (using `mTxDelay`)."]
1363pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_5 = 64;
1364#[doc = "< Radio supports rx at specific time."]
1365pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_5 = 128;
1366#[doc = "< Radio supports RxOnWhenIdle handling."]
1367pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_5 = 256;
1368#[doc = "< Radio supports setting per-frame transmit power."]
1369pub const OT_RADIO_CAPS_TRANSMIT_FRAME_POWER: _bindgen_ty_5 = 512;
1370#[doc = "< Radio supports setting alternate short address."]
1371pub const OT_RADIO_CAPS_ALT_SHORT_ADDR: _bindgen_ty_5 = 1024;
1372#[doc = "< Radio supports scheduling frame TX (`otPlatRadioScheduleTx()`)."]
1373pub const OT_RADIO_CAPS_SCHEDULED_TX: _bindgen_ty_5 = 2048;
1374#[doc = " Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`."]
1375pub type _bindgen_ty_5 = ::std::os::raw::c_uint;
1376#[doc = " Represents the IEEE 802.15.4 PAN ID."]
1377pub type otPanId = u16;
1378#[doc = " Represents the IEEE 802.15.4 Short Address."]
1379pub type otShortAddress = u16;
1380#[doc = "< Size of IE header in bytes."]
1381pub const OT_IE_HEADER_SIZE: _bindgen_ty_6 = 2;
1382#[doc = "< Size of CSL IE content in bytes."]
1383pub const OT_CSL_IE_SIZE: _bindgen_ty_6 = 4;
1384#[doc = "< Max length for header IE in ACK."]
1385pub const OT_ACK_IE_MAX_SIZE: _bindgen_ty_6 = 16;
1386#[doc = "< Max length of Link Metrics data in Vendor-Specific IE."]
1387pub const OT_ENH_PROBING_IE_DATA_MAX_SIZE: _bindgen_ty_6 = 2;
1388#[doc = " Defines constants about size of header IE in ACK."]
1389pub type _bindgen_ty_6 = ::std::os::raw::c_uint;
1390#[doc = " @struct otExtAddress\n\n Represents the IEEE 802.15.4 Extended Address."]
1391#[repr(C, packed)]
1392#[derive(Debug, Default, Copy, Clone)]
1393pub struct otExtAddress {
1394 #[doc = "< IEEE 802.15.4 Extended Address bytes"]
1395 pub m8: [u8; 8usize],
1396}
1397#[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()`, used as the target transmission time in `otPlatRadioScheduleTx()`,\n and used as the timestamp field (`mTimestamp`) in radio frames (`otRadioFrame`)."]
1398pub type otRadioTime64 = u64;
1399#[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."]
1400pub type otRadioTime32 = u32;
1401#[doc = " @struct otMacKey\n\n Represents a MAC Key."]
1402#[repr(C, packed)]
1403#[derive(Debug, Default, Copy, Clone)]
1404pub struct otMacKey {
1405 #[doc = "< MAC Key bytes."]
1406 pub m8: [u8; 16usize],
1407}
1408#[doc = " Represents a MAC Key Ref used by PSA."]
1409pub type otMacKeyRef = otCryptoKeyRef;
1410#[doc = " @struct otMacKeyMaterial\n\n Represents a MAC Key."]
1411#[repr(C)]
1412#[derive(Copy, Clone)]
1413pub struct otMacKeyMaterial {
1414 pub mKeyMaterial: otMacKeyMaterial__bindgen_ty_1,
1415}
1416#[repr(C)]
1417#[derive(Copy, Clone)]
1418pub union otMacKeyMaterial__bindgen_ty_1 {
1419 #[doc = "< Reference to the key stored."]
1420 pub mKeyRef: otMacKeyRef,
1421 #[doc = "< Key stored as literal."]
1422 pub mKey: otMacKey,
1423}
1424impl Default for otMacKeyMaterial__bindgen_ty_1 {
1425 fn default() -> Self {
1426 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1427 unsafe {
1428 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1429 s.assume_init()
1430 }
1431 }
1432}
1433impl Default for otMacKeyMaterial {
1434 fn default() -> Self {
1435 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1436 unsafe {
1437 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1438 s.assume_init()
1439 }
1440 }
1441}
1442#[doc = "< Use Literal Keys."]
1443pub const OT_KEY_TYPE_LITERAL_KEY: otRadioKeyType = 0;
1444#[doc = "< Use Reference to Key."]
1445pub const OT_KEY_TYPE_KEY_REF: otRadioKeyType = 1;
1446#[doc = " Defines constants about key types."]
1447pub type otRadioKeyType = ::std::os::raw::c_uint;
1448#[doc = " Represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame."]
1449#[repr(C)]
1450#[derive(Debug, Default, Copy, Clone)]
1451pub struct otRadioIeInfo {
1452 #[doc = "< The time offset to the Thread network time."]
1453 pub mNetworkTimeOffset: i64,
1454 #[doc = "< The Time IE offset from the start of PSDU."]
1455 pub mTimeIeOffset: u8,
1456 #[doc = "< The Time sync sequence."]
1457 pub mTimeSyncSeq: u8,
1458}
1459#[doc = " Represents an IEEE 802.15.4 radio frame."]
1460#[repr(C)]
1461#[derive(Copy, Clone)]
1462pub struct otRadioFrame {
1463 #[doc = "< The PSDU."]
1464 pub mPsdu: *mut u8,
1465 #[doc = "< Length of the PSDU."]
1466 pub mLength: u16,
1467 #[doc = "< Channel used to transmit/receive the frame."]
1468 pub mChannel: u8,
1469 #[doc = "< Radio link type - should be ignored by radio driver."]
1470 pub mRadioType: u8,
1471 pub mInfo: otRadioFrame__bindgen_ty_1,
1472}
1473#[doc = " The union of transmit and receive information for a radio frame."]
1474#[repr(C)]
1475#[derive(Copy, Clone)]
1476pub union otRadioFrame__bindgen_ty_1 {
1477 pub mTxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_1,
1478 pub mRxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_2,
1479}
1480#[doc = " Structure representing radio frame transmit information."]
1481#[repr(C)]
1482#[derive(Debug, Copy, Clone)]
1483pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1484 #[doc = "< The key material used for AES-CCM frame security."]
1485 pub mAesKey: *const otMacKeyMaterial,
1486 #[doc = "< The pointer to the Header IE(s) related information."]
1487 pub mIeInfo: *mut otRadioIeInfo,
1488 #[doc = " The base time in microseconds for timed transmissions relative to the local radio clock (see\n `otPlatRadioGetNow()` and `mTxDelay`).\n\n This field is only applicable when the radio platform supports the `OT_RADIO_CAPS_TRANSMIT_TIMING`\n capability and the frame is transmitted via `otPlatRadioTransmit()`. It MUST be ignored when\n `OT_RADIO_CAPS_TRANSMIT_TIMING` is not supported or when the frame is scheduled for transmission via\n `otPlatRadioScheduleTx()`.\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`."]
1489 pub mTxDelayBaseTime: otRadioTime32,
1490 #[doc = " The delay time in microseconds for a timed transmission referenced to `mTxDelayBaseTime`.\n\n This field is only applicable when the radio platform supports the `OT_RADIO_CAPS_TRANSMIT_TIMING`\n capability and the frame is transmitted via `otPlatRadioTransmit()`. It MUST be ignored when\n `OT_RADIO_CAPS_TRANSMIT_TIMING` is not supported or when the frame is scheduled for transmission via\n `otPlatRadioScheduleTx()`.\n\n Note: `mTxDelayBaseTime` + `mTxDelay` SHALL point to the point in time when the end of the SFD will be\n present at the local 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`."]
1491 pub mTxDelay: u32,
1492 #[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), if either\n `mTxDelayBaseTime` or `mTxDelay` is non-zero (frame transmission is expected at a specific time), or\n when the frame is scheduled for transmission via `otPlatRadioScheduleTx()`.\n\n It can be set to `0` to skip backoff mechanism (note that CCA MUST still be performed assuming\n `mCsmaCaEnabled` is `true`)."]
1493 pub mMaxCsmaBackoffs: u8,
1494 #[doc = " Maximum number of retries allowed after a transmission failure.\n\n This is applicable when the radio platform provides `OT_RADIO_CAPS_TRANSMIT_RETRIES` and the frame is\n transmitted via `otPlatRadioTransmit()`. It MUST be ignored when the frame is scheduled for transmission\n via `otPlatRadioScheduleTx()`."]
1495 pub mMaxFrameRetries: u8,
1496 #[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. This field\n MUST also be ignored when the frame is scheduled for transmission via `otPlatRadioScheduleTx()`.\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."]
1497 pub mRxChannelAfterTxDone: u8,
1498 #[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()."]
1499 pub mTxPower: i8,
1500 pub _bitfield_align_1: [u8; 0],
1501 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1502 #[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,\n or before `otPlatRadioScheduledTxDone()` is invoked for a scheduled transmission."]
1503 pub mTimestamp: otRadioTime64,
1504}
1505impl Default for otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1506 fn default() -> Self {
1507 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1508 unsafe {
1509 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1510 s.assume_init()
1511 }
1512 }
1513}
1514impl otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1515 #[inline]
1516 pub fn mIsHeaderUpdated(&self) -> bool {
1517 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1518 }
1519 #[inline]
1520 pub fn set_mIsHeaderUpdated(&mut self, val: bool) {
1521 unsafe {
1522 let val: u8 = ::std::mem::transmute(val);
1523 self._bitfield_1.set(0usize, 1u8, val as u64)
1524 }
1525 }
1526 #[inline]
1527 pub unsafe fn mIsHeaderUpdated_raw(this: *const Self) -> bool {
1528 unsafe {
1529 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1530 ::std::ptr::addr_of!((*this)._bitfield_1),
1531 0usize,
1532 1u8,
1533 ) as u8)
1534 }
1535 }
1536 #[inline]
1537 pub unsafe fn set_mIsHeaderUpdated_raw(this: *mut Self, val: bool) {
1538 unsafe {
1539 let val: u8 = ::std::mem::transmute(val);
1540 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1541 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1542 0usize,
1543 1u8,
1544 val as u64,
1545 )
1546 }
1547 }
1548 #[inline]
1549 pub fn mIsARetx(&self) -> bool {
1550 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1551 }
1552 #[inline]
1553 pub fn set_mIsARetx(&mut self, val: bool) {
1554 unsafe {
1555 let val: u8 = ::std::mem::transmute(val);
1556 self._bitfield_1.set(1usize, 1u8, val as u64)
1557 }
1558 }
1559 #[inline]
1560 pub unsafe fn mIsARetx_raw(this: *const Self) -> bool {
1561 unsafe {
1562 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1563 ::std::ptr::addr_of!((*this)._bitfield_1),
1564 1usize,
1565 1u8,
1566 ) as u8)
1567 }
1568 }
1569 #[inline]
1570 pub unsafe fn set_mIsARetx_raw(this: *mut Self, val: bool) {
1571 unsafe {
1572 let val: u8 = ::std::mem::transmute(val);
1573 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1574 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1575 1usize,
1576 1u8,
1577 val as u64,
1578 )
1579 }
1580 }
1581 #[inline]
1582 pub fn mCsmaCaEnabled(&self) -> bool {
1583 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1584 }
1585 #[inline]
1586 pub fn set_mCsmaCaEnabled(&mut self, val: bool) {
1587 unsafe {
1588 let val: u8 = ::std::mem::transmute(val);
1589 self._bitfield_1.set(2usize, 1u8, val as u64)
1590 }
1591 }
1592 #[inline]
1593 pub unsafe fn mCsmaCaEnabled_raw(this: *const Self) -> bool {
1594 unsafe {
1595 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1596 ::std::ptr::addr_of!((*this)._bitfield_1),
1597 2usize,
1598 1u8,
1599 ) as u8)
1600 }
1601 }
1602 #[inline]
1603 pub unsafe fn set_mCsmaCaEnabled_raw(this: *mut Self, val: bool) {
1604 unsafe {
1605 let val: u8 = ::std::mem::transmute(val);
1606 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1607 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1608 2usize,
1609 1u8,
1610 val as u64,
1611 )
1612 }
1613 }
1614 #[inline]
1615 pub fn mCslPresent(&self) -> bool {
1616 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1617 }
1618 #[inline]
1619 pub fn set_mCslPresent(&mut self, val: bool) {
1620 unsafe {
1621 let val: u8 = ::std::mem::transmute(val);
1622 self._bitfield_1.set(3usize, 1u8, val as u64)
1623 }
1624 }
1625 #[inline]
1626 pub unsafe fn mCslPresent_raw(this: *const Self) -> bool {
1627 unsafe {
1628 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1629 ::std::ptr::addr_of!((*this)._bitfield_1),
1630 3usize,
1631 1u8,
1632 ) as u8)
1633 }
1634 }
1635 #[inline]
1636 pub unsafe fn set_mCslPresent_raw(this: *mut Self, val: bool) {
1637 unsafe {
1638 let val: u8 = ::std::mem::transmute(val);
1639 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1640 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1641 3usize,
1642 1u8,
1643 val as u64,
1644 )
1645 }
1646 }
1647 #[inline]
1648 pub fn mIsSecurityProcessed(&self) -> bool {
1649 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1650 }
1651 #[inline]
1652 pub fn set_mIsSecurityProcessed(&mut self, val: bool) {
1653 unsafe {
1654 let val: u8 = ::std::mem::transmute(val);
1655 self._bitfield_1.set(4usize, 1u8, val as u64)
1656 }
1657 }
1658 #[inline]
1659 pub unsafe fn mIsSecurityProcessed_raw(this: *const Self) -> bool {
1660 unsafe {
1661 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1662 ::std::ptr::addr_of!((*this)._bitfield_1),
1663 4usize,
1664 1u8,
1665 ) as u8)
1666 }
1667 }
1668 #[inline]
1669 pub unsafe fn set_mIsSecurityProcessed_raw(this: *mut Self, val: bool) {
1670 unsafe {
1671 let val: u8 = ::std::mem::transmute(val);
1672 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1673 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1674 4usize,
1675 1u8,
1676 val as u64,
1677 )
1678 }
1679 }
1680 #[inline]
1681 pub fn new_bitfield_1(
1682 mIsHeaderUpdated: bool,
1683 mIsARetx: bool,
1684 mCsmaCaEnabled: bool,
1685 mCslPresent: bool,
1686 mIsSecurityProcessed: bool,
1687 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1688 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1689 __bindgen_bitfield_unit.set(0usize, 1u8, {
1690 let mIsHeaderUpdated: u8 = unsafe { ::std::mem::transmute(mIsHeaderUpdated) };
1691 mIsHeaderUpdated as u64
1692 });
1693 __bindgen_bitfield_unit.set(1usize, 1u8, {
1694 let mIsARetx: u8 = unsafe { ::std::mem::transmute(mIsARetx) };
1695 mIsARetx as u64
1696 });
1697 __bindgen_bitfield_unit.set(2usize, 1u8, {
1698 let mCsmaCaEnabled: u8 = unsafe { ::std::mem::transmute(mCsmaCaEnabled) };
1699 mCsmaCaEnabled as u64
1700 });
1701 __bindgen_bitfield_unit.set(3usize, 1u8, {
1702 let mCslPresent: u8 = unsafe { ::std::mem::transmute(mCslPresent) };
1703 mCslPresent as u64
1704 });
1705 __bindgen_bitfield_unit.set(4usize, 1u8, {
1706 let mIsSecurityProcessed: u8 = unsafe { ::std::mem::transmute(mIsSecurityProcessed) };
1707 mIsSecurityProcessed as u64
1708 });
1709 __bindgen_bitfield_unit
1710 }
1711}
1712#[doc = " Structure representing radio frame receive information."]
1713#[repr(C)]
1714#[derive(Debug, Default, Copy, Clone)]
1715pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1716 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna."]
1717 pub mTimestamp: otRadioTime64,
1718 #[doc = "< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set)."]
1719 pub mAckFrameCounter: u32,
1720 #[doc = "< ACK security key index (applicable when `mAckedWithSecEnhAck` is set)."]
1721 pub mAckKeyId: u8,
1722 #[doc = "< Received signal strength indicator in dBm for received frames."]
1723 pub mRssi: i8,
1724 #[doc = "< Link Quality Indicator for received frames."]
1725 pub mLqi: u8,
1726 pub _bitfield_align_1: [u8; 0],
1727 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1728}
1729impl otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1730 #[inline]
1731 pub fn mAckedWithFramePending(&self) -> bool {
1732 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1733 }
1734 #[inline]
1735 pub fn set_mAckedWithFramePending(&mut self, val: bool) {
1736 unsafe {
1737 let val: u8 = ::std::mem::transmute(val);
1738 self._bitfield_1.set(0usize, 1u8, val as u64)
1739 }
1740 }
1741 #[inline]
1742 pub unsafe fn mAckedWithFramePending_raw(this: *const Self) -> bool {
1743 unsafe {
1744 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1745 ::std::ptr::addr_of!((*this)._bitfield_1),
1746 0usize,
1747 1u8,
1748 ) as u8)
1749 }
1750 }
1751 #[inline]
1752 pub unsafe fn set_mAckedWithFramePending_raw(this: *mut Self, val: bool) {
1753 unsafe {
1754 let val: u8 = ::std::mem::transmute(val);
1755 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1756 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1757 0usize,
1758 1u8,
1759 val as u64,
1760 )
1761 }
1762 }
1763 #[inline]
1764 pub fn mAckedWithSecEnhAck(&self) -> bool {
1765 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1766 }
1767 #[inline]
1768 pub fn set_mAckedWithSecEnhAck(&mut self, val: bool) {
1769 unsafe {
1770 let val: u8 = ::std::mem::transmute(val);
1771 self._bitfield_1.set(1usize, 1u8, val as u64)
1772 }
1773 }
1774 #[inline]
1775 pub unsafe fn mAckedWithSecEnhAck_raw(this: *const Self) -> bool {
1776 unsafe {
1777 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1778 ::std::ptr::addr_of!((*this)._bitfield_1),
1779 1usize,
1780 1u8,
1781 ) as u8)
1782 }
1783 }
1784 #[inline]
1785 pub unsafe fn set_mAckedWithSecEnhAck_raw(this: *mut Self, val: bool) {
1786 unsafe {
1787 let val: u8 = ::std::mem::transmute(val);
1788 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1789 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1790 1usize,
1791 1u8,
1792 val as u64,
1793 )
1794 }
1795 }
1796 #[inline]
1797 pub fn new_bitfield_1(
1798 mAckedWithFramePending: bool,
1799 mAckedWithSecEnhAck: bool,
1800 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1801 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1802 __bindgen_bitfield_unit.set(0usize, 1u8, {
1803 let mAckedWithFramePending: u8 =
1804 unsafe { ::std::mem::transmute(mAckedWithFramePending) };
1805 mAckedWithFramePending as u64
1806 });
1807 __bindgen_bitfield_unit.set(1usize, 1u8, {
1808 let mAckedWithSecEnhAck: u8 = unsafe { ::std::mem::transmute(mAckedWithSecEnhAck) };
1809 mAckedWithSecEnhAck as u64
1810 });
1811 __bindgen_bitfield_unit
1812 }
1813}
1814impl Default for otRadioFrame__bindgen_ty_1 {
1815 fn default() -> Self {
1816 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1817 unsafe {
1818 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1819 s.assume_init()
1820 }
1821 }
1822}
1823impl Default for otRadioFrame {
1824 fn default() -> Self {
1825 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1826 unsafe {
1827 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1828 s.assume_init()
1829 }
1830 }
1831}
1832pub const OT_RADIO_STATE_DISABLED: otRadioState = 0;
1833pub const OT_RADIO_STATE_SLEEP: otRadioState = 1;
1834pub const OT_RADIO_STATE_RECEIVE: otRadioState = 2;
1835pub const OT_RADIO_STATE_TRANSMIT: otRadioState = 3;
1836pub const OT_RADIO_STATE_INVALID: otRadioState = 255;
1837#[doc = " Represents the state of a radio.\n Initially, a radio is in the Disabled state."]
1838pub type otRadioState = ::std::os::raw::c_uint;
1839#[doc = " Represents radio coexistence metrics."]
1840#[repr(C)]
1841#[derive(Debug, Default, Copy, Clone)]
1842pub struct otRadioCoexMetrics {
1843 #[doc = "< Number of grant glitches."]
1844 pub mNumGrantGlitch: u32,
1845 #[doc = "< Number of tx requests."]
1846 pub mNumTxRequest: u32,
1847 #[doc = "< Number of tx requests while grant was active."]
1848 pub mNumTxGrantImmediate: u32,
1849 #[doc = "< Number of tx requests while grant was inactive."]
1850 pub mNumTxGrantWait: u32,
1851 #[doc = "< Number of tx requests while grant was inactive that were ultimately granted."]
1852 pub mNumTxGrantWaitActivated: u32,
1853 #[doc = "< Number of tx requests while grant was inactive that timed out."]
1854 pub mNumTxGrantWaitTimeout: u32,
1855 #[doc = "< Number of tx that were in progress when grant was deactivated."]
1856 pub mNumTxGrantDeactivatedDuringRequest: u32,
1857 #[doc = "< Number of tx requests that were not granted within 50us."]
1858 pub mNumTxDelayedGrant: u32,
1859 #[doc = "< Average time in usec from tx request to grant."]
1860 pub mAvgTxRequestToGrantTime: u32,
1861 #[doc = "< Number of rx requests."]
1862 pub mNumRxRequest: u32,
1863 #[doc = "< Number of rx requests while grant was active."]
1864 pub mNumRxGrantImmediate: u32,
1865 #[doc = "< Number of rx requests while grant was inactive."]
1866 pub mNumRxGrantWait: u32,
1867 #[doc = "< Number of rx requests while grant was inactive that were ultimately granted."]
1868 pub mNumRxGrantWaitActivated: u32,
1869 #[doc = "< Number of rx requests while grant was inactive that timed out."]
1870 pub mNumRxGrantWaitTimeout: u32,
1871 #[doc = "< Number of rx that were in progress when grant was deactivated."]
1872 pub mNumRxGrantDeactivatedDuringRequest: u32,
1873 #[doc = "< Number of rx requests that were not granted within 50us."]
1874 pub mNumRxDelayedGrant: u32,
1875 #[doc = "< Average time in usec from rx request to grant."]
1876 pub mAvgRxRequestToGrantTime: u32,
1877 #[doc = "< Number of rx requests that completed without receiving grant."]
1878 pub mNumRxGrantNone: u32,
1879 #[doc = "< Stats collection stopped due to saturation."]
1880 pub mStopped: bool,
1881}
1882#[doc = " Represents what metrics are specified to query."]
1883#[repr(C)]
1884#[derive(Debug, Default, Copy, Clone)]
1885pub struct otLinkMetrics {
1886 pub _bitfield_align_1: [u8; 0],
1887 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1888}
1889impl otLinkMetrics {
1890 #[inline]
1891 pub fn mPduCount(&self) -> bool {
1892 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1893 }
1894 #[inline]
1895 pub fn set_mPduCount(&mut self, val: bool) {
1896 unsafe {
1897 let val: u8 = ::std::mem::transmute(val);
1898 self._bitfield_1.set(0usize, 1u8, val as u64)
1899 }
1900 }
1901 #[inline]
1902 pub unsafe fn mPduCount_raw(this: *const Self) -> bool {
1903 unsafe {
1904 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1905 ::std::ptr::addr_of!((*this)._bitfield_1),
1906 0usize,
1907 1u8,
1908 ) as u8)
1909 }
1910 }
1911 #[inline]
1912 pub unsafe fn set_mPduCount_raw(this: *mut Self, val: bool) {
1913 unsafe {
1914 let val: u8 = ::std::mem::transmute(val);
1915 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1916 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1917 0usize,
1918 1u8,
1919 val as u64,
1920 )
1921 }
1922 }
1923 #[inline]
1924 pub fn mLqi(&self) -> bool {
1925 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1926 }
1927 #[inline]
1928 pub fn set_mLqi(&mut self, val: bool) {
1929 unsafe {
1930 let val: u8 = ::std::mem::transmute(val);
1931 self._bitfield_1.set(1usize, 1u8, val as u64)
1932 }
1933 }
1934 #[inline]
1935 pub unsafe fn mLqi_raw(this: *const Self) -> bool {
1936 unsafe {
1937 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1938 ::std::ptr::addr_of!((*this)._bitfield_1),
1939 1usize,
1940 1u8,
1941 ) as u8)
1942 }
1943 }
1944 #[inline]
1945 pub unsafe fn set_mLqi_raw(this: *mut Self, val: bool) {
1946 unsafe {
1947 let val: u8 = ::std::mem::transmute(val);
1948 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1949 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1950 1usize,
1951 1u8,
1952 val as u64,
1953 )
1954 }
1955 }
1956 #[inline]
1957 pub fn mLinkMargin(&self) -> bool {
1958 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1959 }
1960 #[inline]
1961 pub fn set_mLinkMargin(&mut self, val: bool) {
1962 unsafe {
1963 let val: u8 = ::std::mem::transmute(val);
1964 self._bitfield_1.set(2usize, 1u8, val as u64)
1965 }
1966 }
1967 #[inline]
1968 pub unsafe fn mLinkMargin_raw(this: *const Self) -> bool {
1969 unsafe {
1970 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1971 ::std::ptr::addr_of!((*this)._bitfield_1),
1972 2usize,
1973 1u8,
1974 ) as u8)
1975 }
1976 }
1977 #[inline]
1978 pub unsafe fn set_mLinkMargin_raw(this: *mut Self, val: bool) {
1979 unsafe {
1980 let val: u8 = ::std::mem::transmute(val);
1981 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1982 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1983 2usize,
1984 1u8,
1985 val as u64,
1986 )
1987 }
1988 }
1989 #[inline]
1990 pub fn mRssi(&self) -> bool {
1991 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1992 }
1993 #[inline]
1994 pub fn set_mRssi(&mut self, val: bool) {
1995 unsafe {
1996 let val: u8 = ::std::mem::transmute(val);
1997 self._bitfield_1.set(3usize, 1u8, val as u64)
1998 }
1999 }
2000 #[inline]
2001 pub unsafe fn mRssi_raw(this: *const Self) -> bool {
2002 unsafe {
2003 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2004 ::std::ptr::addr_of!((*this)._bitfield_1),
2005 3usize,
2006 1u8,
2007 ) as u8)
2008 }
2009 }
2010 #[inline]
2011 pub unsafe fn set_mRssi_raw(this: *mut Self, val: bool) {
2012 unsafe {
2013 let val: u8 = ::std::mem::transmute(val);
2014 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2015 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2016 3usize,
2017 1u8,
2018 val as u64,
2019 )
2020 }
2021 }
2022 #[inline]
2023 pub fn mReserved(&self) -> bool {
2024 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
2025 }
2026 #[inline]
2027 pub fn set_mReserved(&mut self, val: bool) {
2028 unsafe {
2029 let val: u8 = ::std::mem::transmute(val);
2030 self._bitfield_1.set(4usize, 1u8, val as u64)
2031 }
2032 }
2033 #[inline]
2034 pub unsafe fn mReserved_raw(this: *const Self) -> bool {
2035 unsafe {
2036 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2037 ::std::ptr::addr_of!((*this)._bitfield_1),
2038 4usize,
2039 1u8,
2040 ) as u8)
2041 }
2042 }
2043 #[inline]
2044 pub unsafe fn set_mReserved_raw(this: *mut Self, val: bool) {
2045 unsafe {
2046 let val: u8 = ::std::mem::transmute(val);
2047 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2048 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2049 4usize,
2050 1u8,
2051 val as u64,
2052 )
2053 }
2054 }
2055 #[inline]
2056 pub fn new_bitfield_1(
2057 mPduCount: bool,
2058 mLqi: bool,
2059 mLinkMargin: bool,
2060 mRssi: bool,
2061 mReserved: bool,
2062 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2063 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2064 __bindgen_bitfield_unit.set(0usize, 1u8, {
2065 let mPduCount: u8 = unsafe { ::std::mem::transmute(mPduCount) };
2066 mPduCount as u64
2067 });
2068 __bindgen_bitfield_unit.set(1usize, 1u8, {
2069 let mLqi: u8 = unsafe { ::std::mem::transmute(mLqi) };
2070 mLqi as u64
2071 });
2072 __bindgen_bitfield_unit.set(2usize, 1u8, {
2073 let mLinkMargin: u8 = unsafe { ::std::mem::transmute(mLinkMargin) };
2074 mLinkMargin as u64
2075 });
2076 __bindgen_bitfield_unit.set(3usize, 1u8, {
2077 let mRssi: u8 = unsafe { ::std::mem::transmute(mRssi) };
2078 mRssi as u64
2079 });
2080 __bindgen_bitfield_unit.set(4usize, 1u8, {
2081 let mReserved: u8 = unsafe { ::std::mem::transmute(mReserved) };
2082 mReserved as u64
2083 });
2084 __bindgen_bitfield_unit
2085 }
2086}
2087unsafe extern "C" {
2088 #[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)."]
2089 pub fn otPlatRadioGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
2090}
2091unsafe extern "C" {
2092 #[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."]
2093 pub fn otPlatRadioGetVersionString(aInstance: *mut otInstance)
2094 -> *const ::std::os::raw::c_char;
2095}
2096unsafe extern "C" {
2097 #[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."]
2098 pub fn otPlatRadioGetReceiveSensitivity(aInstance: *mut otInstance) -> i8;
2099}
2100unsafe extern "C" {
2101 #[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."]
2102 pub fn otPlatRadioGetIeeeEui64(aInstance: *mut otInstance, aIeeeEui64: *mut u8);
2103}
2104unsafe extern "C" {
2105 #[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."]
2106 pub fn otPlatRadioSetPanId(aInstance: *mut otInstance, aPanId: otPanId);
2107}
2108unsafe extern "C" {
2109 #[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."]
2110 pub fn otPlatRadioSetExtendedAddress(
2111 aInstance: *mut otInstance,
2112 aExtAddress: *const otExtAddress,
2113 );
2114}
2115unsafe extern "C" {
2116 #[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."]
2117 pub fn otPlatRadioSetShortAddress(aInstance: *mut otInstance, aShortAddress: otShortAddress);
2118}
2119unsafe extern "C" {
2120 #[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."]
2121 pub fn otPlatRadioSetAlternateShortAddress(
2122 aInstance: *mut otInstance,
2123 aShortAddress: otShortAddress,
2124 );
2125}
2126unsafe extern "C" {
2127 #[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."]
2128 pub fn otPlatRadioGetTransmitPower(aInstance: *mut otInstance, aPower: *mut i8) -> otError;
2129}
2130unsafe extern "C" {
2131 #[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."]
2132 pub fn otPlatRadioSetTransmitPower(aInstance: *mut otInstance, aPower: i8) -> otError;
2133}
2134unsafe extern "C" {
2135 #[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."]
2136 pub fn otPlatRadioGetCcaEnergyDetectThreshold(
2137 aInstance: *mut otInstance,
2138 aThreshold: *mut i8,
2139 ) -> otError;
2140}
2141unsafe extern "C" {
2142 #[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."]
2143 pub fn otPlatRadioSetCcaEnergyDetectThreshold(
2144 aInstance: *mut otInstance,
2145 aThreshold: i8,
2146 ) -> otError;
2147}
2148unsafe extern "C" {
2149 #[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."]
2150 pub fn otPlatRadioGetFemLnaGain(aInstance: *mut otInstance, aGain: *mut i8) -> otError;
2151}
2152unsafe extern "C" {
2153 #[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."]
2154 pub fn otPlatRadioSetFemLnaGain(aInstance: *mut otInstance, aGain: i8) -> otError;
2155}
2156unsafe extern "C" {
2157 #[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."]
2158 pub fn otPlatRadioGetPromiscuous(aInstance: *mut otInstance) -> bool;
2159}
2160unsafe extern "C" {
2161 #[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."]
2162 pub fn otPlatRadioSetPromiscuous(aInstance: *mut otInstance, aEnable: bool);
2163}
2164unsafe extern "C" {
2165 #[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."]
2166 pub fn otPlatRadioSetRxOnWhenIdle(aInstance: *mut otInstance, aEnable: bool);
2167}
2168unsafe extern "C" {
2169 #[doc = " Update MAC keys and key index.\n\n Is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability.\n\n Radio platform implementations MUST ignore the @p aKeyIdMode parameter entirely and treat the keys configured via\n this API as Key ID Mode 1 (standard Thread security).\n\n This API was originally introduced with the @p aKeyIdMode parameter for potential future extensions, and it is\n retained in the function signature for backward compatibility. However, in practice, platform transmit security\n is only intended and used for Key ID Mode 1. Attempting to support or interpret other Key ID modes in the radio\n platform introduces complexity and ambiguity regarding how @p aKeyIdMode values are represented (e.g.,\n bit-shifted as it appears in the IEEE 802.15.4 Security Control field vs. simple sequential mode values 0, 1, 2).\n\n A call to this API replaces any previously set MAC keys.\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 (must be ignored by the radio platform).\n @param[in] aKeyIndex 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."]
2170 pub fn otPlatRadioSetMacKey(
2171 aInstance: *mut otInstance,
2172 aKeyIdMode: u8,
2173 aKeyIndex: u8,
2174 aPrevKey: *const otMacKeyMaterial,
2175 aCurrKey: *const otMacKeyMaterial,
2176 aNextKey: *const otMacKeyMaterial,
2177 aKeyType: otRadioKeyType,
2178 );
2179}
2180unsafe extern "C" {
2181 #[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."]
2182 pub fn otPlatRadioSetMacFrameCounter(aInstance: *mut otInstance, aMacFrameCounter: u32);
2183}
2184unsafe extern "C" {
2185 #[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."]
2186 pub fn otPlatRadioSetMacFrameCounterIfLarger(aInstance: *mut otInstance, aMacFrameCounter: u32);
2187}
2188unsafe extern "C" {
2189 #[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."]
2190 pub fn otPlatRadioGetNow(aInstance: *mut otInstance) -> otRadioTime64;
2191}
2192unsafe extern "C" {
2193 #[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."]
2194 pub fn otPlatRadioGetBusSpeed(aInstance: *mut otInstance) -> u32;
2195}
2196unsafe extern "C" {
2197 #[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."]
2198 pub fn otPlatRadioGetBusLatency(aInstance: *mut otInstance) -> u32;
2199}
2200unsafe extern "C" {
2201 #[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."]
2202 pub fn otPlatRadioGetState(aInstance: *mut otInstance) -> otRadioState;
2203}
2204unsafe extern "C" {
2205 #[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."]
2206 pub fn otPlatRadioEnable(aInstance: *mut otInstance) -> otError;
2207}
2208unsafe extern "C" {
2209 #[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."]
2210 pub fn otPlatRadioDisable(aInstance: *mut otInstance) -> otError;
2211}
2212unsafe extern "C" {
2213 #[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."]
2214 pub fn otPlatRadioIsEnabled(aInstance: *mut otInstance) -> bool;
2215}
2216unsafe extern "C" {
2217 #[doc = " Transition the radio to the Sleep state (turn off the radio).\n\n If the radio is already in the Sleep state, this function MUST return `OT_ERROR_NONE` with no effect.\n\n If `otPlatRadioSleep()` is called while the radio is in the middle of receiving a frame or transmitting an ACK\n (e.g., during AIFS/turnaround wait or actively transmitting the ACK frame), the radio MUST complete the ongoing\n operation (finish frame reception and/or ACK transmission) and transition to Sleep immediately thereafter. In this\n scenario:\n - The radio MUST return `OT_ERROR_NONE` to indicate that the sleep request has been accepted and scheduled.\n - Upon finishing the frame reception (and any associated ACK transmission), the radio driver MUST invoke\n `otPlatRadioReceiveDone()` to deliver the received frame (or report reception error) before transitioning\n to Sleep.\n\n If any subsequent radio state transition function (e.g., `otPlatRadioReceive()` or `otPlatRadioTransmit()`) is\n called while a scheduled transition to Sleep is pending, the pending Sleep transition MUST be canceled/superseded,\n and the radio MUST transition to the newly requested state upon completing the ongoing reception and/or ACK\n transmission.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully transitioned to Sleep, radio is already in Sleep, or transition is\n accepted and scheduled.\n @retval OT_ERROR_BUSY The radio was transmitting a frame (initiated by `otPlatRadioTransmit()`).\n @retval OT_ERROR_INVALID_STATE The radio was disabled."]
2218 pub fn otPlatRadioSleep(aInstance: *mut otInstance) -> otError;
2219}
2220unsafe extern "C" {
2221 #[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."]
2222 pub fn otPlatRadioReceive(aInstance: *mut otInstance, aChannel: u8) -> otError;
2223}
2224unsafe extern "C" {
2225 #[doc = " Schedules a radio reception window at a specific time and duration.\n\n This function is an optional platform API used to schedule a future reception window on a specific channel for\n features such as Coordinated Sampled Listening (CSL) or Thread Direct.\n\n OpenThread supports two approaches for timed reception:\n\n - Software-driven (default and recommended):\n OpenThread's `SubMac` layer manages all timed RX internally using software timers and standard\n `otPlatRadioReceive()` and `otPlatRadioSleep()` calls. In this mode, the radio platform does NOT need to implement\n `otPlatRadioReceiveAt()`, and MUST omit the `OT_RADIO_CAPS_RECEIVE_TIMING` capability from `otPlatRadioGetCaps()`.\n\n - Platform-offloaded (optional):\n The radio platform explicitly declares `OT_RADIO_CAPS_RECEIVE_TIMING` via `otPlatRadioGetCaps()` and implements\n `otPlatRadioReceiveAt()` to handle window timing directly in the platform layer or hardware.\n\n Because OpenThread's built-in `SubMac` software implementation is comprehensive, robust, and fully tested, it is\n strongly recommended that radio platform implementers rely on the default software-driven mode and do NOT implement\n `otPlatRadioReceiveAt()`, unless there is a clear justification for offloading timed reception to the radio platform.\n\n If the radio platform implements this function, the following rules and behaviors are expected:\n\n If this function is called while the radio is disabled (`OT_RADIO_STATE_DISABLED`), the radio platform MUST return\n `OT_ERROR_INVALID_STATE`.\n\n When the radio is enabled, this function can be called from any radio state (`OT_RADIO_STATE_SLEEP`,\n `OT_RADIO_STATE_RECEIVE`, or `OT_RADIO_STATE_TRANSMIT`). The radio platform driver MUST handle the scheduling\n internally: calling this function merely registers a (future) time window for the radio to sample/receive and MUST\n NOT immediately force the radio into Receive mode at the time of the call (unless the window is already active).\n\n The radio platform MUST execute the scheduled reception as follows:\n\n - Operational Precedence and Radio Sleep:\n - Timed reception scheduled by this function is only applicable when the radio is in the Sleep state (whether\n the radio is put to sleep explicitly via `otPlatRadioSleep()` or manages sleep state automatically on its own).\n - Any active radio operation, such as transmission (`otPlatRadioTransmit()` or an active scheduled transmission\n from `otPlatRadioScheduleTx()`) or continuous reception (`otPlatRadioReceive()`), takes precedence over timed\n reception.\n\n - Starting the Reception Window:\n - At the scheduled start time @p aStart, the radio receiver MUST enter Receive mode on channel @p aChannel,\n provided the radio is not busy with another operation. This MUST behave the same as if `otPlatRadioReceive()`\n were called at that time.\n - The OpenThread stack already accounts for and includes any necessary radio ramp-up and receiver settling time\n when computing @p aStart. Therefore, the radio platform driver does not need to adjust @p aStart or schedule\n ramp-up ahead of time.\n\n - Ending the Reception Window:\n - At the end of the duration (@p aStart + @p aDuration), the radio MUST automatically transition back to\n Sleep unless it is actively receiving a frame.\n - If frame reception has started (e.g., SHR detected) before the duration expires, the radio receiver\n MUST remain on until the frame reception completes (either successfully or with an error) and any\n subsequent acknowledgment transmission is finished, after which the radio transitions to Sleep.\n\n - Subsequent Schedules and Overlapping Windows:\n - If the start time of a previously scheduled reception window has not yet arrived, a subsequent call to\n `otPlatRadioReceiveAt()` MUST cancel and replace the previous schedule.\n - If a previous reception window has already started and is currently active:\n - A subsequent call to `otPlatRadioReceiveAt()` with a future start time MUST NOT abort or interrupt the\n ongoing reception. The new window is scheduled to start at its specified time.\n - At the start time of the new window (or immediately if its start time has already arrived), the radio\n MUST honor the new window:\n - Channel: If the new window specifies the same channel, reception SHOULD continue seamlessly without\n toggling the receiver state off and on. If the new window specifies a different channel, the radio\n MUST switch to the new channel. However, if the radio has started receiving a frame on the previous\n channel (e.g., SHR detected) or is transmitting an acknowledgment, it MUST complete the frame reception\n and any acknowledgment transmission before switching to the new channel (or transitioning to Sleep\n if the new window has already expired).\n - End time: The reception window MUST end according to the new window (@p aStart + @p aDuration). The\n new window always dictates when reception ends, replacing any previous end time. Note that this\n behavior is common and often used to shrink an ongoing sample window.\n - If a new window starts immediately upon the end of the previous window (back-to-back), the transition\n SHOULD occur seamlessly without cycling the radio through Sleep.\n\n - Interactions with Sleep and Other Operations:\n - If the radio is busy executing another operation (such as transmission or continuous reception) when the\n scheduled window starts or while it is active, that operation takes precedence. Once that operation completes\n and the radio returns to Sleep, if the scheduled window is still ongoing (before @p aStart + @p aDuration),\n the radio SHOULD start or resume the scheduled timed reception by entering Receive mode on @p aChannel for the\n remaining duration of the window.\n - Calls to `otPlatRadioSleep()` MUST NOT cancel a scheduled reception window, nor abort an ongoing active timed\n reception window. If the radio is already in the Sleep state and performing an active scheduled timed reception,\n subsequent calls to `otPlatRadioSleep()` MUST NOT interrupt or alter its operation.\n - Calls to `otPlatRadioDisable()` MUST immediately abort and cancel any pending (scheduled) or ongoing active\n timed reception window.\n\n @note While `otPlatRadioGetNow()` returns a 64-bit timestamp (`otRadioTime64`), @p aStart is a 32-bit value\n (`otRadioTime32`) representing the lower 32 bits of the radio clock. Radio platform drivers MUST account for\n 32-bit roll-over when scheduling and evaluating reception window timing (e.g., determining whether @p aStart has\n arrived or @p aStart + @p aDuration has elapsed).\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aChannel The radio channel on which to receive.\n @param[in] aStart The receive window start time relative to the local radio clock (see `otPlatRadioGetNow()`),\n representing the lower 32 bits of the radio clock.\n @param[in] aDuration The receive window duration in microseconds.\n\n @retval OT_ERROR_NONE Successfully scheduled receive window.\n @retval OT_ERROR_FAILED The receive window could not be scheduled.\n @retval OT_ERROR_INVALID_STATE The radio is disabled.\n @retval OT_ERROR_INVALID_ARGS Invalid arguments provided (e.g., invalid channel)."]
2226 pub fn otPlatRadioReceiveAt(
2227 aInstance: *mut otInstance,
2228 aChannel: u8,
2229 aStart: otRadioTime32,
2230 aDuration: u32,
2231 ) -> otError;
2232}
2233unsafe extern "C" {
2234 #[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."]
2235 pub fn otPlatRadioReceiveDone(
2236 aInstance: *mut otInstance,
2237 aFrame: *mut otRadioFrame,
2238 aError: otError,
2239 );
2240}
2241unsafe extern "C" {
2242 #[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."]
2243 pub fn otPlatDiagRadioReceiveDone(
2244 aInstance: *mut otInstance,
2245 aFrame: *mut otRadioFrame,
2246 aError: otError,
2247 );
2248}
2249unsafe extern "C" {
2250 #[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."]
2251 pub fn otPlatRadioGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
2252}
2253unsafe extern "C" {
2254 #[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."]
2255 pub fn otPlatRadioTransmit(aInstance: *mut otInstance, aFrame: *mut otRadioFrame) -> otError;
2256}
2257unsafe extern "C" {
2258 #[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."]
2259 pub fn otPlatRadioTxStarted(aInstance: *mut otInstance, aFrame: *mut otRadioFrame);
2260}
2261unsafe extern "C" {
2262 #[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."]
2263 pub fn otPlatRadioTxDone(
2264 aInstance: *mut otInstance,
2265 aFrame: *mut otRadioFrame,
2266 aAckFrame: *mut otRadioFrame,
2267 aError: otError,
2268 );
2269}
2270unsafe extern "C" {
2271 #[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."]
2272 pub fn otPlatDiagRadioTransmitDone(
2273 aInstance: *mut otInstance,
2274 aFrame: *mut otRadioFrame,
2275 aError: otError,
2276 );
2277}
2278unsafe extern "C" {
2279 #[doc = " Get the radio transmit frame buffer dedicated for scheduled transmissions (`otPlatRadioScheduleTx()`).\n\n This API requires the radio platform to support the `OT_RADIO_CAPS_SCHEDULED_TX` capability.\n\n Similar to how `otPlatRadioGetTransmitBuffer()` provides the `otRadioFrame` buffer used for regular transmissions via\n `otPlatRadioTransmit()`, this function provides a separate, single `otRadioFrame` buffer used exclusively for\n scheduled transmissions via `otPlatRadioScheduleTx()`. Having a dedicated frame buffer allows the OpenThread stack\n to prepare and schedule a future timed transmission independently of ongoing or regular transmissions via\n `otPlatRadioTransmit()`.\n\n Frame buffer ownership and lifecycle:\n - The OpenThread stack forms the IEEE 802.15.4 frame in this buffer and then calls `otPlatRadioScheduleTx()` to\n schedule its transmission.\n - Upon a successful call to `otPlatRadioScheduleTx()` (returning `OT_ERROR_NONE`), the radio platform takes\n ownership of this frame buffer. The OpenThread stack guarantees that it will not modify or access the frame\n buffer or its PSDU content while it is owned by the radio platform.\n - Ownership of the frame buffer is released back to the OpenThread stack when:\n 1. The radio platform invokes the `otPlatRadioScheduledTxDone()` callback,\n 2. A call to `otPlatRadioCancelScheduledTx()` succeeds (returning `OT_ERROR_NONE`), or\n 3. The radio is disabled via `otPlatRadioDisable()`.\n - Once ownership is released back to OpenThread, the stack may immediately modify the buffer to prepare and\n schedule a new transmission (including directly from within the `otPlatRadioScheduledTxDone()` callback).\n - The returned `otRadioFrame` pointer (and its `mPsdu` buffer of at least `OT_RADIO_FRAME_MAX_SIZE` bytes) MUST\n remain valid and constant for the lifetime of @p aInstance (including before `otPlatRadioEnable()` is called).\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns A pointer to the scheduled transmit frame buffer."]
2280 pub fn otPlatRadioGetScheduledTxFrame(aInstance: *mut otInstance) -> *mut otRadioFrame;
2281}
2282unsafe extern "C" {
2283 #[doc = " Schedule a radio frame transmission at a specific target time.\n\n This API requires the radio platform to support the `OT_RADIO_CAPS_SCHEDULED_TX` capability. Its primary purpose is\n to support Thread Direct, though it may also be used for other time-sensitive transmission use cases in the future.\n\n The caller forms the IEEE 802.15.4 frame in the buffer provided by `otPlatRadioGetScheduledTxFrame()` before calling\n this function to schedule the transmission at @p aTxTime.\n\n The radio platform MUST execute the scheduled transmission according to the following rules:\n\n - Target Transmission Time and Strict On-Time Requirement:\n - The radio platform MUST transmit the requested frame at the exact specified time @p aTxTime.\n - @p aTxTime is an `otRadioTime64` value in microseconds relative to the local radio clock (see\n `otPlatRadioGetNow()`).\n - @p aTxTime SHALL point to the exact point in time when the end of the Start of Frame Delimiter (SFD) will be\n present at the local antenna. The radio platform driver MUST account for any necessary radio ramp-up, channel\n switching, Clear Channel Assessment (CCA, if enabled), and SHR (preamble and SFD) transmission durations so that\n the end of the SFD aligns with @p aTxTime.\n - Strict on-time execution (no early or late transmission): It is critical that the frame is transmitted at\n @p aTxTime. If at the target transmission time the radio driver determines that it cannot transmit the frame at\n @p aTxTime (for example, due to Coex denial or hardware unavailability), it MUST NOT transmit the frame earlier\n or later. Instead, it MUST abort the transmission and invoke `otPlatRadioScheduledTxDone()` with\n `OT_ERROR_ABORT` to indicate that the frame was not sent.\n - Past or missed @p aTxTime at schedule time: The OpenThread stack calls `otPlatRadioScheduleTx()` as early as\n possible (as soon as it knows a scheduled transmission is needed), providing the radio platform with ample lead\n time ahead of @p aTxTime (for example, to account for radio ramp-up, Coex requests, etc.).\n However, @p aTxTime may still occasionally be in the past or too close to the current radio time\n `otPlatRadioGetNow()` (for example, if a frame is queued very close to the target slot, or if a blocking\n operation such as a flash re-write stalls execution). In this case, the radio platform MUST NOT transmit the\n frame. `otPlatRadioScheduleTx()` MUST still return `OT_ERROR_NONE` and asynchronously report the failure by\n invoking `otPlatRadioScheduledTxDone()` with `OT_ERROR_ABORT`. The radio platform MUST NOT invoke\n `otPlatRadioScheduledTxDone()` synchronously from within `otPlatRadioScheduleTx()`. If\n `otPlatRadioCancelScheduledTx()` is called before this deferred `OT_ERROR_ABORT` callback is invoked, the radio\n platform MAY either cancel the pending callback and return `OT_ERROR_NONE`, or return `OT_ERROR_BUSY` and\n proceed with invoking the `otPlatRadioScheduledTxDone()` callback.\n\n - Operational Precedence, Preemption, and State Restoration:\n - A scheduled transmission SHOULD be prioritized over other radio operations when @p aTxTime arrives:\n - Ongoing Receive or Acknowledgment TX: If the radio is in Receive mode and is in the middle of receiving a\n frame (e.g., after SHR detection) or transmitting an acknowledgment for a received frame when the radio needs\n to prepare/transmit for @p aTxTime, the scheduled transmission SHOULD take precedence—the active reception or\n acknowledgment transmission SHOULD be stopped/aborted so that the scheduled transmission goes out on time at\n @p aTxTime. When an ongoing reception or acknowledgment transmission is aborted, the radio platform MAY either\n invoke `otPlatRadioReceiveDone()` with `OT_ERROR_ABORT` or not invoke `otPlatRadioReceiveDone()` at all (if the\n radio platform still delivers a received frame whose acknowledgment transmission was aborted via\n `otPlatRadioReceiveDone()` with `OT_ERROR_NONE`, `mAckedWithFramePending` and `mAckedWithSecEnhAck` MUST be set\n to `false`).\n - Concurrent `otPlatRadioTransmit()`: If the radio is instructed to transmit a frame via `otPlatRadioTransmit()`\n close to or overlapping with a previously scheduled transmission, the scheduled transmission SHOULD take\n precedence and be performed at @p aTxTime. For the conflicting `otPlatRadioTransmit()` operation, the radio\n platform MAY either:\n - Abort the `otPlatRadioTransmit()` operation and invoke `otPlatRadioTxDone()` with `OT_ERROR_ABORT` (so the\n OpenThread stack does not remain blocked waiting for `otPlatRadioTxDone()` and can handle any retries), or\n - Defer the `otPlatRadioTransmit()` operation until after the scheduled transmission completes, provided that\n the `otPlatRadioTransmit()` has not yet started on the air (`otPlatRadioTxStarted()` has not been invoked)\n and is not a timed transmission (`mTxDelay != 0`) whose target time would be missed. If the\n `otPlatRadioTransmit()` has already started on the air or is a timed transmission whose target time would be\n missed, it MUST be aborted via `otPlatRadioTxDone()` with `OT_ERROR_ABORT`.\n - Radio State and Post-Transmission Restoration:\n - If this function is called while the radio is disabled (`OT_RADIO_STATE_DISABLED`), it MUST return\n `OT_ERROR_INVALID_STATE`. Calling `otPlatRadioDisable()` while a scheduled TX is pending or active MUST\n immediately abort and cancel it without invoking `otPlatRadioScheduledTxDone()` (and MUST NOT fail with\n `OT_ERROR_INVALID_STATE` due to the active scheduled TX when the underlying state is `Sleep`).\n - When the radio is enabled, `otPlatRadioScheduleTx()` can be called from any radio state (`Sleep`, `Receive`,\n or `Transmit`). Conversely, subsequent calls to `otPlatRadioSleep()`, `otPlatRadioReceive()`,\n `otPlatRadioReceiveAt()`, or `otPlatRadioTransmit()` while a scheduled TX is pending MUST NOT cancel or alter\n the pending scheduled transmission (only `otPlatRadioCancelScheduledTx()` or `otPlatRadioDisable()` cancels\n it).\n - If `otPlatRadioSleep()` or `otPlatRadioReceive()` is called while the scheduled transmission is actively in\n progress on the air (or waiting for its acknowledgment) at @p aTxTime, the radio platform MUST NOT abort the\n ongoing scheduled transmission and MUST NOT fail the call with `OT_ERROR_BUSY` or `OT_ERROR_INVALID_STATE`.\n Instead, it MUST return `OT_ERROR_NONE`, complete the scheduled transmission, and then transition to the newly\n requested state (`Sleep` or `Receive` on the requested channel).\n - Once the scheduled transmission completes (after transmitting the frame and receiving the acknowledgment or\n timing out when an acknowledgment is requested, or if CCA fails or the transmission is aborted), the radio\n platform MUST automatically return to its target state (the state prior to the scheduled transmission, or any\n updated state requested via `otPlatRadioSleep()` or `otPlatRadioReceive()` while the scheduled transmission\n was pending/active) and resume what it was doing:\n - If the target state is `Receive` on a channel (from `otPlatRadioReceive()`), it MUST return to `Receive` on\n that receive channel (`mRxChannelAfterTxDone` in `otRadioFrame` MUST be ignored).\n - If the target state is `Sleep` with an active timed reception window (from `otPlatRadioReceiveAt()` whose\n window has not yet expired), it MUST return to `Receive` on that window's channel for the remaining duration\n of the window before transitioning back to `Sleep`.\n - If the target state is `Sleep` (and not in an active timed reception window), it MUST return to `Sleep`.\n - If a transmission requested via `otPlatRadioTransmit()` was deferred for the scheduled transmission, the\n radio platform SHOULD proceed with that transmission.\n\n - Single Active Schedule and Frame Buffer Ownership:\n - At most one scheduled transmission request can be active at any time, using the single `otRadioFrame` provided\n by `otPlatRadioGetScheduledTxFrame()`.\n - After a successful `otPlatRadioScheduleTx()` call (and before it is canceled via `otPlatRadioCancelScheduledTx()`\n or `otPlatRadioDisable()`, or completed via `otPlatRadioScheduledTxDone()`), any new call to\n `otPlatRadioScheduleTx()` MUST be rejected by returning `OT_ERROR_BUSY` without affecting the active schedule.\n The OpenThread stack will generally not call `otPlatRadioScheduleTx()` again until the previous schedule is\n canceled or completed via `otPlatRadioScheduledTxDone()`.\n - Upon a successful `otPlatRadioScheduleTx()` call, the radio platform takes ownership of the frame buffer from\n `otPlatRadioGetScheduledTxFrame()`. The OpenThread stack guarantees that it will not touch or modify the frame\n buffer or its contents while owned by the radio platform.\n - Invoking the `otPlatRadioScheduledTxDone()` callback, a successful `otPlatRadioCancelScheduledTx()` call\n (returning `OT_ERROR_NONE`), or `otPlatRadioDisable()` releases ownership of the frame buffer back to the\n OpenThread stack, allowing the stack to modify the frame again.\n\n - Handling of `otRadioFrame` (`mTxInfo`) fields:\n - `mTxDelayBaseTime` and `mTxDelay`: MUST be ignored. The target transmission time is specified solely by the\n @p aTxTime parameter.\n - `mCsmaCaEnabled`: Indicates whether CCA MUST be performed before transmitting the frame:\n - When set to `false`, the frame MUST be transmitted at @p aTxTime without performing CCA.\n - When set to `true`, CCA MUST be performed prior to transmission (timed so that the end of the SFD still\n occurs at @p aTxTime). If CCA fails, the radio platform MUST NOT transmit the frame and MUST report\n `OT_ERROR_CHANNEL_ACCESS_FAILURE` via `otPlatRadioScheduledTxDone()`.\n - `mMaxCsmaBackoffs`: MUST always be ignored (treated as `0`). The radio platform MUST NOT perform any CSMA\n backoff for a scheduled transmission.\n - `mMaxFrameRetries`: MUST always be ignored (treated as `0`). A scheduled transmission is a single transmission\n attempt with no retries by the radio platform (the OpenThread stack manages any retransmissions in subsequent\n time slots).\n - `mRxChannelAfterTxDone`: MUST be ignored. Upon completing the scheduled transmission, the radio MUST return to\n its previous state and receive channel (if it was receiving).\n - `mIsARetx` and `mCslPresent`: MUST be ignored.\n - `mTimestamp`: When the frame is transmitted, the radio platform MUST update this field with the local radio\n clock timestamp (in microseconds) when the end of the SFD was present at the local antenna before invoking\n `otPlatRadioScheduledTxDone()`.\n - `mIsHeaderUpdated` and `mIsSecurityProcessed`: Follow their existing behavior as defined for\n `otPlatRadioTransmit()` when `OT_RADIO_CAPS_TRANSMIT_SEC` is supported. When `mIsHeaderUpdated` is `false`, the\n radio platform MUST assign the MAC frame counter and perform security processing when preparing the frame for\n transmission at @p aTxTime (rather than when `otPlatRadioScheduleTx()` is called), ensuring that frame counters\n are used in order on the air if other transmissions or enhanced acknowledgments occur before @p aTxTime and that\n no frame counter is wasted if the scheduled transmission is canceled or aborted before the frame is prepared at\n @p aTxTime.\n - All other fields (`mChannel`, `mAesKey`, `mIeInfo`, `mTxPower`) MUST follow their existing behavior as defined\n for `otPlatRadioTransmit()`.\n\n - Completion and Callbacks:\n - The radio platform MUST report the outcome of the scheduled transmission using the `otPlatRadioScheduledTxDone()`\n callback.\n - Aside from `OT_ERROR_INVALID_STATE` (when the radio is disabled) and `OT_ERROR_BUSY` (when a previously\n scheduled transmission is still active), `otPlatRadioScheduleTx()` MUST NOT return any other error\n synchronously. Any other runtime failure to schedule or transmit the frame (for example, if `mChannel` on the\n scheduled TX frame is invalid or unsupported) MUST still return `OT_ERROR_NONE` from `otPlatRadioScheduleTx()`\n and be reported asynchronously by invoking `otPlatRadioScheduledTxDone()` with `OT_ERROR_ABORT`.\n - A scheduled transmission MUST NOT invoke `otPlatRadioTxStarted()` or `otPlatRadioTxDone()`. Those callbacks are\n used exclusively for transmissions initiated via `otPlatRadioTransmit()`.\n\n Why a dedicated scheduled TX API is used (and comparison with `OT_RADIO_CAPS_TRANSMIT_TIMING`):\n\n - Coexistence (Coex) and Radio Arbitration:\n While the OpenThread stack can track time and schedule radio operations in software, it does not have visibility\n into platform-level radio coexistence (Coex) with other radios sharing the same device or antenna (such as Wi-Fi\n or Bluetooth/BLE). The radio platform driver is responsible for managing Coex arbitration and is therefore in a\n much better position to request appropriate Coex priority ahead of time and ensure the scheduled transmission goes\n out at the exact specified target time @p aTxTime. Similarly, the radio platform can directly preempt ongoing\n radio activity (such as an active frame reception, acknowledgment transmission, or a regular\n `otPlatRadioTransmit()` operation) when @p aTxTime arrives.\n\n - Differences from `OT_RADIO_CAPS_TRANSMIT_TIMING` (`mTxDelayBaseTime` and `mTxDelay`):\n `OT_RADIO_CAPS_TRANSMIT_TIMING` was originally introduced to support CSL in Thread 1.2 by extending the existing\n `otPlatRadioTransmit()` API using `mTxDelayBaseTime` and `mTxDelay`. That model has several limitations for\n more strict protocols like Thread Direct:\n - Existing vendor implementations of `OT_RADIO_CAPS_TRANSMIT_TIMING` vary in their behavior when the target\n transmission time is missed (for example, some implementations still transmit the frame after a delay even if\n the target time has passed). While a slightly delayed transmission may still fall within a peer's CSL sample\n window, transmitting late or outside the designated time slot in Thread Direct could result in unpredictable\n failures. `otPlatRadioScheduleTx()` defines strict, explicit requirements on timing accuracy, operational\n precedence, and missed-target handling.\n - `otPlatRadioTransmit()` is a blocking state-transition operation: once called, the OpenThread stack must wait\n for `otPlatRadioTxDone()` before it can issue any other transmit, receive, or sleep commands to the radio (which\n also forces the stack to wait until just before the target time to issue a timed `otPlatRadioTransmit()` so the\n radio is not tied up prematurely). In contrast, `otPlatRadioScheduleTx()` schedules a future transmission using a\n dedicated frame buffer as soon as the stack knows a scheduled transmission is needed—allowing the radio to\n continue other operations in the meantime and supporting explicit cancellation via\n `otPlatRadioCancelScheduledTx()`.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTxTime The target transmission time (end of SFD at the local antenna) in microseconds relative to the\n local radio clock (see `otPlatRadioGetNow()`).\n\n @retval OT_ERROR_NONE Successfully scheduled the frame transmission.\n @retval OT_ERROR_BUSY A previously scheduled transmission is still active.\n @retval OT_ERROR_INVALID_STATE The radio is disabled."]
2284 pub fn otPlatRadioScheduleTx(aInstance: *mut otInstance, aTxTime: otRadioTime64) -> otError;
2285}
2286unsafe extern "C" {
2287 #[doc = " Cancel a previously scheduled transmission.\n\n This API requires the radio platform to support the `OT_RADIO_CAPS_SCHEDULED_TX` capability.\n\n - If there is no pending scheduled transmission (e.g., none was scheduled, or a previous schedule was already\n canceled or completed), calling this function MUST take no action and return `OT_ERROR_NONE`.\n - If a scheduled transmission is pending and can still be aborted before transmission starts on the air, the radio\n platform MUST cancel it, release ownership of the scheduled TX frame buffer (`otPlatRadioGetScheduledTxFrame()`)\n back to the OpenThread stack, and return `OT_ERROR_NONE`. The radio platform MUST NOT invoke\n `otPlatRadioScheduledTxDone()` for a canceled transmission.\n - When `otPlatRadioCancelScheduledTx()` returns `OT_ERROR_NONE`, the OpenThread stack immediately reclaims\n ownership of the scheduled TX frame buffer and may immediately prepare a new frame in that buffer and call\n `otPlatRadioScheduleTx()` to schedule a new transmission.\n - If the radio platform cannot cancel the scheduled transmission (for example, because the transmission has already\n started and is currently in progress on the air or waiting for an acknowledgment, or because an `OT_ERROR_ABORT`\n completion is already queued to be reported), it MUST return `OT_ERROR_BUSY`. In this case:\n - The scheduled transmission is NOT canceled, and the radio platform retains ownership of the scheduled TX frame\n buffer.\n - The radio platform MUST subsequently report the outcome of the transmission via the\n `otPlatRadioScheduledTxDone()` callback.\n - The OpenThread stack will wait until `otPlatRadioScheduledTxDone()` is invoked before modifying the scheduled TX\n frame buffer or scheduling a new transmission.\n - Note that if a deferred `OT_ERROR_ABORT` callback is pending (e.g., due to a past/missed target time or Coex\n denial), the radio platform MAY handle `otPlatRadioCancelScheduledTx()` in whichever way it prefers: it may either\n cancel the pending callback and return `OT_ERROR_NONE`, or return `OT_ERROR_BUSY` and let the\n `otPlatRadioScheduledTxDone()` callback be invoked.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully canceled the scheduled transmission (or no scheduled transmission was pending).\n @retval OT_ERROR_BUSY The scheduled transmission has already started and could not be canceled."]
2288 pub fn otPlatRadioCancelScheduledTx(aInstance: *mut otInstance) -> otError;
2289}
2290unsafe extern "C" {
2291 #[doc = " The radio driver calls this function to notify OpenThread that a scheduled transmission (initiated via\n `otPlatRadioScheduleTx()`) has completed, providing both the transmission outcome and, if applicable, the received\n acknowledgment frame.\n\n This callback is used when the radio platform provides the `OT_RADIO_CAPS_SCHEDULED_TX` capability.\n\n When the radio provides the `OT_RADIO_CAPS_TRANSMIT_SEC` capability, the radio platform layer updates the scheduled\n TX frame (`otPlatRadioGetScheduledTxFrame()`) with the security frame counter and key index values maintained by the\n radio (following the same rules as `otPlatRadioTxDone()`).\n\n Frame buffer ownership and re-entrancy:\n - Invoking this callback transfers ownership of the scheduled TX frame buffer (`otPlatRadioGetScheduledTxFrame()`)\n from the radio platform back to the OpenThread stack.\n - Importantly, from within the `otPlatRadioScheduledTxDone()` callback itself, the OpenThread stack may immediately\n modify the scheduled TX frame buffer and call `otPlatRadioScheduleTx()` to schedule a new transmission. The radio\n platform implementation MUST support `otPlatRadioScheduleTx()` being called directly from within this callback.\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 an ISR or any other task.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aAckFrame A pointer to the received ACK frame, or `NULL` if no ACK was received.\n @param[in] aError `OT_ERROR_NONE` when the frame was transmitted at the target time (and an Ack was received if\n Ack was requested in the MAC header),\n `OT_ERROR_NO_ACK` when the frame was transmitted at the target time but no Ack was received,\n `OT_ERROR_CHANNEL_ACCESS_FAILURE` when transmission at the target time could not take place\n due to activity on the channel (CCA failure when `mCsmaCaEnabled` is `true`),\n `OT_ERROR_ABORT` when the frame could not be transmitted at the exact target time (e.g., due\n to Coex denial or missed target time) or the transmission was aborted for other reasons."]
2292 pub fn otPlatRadioScheduledTxDone(
2293 aInstance: *mut otInstance,
2294 aAckFrame: *mut otRadioFrame,
2295 aError: otError,
2296 );
2297}
2298unsafe extern "C" {
2299 #[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."]
2300 pub fn otPlatRadioGetRssi(aInstance: *mut otInstance) -> i8;
2301}
2302unsafe extern "C" {
2303 #[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."]
2304 pub fn otPlatRadioEnergyScan(
2305 aInstance: *mut otInstance,
2306 aScanChannel: u8,
2307 aScanDuration: u16,
2308 ) -> otError;
2309}
2310unsafe extern "C" {
2311 #[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."]
2312 pub fn otPlatRadioEnergyScanDone(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8);
2313}
2314unsafe extern "C" {
2315 #[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."]
2316 pub fn otPlatRadioBusLatencyChanged(aInstance: *mut otInstance);
2317}
2318unsafe extern "C" {
2319 #[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."]
2320 pub fn otPlatRadioEnableSrcMatch(aInstance: *mut otInstance, aEnable: bool);
2321}
2322unsafe extern "C" {
2323 #[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."]
2324 pub fn otPlatRadioAddSrcMatchShortEntry(
2325 aInstance: *mut otInstance,
2326 aShortAddress: otShortAddress,
2327 ) -> otError;
2328}
2329unsafe extern "C" {
2330 #[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."]
2331 pub fn otPlatRadioAddSrcMatchExtEntry(
2332 aInstance: *mut otInstance,
2333 aExtAddress: *const otExtAddress,
2334 ) -> otError;
2335}
2336unsafe extern "C" {
2337 #[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."]
2338 pub fn otPlatRadioClearSrcMatchShortEntry(
2339 aInstance: *mut otInstance,
2340 aShortAddress: otShortAddress,
2341 ) -> otError;
2342}
2343unsafe extern "C" {
2344 #[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."]
2345 pub fn otPlatRadioClearSrcMatchExtEntry(
2346 aInstance: *mut otInstance,
2347 aExtAddress: *const otExtAddress,
2348 ) -> otError;
2349}
2350unsafe extern "C" {
2351 #[doc = " Clear all short addresses from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2352 pub fn otPlatRadioClearSrcMatchShortEntries(aInstance: *mut otInstance);
2353}
2354unsafe extern "C" {
2355 #[doc = " Clear all the extended/long addresses from source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2356 pub fn otPlatRadioClearSrcMatchExtEntries(aInstance: *mut otInstance);
2357}
2358unsafe extern "C" {
2359 #[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."]
2360 pub fn otPlatRadioGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
2361}
2362unsafe extern "C" {
2363 #[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."]
2364 pub fn otPlatRadioGetPreferredChannelMask(aInstance: *mut otInstance) -> u32;
2365}
2366unsafe extern "C" {
2367 #[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."]
2368 pub fn otPlatRadioSetCoexEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
2369}
2370unsafe extern "C" {
2371 #[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."]
2372 pub fn otPlatRadioIsCoexEnabled(aInstance: *mut otInstance) -> bool;
2373}
2374unsafe extern "C" {
2375 #[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."]
2376 pub fn otPlatRadioGetCoexMetrics(
2377 aInstance: *mut otInstance,
2378 aCoexMetrics: *mut otRadioCoexMetrics,
2379 ) -> otError;
2380}
2381unsafe extern "C" {
2382 #[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."]
2383 pub fn otPlatRadioEnableCsl(
2384 aInstance: *mut otInstance,
2385 aCslPeriod: u32,
2386 aShortAddr: otShortAddress,
2387 aExtAddr: *const otExtAddress,
2388 ) -> otError;
2389}
2390unsafe extern "C" {
2391 #[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."]
2392 pub fn otPlatRadioResetCsl(aInstance: *mut otInstance) -> otError;
2393}
2394unsafe extern "C" {
2395 #[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."]
2396 pub fn otPlatRadioUpdateCslSampleTime(
2397 aInstance: *mut otInstance,
2398 aCslSampleTime: otRadioTime32,
2399 );
2400}
2401unsafe extern "C" {
2402 #[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."]
2403 pub fn otPlatRadioGetCslAccuracy(aInstance: *mut otInstance) -> u8;
2404}
2405unsafe extern "C" {
2406 #[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."]
2407 pub fn otPlatRadioGetCslUncertainty(aInstance: *mut otInstance) -> u8;
2408}
2409unsafe extern "C" {
2410 #[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."]
2411 pub fn otPlatRadioSetChannelMaxTransmitPower(
2412 aInstance: *mut otInstance,
2413 aChannel: u8,
2414 aMaxPower: i8,
2415 ) -> otError;
2416}
2417unsafe extern "C" {
2418 #[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."]
2419 pub fn otPlatRadioSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
2420}
2421unsafe extern "C" {
2422 #[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."]
2423 pub fn otPlatRadioGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
2424}
2425unsafe extern "C" {
2426 #[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."]
2427 pub fn otPlatRadioConfigureEnhAckProbing(
2428 aInstance: *mut otInstance,
2429 aLinkMetrics: otLinkMetrics,
2430 aShortAddress: otShortAddress,
2431 aExtAddress: *const otExtAddress,
2432 ) -> otError;
2433}
2434unsafe extern "C" {
2435 #[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."]
2436 pub fn otPlatRadioAddCalibratedPower(
2437 aInstance: *mut otInstance,
2438 aChannel: u8,
2439 aActualPower: i16,
2440 aRawPowerSetting: *const u8,
2441 aRawPowerSettingLength: u16,
2442 ) -> otError;
2443}
2444unsafe extern "C" {
2445 #[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."]
2446 pub fn otPlatRadioClearCalibratedPowers(aInstance: *mut otInstance) -> otError;
2447}
2448unsafe extern "C" {
2449 #[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."]
2450 pub fn otPlatRadioSetChannelTargetPower(
2451 aInstance: *mut otInstance,
2452 aChannel: u8,
2453 aTargetPower: i16,
2454 ) -> otError;
2455}
2456unsafe extern "C" {
2457 #[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."]
2458 pub fn otPlatRadioGetRawPowerSetting(
2459 aInstance: *mut otInstance,
2460 aChannel: u8,
2461 aRawPowerSetting: *mut u8,
2462 aRawPowerSettingLength: *mut u16,
2463 ) -> otError;
2464}
2465#[doc = " @struct otIp6InterfaceIdentifier\n\n Represents the Interface Identifier of an IPv6 address."]
2466#[repr(C, packed)]
2467#[derive(Copy, Clone)]
2468pub struct otIp6InterfaceIdentifier {
2469 #[doc = "< The Interface Identifier accessor fields"]
2470 pub mFields: otIp6InterfaceIdentifier__bindgen_ty_1,
2471}
2472#[repr(C, packed)]
2473#[derive(Copy, Clone)]
2474pub union otIp6InterfaceIdentifier__bindgen_ty_1 {
2475 #[doc = "< 8-bit fields"]
2476 pub m8: [u8; 8usize],
2477 #[doc = "< 16-bit fields"]
2478 pub m16: [u16; 4usize],
2479 #[doc = "< 32-bit fields"]
2480 pub m32: [u32; 2usize],
2481}
2482impl Default for otIp6InterfaceIdentifier__bindgen_ty_1 {
2483 fn default() -> Self {
2484 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2485 unsafe {
2486 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2487 s.assume_init()
2488 }
2489 }
2490}
2491impl Default for otIp6InterfaceIdentifier {
2492 fn default() -> Self {
2493 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2494 unsafe {
2495 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2496 s.assume_init()
2497 }
2498 }
2499}
2500#[doc = " @struct otIp6NetworkPrefix\n\n Represents the Network Prefix of an IPv6 address (most significant 64 bits of the address)."]
2501#[repr(C, packed)]
2502#[derive(Debug, Default, Copy, Clone)]
2503pub struct otIp6NetworkPrefix {
2504 #[doc = "< The Network Prefix."]
2505 pub m8: [u8; 8usize],
2506}
2507#[doc = " @struct otIp6AddressComponents\n\n Represents the components of an IPv6 address."]
2508#[repr(C, packed)]
2509#[derive(Copy, Clone)]
2510pub struct otIp6AddressComponents {
2511 #[doc = "< The Network Prefix (most significant 64 bits of the address)"]
2512 pub mNetworkPrefix: otIp6NetworkPrefix,
2513 #[doc = "< The Interface Identifier (least significant 64 bits of the address)"]
2514 pub mIid: otIp6InterfaceIdentifier,
2515}
2516impl Default for otIp6AddressComponents {
2517 fn default() -> Self {
2518 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2519 unsafe {
2520 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2521 s.assume_init()
2522 }
2523 }
2524}
2525#[doc = " @struct otIp6Address\n\n Represents an IPv6 address."]
2526#[repr(C, packed)]
2527#[derive(Copy, Clone)]
2528pub struct otIp6Address {
2529 #[doc = "< IPv6 accessor fields"]
2530 pub mFields: otIp6Address__bindgen_ty_1,
2531}
2532#[repr(C, packed)]
2533#[derive(Copy, Clone)]
2534pub union otIp6Address__bindgen_ty_1 {
2535 #[doc = "< 8-bit fields"]
2536 pub m8: [u8; 16usize],
2537 #[doc = "< 16-bit fields"]
2538 pub m16: [u16; 8usize],
2539 #[doc = "< 32-bit fields"]
2540 pub m32: [u32; 4usize],
2541 #[doc = "< IPv6 address components"]
2542 pub mComponents: otIp6AddressComponents,
2543}
2544impl Default for otIp6Address__bindgen_ty_1 {
2545 fn default() -> Self {
2546 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2547 unsafe {
2548 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2549 s.assume_init()
2550 }
2551 }
2552}
2553impl Default for otIp6Address {
2554 fn default() -> Self {
2555 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2556 unsafe {
2557 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2558 s.assume_init()
2559 }
2560 }
2561}
2562#[doc = " @struct otIp6Prefix\n\n Represents an IPv6 prefix."]
2563#[repr(C, packed)]
2564#[derive(Copy, Clone)]
2565pub struct otIp6Prefix {
2566 #[doc = "< The IPv6 prefix."]
2567 pub mPrefix: otIp6Address,
2568 #[doc = "< The IPv6 prefix length (in bits)."]
2569 pub mLength: u8,
2570}
2571impl Default for otIp6Prefix {
2572 fn default() -> Self {
2573 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2574 unsafe {
2575 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2576 s.assume_init()
2577 }
2578 }
2579}
2580#[doc = "< Thread assigned (ALOC, RLOC, MLEID, etc.)"]
2581pub const OT_ADDRESS_ORIGIN_THREAD: _bindgen_ty_7 = 0;
2582#[doc = "< SLAAC assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2583pub const OT_ADDRESS_ORIGIN_SLAAC: _bindgen_ty_7 = 1;
2584#[doc = "< DHCPv6 assigned (used in `otNetifAddress` and not in `otNetifMulticastAddress`)."]
2585pub const OT_ADDRESS_ORIGIN_DHCPV6: _bindgen_ty_7 = 2;
2586#[doc = "< Manually assigned address."]
2587pub const OT_ADDRESS_ORIGIN_MANUAL: _bindgen_ty_7 = 3;
2588#[doc = " IPv6 Address origins"]
2589pub type _bindgen_ty_7 = ::std::os::raw::c_uint;
2590#[doc = " Represents an IPv6 network interface unicast address."]
2591#[repr(C)]
2592#[derive(Copy, Clone)]
2593pub struct otNetifAddress {
2594 #[doc = "< The IPv6 unicast address."]
2595 pub mAddress: otIp6Address,
2596 #[doc = "< The Prefix length (in bits)."]
2597 pub mPrefixLength: u8,
2598 #[doc = "< The IPv6 address origin (OT_ADDRESS_ORIGIN_* values)."]
2599 pub mAddressOrigin: u8,
2600 pub _bitfield_align_1: [u8; 0],
2601 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
2602 #[doc = "< A pointer to the next network interface address."]
2603 pub mNext: *const otNetifAddress,
2604}
2605impl Default for otNetifAddress {
2606 fn default() -> Self {
2607 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2608 unsafe {
2609 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2610 s.assume_init()
2611 }
2612 }
2613}
2614impl otNetifAddress {
2615 #[inline]
2616 pub fn mPreferred(&self) -> bool {
2617 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2618 }
2619 #[inline]
2620 pub fn set_mPreferred(&mut self, val: bool) {
2621 unsafe {
2622 let val: u8 = ::std::mem::transmute(val);
2623 self._bitfield_1.set(0usize, 1u8, val as u64)
2624 }
2625 }
2626 #[inline]
2627 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
2628 unsafe {
2629 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2630 ::std::ptr::addr_of!((*this)._bitfield_1),
2631 0usize,
2632 1u8,
2633 ) as u8)
2634 }
2635 }
2636 #[inline]
2637 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
2638 unsafe {
2639 let val: u8 = ::std::mem::transmute(val);
2640 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2641 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2642 0usize,
2643 1u8,
2644 val as u64,
2645 )
2646 }
2647 }
2648 #[inline]
2649 pub fn mValid(&self) -> bool {
2650 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2651 }
2652 #[inline]
2653 pub fn set_mValid(&mut self, val: bool) {
2654 unsafe {
2655 let val: u8 = ::std::mem::transmute(val);
2656 self._bitfield_1.set(1usize, 1u8, val as u64)
2657 }
2658 }
2659 #[inline]
2660 pub unsafe fn mValid_raw(this: *const Self) -> bool {
2661 unsafe {
2662 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2663 ::std::ptr::addr_of!((*this)._bitfield_1),
2664 1usize,
2665 1u8,
2666 ) as u8)
2667 }
2668 }
2669 #[inline]
2670 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
2671 unsafe {
2672 let val: u8 = ::std::mem::transmute(val);
2673 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2674 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2675 1usize,
2676 1u8,
2677 val as u64,
2678 )
2679 }
2680 }
2681 #[inline]
2682 pub fn mScopeOverrideValid(&self) -> bool {
2683 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2684 }
2685 #[inline]
2686 pub fn set_mScopeOverrideValid(&mut self, val: bool) {
2687 unsafe {
2688 let val: u8 = ::std::mem::transmute(val);
2689 self._bitfield_1.set(2usize, 1u8, val as u64)
2690 }
2691 }
2692 #[inline]
2693 pub unsafe fn mScopeOverrideValid_raw(this: *const Self) -> bool {
2694 unsafe {
2695 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2696 ::std::ptr::addr_of!((*this)._bitfield_1),
2697 2usize,
2698 1u8,
2699 ) as u8)
2700 }
2701 }
2702 #[inline]
2703 pub unsafe fn set_mScopeOverrideValid_raw(this: *mut Self, val: bool) {
2704 unsafe {
2705 let val: u8 = ::std::mem::transmute(val);
2706 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2707 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2708 2usize,
2709 1u8,
2710 val as u64,
2711 )
2712 }
2713 }
2714 #[inline]
2715 pub fn mScopeOverride(&self) -> ::std::os::raw::c_uint {
2716 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 4u8) as u32) }
2717 }
2718 #[inline]
2719 pub fn set_mScopeOverride(&mut self, val: ::std::os::raw::c_uint) {
2720 unsafe {
2721 let val: u32 = ::std::mem::transmute(val);
2722 self._bitfield_1.set(3usize, 4u8, val as u64)
2723 }
2724 }
2725 #[inline]
2726 pub unsafe fn mScopeOverride_raw(this: *const Self) -> ::std::os::raw::c_uint {
2727 unsafe {
2728 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2729 ::std::ptr::addr_of!((*this)._bitfield_1),
2730 3usize,
2731 4u8,
2732 ) as u32)
2733 }
2734 }
2735 #[inline]
2736 pub unsafe fn set_mScopeOverride_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
2737 unsafe {
2738 let val: u32 = ::std::mem::transmute(val);
2739 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2740 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2741 3usize,
2742 4u8,
2743 val as u64,
2744 )
2745 }
2746 }
2747 #[inline]
2748 pub fn mRloc(&self) -> bool {
2749 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
2750 }
2751 #[inline]
2752 pub fn set_mRloc(&mut self, val: bool) {
2753 unsafe {
2754 let val: u8 = ::std::mem::transmute(val);
2755 self._bitfield_1.set(7usize, 1u8, val as u64)
2756 }
2757 }
2758 #[inline]
2759 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
2760 unsafe {
2761 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2762 ::std::ptr::addr_of!((*this)._bitfield_1),
2763 7usize,
2764 1u8,
2765 ) as u8)
2766 }
2767 }
2768 #[inline]
2769 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
2770 unsafe {
2771 let val: u8 = ::std::mem::transmute(val);
2772 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2773 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2774 7usize,
2775 1u8,
2776 val as u64,
2777 )
2778 }
2779 }
2780 #[inline]
2781 pub fn mMeshLocal(&self) -> bool {
2782 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
2783 }
2784 #[inline]
2785 pub fn set_mMeshLocal(&mut self, val: bool) {
2786 unsafe {
2787 let val: u8 = ::std::mem::transmute(val);
2788 self._bitfield_1.set(8usize, 1u8, val as u64)
2789 }
2790 }
2791 #[inline]
2792 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
2793 unsafe {
2794 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2795 ::std::ptr::addr_of!((*this)._bitfield_1),
2796 8usize,
2797 1u8,
2798 ) as u8)
2799 }
2800 }
2801 #[inline]
2802 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
2803 unsafe {
2804 let val: u8 = ::std::mem::transmute(val);
2805 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2806 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2807 8usize,
2808 1u8,
2809 val as u64,
2810 )
2811 }
2812 }
2813 #[inline]
2814 pub fn mSrpRegistered(&self) -> bool {
2815 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
2816 }
2817 #[inline]
2818 pub fn set_mSrpRegistered(&mut self, val: bool) {
2819 unsafe {
2820 let val: u8 = ::std::mem::transmute(val);
2821 self._bitfield_1.set(9usize, 1u8, val as u64)
2822 }
2823 }
2824 #[inline]
2825 pub unsafe fn mSrpRegistered_raw(this: *const Self) -> bool {
2826 unsafe {
2827 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2828 ::std::ptr::addr_of!((*this)._bitfield_1),
2829 9usize,
2830 1u8,
2831 ) as u8)
2832 }
2833 }
2834 #[inline]
2835 pub unsafe fn set_mSrpRegistered_raw(this: *mut Self, val: bool) {
2836 unsafe {
2837 let val: u8 = ::std::mem::transmute(val);
2838 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2839 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2840 9usize,
2841 1u8,
2842 val as u64,
2843 )
2844 }
2845 }
2846 #[inline]
2847 pub fn new_bitfield_1(
2848 mPreferred: bool,
2849 mValid: bool,
2850 mScopeOverrideValid: bool,
2851 mScopeOverride: ::std::os::raw::c_uint,
2852 mRloc: bool,
2853 mMeshLocal: bool,
2854 mSrpRegistered: bool,
2855 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
2856 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
2857 __bindgen_bitfield_unit.set(0usize, 1u8, {
2858 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
2859 mPreferred as u64
2860 });
2861 __bindgen_bitfield_unit.set(1usize, 1u8, {
2862 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
2863 mValid as u64
2864 });
2865 __bindgen_bitfield_unit.set(2usize, 1u8, {
2866 let mScopeOverrideValid: u8 = unsafe { ::std::mem::transmute(mScopeOverrideValid) };
2867 mScopeOverrideValid as u64
2868 });
2869 __bindgen_bitfield_unit.set(3usize, 4u8, {
2870 let mScopeOverride: u32 = unsafe { ::std::mem::transmute(mScopeOverride) };
2871 mScopeOverride as u64
2872 });
2873 __bindgen_bitfield_unit.set(7usize, 1u8, {
2874 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
2875 mRloc as u64
2876 });
2877 __bindgen_bitfield_unit.set(8usize, 1u8, {
2878 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
2879 mMeshLocal as u64
2880 });
2881 __bindgen_bitfield_unit.set(9usize, 1u8, {
2882 let mSrpRegistered: u8 = unsafe { ::std::mem::transmute(mSrpRegistered) };
2883 mSrpRegistered as u64
2884 });
2885 __bindgen_bitfield_unit
2886 }
2887}
2888#[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."]
2889#[repr(C)]
2890#[derive(Copy, Clone)]
2891pub struct otNetifMulticastAddress {
2892 #[doc = "< The IPv6 multicast address."]
2893 pub mAddress: otIp6Address,
2894 #[doc = "< A pointer to the next multicast address."]
2895 pub mNext: *const otNetifMulticastAddress,
2896 #[doc = "< The multicast address origin."]
2897 pub mAddressOrigin: u8,
2898 #[doc = "< Opaque data used by OpenThread core."]
2899 pub mData: u8,
2900}
2901impl Default for otNetifMulticastAddress {
2902 fn default() -> Self {
2903 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2904 unsafe {
2905 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2906 s.assume_init()
2907 }
2908 }
2909}
2910#[doc = " Represents an IPv6 socket address."]
2911#[repr(C)]
2912#[derive(Copy, Clone)]
2913pub struct otSockAddr {
2914 #[doc = "< An IPv6 address."]
2915 pub mAddress: otIp6Address,
2916 #[doc = "< A transport-layer port."]
2917 pub mPort: u16,
2918}
2919impl Default for otSockAddr {
2920 fn default() -> Self {
2921 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2922 unsafe {
2923 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2924 s.assume_init()
2925 }
2926 }
2927}
2928#[doc = "< Non-ECT"]
2929pub const OT_ECN_NOT_CAPABLE: _bindgen_ty_8 = 0;
2930#[doc = "< ECT(0)"]
2931pub const OT_ECN_CAPABLE_0: _bindgen_ty_8 = 2;
2932#[doc = "< ECT(1)"]
2933pub const OT_ECN_CAPABLE_1: _bindgen_ty_8 = 1;
2934#[doc = "< Congestion encountered (CE)"]
2935pub const OT_ECN_MARKED: _bindgen_ty_8 = 3;
2936#[doc = " ECN statuses, represented as in the IP header."]
2937pub type _bindgen_ty_8 = ::std::os::raw::c_uint;
2938#[doc = " Represents the local and peer IPv6 socket addresses."]
2939#[repr(C)]
2940#[derive(Copy, Clone)]
2941pub struct otMessageInfo {
2942 #[doc = "< The local IPv6 address."]
2943 pub mSockAddr: otIp6Address,
2944 #[doc = "< The peer IPv6 address."]
2945 pub mPeerAddr: otIp6Address,
2946 #[doc = "< The local transport-layer port."]
2947 pub mSockPort: u16,
2948 #[doc = "< The peer transport-layer port."]
2949 pub mPeerPort: u16,
2950 #[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."]
2951 pub mHopLimit: u8,
2952 pub _bitfield_align_1: [u8; 0],
2953 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2954}
2955impl Default for otMessageInfo {
2956 fn default() -> Self {
2957 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2958 unsafe {
2959 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2960 s.assume_init()
2961 }
2962 }
2963}
2964impl otMessageInfo {
2965 #[inline]
2966 pub fn mEcn(&self) -> u8 {
2967 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
2968 }
2969 #[inline]
2970 pub fn set_mEcn(&mut self, val: u8) {
2971 unsafe {
2972 let val: u8 = ::std::mem::transmute(val);
2973 self._bitfield_1.set(0usize, 2u8, val as u64)
2974 }
2975 }
2976 #[inline]
2977 pub unsafe fn mEcn_raw(this: *const Self) -> u8 {
2978 unsafe {
2979 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2980 ::std::ptr::addr_of!((*this)._bitfield_1),
2981 0usize,
2982 2u8,
2983 ) as u8)
2984 }
2985 }
2986 #[inline]
2987 pub unsafe fn set_mEcn_raw(this: *mut Self, val: u8) {
2988 unsafe {
2989 let val: u8 = ::std::mem::transmute(val);
2990 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2991 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2992 0usize,
2993 2u8,
2994 val as u64,
2995 )
2996 }
2997 }
2998 #[inline]
2999 pub fn mIsHostInterface(&self) -> bool {
3000 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
3001 }
3002 #[inline]
3003 pub fn set_mIsHostInterface(&mut self, val: bool) {
3004 unsafe {
3005 let val: u8 = ::std::mem::transmute(val);
3006 self._bitfield_1.set(2usize, 1u8, val as u64)
3007 }
3008 }
3009 #[inline]
3010 pub unsafe fn mIsHostInterface_raw(this: *const Self) -> bool {
3011 unsafe {
3012 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3013 ::std::ptr::addr_of!((*this)._bitfield_1),
3014 2usize,
3015 1u8,
3016 ) as u8)
3017 }
3018 }
3019 #[inline]
3020 pub unsafe fn set_mIsHostInterface_raw(this: *mut Self, val: bool) {
3021 unsafe {
3022 let val: u8 = ::std::mem::transmute(val);
3023 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3024 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3025 2usize,
3026 1u8,
3027 val as u64,
3028 )
3029 }
3030 }
3031 #[inline]
3032 pub fn mAllowZeroHopLimit(&self) -> bool {
3033 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3034 }
3035 #[inline]
3036 pub fn set_mAllowZeroHopLimit(&mut self, val: bool) {
3037 unsafe {
3038 let val: u8 = ::std::mem::transmute(val);
3039 self._bitfield_1.set(3usize, 1u8, val as u64)
3040 }
3041 }
3042 #[inline]
3043 pub unsafe fn mAllowZeroHopLimit_raw(this: *const Self) -> bool {
3044 unsafe {
3045 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3046 ::std::ptr::addr_of!((*this)._bitfield_1),
3047 3usize,
3048 1u8,
3049 ) as u8)
3050 }
3051 }
3052 #[inline]
3053 pub unsafe fn set_mAllowZeroHopLimit_raw(this: *mut Self, val: bool) {
3054 unsafe {
3055 let val: u8 = ::std::mem::transmute(val);
3056 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3057 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3058 3usize,
3059 1u8,
3060 val as u64,
3061 )
3062 }
3063 }
3064 #[inline]
3065 pub fn mMulticastLoop(&self) -> bool {
3066 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3067 }
3068 #[inline]
3069 pub fn set_mMulticastLoop(&mut self, val: bool) {
3070 unsafe {
3071 let val: u8 = ::std::mem::transmute(val);
3072 self._bitfield_1.set(4usize, 1u8, val as u64)
3073 }
3074 }
3075 #[inline]
3076 pub unsafe fn mMulticastLoop_raw(this: *const Self) -> bool {
3077 unsafe {
3078 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3079 ::std::ptr::addr_of!((*this)._bitfield_1),
3080 4usize,
3081 1u8,
3082 ) as u8)
3083 }
3084 }
3085 #[inline]
3086 pub unsafe fn set_mMulticastLoop_raw(this: *mut Self, val: bool) {
3087 unsafe {
3088 let val: u8 = ::std::mem::transmute(val);
3089 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3090 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3091 4usize,
3092 1u8,
3093 val as u64,
3094 )
3095 }
3096 }
3097 #[inline]
3098 pub fn new_bitfield_1(
3099 mEcn: u8,
3100 mIsHostInterface: bool,
3101 mAllowZeroHopLimit: bool,
3102 mMulticastLoop: bool,
3103 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3104 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3105 __bindgen_bitfield_unit.set(0usize, 2u8, {
3106 let mEcn: u8 = unsafe { ::std::mem::transmute(mEcn) };
3107 mEcn as u64
3108 });
3109 __bindgen_bitfield_unit.set(2usize, 1u8, {
3110 let mIsHostInterface: u8 = unsafe { ::std::mem::transmute(mIsHostInterface) };
3111 mIsHostInterface as u64
3112 });
3113 __bindgen_bitfield_unit.set(3usize, 1u8, {
3114 let mAllowZeroHopLimit: u8 = unsafe { ::std::mem::transmute(mAllowZeroHopLimit) };
3115 mAllowZeroHopLimit as u64
3116 });
3117 __bindgen_bitfield_unit.set(4usize, 1u8, {
3118 let mMulticastLoop: u8 = unsafe { ::std::mem::transmute(mMulticastLoop) };
3119 mMulticastLoop as u64
3120 });
3121 __bindgen_bitfield_unit
3122 }
3123}
3124#[doc = "< IPv6 Hop-by-Hop Option"]
3125pub const OT_IP6_PROTO_HOP_OPTS: _bindgen_ty_9 = 0;
3126#[doc = "< Transmission Control Protocol"]
3127pub const OT_IP6_PROTO_TCP: _bindgen_ty_9 = 6;
3128#[doc = "< User Datagram"]
3129pub const OT_IP6_PROTO_UDP: _bindgen_ty_9 = 17;
3130#[doc = "< IPv6 encapsulation"]
3131pub const OT_IP6_PROTO_IP6: _bindgen_ty_9 = 41;
3132#[doc = "< Routing Header for IPv6"]
3133pub const OT_IP6_PROTO_ROUTING: _bindgen_ty_9 = 43;
3134#[doc = "< Fragment Header for IPv6"]
3135pub const OT_IP6_PROTO_FRAGMENT: _bindgen_ty_9 = 44;
3136#[doc = "< ICMP for IPv6"]
3137pub const OT_IP6_PROTO_ICMP6: _bindgen_ty_9 = 58;
3138#[doc = "< No Next Header for IPv6"]
3139pub const OT_IP6_PROTO_NONE: _bindgen_ty_9 = 59;
3140#[doc = "< Destination Options for IPv6"]
3141pub const OT_IP6_PROTO_DST_OPTS: _bindgen_ty_9 = 60;
3142#[doc = " Internet Protocol Numbers."]
3143pub type _bindgen_ty_9 = ::std::os::raw::c_uint;
3144unsafe extern "C" {
3145 #[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."]
3146 pub fn otIp6Init(
3147 aInstance: *mut otInstance,
3148 aUnicastAddrPool: *mut otNetifAddress,
3149 aUnicastAddrPoolSize: u16,
3150 aMulticastAddrPool: *mut otNetifMulticastAddress,
3151 aMulticastAddrPoolSize: u16,
3152 ) -> otError;
3153}
3154unsafe extern "C" {
3155 #[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`."]
3156 pub fn otIp6SetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3157}
3158unsafe extern "C" {
3159 #[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."]
3160 pub fn otIp6IsEnabled(aInstance: *mut otInstance) -> bool;
3161}
3162unsafe extern "C" {
3163 #[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."]
3164 pub fn otIp6AddUnicastAddress(
3165 aInstance: *mut otInstance,
3166 aAddress: *const otNetifAddress,
3167 ) -> otError;
3168}
3169unsafe extern "C" {
3170 #[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."]
3171 pub fn otIp6RemoveUnicastAddress(
3172 aInstance: *mut otInstance,
3173 aAddress: *const otIp6Address,
3174 ) -> otError;
3175}
3176unsafe extern "C" {
3177 #[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."]
3178 pub fn otIp6GetUnicastAddresses(aInstance: *mut otInstance) -> *const otNetifAddress;
3179}
3180unsafe extern "C" {
3181 #[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."]
3182 pub fn otIp6HasUnicastAddress(
3183 aInstance: *mut otInstance,
3184 aAddress: *const otIp6Address,
3185 ) -> bool;
3186}
3187unsafe extern "C" {
3188 #[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."]
3189 pub fn otIp6SubscribeMulticastAddress(
3190 aInstance: *mut otInstance,
3191 aAddress: *const otIp6Address,
3192 ) -> otError;
3193}
3194unsafe extern "C" {
3195 #[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."]
3196 pub fn otIp6UnsubscribeMulticastAddress(
3197 aInstance: *mut otInstance,
3198 aAddress: *const otIp6Address,
3199 ) -> otError;
3200}
3201unsafe extern "C" {
3202 #[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."]
3203 pub fn otIp6GetMulticastAddresses(aInstance: *mut otInstance)
3204 -> *const otNetifMulticastAddress;
3205}
3206unsafe extern "C" {
3207 #[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"]
3208 pub fn otIp6NewMessage(
3209 aInstance: *mut otInstance,
3210 aSettings: *const otMessageSettings,
3211 ) -> *mut otMessage;
3212}
3213unsafe extern "C" {
3214 #[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"]
3215 pub fn otIp6NewMessageFromBuffer(
3216 aInstance: *mut otInstance,
3217 aData: *const u8,
3218 aDataLength: u16,
3219 aSettings: *const otMessageSettings,
3220 ) -> *mut otMessage;
3221}
3222#[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."]
3223pub type otIp6ReceiveCallback = ::std::option::Option<
3224 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
3225>;
3226unsafe extern "C" {
3227 #[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"]
3228 pub fn otIp6SetReceiveCallback(
3229 aInstance: *mut otInstance,
3230 aCallback: otIp6ReceiveCallback,
3231 aCallbackContext: *mut ::std::os::raw::c_void,
3232 );
3233}
3234#[doc = " Represents IPv6 address information."]
3235#[repr(C)]
3236#[derive(Debug, Copy, Clone)]
3237pub struct otIp6AddressInfo {
3238 #[doc = "< A pointer to the IPv6 address."]
3239 pub mAddress: *const otIp6Address,
3240 #[doc = "< The prefix length of mAddress if it is a unicast address."]
3241 pub mPrefixLength: u8,
3242 pub _bitfield_align_1: [u8; 0],
3243 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3244 pub __bindgen_padding_0: [u16; 3usize],
3245}
3246impl Default for otIp6AddressInfo {
3247 fn default() -> Self {
3248 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3249 unsafe {
3250 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3251 s.assume_init()
3252 }
3253 }
3254}
3255impl otIp6AddressInfo {
3256 #[inline]
3257 pub fn mScope(&self) -> u8 {
3258 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
3259 }
3260 #[inline]
3261 pub fn set_mScope(&mut self, val: u8) {
3262 unsafe {
3263 let val: u8 = ::std::mem::transmute(val);
3264 self._bitfield_1.set(0usize, 4u8, val as u64)
3265 }
3266 }
3267 #[inline]
3268 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
3269 unsafe {
3270 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3271 ::std::ptr::addr_of!((*this)._bitfield_1),
3272 0usize,
3273 4u8,
3274 ) as u8)
3275 }
3276 }
3277 #[inline]
3278 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
3279 unsafe {
3280 let val: u8 = ::std::mem::transmute(val);
3281 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3282 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3283 0usize,
3284 4u8,
3285 val as u64,
3286 )
3287 }
3288 }
3289 #[inline]
3290 pub fn mPreferred(&self) -> bool {
3291 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3292 }
3293 #[inline]
3294 pub fn set_mPreferred(&mut self, val: bool) {
3295 unsafe {
3296 let val: u8 = ::std::mem::transmute(val);
3297 self._bitfield_1.set(4usize, 1u8, val as u64)
3298 }
3299 }
3300 #[inline]
3301 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
3302 unsafe {
3303 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3304 ::std::ptr::addr_of!((*this)._bitfield_1),
3305 4usize,
3306 1u8,
3307 ) as u8)
3308 }
3309 }
3310 #[inline]
3311 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
3312 unsafe {
3313 let val: u8 = ::std::mem::transmute(val);
3314 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3315 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3316 4usize,
3317 1u8,
3318 val as u64,
3319 )
3320 }
3321 }
3322 #[inline]
3323 pub fn mMeshLocal(&self) -> bool {
3324 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
3325 }
3326 #[inline]
3327 pub fn set_mMeshLocal(&mut self, val: bool) {
3328 unsafe {
3329 let val: u8 = ::std::mem::transmute(val);
3330 self._bitfield_1.set(5usize, 1u8, val as u64)
3331 }
3332 }
3333 #[inline]
3334 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
3335 unsafe {
3336 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3337 ::std::ptr::addr_of!((*this)._bitfield_1),
3338 5usize,
3339 1u8,
3340 ) as u8)
3341 }
3342 }
3343 #[inline]
3344 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
3345 unsafe {
3346 let val: u8 = ::std::mem::transmute(val);
3347 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3348 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3349 5usize,
3350 1u8,
3351 val as u64,
3352 )
3353 }
3354 }
3355 #[inline]
3356 pub fn mIsLocator(&self) -> bool {
3357 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
3358 }
3359 #[inline]
3360 pub fn set_mIsLocator(&mut self, val: bool) {
3361 unsafe {
3362 let val: u8 = ::std::mem::transmute(val);
3363 self._bitfield_1.set(6usize, 1u8, val as u64)
3364 }
3365 }
3366 #[inline]
3367 pub unsafe fn mIsLocator_raw(this: *const Self) -> bool {
3368 unsafe {
3369 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3370 ::std::ptr::addr_of!((*this)._bitfield_1),
3371 6usize,
3372 1u8,
3373 ) as u8)
3374 }
3375 }
3376 #[inline]
3377 pub unsafe fn set_mIsLocator_raw(this: *mut Self, val: bool) {
3378 unsafe {
3379 let val: u8 = ::std::mem::transmute(val);
3380 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3381 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3382 6usize,
3383 1u8,
3384 val as u64,
3385 )
3386 }
3387 }
3388 #[inline]
3389 pub fn new_bitfield_1(
3390 mScope: u8,
3391 mPreferred: bool,
3392 mMeshLocal: bool,
3393 mIsLocator: bool,
3394 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3395 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3396 __bindgen_bitfield_unit.set(0usize, 4u8, {
3397 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
3398 mScope as u64
3399 });
3400 __bindgen_bitfield_unit.set(4usize, 1u8, {
3401 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
3402 mPreferred as u64
3403 });
3404 __bindgen_bitfield_unit.set(5usize, 1u8, {
3405 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
3406 mMeshLocal as u64
3407 });
3408 __bindgen_bitfield_unit.set(6usize, 1u8, {
3409 let mIsLocator: u8 = unsafe { ::std::mem::transmute(mIsLocator) };
3410 mIsLocator as u64
3411 });
3412 __bindgen_bitfield_unit
3413 }
3414}
3415#[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."]
3416pub type otIp6AddressCallback = ::std::option::Option<
3417 unsafe extern "C" fn(
3418 aAddressInfo: *const otIp6AddressInfo,
3419 aIsAdded: bool,
3420 aContext: *mut ::std::os::raw::c_void,
3421 ),
3422>;
3423unsafe extern "C" {
3424 #[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."]
3425 pub fn otIp6SetAddressCallback(
3426 aInstance: *mut otInstance,
3427 aCallback: otIp6AddressCallback,
3428 aCallbackContext: *mut ::std::os::raw::c_void,
3429 );
3430}
3431unsafe extern "C" {
3432 #[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"]
3433 pub fn otIp6IsReceiveFilterEnabled(aInstance: *mut otInstance) -> bool;
3434}
3435unsafe extern "C" {
3436 #[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"]
3437 pub fn otIp6SetReceiveFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
3438}
3439unsafe extern "C" {
3440 #[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."]
3441 pub fn otIp6Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
3442}
3443unsafe extern "C" {
3444 #[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."]
3445 pub fn otIp6AddUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3446}
3447unsafe extern "C" {
3448 #[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."]
3449 pub fn otIp6RemoveUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3450}
3451unsafe extern "C" {
3452 #[doc = " Removes all ports from the allowed unsecure port list.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3453 pub fn otIp6RemoveAllUnsecurePorts(aInstance: *mut otInstance);
3454}
3455unsafe extern "C" {
3456 #[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."]
3457 pub fn otIp6GetUnsecurePorts(aInstance: *mut otInstance, aNumEntries: *mut u8) -> *const u16;
3458}
3459unsafe extern "C" {
3460 #[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."]
3461 pub fn otIp6SetAllowUnsecureWhenDisabled(aInstance: *mut otInstance, aAllow: bool);
3462}
3463unsafe extern "C" {
3464 #[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."]
3465 pub fn otIp6IsUnsecureAllowedWhenDisabled(aInstance: *mut otInstance) -> bool;
3466}
3467unsafe extern "C" {
3468 #[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."]
3469 pub fn otIp6IsAddressEqual(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> bool;
3470}
3471unsafe extern "C" {
3472 #[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."]
3473 pub fn otIp6IsLinkLocalUnicast(aAddress: *const otIp6Address) -> bool;
3474}
3475unsafe extern "C" {
3476 #[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."]
3477 pub fn otIp6FormLinkLocalAddressFromExtAddress(
3478 aExtAddress: *const otExtAddress,
3479 aAddress: *mut otIp6Address,
3480 );
3481}
3482unsafe extern "C" {
3483 #[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)."]
3484 pub fn otIp6ExtractExtAddressFromIp6AddressIid(
3485 aAddress: *const otIp6Address,
3486 aExtAddress: *mut otExtAddress,
3487 );
3488}
3489unsafe extern "C" {
3490 #[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."]
3491 pub fn otIp6ArePrefixesEqual(aFirst: *const otIp6Prefix, aSecond: *const otIp6Prefix) -> bool;
3492}
3493unsafe extern "C" {
3494 #[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."]
3495 pub fn otIp6AddressFromString(
3496 aString: *const ::std::os::raw::c_char,
3497 aAddress: *mut otIp6Address,
3498 ) -> otError;
3499}
3500unsafe extern "C" {
3501 #[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."]
3502 pub fn otIp6PrefixFromString(
3503 aString: *const ::std::os::raw::c_char,
3504 aPrefix: *mut otIp6Prefix,
3505 ) -> otError;
3506}
3507unsafe extern "C" {
3508 #[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`."]
3509 pub fn otIp6AddressToString(
3510 aAddress: *const otIp6Address,
3511 aBuffer: *mut ::std::os::raw::c_char,
3512 aSize: u16,
3513 );
3514}
3515unsafe extern "C" {
3516 #[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`."]
3517 pub fn otIp6SockAddrToString(
3518 aSockAddr: *const otSockAddr,
3519 aBuffer: *mut ::std::os::raw::c_char,
3520 aSize: u16,
3521 );
3522}
3523unsafe extern "C" {
3524 #[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`."]
3525 pub fn otIp6PrefixToString(
3526 aPrefix: *const otIp6Prefix,
3527 aBuffer: *mut ::std::os::raw::c_char,
3528 aSize: u16,
3529 );
3530}
3531unsafe extern "C" {
3532 #[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."]
3533 pub fn otIp6PrefixMatch(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> u8;
3534}
3535unsafe extern "C" {
3536 #[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."]
3537 pub fn otIp6GetPrefix(aAddress: *const otIp6Address, aLength: u8, aPrefix: *mut otIp6Prefix);
3538}
3539unsafe extern "C" {
3540 #[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."]
3541 pub fn otIp6IsAddressUnspecified(aAddress: *const otIp6Address) -> bool;
3542}
3543unsafe extern "C" {
3544 #[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."]
3545 pub fn otIp6SelectSourceAddress(
3546 aInstance: *mut otInstance,
3547 aMessageInfo: *mut otMessageInfo,
3548 ) -> otError;
3549}
3550unsafe extern "C" {
3551 #[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."]
3552 pub fn otIp6IsSlaacEnabled(aInstance: *mut otInstance) -> bool;
3553}
3554unsafe extern "C" {
3555 #[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."]
3556 pub fn otIp6SetSlaacEnabled(aInstance: *mut otInstance, aEnabled: bool);
3557}
3558#[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."]
3559pub type otIp6SlaacPrefixFilter = ::std::option::Option<
3560 unsafe extern "C" fn(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix) -> bool,
3561>;
3562unsafe extern "C" {
3563 #[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."]
3564 pub fn otIp6SetSlaacPrefixFilter(aInstance: *mut otInstance, aFilter: otIp6SlaacPrefixFilter);
3565}
3566#[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"]
3567pub type otIp6RegisterMulticastListenersCallback = ::std::option::Option<
3568 unsafe extern "C" fn(
3569 aContext: *mut ::std::os::raw::c_void,
3570 aError: otError,
3571 aMlrStatus: u8,
3572 aFailedAddresses: *const otIp6Address,
3573 aFailedAddressNum: u8,
3574 ),
3575>;
3576unsafe extern "C" {
3577 #[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"]
3578 pub fn otIp6RegisterMulticastListeners(
3579 aInstance: *mut otInstance,
3580 aAddresses: *const otIp6Address,
3581 aAddressNum: u8,
3582 aTimeout: *const u32,
3583 aCallback: otIp6RegisterMulticastListenersCallback,
3584 aContext: *mut ::std::os::raw::c_void,
3585 ) -> otError;
3586}
3587unsafe extern "C" {
3588 #[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."]
3589 pub fn otIp6SetMeshLocalIid(
3590 aInstance: *mut otInstance,
3591 aIid: *const otIp6InterfaceIdentifier,
3592 ) -> otError;
3593}
3594unsafe extern "C" {
3595 #[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."]
3596 pub fn otIp6ProtoToString(aIpProto: u8) -> *const ::std::os::raw::c_char;
3597}
3598#[doc = " Represents the counters for packets and bytes."]
3599#[repr(C)]
3600#[derive(Debug, Default, Copy, Clone)]
3601pub struct otPacketsAndBytes {
3602 #[doc = "< The number of packets."]
3603 pub mPackets: u64,
3604 #[doc = "< The number of bytes."]
3605 pub mBytes: u64,
3606}
3607#[doc = " Represents the counters of packets forwarded via Border Routing."]
3608#[repr(C)]
3609#[derive(Debug, Default, Copy, Clone)]
3610pub struct otBorderRoutingCounters {
3611 #[doc = "< The counters for inbound unicast."]
3612 pub mInboundUnicast: otPacketsAndBytes,
3613 #[doc = "< The counters for inbound multicast."]
3614 pub mInboundMulticast: otPacketsAndBytes,
3615 #[doc = "< The counters for outbound unicast."]
3616 pub mOutboundUnicast: otPacketsAndBytes,
3617 #[doc = "< The counters for outbound multicast."]
3618 pub mOutboundMulticast: otPacketsAndBytes,
3619 #[doc = "< The counters for inbound Internet when DHCPv6 PD enabled."]
3620 pub mInboundInternet: otPacketsAndBytes,
3621 #[doc = "< The counters for outbound Internet when DHCPv6 PD enabled."]
3622 pub mOutboundInternet: otPacketsAndBytes,
3623 #[doc = "< The number of received RA packets."]
3624 pub mRaRx: u32,
3625 #[doc = "< The number of RA packets successfully transmitted."]
3626 pub mRaTxSuccess: u32,
3627 #[doc = "< The number of RA packets failed to transmit."]
3628 pub mRaTxFailure: u32,
3629 #[doc = "< The number of received RS packets."]
3630 pub mRsRx: u32,
3631 #[doc = "< The number of RS packets successfully transmitted."]
3632 pub mRsTxSuccess: u32,
3633 #[doc = "< The number of RS packets failed to transmit."]
3634 pub mRsTxFailure: u32,
3635}
3636unsafe extern "C" {
3637 #[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."]
3638 pub fn otIp6GetBorderRoutingCounters(
3639 aInstance: *mut otInstance,
3640 ) -> *const otBorderRoutingCounters;
3641}
3642unsafe extern "C" {
3643 #[doc = " Resets the Border Routing counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3644 pub fn otIp6ResetBorderRoutingCounters(aInstance: *mut otInstance);
3645}
3646#[doc = "< Backbone function is disabled."]
3647pub const OT_BACKBONE_ROUTER_STATE_DISABLED: otBackboneRouterState = 0;
3648#[doc = "< Secondary Backbone Router."]
3649pub const OT_BACKBONE_ROUTER_STATE_SECONDARY: otBackboneRouterState = 1;
3650#[doc = "< The Primary Backbone Router."]
3651pub const OT_BACKBONE_ROUTER_STATE_PRIMARY: otBackboneRouterState = 2;
3652#[doc = " Represents the Backbone Router Status."]
3653pub type otBackboneRouterState = ::std::os::raw::c_uint;
3654unsafe extern "C" {
3655 #[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"]
3656 pub fn otBackboneRouterSetEnabled(aInstance: *mut otInstance, aEnable: bool);
3657}
3658unsafe extern "C" {
3659 #[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"]
3660 pub fn otBackboneRouterGetState(aInstance: *mut otInstance) -> otBackboneRouterState;
3661}
3662unsafe extern "C" {
3663 #[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"]
3664 pub fn otBackboneRouterGetConfig(
3665 aInstance: *mut otInstance,
3666 aConfig: *mut otBackboneRouterConfig,
3667 );
3668}
3669unsafe extern "C" {
3670 #[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"]
3671 pub fn otBackboneRouterSetConfig(
3672 aInstance: *mut otInstance,
3673 aConfig: *const otBackboneRouterConfig,
3674 ) -> otError;
3675}
3676unsafe extern "C" {
3677 #[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"]
3678 pub fn otBackboneRouterRegister(aInstance: *mut otInstance) -> otError;
3679}
3680unsafe extern "C" {
3681 #[doc = " Returns the Backbone Router registration jitter value.\n\n @returns The Backbone Router registration jitter value.\n\n @sa otBackboneRouterSetRegistrationJitter"]
3682 pub fn otBackboneRouterGetRegistrationJitter(aInstance: *mut otInstance) -> u8;
3683}
3684unsafe extern "C" {
3685 #[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"]
3686 pub fn otBackboneRouterSetRegistrationJitter(aInstance: *mut otInstance, aJitter: u8);
3687}
3688unsafe extern "C" {
3689 #[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."]
3690 pub fn otBackboneRouterConfigNextMulticastListenerRegistrationResponse(
3691 aInstance: *mut otInstance,
3692 aStatus: u8,
3693 );
3694}
3695#[doc = "< Multicast Listener was added."]
3696pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ADDED: otBackboneRouterMulticastListenerEvent = 0;
3697#[doc = "< Multicast Listener was removed or expired."]
3698pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_REMOVED: otBackboneRouterMulticastListenerEvent = 1;
3699#[doc = " Represents the Multicast Listener events."]
3700pub type otBackboneRouterMulticastListenerEvent = ::std::os::raw::c_uint;
3701#[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."]
3702pub type otBackboneRouterMulticastListenerCallback = ::std::option::Option<
3703 unsafe extern "C" fn(
3704 aContext: *mut ::std::os::raw::c_void,
3705 aEvent: otBackboneRouterMulticastListenerEvent,
3706 aAddress: *const otIp6Address,
3707 ),
3708>;
3709unsafe extern "C" {
3710 #[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."]
3711 pub fn otBackboneRouterSetMulticastListenerCallback(
3712 aInstance: *mut otInstance,
3713 aCallback: otBackboneRouterMulticastListenerCallback,
3714 aContext: *mut ::std::os::raw::c_void,
3715 );
3716}
3717unsafe extern "C" {
3718 #[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"]
3719 pub fn otBackboneRouterMulticastListenerClear(aInstance: *mut otInstance);
3720}
3721unsafe extern "C" {
3722 #[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"]
3723 pub fn otBackboneRouterMulticastListenerAdd(
3724 aInstance: *mut otInstance,
3725 aAddress: *const otIp6Address,
3726 aTimeout: u32,
3727 ) -> otError;
3728}
3729pub type otBackboneRouterMulticastListenerIterator = u16;
3730#[doc = " Represents a Backbone Router Multicast Listener info."]
3731#[repr(C)]
3732#[derive(Copy, Clone)]
3733pub struct otBackboneRouterMulticastListenerInfo {
3734 pub mAddress: otIp6Address,
3735 pub mTimeout: u32,
3736}
3737impl Default for otBackboneRouterMulticastListenerInfo {
3738 fn default() -> Self {
3739 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3740 unsafe {
3741 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3742 s.assume_init()
3743 }
3744 }
3745}
3746unsafe extern "C" {
3747 #[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"]
3748 pub fn otBackboneRouterMulticastListenerGetNext(
3749 aInstance: *mut otInstance,
3750 aIterator: *mut otBackboneRouterMulticastListenerIterator,
3751 aListenerInfo: *mut otBackboneRouterMulticastListenerInfo,
3752 ) -> otError;
3753}
3754#[doc = "< Ephemeral Key Manager is disabled."]
3755pub const OT_BORDER_AGENT_STATE_DISABLED: otBorderAgentEphemeralKeyState = 0;
3756#[doc = "< Enabled, but no ephemeral key is in use (not set or started)."]
3757pub const OT_BORDER_AGENT_STATE_STOPPED: otBorderAgentEphemeralKeyState = 1;
3758#[doc = "< Ephemeral key is set. Listening to accept secure connections."]
3759pub const OT_BORDER_AGENT_STATE_STARTED: otBorderAgentEphemeralKeyState = 2;
3760#[doc = "< Session is established with an external commissioner candidate."]
3761pub const OT_BORDER_AGENT_STATE_CONNECTED: otBorderAgentEphemeralKeyState = 3;
3762#[doc = "< Session is established and candidate is accepted as full commissioner."]
3763pub const OT_BORDER_AGENT_STATE_ACCEPTED: otBorderAgentEphemeralKeyState = 4;
3764#[doc = " Represents Border Agent's Ephemeral Key Manager state."]
3765pub type otBorderAgentEphemeralKeyState = ::std::os::raw::c_uint;
3766#[doc = " Represents a Thread Administration One-Time Passcode (TAP)."]
3767#[repr(C)]
3768#[derive(Debug, Default, Copy, Clone)]
3769pub struct otBorderAgentEphemeralKeyTap {
3770 #[doc = "< TAP string buffer (including `\\0` character)."]
3771 pub mTap: [::std::os::raw::c_char; 10usize],
3772}
3773unsafe extern "C" {
3774 #[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."]
3775 pub fn otBorderAgentEphemeralKeyGetState(
3776 aInstance: *mut otInstance,
3777 ) -> otBorderAgentEphemeralKeyState;
3778}
3779unsafe extern "C" {
3780 #[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."]
3781 pub fn otBorderAgentEphemeralKeySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
3782}
3783unsafe extern "C" {
3784 #[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)."]
3785 pub fn otBorderAgentEphemeralKeyStart(
3786 aInstance: *mut otInstance,
3787 aKeyString: *const ::std::os::raw::c_char,
3788 aTimeout: u32,
3789 aUdpPort: u16,
3790 ) -> otError;
3791}
3792unsafe extern "C" {
3793 #[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."]
3794 pub fn otBorderAgentEphemeralKeyStop(aInstance: *mut otInstance);
3795}
3796unsafe extern "C" {
3797 #[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)."]
3798 pub fn otBorderAgentEphemeralKeyGetUdpPort(aInstance: *mut otInstance) -> u16;
3799}
3800#[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)."]
3801pub type otBorderAgentEphemeralKeyCallback =
3802 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
3803unsafe extern "C" {
3804 #[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."]
3805 pub fn otBorderAgentEphemeralKeySetCallback(
3806 aInstance: *mut otInstance,
3807 aCallback: otBorderAgentEphemeralKeyCallback,
3808 aContext: *mut ::std::os::raw::c_void,
3809 );
3810}
3811unsafe extern "C" {
3812 #[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."]
3813 pub fn otBorderAgentEphemeralKeyStateToString(
3814 aState: otBorderAgentEphemeralKeyState,
3815 ) -> *const ::std::os::raw::c_char;
3816}
3817unsafe extern "C" {
3818 #[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."]
3819 pub fn otBorderAgentEphemeralKeyGenerateTap(aTap: *mut otBorderAgentEphemeralKeyTap)
3820 -> otError;
3821}
3822unsafe extern "C" {
3823 #[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."]
3824 pub fn otBorderAgentEphemeralKeyValidateTap(
3825 aTap: *const otBorderAgentEphemeralKeyTap,
3826 ) -> otError;
3827}
3828#[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)."]
3829#[repr(C)]
3830#[derive(Debug, Copy, Clone)]
3831pub struct otDnsTxtEntry {
3832 #[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."]
3833 pub mKey: *const ::std::os::raw::c_char,
3834 #[doc = "< The TXT record value or already encoded TXT-DATA (depending on `mKey`)."]
3835 pub mValue: *const u8,
3836 #[doc = "< Number of bytes in `mValue` buffer."]
3837 pub mValueLength: u16,
3838}
3839impl Default for otDnsTxtEntry {
3840 fn default() -> Self {
3841 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3842 unsafe {
3843 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3844 s.assume_init()
3845 }
3846 }
3847}
3848#[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."]
3849#[repr(C)]
3850#[derive(Debug, Copy, Clone)]
3851pub struct otDnsTxtEntryIterator {
3852 pub mPtr: *const ::std::os::raw::c_void,
3853 pub mData: [u16; 2usize],
3854 pub mChar: [::std::os::raw::c_char; 65usize],
3855}
3856impl Default for otDnsTxtEntryIterator {
3857 fn default() -> Self {
3858 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3859 unsafe {
3860 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3861 s.assume_init()
3862 }
3863 }
3864}
3865unsafe extern "C" {
3866 #[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."]
3867 pub fn otDnsInitTxtEntryIterator(
3868 aIterator: *mut otDnsTxtEntryIterator,
3869 aTxtData: *const u8,
3870 aTxtDataLength: u16,
3871 );
3872}
3873unsafe extern "C" {
3874 #[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."]
3875 pub fn otDnsGetNextTxtEntry(
3876 aIterator: *mut otDnsTxtEntryIterator,
3877 aEntry: *mut otDnsTxtEntry,
3878 ) -> otError;
3879}
3880unsafe extern "C" {
3881 #[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."]
3882 pub fn otDnsEncodeTxtData(
3883 aTxtEntries: *const otDnsTxtEntry,
3884 aNumTxtEntries: u16,
3885 aTxtData: *mut u8,
3886 aTxtDataLength: *mut u16,
3887 ) -> otError;
3888}
3889unsafe extern "C" {
3890 #[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."]
3891 pub fn otDnsSetNameCompressionEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3892}
3893unsafe extern "C" {
3894 #[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."]
3895 pub fn otDnsIsNameCompressionEnabled(aInstance: *mut otInstance) -> bool;
3896}
3897#[doc = " Represents a Border Agent Identifier."]
3898#[repr(C)]
3899#[derive(Debug, Default, Copy, Clone)]
3900pub struct otBorderAgentId {
3901 #[doc = "< Border Agent ID bytes."]
3902 pub mId: [u8; 16usize],
3903}
3904#[doc = " Defines Border Agent counters.\n\n The `mEpskc` related counters require `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`."]
3905#[repr(C)]
3906#[derive(Debug, Default, Copy, Clone)]
3907pub struct otBorderAgentCounters {
3908 #[doc = "< The number of ePSKc activations"]
3909 pub mEpskcActivations: u32,
3910 #[doc = "< The number of ePSKc deactivations via API"]
3911 pub mEpskcDeactivationClears: u32,
3912 #[doc = "< The number of ePSKc deactivations due to timeout"]
3913 pub mEpskcDeactivationTimeouts: u32,
3914 #[doc = "< The number of ePSKc deactivations due to reached max attempts"]
3915 pub mEpskcDeactivationMaxAttempts: u32,
3916 #[doc = "< The number of ePSKc deactivations due to commissioner disconnected"]
3917 pub mEpskcDeactivationDisconnects: u32,
3918 #[doc = "< The number of invalid border agent state errors at ePSKc activation"]
3919 pub mEpskcInvalidBaStateErrors: u32,
3920 #[doc = "< The number of invalid args errors at ePSKc activation"]
3921 pub mEpskcInvalidArgsErrors: u32,
3922 #[doc = "< The number of start secure session errors at ePSKc activation"]
3923 pub mEpskcStartSecureSessionErrors: u32,
3924 #[doc = "< The number of established secure sessions with ePSKc"]
3925 pub mEpskcSecureSessionSuccesses: u32,
3926 #[doc = "< The number of failed secure sessions with ePSKc"]
3927 pub mEpskcSecureSessionFailures: u32,
3928 #[doc = "< The number of successful commissioner petitions with ePSKc"]
3929 pub mEpskcCommissionerPetitions: u32,
3930 #[doc = "< The number of established secure sessions with PSKc"]
3931 pub mPskcSecureSessionSuccesses: u32,
3932 #[doc = "< The number of failed secure sessions with PSKc"]
3933 pub mPskcSecureSessionFailures: u32,
3934 #[doc = "< The number of successful commissioner petitions with PSKc"]
3935 pub mPskcCommissionerPetitions: u32,
3936 #[doc = "< The number of MGMT_ACTIVE_GET.req sent over secure sessions"]
3937 pub mMgmtActiveGets: u32,
3938 #[doc = "< The number of MGMT_PENDING_GET.req sent over secure sessions"]
3939 pub mMgmtPendingGets: u32,
3940}
3941#[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."]
3942#[repr(C)]
3943#[derive(Copy, Clone)]
3944pub struct otBorderAgentSessionInfo {
3945 #[doc = "< Socket address (IPv6 address and port number) of session peer."]
3946 pub mPeerSockAddr: otSockAddr,
3947 #[doc = "< Indicates whether the session is connected."]
3948 pub mIsConnected: bool,
3949 #[doc = "< Indicates whether the session is accepted as full commissioner."]
3950 pub mIsCommissioner: bool,
3951 #[doc = "< Milliseconds since the session was first established."]
3952 pub mLifetime: u64,
3953}
3954impl Default for otBorderAgentSessionInfo {
3955 fn default() -> Self {
3956 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3957 unsafe {
3958 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3959 s.assume_init()
3960 }
3961 }
3962}
3963#[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."]
3964#[repr(C)]
3965#[derive(Debug, Copy, Clone)]
3966pub struct otBorderAgentSessionIterator {
3967 pub mPtr: *mut ::std::os::raw::c_void,
3968 pub mData: u64,
3969}
3970impl Default for otBorderAgentSessionIterator {
3971 fn default() -> Self {
3972 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3973 unsafe {
3974 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3975 s.assume_init()
3976 }
3977 }
3978}
3979#[doc = " Represents the Border Agent MeshCoP Service TXT data."]
3980#[repr(C)]
3981#[derive(Debug, Copy, Clone)]
3982pub struct otBorderAgentMeshCoPServiceTxtData {
3983 pub mData: [u8; 256usize],
3984 pub mLength: u16,
3985}
3986impl Default for otBorderAgentMeshCoPServiceTxtData {
3987 fn default() -> Self {
3988 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3989 unsafe {
3990 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3991 s.assume_init()
3992 }
3993 }
3994}
3995unsafe extern "C" {
3996 #[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)."]
3997 pub fn otBorderAgentSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
3998}
3999unsafe extern "C" {
4000 #[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."]
4001 pub fn otBorderAgentIsEnabled(aInstance: *mut otInstance) -> bool;
4002}
4003unsafe extern "C" {
4004 #[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."]
4005 pub fn otBorderAgentIsActive(aInstance: *mut otInstance) -> bool;
4006}
4007unsafe extern "C" {
4008 #[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."]
4009 pub fn otBorderAgentGetUdpPort(aInstance: *mut otInstance) -> u16;
4010}
4011#[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."]
4012pub type otBorderAgentMeshCoPServiceChangedCallback =
4013 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
4014unsafe extern "C" {
4015 #[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."]
4016 pub fn otBorderAgentSetMeshCoPServiceChangedCallback(
4017 aInstance: *mut otInstance,
4018 aCallback: otBorderAgentMeshCoPServiceChangedCallback,
4019 aContext: *mut ::std::os::raw::c_void,
4020 );
4021}
4022unsafe extern "C" {
4023 #[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."]
4024 pub fn otBorderAgentGetMeshCoPServiceTxtData(
4025 aInstance: *mut otInstance,
4026 aTxtData: *mut otBorderAgentMeshCoPServiceTxtData,
4027 ) -> otError;
4028}
4029unsafe extern "C" {
4030 #[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."]
4031 pub fn otBorderAgentSetMeshCoPServiceBaseName(
4032 aInstance: *mut otInstance,
4033 aBaseName: *const ::std::os::raw::c_char,
4034 ) -> otError;
4035}
4036unsafe extern "C" {
4037 #[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."]
4038 pub fn otBorderAgentSetVendorTxtData(
4039 aInstance: *mut otInstance,
4040 aVendorData: *const u8,
4041 aVendorDataLength: u16,
4042 );
4043}
4044unsafe extern "C" {
4045 #[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"]
4046 pub fn otBorderAgentGetId(aInstance: *mut otInstance, aId: *mut otBorderAgentId) -> otError;
4047}
4048unsafe extern "C" {
4049 #[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"]
4050 pub fn otBorderAgentSetId(aInstance: *mut otInstance, aId: *const otBorderAgentId) -> otError;
4051}
4052unsafe extern "C" {
4053 #[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."]
4054 pub fn otBorderAgentInitSessionIterator(
4055 aInstance: *mut otInstance,
4056 aIterator: *mut otBorderAgentSessionIterator,
4057 );
4058}
4059unsafe extern "C" {
4060 #[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."]
4061 pub fn otBorderAgentGetNextSessionInfo(
4062 aIterator: *mut otBorderAgentSessionIterator,
4063 aSessionInfo: *mut otBorderAgentSessionInfo,
4064 ) -> otError;
4065}
4066unsafe extern "C" {
4067 #[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."]
4068 pub fn otBorderAgentGetCounters(aInstance: *mut otInstance) -> *const otBorderAgentCounters;
4069}
4070unsafe extern "C" {
4071 #[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."]
4072 pub fn otBorderAgentEvictActiveCommissioner(aInstance: *mut otInstance) -> otError;
4073}
4074pub const OT_JOINER_STATE_IDLE: otJoinerState = 0;
4075pub const OT_JOINER_STATE_DISCOVER: otJoinerState = 1;
4076pub const OT_JOINER_STATE_CONNECT: otJoinerState = 2;
4077pub const OT_JOINER_STATE_CONNECTED: otJoinerState = 3;
4078pub const OT_JOINER_STATE_ENTRUST: otJoinerState = 4;
4079pub const OT_JOINER_STATE_JOINED: otJoinerState = 5;
4080#[doc = " Defines the Joiner State."]
4081pub type otJoinerState = ::std::os::raw::c_uint;
4082#[doc = " Represents a Joiner Discerner."]
4083#[repr(C)]
4084#[derive(Debug, Default, Copy, Clone)]
4085pub struct otJoinerDiscerner {
4086 #[doc = "< Discerner value (the lowest `mLength` bits specify the discerner)."]
4087 pub mValue: u64,
4088 #[doc = "< Length (number of bits) - must be non-zero and at most `OT_JOINER_MAX_DISCERNER_LENGTH`."]
4089 pub mLength: u8,
4090}
4091#[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."]
4092pub type otJoinerCallback = ::std::option::Option<
4093 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
4094>;
4095unsafe extern "C" {
4096 #[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."]
4097 pub fn otJoinerStart(
4098 aInstance: *mut otInstance,
4099 aPskd: *const ::std::os::raw::c_char,
4100 aProvisioningUrl: *const ::std::os::raw::c_char,
4101 aVendorName: *const ::std::os::raw::c_char,
4102 aVendorModel: *const ::std::os::raw::c_char,
4103 aVendorSwVersion: *const ::std::os::raw::c_char,
4104 aVendorData: *const ::std::os::raw::c_char,
4105 aCallback: otJoinerCallback,
4106 aContext: *mut ::std::os::raw::c_void,
4107 ) -> otError;
4108}
4109unsafe extern "C" {
4110 #[doc = " Disables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
4111 pub fn otJoinerStop(aInstance: *mut otInstance);
4112}
4113unsafe extern "C" {
4114 #[doc = " Gets the Joiner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The joiner state."]
4115 pub fn otJoinerGetState(aInstance: *mut otInstance) -> otJoinerState;
4116}
4117unsafe extern "C" {
4118 #[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."]
4119 pub fn otJoinerGetId(aInstance: *mut otInstance) -> *const otExtAddress;
4120}
4121unsafe extern "C" {
4122 #[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."]
4123 pub fn otJoinerSetDiscerner(
4124 aInstance: *mut otInstance,
4125 aDiscerner: *mut otJoinerDiscerner,
4126 ) -> otError;
4127}
4128unsafe extern "C" {
4129 #[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."]
4130 pub fn otJoinerGetDiscerner(aInstance: *mut otInstance) -> *const otJoinerDiscerner;
4131}
4132unsafe extern "C" {
4133 #[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."]
4134 pub fn otJoinerStateToString(aState: otJoinerState) -> *const ::std::os::raw::c_char;
4135}
4136#[doc = " Represents the steering data."]
4137#[repr(C)]
4138#[derive(Debug, Default, Copy, Clone)]
4139pub struct otSteeringData {
4140 #[doc = "< Length of Steering Data (bytes)."]
4141 pub mLength: u8,
4142 #[doc = "< Byte values."]
4143 pub m8: [u8; 16usize],
4144}
4145unsafe extern "C" {
4146 #[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."]
4147 pub fn otSteeringDataInit(aSteeringData: *mut otSteeringData, aLength: u8) -> otError;
4148}
4149unsafe extern "C" {
4150 #[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."]
4151 pub fn otSteeringDataIsValid(aSteeringData: *const otSteeringData) -> bool;
4152}
4153unsafe extern "C" {
4154 #[doc = " Sets the Steering Data to permit all joiners.\n\n @param[out] aSteeringData The Steering Data to update."]
4155 pub fn otSteeringDataSetToPermitAllJoiners(aSteeringData: *mut otSteeringData);
4156}
4157unsafe extern "C" {
4158 #[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)."]
4159 pub fn otSteeringDataUpdateWithJoinerId(
4160 aSteeringData: *mut otSteeringData,
4161 aJoinerId: *const otExtAddress,
4162 ) -> otError;
4163}
4164unsafe extern "C" {
4165 #[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)."]
4166 pub fn otSteeringDataUpdateWithDiscerner(
4167 aSteeringData: *mut otSteeringData,
4168 aDiscerner: *const otJoinerDiscerner,
4169 ) -> otError;
4170}
4171unsafe extern "C" {
4172 #[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."]
4173 pub fn otSteeringDataMerge(
4174 aSteeringData: *mut otSteeringData,
4175 aOtherSteeringData: *const otSteeringData,
4176 ) -> otError;
4177}
4178unsafe extern "C" {
4179 #[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."]
4180 pub fn otSteeringDataPermitsAllJoiners(aSteeringData: *const otSteeringData) -> bool;
4181}
4182unsafe extern "C" {
4183 #[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."]
4184 pub fn otSteeringDataIsEmpty(aSteeringData: *const otSteeringData) -> bool;
4185}
4186unsafe extern "C" {
4187 #[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."]
4188 pub fn otSteeringDataContainsJoinerId(
4189 aSteeringData: *const otSteeringData,
4190 aJoinerId: *const otExtAddress,
4191 ) -> bool;
4192}
4193unsafe extern "C" {
4194 #[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."]
4195 pub fn otSteeringDataContainsDiscerner(
4196 aSteeringData: *const otSteeringData,
4197 aDiscerner: *const otJoinerDiscerner,
4198 ) -> bool;
4199}
4200#[doc = "< Commissioner role is disabled."]
4201pub const OT_COMMISSIONER_STATE_DISABLED: otCommissionerState = 0;
4202#[doc = "< Currently petitioning to become a Commissioner."]
4203pub const OT_COMMISSIONER_STATE_PETITION: otCommissionerState = 1;
4204#[doc = "< Commissioner role is active."]
4205pub const OT_COMMISSIONER_STATE_ACTIVE: otCommissionerState = 2;
4206#[doc = " Defines the Commissioner State."]
4207pub type otCommissionerState = ::std::os::raw::c_uint;
4208pub const OT_COMMISSIONER_JOINER_START: otCommissionerJoinerEvent = 0;
4209pub const OT_COMMISSIONER_JOINER_CONNECTED: otCommissionerJoinerEvent = 1;
4210pub const OT_COMMISSIONER_JOINER_FINALIZE: otCommissionerJoinerEvent = 2;
4211pub const OT_COMMISSIONER_JOINER_END: otCommissionerJoinerEvent = 3;
4212pub const OT_COMMISSIONER_JOINER_REMOVED: otCommissionerJoinerEvent = 4;
4213#[doc = " Defines a Joiner Event on the Commissioner."]
4214pub type otCommissionerJoinerEvent = ::std::os::raw::c_uint;
4215#[doc = " Represents a Commissioning Dataset."]
4216#[repr(C)]
4217#[derive(Debug, Default, Copy, Clone)]
4218pub struct otCommissioningDataset {
4219 #[doc = "< Border Router RLOC16"]
4220 pub mLocator: u16,
4221 #[doc = "< Commissioner Session Id"]
4222 pub mSessionId: u16,
4223 #[doc = "< Steering Data"]
4224 pub mSteeringData: otSteeringData,
4225 #[doc = "< Joiner UDP Port"]
4226 pub mJoinerUdpPort: u16,
4227 pub _bitfield_align_1: [u8; 0],
4228 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4229 pub __bindgen_padding_0: u8,
4230}
4231impl otCommissioningDataset {
4232 #[inline]
4233 pub fn mIsLocatorSet(&self) -> bool {
4234 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4235 }
4236 #[inline]
4237 pub fn set_mIsLocatorSet(&mut self, val: bool) {
4238 unsafe {
4239 let val: u8 = ::std::mem::transmute(val);
4240 self._bitfield_1.set(0usize, 1u8, val as u64)
4241 }
4242 }
4243 #[inline]
4244 pub unsafe fn mIsLocatorSet_raw(this: *const Self) -> bool {
4245 unsafe {
4246 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4247 ::std::ptr::addr_of!((*this)._bitfield_1),
4248 0usize,
4249 1u8,
4250 ) as u8)
4251 }
4252 }
4253 #[inline]
4254 pub unsafe fn set_mIsLocatorSet_raw(this: *mut Self, val: bool) {
4255 unsafe {
4256 let val: u8 = ::std::mem::transmute(val);
4257 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4258 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4259 0usize,
4260 1u8,
4261 val as u64,
4262 )
4263 }
4264 }
4265 #[inline]
4266 pub fn mIsSessionIdSet(&self) -> bool {
4267 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
4268 }
4269 #[inline]
4270 pub fn set_mIsSessionIdSet(&mut self, val: bool) {
4271 unsafe {
4272 let val: u8 = ::std::mem::transmute(val);
4273 self._bitfield_1.set(1usize, 1u8, val as u64)
4274 }
4275 }
4276 #[inline]
4277 pub unsafe fn mIsSessionIdSet_raw(this: *const Self) -> bool {
4278 unsafe {
4279 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4280 ::std::ptr::addr_of!((*this)._bitfield_1),
4281 1usize,
4282 1u8,
4283 ) as u8)
4284 }
4285 }
4286 #[inline]
4287 pub unsafe fn set_mIsSessionIdSet_raw(this: *mut Self, val: bool) {
4288 unsafe {
4289 let val: u8 = ::std::mem::transmute(val);
4290 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4291 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4292 1usize,
4293 1u8,
4294 val as u64,
4295 )
4296 }
4297 }
4298 #[inline]
4299 pub fn mIsSteeringDataSet(&self) -> bool {
4300 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4301 }
4302 #[inline]
4303 pub fn set_mIsSteeringDataSet(&mut self, val: bool) {
4304 unsafe {
4305 let val: u8 = ::std::mem::transmute(val);
4306 self._bitfield_1.set(2usize, 1u8, val as u64)
4307 }
4308 }
4309 #[inline]
4310 pub unsafe fn mIsSteeringDataSet_raw(this: *const Self) -> bool {
4311 unsafe {
4312 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4313 ::std::ptr::addr_of!((*this)._bitfield_1),
4314 2usize,
4315 1u8,
4316 ) as u8)
4317 }
4318 }
4319 #[inline]
4320 pub unsafe fn set_mIsSteeringDataSet_raw(this: *mut Self, val: bool) {
4321 unsafe {
4322 let val: u8 = ::std::mem::transmute(val);
4323 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4324 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4325 2usize,
4326 1u8,
4327 val as u64,
4328 )
4329 }
4330 }
4331 #[inline]
4332 pub fn mIsJoinerUdpPortSet(&self) -> bool {
4333 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4334 }
4335 #[inline]
4336 pub fn set_mIsJoinerUdpPortSet(&mut self, val: bool) {
4337 unsafe {
4338 let val: u8 = ::std::mem::transmute(val);
4339 self._bitfield_1.set(3usize, 1u8, val as u64)
4340 }
4341 }
4342 #[inline]
4343 pub unsafe fn mIsJoinerUdpPortSet_raw(this: *const Self) -> bool {
4344 unsafe {
4345 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4346 ::std::ptr::addr_of!((*this)._bitfield_1),
4347 3usize,
4348 1u8,
4349 ) as u8)
4350 }
4351 }
4352 #[inline]
4353 pub unsafe fn set_mIsJoinerUdpPortSet_raw(this: *mut Self, val: bool) {
4354 unsafe {
4355 let val: u8 = ::std::mem::transmute(val);
4356 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4357 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4358 3usize,
4359 1u8,
4360 val as u64,
4361 )
4362 }
4363 }
4364 #[inline]
4365 pub fn mHasExtraTlv(&self) -> bool {
4366 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4367 }
4368 #[inline]
4369 pub fn set_mHasExtraTlv(&mut self, val: bool) {
4370 unsafe {
4371 let val: u8 = ::std::mem::transmute(val);
4372 self._bitfield_1.set(4usize, 1u8, val as u64)
4373 }
4374 }
4375 #[inline]
4376 pub unsafe fn mHasExtraTlv_raw(this: *const Self) -> bool {
4377 unsafe {
4378 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4379 ::std::ptr::addr_of!((*this)._bitfield_1),
4380 4usize,
4381 1u8,
4382 ) as u8)
4383 }
4384 }
4385 #[inline]
4386 pub unsafe fn set_mHasExtraTlv_raw(this: *mut Self, val: bool) {
4387 unsafe {
4388 let val: u8 = ::std::mem::transmute(val);
4389 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4390 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4391 4usize,
4392 1u8,
4393 val as u64,
4394 )
4395 }
4396 }
4397 #[inline]
4398 pub fn new_bitfield_1(
4399 mIsLocatorSet: bool,
4400 mIsSessionIdSet: bool,
4401 mIsSteeringDataSet: bool,
4402 mIsJoinerUdpPortSet: bool,
4403 mHasExtraTlv: bool,
4404 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4405 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4406 __bindgen_bitfield_unit.set(0usize, 1u8, {
4407 let mIsLocatorSet: u8 = unsafe { ::std::mem::transmute(mIsLocatorSet) };
4408 mIsLocatorSet as u64
4409 });
4410 __bindgen_bitfield_unit.set(1usize, 1u8, {
4411 let mIsSessionIdSet: u8 = unsafe { ::std::mem::transmute(mIsSessionIdSet) };
4412 mIsSessionIdSet as u64
4413 });
4414 __bindgen_bitfield_unit.set(2usize, 1u8, {
4415 let mIsSteeringDataSet: u8 = unsafe { ::std::mem::transmute(mIsSteeringDataSet) };
4416 mIsSteeringDataSet as u64
4417 });
4418 __bindgen_bitfield_unit.set(3usize, 1u8, {
4419 let mIsJoinerUdpPortSet: u8 = unsafe { ::std::mem::transmute(mIsJoinerUdpPortSet) };
4420 mIsJoinerUdpPortSet as u64
4421 });
4422 __bindgen_bitfield_unit.set(4usize, 1u8, {
4423 let mHasExtraTlv: u8 = unsafe { ::std::mem::transmute(mHasExtraTlv) };
4424 mHasExtraTlv as u64
4425 });
4426 __bindgen_bitfield_unit
4427 }
4428}
4429#[doc = " Represents a Joiner PSKd."]
4430#[repr(C)]
4431#[derive(Debug, Copy, Clone)]
4432pub struct otJoinerPskd {
4433 #[doc = "< Char string array (must be null terminated - +1 is for null char)."]
4434 pub m8: [::std::os::raw::c_char; 33usize],
4435}
4436impl Default for otJoinerPskd {
4437 fn default() -> Self {
4438 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4439 unsafe {
4440 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4441 s.assume_init()
4442 }
4443 }
4444}
4445#[doc = "< Accept any Joiner (no EUI64 or Discerner is specified)."]
4446pub const OT_JOINER_INFO_TYPE_ANY: otJoinerInfoType = 0;
4447#[doc = "< Joiner EUI-64 is specified (`mSharedId.mEui64` in `otJoinerInfo`)."]
4448pub const OT_JOINER_INFO_TYPE_EUI64: otJoinerInfoType = 1;
4449#[doc = "< Joiner Discerner is specified (`mSharedId.mDiscerner` in `otJoinerInfo`)."]
4450pub const OT_JOINER_INFO_TYPE_DISCERNER: otJoinerInfoType = 2;
4451#[doc = " Defines a Joiner Info Type."]
4452pub type otJoinerInfoType = ::std::os::raw::c_uint;
4453#[doc = " Represents a Joiner Info."]
4454#[repr(C)]
4455#[derive(Copy, Clone)]
4456pub struct otJoinerInfo {
4457 #[doc = "< Joiner type."]
4458 pub mType: otJoinerInfoType,
4459 #[doc = "< Shared fields"]
4460 pub mSharedId: otJoinerInfo__bindgen_ty_1,
4461 #[doc = "< Joiner PSKd"]
4462 pub mPskd: otJoinerPskd,
4463 #[doc = "< Joiner expiration time in msec"]
4464 pub mExpirationTime: u32,
4465}
4466#[repr(C)]
4467#[derive(Copy, Clone)]
4468pub union otJoinerInfo__bindgen_ty_1 {
4469 #[doc = "< Joiner EUI64 (when `mType` is `OT_JOINER_INFO_TYPE_EUI64`)"]
4470 pub mEui64: otExtAddress,
4471 #[doc = "< Joiner Discerner (when `mType` is `OT_JOINER_INFO_TYPE_DISCERNER`)"]
4472 pub mDiscerner: otJoinerDiscerner,
4473}
4474impl Default for otJoinerInfo__bindgen_ty_1 {
4475 fn default() -> Self {
4476 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4477 unsafe {
4478 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4479 s.assume_init()
4480 }
4481 }
4482}
4483impl Default for otJoinerInfo {
4484 fn default() -> Self {
4485 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4486 unsafe {
4487 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4488 s.assume_init()
4489 }
4490 }
4491}
4492#[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."]
4493pub type otCommissionerStateCallback = ::std::option::Option<
4494 unsafe extern "C" fn(aState: otCommissionerState, aContext: *mut ::std::os::raw::c_void),
4495>;
4496#[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."]
4497pub type otCommissionerJoinerCallback = ::std::option::Option<
4498 unsafe extern "C" fn(
4499 aEvent: otCommissionerJoinerEvent,
4500 aJoinerInfo: *const otJoinerInfo,
4501 aJoinerId: *const otExtAddress,
4502 aContext: *mut ::std::os::raw::c_void,
4503 ),
4504>;
4505unsafe extern "C" {
4506 #[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."]
4507 pub fn otCommissionerStart(
4508 aInstance: *mut otInstance,
4509 aStateCallback: otCommissionerStateCallback,
4510 aJoinerCallback: otCommissionerJoinerCallback,
4511 aCallbackContext: *mut ::std::os::raw::c_void,
4512 ) -> otError;
4513}
4514unsafe extern "C" {
4515 #[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."]
4516 pub fn otCommissionerStop(aInstance: *mut otInstance) -> otError;
4517}
4518unsafe extern "C" {
4519 #[doc = " Returns the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Commissioner Id."]
4520 pub fn otCommissionerGetId(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
4521}
4522unsafe extern "C" {
4523 #[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."]
4524 pub fn otCommissionerSetId(
4525 aInstance: *mut otInstance,
4526 aId: *const ::std::os::raw::c_char,
4527 ) -> otError;
4528}
4529unsafe extern "C" {
4530 #[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()."]
4531 pub fn otCommissionerAddJoiner(
4532 aInstance: *mut otInstance,
4533 aEui64: *const otExtAddress,
4534 aPskd: *const ::std::os::raw::c_char,
4535 aTimeout: u32,
4536 ) -> otError;
4537}
4538unsafe extern "C" {
4539 #[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()."]
4540 pub fn otCommissionerAddJoinerWithDiscerner(
4541 aInstance: *mut otInstance,
4542 aDiscerner: *const otJoinerDiscerner,
4543 aPskd: *const ::std::os::raw::c_char,
4544 aTimeout: u32,
4545 ) -> otError;
4546}
4547unsafe extern "C" {
4548 #[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."]
4549 pub fn otCommissionerGetNextJoinerInfo(
4550 aInstance: *mut otInstance,
4551 aIterator: *mut u16,
4552 aJoiner: *mut otJoinerInfo,
4553 ) -> otError;
4554}
4555unsafe extern "C" {
4556 #[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()."]
4557 pub fn otCommissionerRemoveJoiner(
4558 aInstance: *mut otInstance,
4559 aEui64: *const otExtAddress,
4560 ) -> otError;
4561}
4562unsafe extern "C" {
4563 #[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()."]
4564 pub fn otCommissionerRemoveJoinerWithDiscerner(
4565 aInstance: *mut otInstance,
4566 aDiscerner: *const otJoinerDiscerner,
4567 ) -> otError;
4568}
4569unsafe extern "C" {
4570 #[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."]
4571 pub fn otCommissionerGetProvisioningUrl(
4572 aInstance: *mut otInstance,
4573 ) -> *const ::std::os::raw::c_char;
4574}
4575unsafe extern "C" {
4576 #[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)."]
4577 pub fn otCommissionerSetProvisioningUrl(
4578 aInstance: *mut otInstance,
4579 aProvisioningUrl: *const ::std::os::raw::c_char,
4580 ) -> otError;
4581}
4582unsafe extern "C" {
4583 #[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()."]
4584 pub fn otCommissionerAnnounceBegin(
4585 aInstance: *mut otInstance,
4586 aChannelMask: u32,
4587 aCount: u8,
4588 aPeriod: u16,
4589 aAddress: *const otIp6Address,
4590 ) -> otError;
4591}
4592#[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."]
4593pub type otCommissionerEnergyReportCallback = ::std::option::Option<
4594 unsafe extern "C" fn(
4595 aChannelMask: u32,
4596 aEnergyList: *const u8,
4597 aEnergyListLength: u8,
4598 aContext: *mut ::std::os::raw::c_void,
4599 ),
4600>;
4601unsafe extern "C" {
4602 #[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()."]
4603 pub fn otCommissionerEnergyScan(
4604 aInstance: *mut otInstance,
4605 aChannelMask: u32,
4606 aCount: u8,
4607 aPeriod: u16,
4608 aScanDuration: u16,
4609 aAddress: *const otIp6Address,
4610 aCallback: otCommissionerEnergyReportCallback,
4611 aContext: *mut ::std::os::raw::c_void,
4612 ) -> otError;
4613}
4614#[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."]
4615pub type otCommissionerPanIdConflictCallback = ::std::option::Option<
4616 unsafe extern "C" fn(aPanId: u16, aChannelMask: u32, aContext: *mut ::std::os::raw::c_void),
4617>;
4618unsafe extern "C" {
4619 #[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()."]
4620 pub fn otCommissionerPanIdQuery(
4621 aInstance: *mut otInstance,
4622 aPanId: u16,
4623 aChannelMask: u32,
4624 aAddress: *const otIp6Address,
4625 aCallback: otCommissionerPanIdConflictCallback,
4626 aContext: *mut ::std::os::raw::c_void,
4627 ) -> otError;
4628}
4629unsafe extern "C" {
4630 #[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."]
4631 pub fn otCommissionerSendMgmtGet(
4632 aInstance: *mut otInstance,
4633 aTlvs: *const u8,
4634 aLength: u8,
4635 ) -> otError;
4636}
4637unsafe extern "C" {
4638 #[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."]
4639 pub fn otCommissionerSendMgmtSet(
4640 aInstance: *mut otInstance,
4641 aDataset: *const otCommissioningDataset,
4642 aTlvs: *const u8,
4643 aLength: u8,
4644 ) -> otError;
4645}
4646unsafe extern "C" {
4647 #[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."]
4648 pub fn otCommissionerGetSessionId(aInstance: *mut otInstance) -> u16;
4649}
4650unsafe extern "C" {
4651 #[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."]
4652 pub fn otCommissionerGetState(aInstance: *mut otInstance) -> otCommissionerState;
4653}
4654pub type otNetworkDataIterator = u32;
4655#[doc = " Represents a Border Router configuration."]
4656#[repr(C)]
4657#[repr(align(4))]
4658#[derive(Copy, Clone)]
4659pub struct otBorderRouterConfig {
4660 #[doc = "< The IPv6 prefix."]
4661 pub mPrefix: otIp6Prefix,
4662 pub _bitfield_align_1: [u8; 0],
4663 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
4664 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4665 pub mRloc16: u16,
4666}
4667impl Default for otBorderRouterConfig {
4668 fn default() -> Self {
4669 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4670 unsafe {
4671 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4672 s.assume_init()
4673 }
4674 }
4675}
4676impl otBorderRouterConfig {
4677 #[inline]
4678 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4679 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4680 }
4681 #[inline]
4682 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4683 unsafe {
4684 let val: u32 = ::std::mem::transmute(val);
4685 self._bitfield_1.set(0usize, 2u8, val as u64)
4686 }
4687 }
4688 #[inline]
4689 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4690 unsafe {
4691 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4692 ::std::ptr::addr_of!((*this)._bitfield_1),
4693 0usize,
4694 2u8,
4695 ) as u32)
4696 }
4697 }
4698 #[inline]
4699 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4700 unsafe {
4701 let val: u32 = ::std::mem::transmute(val);
4702 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4703 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4704 0usize,
4705 2u8,
4706 val as u64,
4707 )
4708 }
4709 }
4710 #[inline]
4711 pub fn mPreferred(&self) -> bool {
4712 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4713 }
4714 #[inline]
4715 pub fn set_mPreferred(&mut self, val: bool) {
4716 unsafe {
4717 let val: u8 = ::std::mem::transmute(val);
4718 self._bitfield_1.set(2usize, 1u8, val as u64)
4719 }
4720 }
4721 #[inline]
4722 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
4723 unsafe {
4724 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4725 ::std::ptr::addr_of!((*this)._bitfield_1),
4726 2usize,
4727 1u8,
4728 ) as u8)
4729 }
4730 }
4731 #[inline]
4732 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
4733 unsafe {
4734 let val: u8 = ::std::mem::transmute(val);
4735 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4736 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4737 2usize,
4738 1u8,
4739 val as u64,
4740 )
4741 }
4742 }
4743 #[inline]
4744 pub fn mSlaac(&self) -> bool {
4745 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4746 }
4747 #[inline]
4748 pub fn set_mSlaac(&mut self, val: bool) {
4749 unsafe {
4750 let val: u8 = ::std::mem::transmute(val);
4751 self._bitfield_1.set(3usize, 1u8, val as u64)
4752 }
4753 }
4754 #[inline]
4755 pub unsafe fn mSlaac_raw(this: *const Self) -> bool {
4756 unsafe {
4757 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4758 ::std::ptr::addr_of!((*this)._bitfield_1),
4759 3usize,
4760 1u8,
4761 ) as u8)
4762 }
4763 }
4764 #[inline]
4765 pub unsafe fn set_mSlaac_raw(this: *mut Self, val: bool) {
4766 unsafe {
4767 let val: u8 = ::std::mem::transmute(val);
4768 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4769 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4770 3usize,
4771 1u8,
4772 val as u64,
4773 )
4774 }
4775 }
4776 #[inline]
4777 pub fn mDhcp(&self) -> bool {
4778 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4779 }
4780 #[inline]
4781 pub fn set_mDhcp(&mut self, val: bool) {
4782 unsafe {
4783 let val: u8 = ::std::mem::transmute(val);
4784 self._bitfield_1.set(4usize, 1u8, val as u64)
4785 }
4786 }
4787 #[inline]
4788 pub unsafe fn mDhcp_raw(this: *const Self) -> bool {
4789 unsafe {
4790 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4791 ::std::ptr::addr_of!((*this)._bitfield_1),
4792 4usize,
4793 1u8,
4794 ) as u8)
4795 }
4796 }
4797 #[inline]
4798 pub unsafe fn set_mDhcp_raw(this: *mut Self, val: bool) {
4799 unsafe {
4800 let val: u8 = ::std::mem::transmute(val);
4801 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4802 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4803 4usize,
4804 1u8,
4805 val as u64,
4806 )
4807 }
4808 }
4809 #[inline]
4810 pub fn mConfigure(&self) -> bool {
4811 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4812 }
4813 #[inline]
4814 pub fn set_mConfigure(&mut self, val: bool) {
4815 unsafe {
4816 let val: u8 = ::std::mem::transmute(val);
4817 self._bitfield_1.set(5usize, 1u8, val as u64)
4818 }
4819 }
4820 #[inline]
4821 pub unsafe fn mConfigure_raw(this: *const Self) -> bool {
4822 unsafe {
4823 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4824 ::std::ptr::addr_of!((*this)._bitfield_1),
4825 5usize,
4826 1u8,
4827 ) as u8)
4828 }
4829 }
4830 #[inline]
4831 pub unsafe fn set_mConfigure_raw(this: *mut Self, val: bool) {
4832 unsafe {
4833 let val: u8 = ::std::mem::transmute(val);
4834 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4835 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4836 5usize,
4837 1u8,
4838 val as u64,
4839 )
4840 }
4841 }
4842 #[inline]
4843 pub fn mDefaultRoute(&self) -> bool {
4844 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
4845 }
4846 #[inline]
4847 pub fn set_mDefaultRoute(&mut self, val: bool) {
4848 unsafe {
4849 let val: u8 = ::std::mem::transmute(val);
4850 self._bitfield_1.set(6usize, 1u8, val as u64)
4851 }
4852 }
4853 #[inline]
4854 pub unsafe fn mDefaultRoute_raw(this: *const Self) -> bool {
4855 unsafe {
4856 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4857 ::std::ptr::addr_of!((*this)._bitfield_1),
4858 6usize,
4859 1u8,
4860 ) as u8)
4861 }
4862 }
4863 #[inline]
4864 pub unsafe fn set_mDefaultRoute_raw(this: *mut Self, val: bool) {
4865 unsafe {
4866 let val: u8 = ::std::mem::transmute(val);
4867 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4868 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4869 6usize,
4870 1u8,
4871 val as u64,
4872 )
4873 }
4874 }
4875 #[inline]
4876 pub fn mOnMesh(&self) -> bool {
4877 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
4878 }
4879 #[inline]
4880 pub fn set_mOnMesh(&mut self, val: bool) {
4881 unsafe {
4882 let val: u8 = ::std::mem::transmute(val);
4883 self._bitfield_1.set(7usize, 1u8, val as u64)
4884 }
4885 }
4886 #[inline]
4887 pub unsafe fn mOnMesh_raw(this: *const Self) -> bool {
4888 unsafe {
4889 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4890 ::std::ptr::addr_of!((*this)._bitfield_1),
4891 7usize,
4892 1u8,
4893 ) as u8)
4894 }
4895 }
4896 #[inline]
4897 pub unsafe fn set_mOnMesh_raw(this: *mut Self, val: bool) {
4898 unsafe {
4899 let val: u8 = ::std::mem::transmute(val);
4900 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4901 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4902 7usize,
4903 1u8,
4904 val as u64,
4905 )
4906 }
4907 }
4908 #[inline]
4909 pub fn mStable(&self) -> bool {
4910 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
4911 }
4912 #[inline]
4913 pub fn set_mStable(&mut self, val: bool) {
4914 unsafe {
4915 let val: u8 = ::std::mem::transmute(val);
4916 self._bitfield_1.set(8usize, 1u8, val as u64)
4917 }
4918 }
4919 #[inline]
4920 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4921 unsafe {
4922 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4923 ::std::ptr::addr_of!((*this)._bitfield_1),
4924 8usize,
4925 1u8,
4926 ) as u8)
4927 }
4928 }
4929 #[inline]
4930 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4931 unsafe {
4932 let val: u8 = ::std::mem::transmute(val);
4933 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4934 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4935 8usize,
4936 1u8,
4937 val as u64,
4938 )
4939 }
4940 }
4941 #[inline]
4942 pub fn mNdDns(&self) -> bool {
4943 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
4944 }
4945 #[inline]
4946 pub fn set_mNdDns(&mut self, val: bool) {
4947 unsafe {
4948 let val: u8 = ::std::mem::transmute(val);
4949 self._bitfield_1.set(9usize, 1u8, val as u64)
4950 }
4951 }
4952 #[inline]
4953 pub unsafe fn mNdDns_raw(this: *const Self) -> bool {
4954 unsafe {
4955 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4956 ::std::ptr::addr_of!((*this)._bitfield_1),
4957 9usize,
4958 1u8,
4959 ) as u8)
4960 }
4961 }
4962 #[inline]
4963 pub unsafe fn set_mNdDns_raw(this: *mut Self, val: bool) {
4964 unsafe {
4965 let val: u8 = ::std::mem::transmute(val);
4966 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4967 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4968 9usize,
4969 1u8,
4970 val as u64,
4971 )
4972 }
4973 }
4974 #[inline]
4975 pub fn mDp(&self) -> bool {
4976 unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
4977 }
4978 #[inline]
4979 pub fn set_mDp(&mut self, val: bool) {
4980 unsafe {
4981 let val: u8 = ::std::mem::transmute(val);
4982 self._bitfield_1.set(10usize, 1u8, val as u64)
4983 }
4984 }
4985 #[inline]
4986 pub unsafe fn mDp_raw(this: *const Self) -> bool {
4987 unsafe {
4988 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4989 ::std::ptr::addr_of!((*this)._bitfield_1),
4990 10usize,
4991 1u8,
4992 ) as u8)
4993 }
4994 }
4995 #[inline]
4996 pub unsafe fn set_mDp_raw(this: *mut Self, val: bool) {
4997 unsafe {
4998 let val: u8 = ::std::mem::transmute(val);
4999 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
5000 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5001 10usize,
5002 1u8,
5003 val as u64,
5004 )
5005 }
5006 }
5007 #[inline]
5008 pub fn new_bitfield_1(
5009 mPreference: ::std::os::raw::c_int,
5010 mPreferred: bool,
5011 mSlaac: bool,
5012 mDhcp: bool,
5013 mConfigure: bool,
5014 mDefaultRoute: bool,
5015 mOnMesh: bool,
5016 mStable: bool,
5017 mNdDns: bool,
5018 mDp: bool,
5019 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
5020 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
5021 __bindgen_bitfield_unit.set(0usize, 2u8, {
5022 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
5023 mPreference as u64
5024 });
5025 __bindgen_bitfield_unit.set(2usize, 1u8, {
5026 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
5027 mPreferred as u64
5028 });
5029 __bindgen_bitfield_unit.set(3usize, 1u8, {
5030 let mSlaac: u8 = unsafe { ::std::mem::transmute(mSlaac) };
5031 mSlaac as u64
5032 });
5033 __bindgen_bitfield_unit.set(4usize, 1u8, {
5034 let mDhcp: u8 = unsafe { ::std::mem::transmute(mDhcp) };
5035 mDhcp as u64
5036 });
5037 __bindgen_bitfield_unit.set(5usize, 1u8, {
5038 let mConfigure: u8 = unsafe { ::std::mem::transmute(mConfigure) };
5039 mConfigure as u64
5040 });
5041 __bindgen_bitfield_unit.set(6usize, 1u8, {
5042 let mDefaultRoute: u8 = unsafe { ::std::mem::transmute(mDefaultRoute) };
5043 mDefaultRoute as u64
5044 });
5045 __bindgen_bitfield_unit.set(7usize, 1u8, {
5046 let mOnMesh: u8 = unsafe { ::std::mem::transmute(mOnMesh) };
5047 mOnMesh as u64
5048 });
5049 __bindgen_bitfield_unit.set(8usize, 1u8, {
5050 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5051 mStable as u64
5052 });
5053 __bindgen_bitfield_unit.set(9usize, 1u8, {
5054 let mNdDns: u8 = unsafe { ::std::mem::transmute(mNdDns) };
5055 mNdDns as u64
5056 });
5057 __bindgen_bitfield_unit.set(10usize, 1u8, {
5058 let mDp: u8 = unsafe { ::std::mem::transmute(mDp) };
5059 mDp as u64
5060 });
5061 __bindgen_bitfield_unit
5062 }
5063}
5064#[doc = " Represents 6LoWPAN Context ID information associated with a prefix in Network Data."]
5065#[repr(C)]
5066#[derive(Copy, Clone)]
5067pub struct otLowpanContextInfo {
5068 #[doc = "< The 6LoWPAN Context ID."]
5069 pub mContextId: u8,
5070 pub _bitfield_align_1: [u8; 0],
5071 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5072 #[doc = "< The associated IPv6 prefix."]
5073 pub mPrefix: otIp6Prefix,
5074}
5075impl Default for otLowpanContextInfo {
5076 fn default() -> Self {
5077 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5078 unsafe {
5079 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5080 s.assume_init()
5081 }
5082 }
5083}
5084impl otLowpanContextInfo {
5085 #[inline]
5086 pub fn mCompressFlag(&self) -> bool {
5087 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
5088 }
5089 #[inline]
5090 pub fn set_mCompressFlag(&mut self, val: bool) {
5091 unsafe {
5092 let val: u8 = ::std::mem::transmute(val);
5093 self._bitfield_1.set(0usize, 1u8, val as u64)
5094 }
5095 }
5096 #[inline]
5097 pub unsafe fn mCompressFlag_raw(this: *const Self) -> bool {
5098 unsafe {
5099 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5100 ::std::ptr::addr_of!((*this)._bitfield_1),
5101 0usize,
5102 1u8,
5103 ) as u8)
5104 }
5105 }
5106 #[inline]
5107 pub unsafe fn set_mCompressFlag_raw(this: *mut Self, val: bool) {
5108 unsafe {
5109 let val: u8 = ::std::mem::transmute(val);
5110 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5111 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5112 0usize,
5113 1u8,
5114 val as u64,
5115 )
5116 }
5117 }
5118 #[inline]
5119 pub fn mStable(&self) -> bool {
5120 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
5121 }
5122 #[inline]
5123 pub fn set_mStable(&mut self, val: bool) {
5124 unsafe {
5125 let val: u8 = ::std::mem::transmute(val);
5126 self._bitfield_1.set(1usize, 1u8, val as u64)
5127 }
5128 }
5129 #[inline]
5130 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5131 unsafe {
5132 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5133 ::std::ptr::addr_of!((*this)._bitfield_1),
5134 1usize,
5135 1u8,
5136 ) as u8)
5137 }
5138 }
5139 #[inline]
5140 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5141 unsafe {
5142 let val: u8 = ::std::mem::transmute(val);
5143 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5144 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5145 1usize,
5146 1u8,
5147 val as u64,
5148 )
5149 }
5150 }
5151 #[inline]
5152 pub fn new_bitfield_1(
5153 mCompressFlag: bool,
5154 mStable: bool,
5155 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5156 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5157 __bindgen_bitfield_unit.set(0usize, 1u8, {
5158 let mCompressFlag: u8 = unsafe { ::std::mem::transmute(mCompressFlag) };
5159 mCompressFlag as u64
5160 });
5161 __bindgen_bitfield_unit.set(1usize, 1u8, {
5162 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5163 mStable as u64
5164 });
5165 __bindgen_bitfield_unit
5166 }
5167}
5168#[doc = " Represents an External Route configuration."]
5169#[repr(C)]
5170#[repr(align(4))]
5171#[derive(Copy, Clone)]
5172pub struct otExternalRouteConfig {
5173 #[doc = "< The IPv6 prefix."]
5174 pub mPrefix: otIp6Prefix,
5175 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
5176 pub mRloc16: u16,
5177 pub _bitfield_align_1: [u8; 0],
5178 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5179 pub __bindgen_padding_0: [u8; 3usize],
5180}
5181impl Default for otExternalRouteConfig {
5182 fn default() -> Self {
5183 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5184 unsafe {
5185 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5186 s.assume_init()
5187 }
5188 }
5189}
5190impl otExternalRouteConfig {
5191 #[inline]
5192 pub fn mPreference(&self) -> ::std::os::raw::c_int {
5193 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
5194 }
5195 #[inline]
5196 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
5197 unsafe {
5198 let val: u32 = ::std::mem::transmute(val);
5199 self._bitfield_1.set(0usize, 2u8, val as u64)
5200 }
5201 }
5202 #[inline]
5203 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
5204 unsafe {
5205 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5206 ::std::ptr::addr_of!((*this)._bitfield_1),
5207 0usize,
5208 2u8,
5209 ) as u32)
5210 }
5211 }
5212 #[inline]
5213 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
5214 unsafe {
5215 let val: u32 = ::std::mem::transmute(val);
5216 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5217 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5218 0usize,
5219 2u8,
5220 val as u64,
5221 )
5222 }
5223 }
5224 #[inline]
5225 pub fn mNat64(&self) -> bool {
5226 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
5227 }
5228 #[inline]
5229 pub fn set_mNat64(&mut self, val: bool) {
5230 unsafe {
5231 let val: u8 = ::std::mem::transmute(val);
5232 self._bitfield_1.set(2usize, 1u8, val as u64)
5233 }
5234 }
5235 #[inline]
5236 pub unsafe fn mNat64_raw(this: *const Self) -> bool {
5237 unsafe {
5238 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5239 ::std::ptr::addr_of!((*this)._bitfield_1),
5240 2usize,
5241 1u8,
5242 ) as u8)
5243 }
5244 }
5245 #[inline]
5246 pub unsafe fn set_mNat64_raw(this: *mut Self, val: bool) {
5247 unsafe {
5248 let val: u8 = ::std::mem::transmute(val);
5249 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5250 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5251 2usize,
5252 1u8,
5253 val as u64,
5254 )
5255 }
5256 }
5257 #[inline]
5258 pub fn mStable(&self) -> bool {
5259 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
5260 }
5261 #[inline]
5262 pub fn set_mStable(&mut self, val: bool) {
5263 unsafe {
5264 let val: u8 = ::std::mem::transmute(val);
5265 self._bitfield_1.set(3usize, 1u8, val as u64)
5266 }
5267 }
5268 #[inline]
5269 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5270 unsafe {
5271 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5272 ::std::ptr::addr_of!((*this)._bitfield_1),
5273 3usize,
5274 1u8,
5275 ) as u8)
5276 }
5277 }
5278 #[inline]
5279 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5280 unsafe {
5281 let val: u8 = ::std::mem::transmute(val);
5282 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5283 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5284 3usize,
5285 1u8,
5286 val as u64,
5287 )
5288 }
5289 }
5290 #[inline]
5291 pub fn mNextHopIsThisDevice(&self) -> bool {
5292 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
5293 }
5294 #[inline]
5295 pub fn set_mNextHopIsThisDevice(&mut self, val: bool) {
5296 unsafe {
5297 let val: u8 = ::std::mem::transmute(val);
5298 self._bitfield_1.set(4usize, 1u8, val as u64)
5299 }
5300 }
5301 #[inline]
5302 pub unsafe fn mNextHopIsThisDevice_raw(this: *const Self) -> bool {
5303 unsafe {
5304 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5305 ::std::ptr::addr_of!((*this)._bitfield_1),
5306 4usize,
5307 1u8,
5308 ) as u8)
5309 }
5310 }
5311 #[inline]
5312 pub unsafe fn set_mNextHopIsThisDevice_raw(this: *mut Self, val: bool) {
5313 unsafe {
5314 let val: u8 = ::std::mem::transmute(val);
5315 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5316 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5317 4usize,
5318 1u8,
5319 val as u64,
5320 )
5321 }
5322 }
5323 #[inline]
5324 pub fn mAdvPio(&self) -> bool {
5325 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
5326 }
5327 #[inline]
5328 pub fn set_mAdvPio(&mut self, val: bool) {
5329 unsafe {
5330 let val: u8 = ::std::mem::transmute(val);
5331 self._bitfield_1.set(5usize, 1u8, val as u64)
5332 }
5333 }
5334 #[inline]
5335 pub unsafe fn mAdvPio_raw(this: *const Self) -> bool {
5336 unsafe {
5337 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5338 ::std::ptr::addr_of!((*this)._bitfield_1),
5339 5usize,
5340 1u8,
5341 ) as u8)
5342 }
5343 }
5344 #[inline]
5345 pub unsafe fn set_mAdvPio_raw(this: *mut Self, val: bool) {
5346 unsafe {
5347 let val: u8 = ::std::mem::transmute(val);
5348 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5349 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5350 5usize,
5351 1u8,
5352 val as u64,
5353 )
5354 }
5355 }
5356 #[inline]
5357 pub fn new_bitfield_1(
5358 mPreference: ::std::os::raw::c_int,
5359 mNat64: bool,
5360 mStable: bool,
5361 mNextHopIsThisDevice: bool,
5362 mAdvPio: bool,
5363 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5364 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5365 __bindgen_bitfield_unit.set(0usize, 2u8, {
5366 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
5367 mPreference as u64
5368 });
5369 __bindgen_bitfield_unit.set(2usize, 1u8, {
5370 let mNat64: u8 = unsafe { ::std::mem::transmute(mNat64) };
5371 mNat64 as u64
5372 });
5373 __bindgen_bitfield_unit.set(3usize, 1u8, {
5374 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5375 mStable as u64
5376 });
5377 __bindgen_bitfield_unit.set(4usize, 1u8, {
5378 let mNextHopIsThisDevice: u8 = unsafe { ::std::mem::transmute(mNextHopIsThisDevice) };
5379 mNextHopIsThisDevice as u64
5380 });
5381 __bindgen_bitfield_unit.set(5usize, 1u8, {
5382 let mAdvPio: u8 = unsafe { ::std::mem::transmute(mAdvPio) };
5383 mAdvPio as u64
5384 });
5385 __bindgen_bitfield_unit
5386 }
5387}
5388#[doc = "< Low route preference."]
5389pub const OT_ROUTE_PREFERENCE_LOW: otRoutePreference = -1;
5390#[doc = "< Medium route preference."]
5391pub const OT_ROUTE_PREFERENCE_MED: otRoutePreference = 0;
5392#[doc = "< High route preference."]
5393pub const OT_ROUTE_PREFERENCE_HIGH: otRoutePreference = 1;
5394#[doc = " Defines valid values for `mPreference` in `otExternalRouteConfig` and `otBorderRouterConfig`."]
5395pub type otRoutePreference = ::std::os::raw::c_int;
5396#[doc = " Represents a Server configuration."]
5397#[repr(C)]
5398#[derive(Debug, Copy, Clone)]
5399pub struct otServerConfig {
5400 pub _bitfield_align_1: [u8; 0],
5401 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5402 #[doc = "< Length of server data."]
5403 pub mServerDataLength: u8,
5404 #[doc = "< Server data bytes."]
5405 pub mServerData: [u8; 248usize],
5406 #[doc = "< The Server RLOC16."]
5407 pub mRloc16: u16,
5408}
5409impl Default for otServerConfig {
5410 fn default() -> Self {
5411 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5412 unsafe {
5413 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5414 s.assume_init()
5415 }
5416 }
5417}
5418impl otServerConfig {
5419 #[inline]
5420 pub fn mStable(&self) -> bool {
5421 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
5422 }
5423 #[inline]
5424 pub fn set_mStable(&mut self, val: bool) {
5425 unsafe {
5426 let val: u8 = ::std::mem::transmute(val);
5427 self._bitfield_1.set(0usize, 1u8, val as u64)
5428 }
5429 }
5430 #[inline]
5431 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5432 unsafe {
5433 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5434 ::std::ptr::addr_of!((*this)._bitfield_1),
5435 0usize,
5436 1u8,
5437 ) as u8)
5438 }
5439 }
5440 #[inline]
5441 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5442 unsafe {
5443 let val: u8 = ::std::mem::transmute(val);
5444 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5445 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5446 0usize,
5447 1u8,
5448 val as u64,
5449 )
5450 }
5451 }
5452 #[inline]
5453 pub fn new_bitfield_1(mStable: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5454 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5455 __bindgen_bitfield_unit.set(0usize, 1u8, {
5456 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5457 mStable as u64
5458 });
5459 __bindgen_bitfield_unit
5460 }
5461}
5462#[doc = " Represents a Service configuration."]
5463#[repr(C)]
5464#[derive(Debug, Copy, Clone)]
5465pub struct otServiceConfig {
5466 #[doc = "< Service ID (when iterating over the Network Data)."]
5467 pub mServiceId: u8,
5468 #[doc = "< IANA Enterprise Number."]
5469 pub mEnterpriseNumber: u32,
5470 #[doc = "< Length of service data."]
5471 pub mServiceDataLength: u8,
5472 #[doc = "< Service data bytes."]
5473 pub mServiceData: [u8; 252usize],
5474 #[doc = "< The Server configuration."]
5475 pub mServerConfig: otServerConfig,
5476}
5477impl Default for otServiceConfig {
5478 fn default() -> Self {
5479 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5480 unsafe {
5481 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5482 s.assume_init()
5483 }
5484 }
5485}
5486unsafe extern "C" {
5487 #[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."]
5488 pub fn otNetDataGet(
5489 aInstance: *mut otInstance,
5490 aStable: bool,
5491 aData: *mut u8,
5492 aDataLength: *mut u8,
5493 ) -> otError;
5494}
5495unsafe extern "C" {
5496 #[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."]
5497 pub fn otNetDataGetLength(aInstance: *mut otInstance) -> u8;
5498}
5499unsafe extern "C" {
5500 #[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)."]
5501 pub fn otNetDataGetMaxLength(aInstance: *mut otInstance) -> u8;
5502}
5503unsafe extern "C" {
5504 #[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"]
5505 pub fn otNetDataResetMaxLength(aInstance: *mut otInstance);
5506}
5507unsafe extern "C" {
5508 #[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."]
5509 pub fn otNetDataGetNextOnMeshPrefix(
5510 aInstance: *mut otInstance,
5511 aIterator: *mut otNetworkDataIterator,
5512 aConfig: *mut otBorderRouterConfig,
5513 ) -> otError;
5514}
5515unsafe extern "C" {
5516 #[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."]
5517 pub fn otNetDataGetNextRoute(
5518 aInstance: *mut otInstance,
5519 aIterator: *mut otNetworkDataIterator,
5520 aConfig: *mut otExternalRouteConfig,
5521 ) -> otError;
5522}
5523unsafe extern "C" {
5524 #[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."]
5525 pub fn otNetDataGetNextService(
5526 aInstance: *mut otInstance,
5527 aIterator: *mut otNetworkDataIterator,
5528 aConfig: *mut otServiceConfig,
5529 ) -> otError;
5530}
5531unsafe extern "C" {
5532 #[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."]
5533 pub fn otNetDataGetNextLowpanContextInfo(
5534 aInstance: *mut otInstance,
5535 aIterator: *mut otNetworkDataIterator,
5536 aContextInfo: *mut otLowpanContextInfo,
5537 ) -> otError;
5538}
5539unsafe extern "C" {
5540 #[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."]
5541 pub fn otNetDataGetCommissioningDataset(
5542 aInstance: *mut otInstance,
5543 aDataset: *mut otCommissioningDataset,
5544 );
5545}
5546unsafe extern "C" {
5547 #[doc = " Get the Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Network Data Version."]
5548 pub fn otNetDataGetVersion(aInstance: *mut otInstance) -> u8;
5549}
5550unsafe extern "C" {
5551 #[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."]
5552 pub fn otNetDataGetStableVersion(aInstance: *mut otInstance) -> u8;
5553}
5554unsafe extern "C" {
5555 #[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."]
5556 pub fn otNetDataSteeringDataCheckJoiner(
5557 aInstance: *mut otInstance,
5558 aEui64: *const otExtAddress,
5559 ) -> otError;
5560}
5561unsafe extern "C" {
5562 #[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."]
5563 pub fn otNetDataSteeringDataCheckJoinerWithDiscerner(
5564 aInstance: *mut otInstance,
5565 aDiscerner: *const otJoinerDiscerner,
5566 ) -> otError;
5567}
5568unsafe extern "C" {
5569 #[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."]
5570 pub fn otNetDataContainsOmrPrefix(
5571 aInstance: *mut otInstance,
5572 aPrefix: *const otIp6Prefix,
5573 ) -> bool;
5574}
5575unsafe extern "C" {
5576 #[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."]
5577 pub fn otBorderRouterGetNetData(
5578 aInstance: *mut otInstance,
5579 aStable: bool,
5580 aData: *mut u8,
5581 aDataLength: *mut u8,
5582 ) -> otError;
5583}
5584unsafe extern "C" {
5585 #[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"]
5586 pub fn otBorderRouterAddOnMeshPrefix(
5587 aInstance: *mut otInstance,
5588 aConfig: *const otBorderRouterConfig,
5589 ) -> otError;
5590}
5591unsafe extern "C" {
5592 #[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"]
5593 pub fn otBorderRouterRemoveOnMeshPrefix(
5594 aInstance: *mut otInstance,
5595 aPrefix: *const otIp6Prefix,
5596 ) -> otError;
5597}
5598unsafe extern "C" {
5599 #[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."]
5600 pub fn otBorderRouterGetNextOnMeshPrefix(
5601 aInstance: *mut otInstance,
5602 aIterator: *mut otNetworkDataIterator,
5603 aConfig: *mut otBorderRouterConfig,
5604 ) -> otError;
5605}
5606unsafe extern "C" {
5607 #[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"]
5608 pub fn otBorderRouterAddRoute(
5609 aInstance: *mut otInstance,
5610 aConfig: *const otExternalRouteConfig,
5611 ) -> otError;
5612}
5613unsafe extern "C" {
5614 #[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"]
5615 pub fn otBorderRouterRemoveRoute(
5616 aInstance: *mut otInstance,
5617 aPrefix: *const otIp6Prefix,
5618 ) -> otError;
5619}
5620unsafe extern "C" {
5621 #[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."]
5622 pub fn otBorderRouterGetNextRoute(
5623 aInstance: *mut otInstance,
5624 aIterator: *mut otNetworkDataIterator,
5625 aConfig: *mut otExternalRouteConfig,
5626 ) -> otError;
5627}
5628unsafe extern "C" {
5629 #[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"]
5630 pub fn otBorderRouterRegister(aInstance: *mut otInstance) -> otError;
5631}
5632#[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."]
5633pub type otBorderRouterNetDataFullCallback =
5634 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5635unsafe extern "C" {
5636 #[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."]
5637 pub fn otBorderRouterSetNetDataFullCallback(
5638 aInstance: *mut otInstance,
5639 aCallback: otBorderRouterNetDataFullCallback,
5640 aContext: *mut ::std::os::raw::c_void,
5641 );
5642}
5643unsafe extern "C" {
5644 #[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."]
5645 pub fn otChannelManagerRequestChannelChange(aInstance: *mut otInstance, aChannel: u8);
5646}
5647unsafe extern "C" {
5648 #[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."]
5649 pub fn otChannelManagerGetRequestedChannel(aInstance: *mut otInstance) -> u8;
5650}
5651unsafe extern "C" {
5652 #[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."]
5653 pub fn otChannelManagerGetDelay(aInstance: *mut otInstance) -> u16;
5654}
5655unsafe extern "C" {
5656 #[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."]
5657 pub fn otChannelManagerSetDelay(aInstance: *mut otInstance, aDelay: u16) -> otError;
5658}
5659unsafe extern "C" {
5660 #[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."]
5661 pub fn otChannelManagerRequestChannelSelect(
5662 aInstance: *mut otInstance,
5663 aSkipQualityCheck: bool,
5664 ) -> otError;
5665}
5666unsafe extern "C" {
5667 #[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."]
5668 pub fn otChannelManagerRequestCslChannelSelect(
5669 aInstance: *mut otInstance,
5670 aSkipQualityCheck: bool,
5671 ) -> otError;
5672}
5673unsafe extern "C" {
5674 #[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."]
5675 pub fn otChannelManagerSetAutoChannelSelectionEnabled(
5676 aInstance: *mut otInstance,
5677 aEnabled: bool,
5678 );
5679}
5680unsafe extern "C" {
5681 #[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."]
5682 pub fn otChannelManagerGetAutoChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5683}
5684unsafe extern "C" {
5685 #[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."]
5686 pub fn otChannelManagerSetAutoCslChannelSelectionEnabled(
5687 aInstance: *mut otInstance,
5688 aEnabled: bool,
5689 );
5690}
5691unsafe extern "C" {
5692 #[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."]
5693 pub fn otChannelManagerGetAutoCslChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5694}
5695unsafe extern "C" {
5696 #[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)."]
5697 pub fn otChannelManagerSetAutoChannelSelectionInterval(
5698 aInstance: *mut otInstance,
5699 aInterval: u32,
5700 ) -> otError;
5701}
5702unsafe extern "C" {
5703 #[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."]
5704 pub fn otChannelManagerGetAutoChannelSelectionInterval(aInstance: *mut otInstance) -> u32;
5705}
5706unsafe extern "C" {
5707 #[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."]
5708 pub fn otChannelManagerGetSupportedChannels(aInstance: *mut otInstance) -> u32;
5709}
5710unsafe extern "C" {
5711 #[doc = " Sets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5712 pub fn otChannelManagerSetSupportedChannels(aInstance: *mut otInstance, aChannelMask: u32);
5713}
5714unsafe extern "C" {
5715 #[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."]
5716 pub fn otChannelManagerGetFavoredChannels(aInstance: *mut otInstance) -> u32;
5717}
5718unsafe extern "C" {
5719 #[doc = " Sets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5720 pub fn otChannelManagerSetFavoredChannels(aInstance: *mut otInstance, aChannelMask: u32);
5721}
5722unsafe extern "C" {
5723 #[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%."]
5724 pub fn otChannelManagerGetCcaFailureRateThreshold(aInstance: *mut otInstance) -> u16;
5725}
5726unsafe extern "C" {
5727 #[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%."]
5728 pub fn otChannelManagerSetCcaFailureRateThreshold(aInstance: *mut otInstance, aThreshold: u16);
5729}
5730unsafe extern "C" {
5731 #[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."]
5732 pub fn otChannelMonitorSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
5733}
5734unsafe extern "C" {
5735 #[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."]
5736 pub fn otChannelMonitorIsEnabled(aInstance: *mut otInstance) -> bool;
5737}
5738unsafe extern "C" {
5739 #[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."]
5740 pub fn otChannelMonitorGetSampleInterval(aInstance: *mut otInstance) -> u32;
5741}
5742unsafe extern "C" {
5743 #[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."]
5744 pub fn otChannelMonitorGetRssiThreshold(aInstance: *mut otInstance) -> i8;
5745}
5746unsafe extern "C" {
5747 #[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."]
5748 pub fn otChannelMonitorGetSampleWindow(aInstance: *mut otInstance) -> u32;
5749}
5750unsafe extern "C" {
5751 #[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."]
5752 pub fn otChannelMonitorGetSampleCount(aInstance: *mut otInstance) -> u32;
5753}
5754unsafe extern "C" {
5755 #[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."]
5756 pub fn otChannelMonitorGetChannelOccupancy(aInstance: *mut otInstance, aChannel: u8) -> u16;
5757}
5758unsafe extern "C" {
5759 #[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."]
5760 pub fn otChildSupervisionGetInterval(aInstance: *mut otInstance) -> u16;
5761}
5762unsafe extern "C" {
5763 #[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."]
5764 pub fn otChildSupervisionSetInterval(aInstance: *mut otInstance, aInterval: u16);
5765}
5766unsafe extern "C" {
5767 #[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."]
5768 pub fn otChildSupervisionGetCheckTimeout(aInstance: *mut otInstance) -> u16;
5769}
5770unsafe extern "C" {
5771 #[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."]
5772 pub fn otChildSupervisionSetCheckTimeout(aInstance: *mut otInstance, aTimeout: u16);
5773}
5774unsafe extern "C" {
5775 #[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."]
5776 pub fn otChildSupervisionGetCheckFailureCounter(aInstance: *mut otInstance) -> u16;
5777}
5778unsafe extern "C" {
5779 #[doc = " Reset the supervision check timeout failure counter to zero."]
5780 pub fn otChildSupervisionResetCheckFailureCounter(aInstance: *mut otInstance);
5781}
5782pub type va_list = __builtin_va_list;
5783#[doc = " Represents the log level."]
5784pub type otLogLevel = ::std::os::raw::c_int;
5785#[doc = "< OpenThread API"]
5786pub const OT_LOG_REGION_API: otLogRegion = 1;
5787#[doc = "< MLE"]
5788pub const OT_LOG_REGION_MLE: otLogRegion = 2;
5789#[doc = "< EID-to-RLOC mapping."]
5790pub const OT_LOG_REGION_ARP: otLogRegion = 3;
5791#[doc = "< Network Data"]
5792pub const OT_LOG_REGION_NET_DATA: otLogRegion = 4;
5793#[doc = "< ICMPv6"]
5794pub const OT_LOG_REGION_ICMP: otLogRegion = 5;
5795#[doc = "< IPv6"]
5796pub const OT_LOG_REGION_IP6: otLogRegion = 6;
5797#[doc = "< TCP"]
5798pub const OT_LOG_REGION_TCP: otLogRegion = 7;
5799#[doc = "< IEEE 802.15.4 MAC"]
5800pub const OT_LOG_REGION_MAC: otLogRegion = 8;
5801#[doc = "< Memory"]
5802pub const OT_LOG_REGION_MEM: otLogRegion = 9;
5803#[doc = "< NCP"]
5804pub const OT_LOG_REGION_NCP: otLogRegion = 10;
5805#[doc = "< Mesh Commissioning Protocol"]
5806pub const OT_LOG_REGION_MESH_COP: otLogRegion = 11;
5807#[doc = "< Network Diagnostic"]
5808pub const OT_LOG_REGION_NET_DIAG: otLogRegion = 12;
5809#[doc = "< Platform"]
5810pub const OT_LOG_REGION_PLATFORM: otLogRegion = 13;
5811#[doc = "< CoAP"]
5812pub const OT_LOG_REGION_COAP: otLogRegion = 14;
5813#[doc = "< CLI"]
5814pub const OT_LOG_REGION_CLI: otLogRegion = 15;
5815#[doc = "< OpenThread Core"]
5816pub const OT_LOG_REGION_CORE: otLogRegion = 16;
5817#[doc = "< Utility module"]
5818pub const OT_LOG_REGION_UTIL: otLogRegion = 17;
5819#[doc = "< Backbone Router (available since Thread 1.2)"]
5820pub const OT_LOG_REGION_BBR: otLogRegion = 18;
5821#[doc = "< Multicast Listener Registration (available since Thread 1.2)"]
5822pub const OT_LOG_REGION_MLR: otLogRegion = 19;
5823#[doc = "< Domain Unicast Address (available since Thread 1.2)"]
5824pub const OT_LOG_REGION_DUA: otLogRegion = 20;
5825#[doc = "< Border Router"]
5826pub const OT_LOG_REGION_BR: otLogRegion = 21;
5827#[doc = "< Service Registration Protocol (SRP)"]
5828pub const OT_LOG_REGION_SRP: otLogRegion = 22;
5829#[doc = "< DNS"]
5830pub const OT_LOG_REGION_DNS: otLogRegion = 23;
5831#[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`."]
5832pub type otLogRegion = ::std::os::raw::c_uint;
5833unsafe extern "C" {
5834 #[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."]
5835 pub fn otPlatLog(
5836 aLogLevel: otLogLevel,
5837 aLogRegion: otLogRegion,
5838 aFormat: *const ::std::os::raw::c_char,
5839 ...
5840 );
5841}
5842unsafe extern "C" {
5843 #[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."]
5844 pub fn otPlatLogOutput(
5845 aInstance: *mut otInstance,
5846 aLogLevel: otLogLevel,
5847 aLogLine: *const ::std::os::raw::c_char,
5848 );
5849}
5850unsafe extern "C" {
5851 #[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."]
5852 pub fn otPlatLogHandleLevelChanged(aLogLevel: otLogLevel);
5853}
5854unsafe extern "C" {
5855 #[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."]
5856 pub fn otPlatLogHandleLogLevelChanged(aInstance: *mut otInstance, aLogLevel: otLogLevel);
5857}
5858#[repr(C)]
5859#[derive(Debug, Copy, Clone)]
5860pub struct otCliInterpreter {
5861 _unused: [u8; 0],
5862}
5863#[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."]
5864pub type otCliOutputCallback = ::std::option::Option<
5865 unsafe extern "C" fn(
5866 aContext: *mut ::std::os::raw::c_void,
5867 aFormat: *const ::std::os::raw::c_char,
5868 aArguments: *mut __va_list_tag,
5869 ) -> ::std::os::raw::c_int,
5870>;
5871unsafe extern "C" {
5872 #[doc = " Gets the size of the CLI interpreter object.\n\n @returns The size of the CLI interpreter object in bytes."]
5873 pub fn otCliInterpreterGetSize() -> usize;
5874}
5875unsafe extern "C" {
5876 #[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."]
5877 pub fn otCliInterpreterInit(
5878 aBuffer: *mut ::std::os::raw::c_void,
5879 aSize: usize,
5880 aInstance: *mut otInstance,
5881 aCallback: otCliOutputCallback,
5882 aContext: *mut ::std::os::raw::c_void,
5883 ) -> *mut otCliInterpreter;
5884}
5885unsafe extern "C" {
5886 #[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."]
5887 pub fn otCliInterpreterSetPromptConfig(aInterpreter: *mut otCliInterpreter, aEnable: bool);
5888}
5889unsafe extern "C" {
5890 #[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."]
5891 pub fn otCliInterpreterInputLine(
5892 aInterpreter: *mut otCliInterpreter,
5893 aLine: *mut ::std::os::raw::c_char,
5894 );
5895}
5896unsafe extern "C" {
5897 #[doc = " Finalizes the CLI interpreter.\n\n @param[in] aInterpreter A pointer to a CLI interpreter."]
5898 pub fn otCliInterpreterFinalize(aInterpreter: *mut otCliInterpreter);
5899}
5900unsafe extern "C" {
5901 #[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."]
5902 pub fn otCliInit(
5903 aInstance: *mut otInstance,
5904 aCallback: otCliOutputCallback,
5905 aContext: *mut ::std::os::raw::c_void,
5906 );
5907}
5908unsafe extern "C" {
5909 #[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."]
5910 pub fn otCliGetStaticInterpreter() -> *mut otCliInterpreter;
5911}
5912unsafe extern "C" {
5913 #[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."]
5914 pub fn otCliInputLine(aLine: *mut ::std::os::raw::c_char);
5915}
5916#[doc = " Represents a user provided CLI command entry."]
5917#[repr(C)]
5918#[derive(Debug, Copy, Clone)]
5919pub struct otCliCommand {
5920 #[doc = "< The command string."]
5921 pub mName: *const ::std::os::raw::c_char,
5922 #[doc = "< Command handler function pointer."]
5923 pub mCommand: ::std::option::Option<
5924 unsafe extern "C" fn(
5925 aContext: *mut ::std::os::raw::c_void,
5926 aArgsLength: u8,
5927 aArgs: *mut *mut ::std::os::raw::c_char,
5928 ) -> otError,
5929 >,
5930}
5931impl Default for otCliCommand {
5932 fn default() -> Self {
5933 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5934 unsafe {
5935 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5936 s.assume_init()
5937 }
5938 }
5939}
5940unsafe extern "C" {
5941 #[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."]
5942 pub fn otCliSetUserCommands(
5943 aUserCommands: *const otCliCommand,
5944 aLength: u8,
5945 aContext: *mut ::std::os::raw::c_void,
5946 ) -> otError;
5947}
5948unsafe extern "C" {
5949 #[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."]
5950 pub fn otCliOutputBytes(aBytes: *const u8, aLength: u8);
5951}
5952unsafe extern "C" {
5953 #[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."]
5954 pub fn otCliOutputFormat(aFmt: *const ::std::os::raw::c_char, ...);
5955}
5956unsafe extern "C" {
5957 #[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."]
5958 pub fn otCliAppendResult(aError: otError);
5959}
5960unsafe extern "C" {
5961 #[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."]
5962 pub fn otCliPlatLogv(
5963 aLogLevel: otLogLevel,
5964 aLogRegion: otLogRegion,
5965 aFormat: *const ::std::os::raw::c_char,
5966 aArgs: *mut __va_list_tag,
5967 );
5968}
5969unsafe extern "C" {
5970 #[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`."]
5971 pub fn otCliVendorSetUserCommands();
5972}
5973#[doc = "< Confirmable"]
5974pub const OT_COAP_TYPE_CONFIRMABLE: otCoapType = 0;
5975#[doc = "< Non-confirmable"]
5976pub const OT_COAP_TYPE_NON_CONFIRMABLE: otCoapType = 1;
5977#[doc = "< Acknowledgment"]
5978pub const OT_COAP_TYPE_ACKNOWLEDGMENT: otCoapType = 2;
5979#[doc = "< Reset"]
5980pub const OT_COAP_TYPE_RESET: otCoapType = 3;
5981#[doc = " CoAP Type values (2 bit unsigned integer)."]
5982pub type otCoapType = ::std::os::raw::c_uint;
5983#[doc = "< Empty message code"]
5984pub const OT_COAP_CODE_EMPTY: otCoapCode = 0;
5985#[doc = "< Get"]
5986pub const OT_COAP_CODE_GET: otCoapCode = 1;
5987#[doc = "< Post"]
5988pub const OT_COAP_CODE_POST: otCoapCode = 2;
5989#[doc = "< Put"]
5990pub const OT_COAP_CODE_PUT: otCoapCode = 3;
5991#[doc = "< Delete"]
5992pub const OT_COAP_CODE_DELETE: otCoapCode = 4;
5993#[doc = "< 2.00"]
5994pub const OT_COAP_CODE_RESPONSE_MIN: otCoapCode = 64;
5995#[doc = "< Created"]
5996pub const OT_COAP_CODE_CREATED: otCoapCode = 65;
5997#[doc = "< Deleted"]
5998pub const OT_COAP_CODE_DELETED: otCoapCode = 66;
5999#[doc = "< Valid"]
6000pub const OT_COAP_CODE_VALID: otCoapCode = 67;
6001#[doc = "< Changed"]
6002pub const OT_COAP_CODE_CHANGED: otCoapCode = 68;
6003#[doc = "< Content"]
6004pub const OT_COAP_CODE_CONTENT: otCoapCode = 69;
6005#[doc = "< RFC7959 Continue"]
6006pub const OT_COAP_CODE_CONTINUE: otCoapCode = 95;
6007#[doc = "< Bad Request"]
6008pub const OT_COAP_CODE_BAD_REQUEST: otCoapCode = 128;
6009#[doc = "< Unauthorized"]
6010pub const OT_COAP_CODE_UNAUTHORIZED: otCoapCode = 129;
6011#[doc = "< Bad Option"]
6012pub const OT_COAP_CODE_BAD_OPTION: otCoapCode = 130;
6013#[doc = "< Forbidden"]
6014pub const OT_COAP_CODE_FORBIDDEN: otCoapCode = 131;
6015#[doc = "< Not Found"]
6016pub const OT_COAP_CODE_NOT_FOUND: otCoapCode = 132;
6017#[doc = "< Method Not Allowed"]
6018pub const OT_COAP_CODE_METHOD_NOT_ALLOWED: otCoapCode = 133;
6019#[doc = "< Not Acceptable"]
6020pub const OT_COAP_CODE_NOT_ACCEPTABLE: otCoapCode = 134;
6021#[doc = "< RFC7959 Request Entity Incomplete"]
6022pub const OT_COAP_CODE_REQUEST_INCOMPLETE: otCoapCode = 136;
6023#[doc = "< Precondition Failed"]
6024pub const OT_COAP_CODE_PRECONDITION_FAILED: otCoapCode = 140;
6025#[doc = "< Request Entity Too Large"]
6026pub const OT_COAP_CODE_REQUEST_TOO_LARGE: otCoapCode = 141;
6027#[doc = "< Unsupported Content-Format"]
6028pub const OT_COAP_CODE_UNSUPPORTED_FORMAT: otCoapCode = 143;
6029#[doc = "< Internal Server Error"]
6030pub const OT_COAP_CODE_INTERNAL_ERROR: otCoapCode = 160;
6031#[doc = "< Not Implemented"]
6032pub const OT_COAP_CODE_NOT_IMPLEMENTED: otCoapCode = 161;
6033#[doc = "< Bad Gateway"]
6034pub const OT_COAP_CODE_BAD_GATEWAY: otCoapCode = 162;
6035#[doc = "< Service Unavailable"]
6036pub const OT_COAP_CODE_SERVICE_UNAVAILABLE: otCoapCode = 163;
6037#[doc = "< Gateway Timeout"]
6038pub const OT_COAP_CODE_GATEWAY_TIMEOUT: otCoapCode = 164;
6039#[doc = "< Proxying Not Supported"]
6040pub const OT_COAP_CODE_PROXY_NOT_SUPPORTED: otCoapCode = 165;
6041#[doc = " CoAP Code values."]
6042pub type otCoapCode = ::std::os::raw::c_uint;
6043#[doc = "< If-Match"]
6044pub const OT_COAP_OPTION_IF_MATCH: otCoapOptionType = 1;
6045#[doc = "< Uri-Host"]
6046pub const OT_COAP_OPTION_URI_HOST: otCoapOptionType = 3;
6047#[doc = "< ETag"]
6048pub const OT_COAP_OPTION_E_TAG: otCoapOptionType = 4;
6049#[doc = "< If-None-Match"]
6050pub const OT_COAP_OPTION_IF_NONE_MATCH: otCoapOptionType = 5;
6051#[doc = "< Observe [RFC7641]"]
6052pub const OT_COAP_OPTION_OBSERVE: otCoapOptionType = 6;
6053#[doc = "< Uri-Port"]
6054pub const OT_COAP_OPTION_URI_PORT: otCoapOptionType = 7;
6055#[doc = "< Location-Path"]
6056pub const OT_COAP_OPTION_LOCATION_PATH: otCoapOptionType = 8;
6057#[doc = "< Uri-Path"]
6058pub const OT_COAP_OPTION_URI_PATH: otCoapOptionType = 11;
6059#[doc = "< Content-Format"]
6060pub const OT_COAP_OPTION_CONTENT_FORMAT: otCoapOptionType = 12;
6061#[doc = "< Max-Age"]
6062pub const OT_COAP_OPTION_MAX_AGE: otCoapOptionType = 14;
6063#[doc = "< Uri-Query"]
6064pub const OT_COAP_OPTION_URI_QUERY: otCoapOptionType = 15;
6065#[doc = "< Accept"]
6066pub const OT_COAP_OPTION_ACCEPT: otCoapOptionType = 17;
6067#[doc = "< Location-Query"]
6068pub const OT_COAP_OPTION_LOCATION_QUERY: otCoapOptionType = 20;
6069#[doc = "< Block2 (RFC7959)"]
6070pub const OT_COAP_OPTION_BLOCK2: otCoapOptionType = 23;
6071#[doc = "< Block1 (RFC7959)"]
6072pub const OT_COAP_OPTION_BLOCK1: otCoapOptionType = 27;
6073#[doc = "< Size2 (RFC7959)"]
6074pub const OT_COAP_OPTION_SIZE2: otCoapOptionType = 28;
6075#[doc = "< Proxy-Uri"]
6076pub const OT_COAP_OPTION_PROXY_URI: otCoapOptionType = 35;
6077#[doc = "< Proxy-Scheme"]
6078pub const OT_COAP_OPTION_PROXY_SCHEME: otCoapOptionType = 39;
6079#[doc = "< Size1"]
6080pub const OT_COAP_OPTION_SIZE1: otCoapOptionType = 60;
6081#[doc = " CoAP Option Numbers"]
6082pub type otCoapOptionType = ::std::os::raw::c_uint;
6083#[doc = " Represents a CoAP option."]
6084#[repr(C)]
6085#[derive(Debug, Default, Copy, Clone)]
6086pub struct otCoapOption {
6087 #[doc = "< Option Number"]
6088 pub mNumber: u16,
6089 #[doc = "< Option Length"]
6090 pub mLength: u16,
6091}
6092#[doc = " Acts as an iterator for CoAP options"]
6093#[repr(C)]
6094#[derive(Debug, Copy, Clone)]
6095pub struct otCoapOptionIterator {
6096 #[doc = "< CoAP message"]
6097 pub mMessage: *const otMessage,
6098 #[doc = "< CoAP message option"]
6099 pub mOption: otCoapOption,
6100 #[doc = "< Byte offset of next option"]
6101 pub mNextOptionOffset: u16,
6102}
6103impl Default for otCoapOptionIterator {
6104 fn default() -> Self {
6105 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6106 unsafe {
6107 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6108 s.assume_init()
6109 }
6110 }
6111}
6112#[doc = "< txt/plain; charset=utf-8: [RFC2046][RFC3676][RFC5147]"]
6113pub const OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN: otCoapOptionContentFormat = 0;
6114#[doc = "< application/cose; cose-type=\"cose-encrypt0\": [RFC8152]"]
6115pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0: otCoapOptionContentFormat = 16;
6116#[doc = "< application/cose; cose-type=\"cose-mac0\": [RFC8152]"]
6117pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0: otCoapOptionContentFormat = 17;
6118#[doc = "< application/cose; cose-type=\"cose-sign1\": [RFC8152]"]
6119pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1: otCoapOptionContentFormat = 18;
6120#[doc = "< application/link-format: [RFC6690]"]
6121pub const OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT: otCoapOptionContentFormat = 40;
6122#[doc = "< application/xml: [RFC3023]"]
6123pub const OT_COAP_OPTION_CONTENT_FORMAT_XML: otCoapOptionContentFormat = 41;
6124#[doc = "< application/octet-stream: [RFC2045][RFC2046]"]
6125pub const OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM: otCoapOptionContentFormat = 42;
6126#[doc = "< application/exi: [\"Efficient XML Interchange (EXI)\"]"]
6127pub const OT_COAP_OPTION_CONTENT_FORMAT_EXI: otCoapOptionContentFormat = 47;
6128#[doc = "< application/json: [RFC7159]"]
6129pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON: otCoapOptionContentFormat = 50;
6130#[doc = "< application/json-patch+json: [RFC6902]"]
6131pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON: otCoapOptionContentFormat = 51;
6132#[doc = "< application/merge-patch+json: [RFC7396]"]
6133pub const OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON: otCoapOptionContentFormat = 52;
6134#[doc = "< application/cbor: [RFC7049]"]
6135pub const OT_COAP_OPTION_CONTENT_FORMAT_CBOR: otCoapOptionContentFormat = 60;
6136#[doc = "< application/cwt: [RFC8392]"]
6137pub const OT_COAP_OPTION_CONTENT_FORMAT_CWT: otCoapOptionContentFormat = 61;
6138#[doc = "< application/cose; cose-type=\"cose-encrypt\": [RFC8152]"]
6139pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT: otCoapOptionContentFormat = 96;
6140#[doc = "< application/cose; cose-type=\"cose-mac\": [RFC8152]"]
6141pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC: otCoapOptionContentFormat = 97;
6142#[doc = "< application/cose; cose-type=\"cose-sign\": [RFC8152]"]
6143pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN: otCoapOptionContentFormat = 98;
6144#[doc = "< application/cose-key: [RFC8152]"]
6145pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY: otCoapOptionContentFormat = 101;
6146#[doc = "< application/cose-key-set: [RFC8152]"]
6147pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET: otCoapOptionContentFormat = 102;
6148#[doc = "< application/senml+json: [RFC8428]"]
6149pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON: otCoapOptionContentFormat = 110;
6150#[doc = "< application/sensml+json: [RFC8428]"]
6151pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON: otCoapOptionContentFormat = 111;
6152#[doc = "< application/senml+cbor: [RFC8428]"]
6153pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR: otCoapOptionContentFormat = 112;
6154#[doc = "< application/sensml+cbor: [RFC8428]"]
6155pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR: otCoapOptionContentFormat = 113;
6156#[doc = "< application/senml-exi: [RFC8428]"]
6157pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI: otCoapOptionContentFormat = 114;
6158#[doc = "< application/sensml-exi: [RFC8428]"]
6159pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI: otCoapOptionContentFormat = 115;
6160#[doc = "< application/coap-group+json: [RFC7390]"]
6161pub const OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON: otCoapOptionContentFormat = 256;
6162#[doc = "< application/senml+xml: [RFC8428]"]
6163pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML: otCoapOptionContentFormat = 310;
6164#[doc = "< application/sensml+xml: [RFC8428]"]
6165pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML: otCoapOptionContentFormat = 311;
6166#[doc = " CoAP Content Format codes. The full list is documented at\n https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats"]
6167pub type otCoapOptionContentFormat = ::std::os::raw::c_uint;
6168pub const OT_COAP_OPTION_BLOCK_SZX_16: otCoapBlockSzx = 0;
6169pub const OT_COAP_OPTION_BLOCK_SZX_32: otCoapBlockSzx = 1;
6170pub const OT_COAP_OPTION_BLOCK_SZX_64: otCoapBlockSzx = 2;
6171pub const OT_COAP_OPTION_BLOCK_SZX_128: otCoapBlockSzx = 3;
6172pub const OT_COAP_OPTION_BLOCK_SZX_256: otCoapBlockSzx = 4;
6173pub const OT_COAP_OPTION_BLOCK_SZX_512: otCoapBlockSzx = 5;
6174pub const OT_COAP_OPTION_BLOCK_SZX_1024: otCoapBlockSzx = 6;
6175#[doc = " CoAP Block Size Exponents"]
6176pub type otCoapBlockSzx = ::std::os::raw::c_uint;
6177#[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."]
6178pub type otCoapResponseHandler = ::std::option::Option<
6179 unsafe extern "C" fn(
6180 aContext: *mut ::std::os::raw::c_void,
6181 aMessage: *mut otMessage,
6182 aMessageInfo: *const otMessageInfo,
6183 aResult: otError,
6184 ),
6185>;
6186#[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."]
6187pub type otCoapRequestHandler = ::std::option::Option<
6188 unsafe extern "C" fn(
6189 aContext: *mut ::std::os::raw::c_void,
6190 aMessage: *mut otMessage,
6191 aMessageInfo: *const otMessageInfo,
6192 ),
6193>;
6194#[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."]
6195pub type otCoapResponseFallback = ::std::option::Option<
6196 unsafe extern "C" fn(
6197 aContext: *mut ::std::os::raw::c_void,
6198 aMessage: *mut otMessage,
6199 aMessageInfo: *const otMessageInfo,
6200 ) -> bool,
6201>;
6202#[doc = " Represents a CoAP message token."]
6203#[repr(C)]
6204#[derive(Debug, Default, Copy, Clone)]
6205pub struct otCoapToken {
6206 #[doc = "< The token bytes."]
6207 pub m8: [u8; 8usize],
6208 #[doc = "< The token length in bytes."]
6209 pub mLength: u8,
6210}
6211#[doc = " Represents a CoAP resource."]
6212#[repr(C)]
6213#[derive(Debug, Copy, Clone)]
6214pub struct otCoapResource {
6215 #[doc = "< The URI Path string"]
6216 pub mUriPath: *const ::std::os::raw::c_char,
6217 #[doc = "< The callback for handling a received request"]
6218 pub mHandler: otCoapRequestHandler,
6219 #[doc = "< Application-specific context"]
6220 pub mContext: *mut ::std::os::raw::c_void,
6221 #[doc = "< The next CoAP resource in the list"]
6222 pub mNext: *mut otCoapResource,
6223}
6224impl Default for otCoapResource {
6225 fn default() -> Self {
6226 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6227 unsafe {
6228 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6229 s.assume_init()
6230 }
6231 }
6232}
6233#[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."]
6234#[repr(C)]
6235#[derive(Debug, Default, Copy, Clone)]
6236pub struct otCoapTxParameters {
6237 #[doc = " Minimum spacing before first retransmission when ACK is not received, in milliseconds (RFC7252 default value is\n 2000ms)."]
6238 pub mAckTimeout: u32,
6239 #[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)."]
6240 pub mAckRandomFactorNumerator: u8,
6241 #[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)."]
6242 pub mAckRandomFactorDenominator: u8,
6243 #[doc = " Maximum number of retransmissions for CoAP Confirmable messages (RFC7252 default value is 4)."]
6244 pub mMaxRetransmit: u8,
6245}
6246unsafe extern "C" {
6247 #[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."]
6248 pub fn otCoapMessageInit(
6249 aMessage: *mut otMessage,
6250 aType: otCoapType,
6251 aCode: otCoapCode,
6252 ) -> otError;
6253}
6254unsafe extern "C" {
6255 #[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."]
6256 pub fn otCoapMessageInitResponse(
6257 aResponse: *mut otMessage,
6258 aRequest: *const otMessage,
6259 aType: otCoapType,
6260 aCode: otCoapCode,
6261 ) -> otError;
6262}
6263unsafe extern "C" {
6264 #[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."]
6265 pub fn otCoapMessageWriteToken(aMessage: *mut otMessage, aToken: *const otCoapToken)
6266 -> otError;
6267}
6268unsafe extern "C" {
6269 #[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)."]
6270 pub fn otCoapMessageGenerateToken(aMessage: *mut otMessage, aTokenLength: u8);
6271}
6272unsafe extern "C" {
6273 #[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."]
6274 pub fn otCoapMessageAppendContentFormatOption(
6275 aMessage: *mut otMessage,
6276 aContentFormat: otCoapOptionContentFormat,
6277 ) -> otError;
6278}
6279unsafe extern "C" {
6280 #[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."]
6281 pub fn otCoapMessageAppendOption(
6282 aMessage: *mut otMessage,
6283 aNumber: u16,
6284 aLength: u16,
6285 aValue: *const ::std::os::raw::c_void,
6286 ) -> otError;
6287}
6288unsafe extern "C" {
6289 #[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"]
6290 pub fn otCoapMessageAppendUintOption(
6291 aMessage: *mut otMessage,
6292 aNumber: u16,
6293 aValue: u32,
6294 ) -> otError;
6295}
6296unsafe extern "C" {
6297 #[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."]
6298 pub fn otCoapMessageAppendObserveOption(aMessage: *mut otMessage, aObserve: u32) -> otError;
6299}
6300unsafe extern "C" {
6301 #[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."]
6302 pub fn otCoapMessageAppendUriPathOptions(
6303 aMessage: *mut otMessage,
6304 aUriPath: *const ::std::os::raw::c_char,
6305 ) -> otError;
6306}
6307unsafe extern "C" {
6308 #[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."]
6309 pub fn otCoapMessageAppendUriQueryOptions(
6310 aMessage: *mut otMessage,
6311 aUriQuery: *const ::std::os::raw::c_char,
6312 ) -> otError;
6313}
6314unsafe extern "C" {
6315 #[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."]
6316 pub fn otCoapBlockSizeFromExponent(aSize: otCoapBlockSzx) -> u16;
6317}
6318unsafe extern "C" {
6319 #[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."]
6320 pub fn otCoapMessageAppendBlock2Option(
6321 aMessage: *mut otMessage,
6322 aNum: u32,
6323 aMore: bool,
6324 aSize: otCoapBlockSzx,
6325 ) -> otError;
6326}
6327unsafe extern "C" {
6328 #[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."]
6329 pub fn otCoapMessageAppendBlock1Option(
6330 aMessage: *mut otMessage,
6331 aNum: u32,
6332 aMore: bool,
6333 aSize: otCoapBlockSzx,
6334 ) -> otError;
6335}
6336unsafe extern "C" {
6337 #[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."]
6338 pub fn otCoapMessageAppendProxyUriOption(
6339 aMessage: *mut otMessage,
6340 aUriPath: *const ::std::os::raw::c_char,
6341 ) -> otError;
6342}
6343unsafe extern "C" {
6344 #[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."]
6345 pub fn otCoapMessageAppendMaxAgeOption(aMessage: *mut otMessage, aMaxAge: u32) -> otError;
6346}
6347unsafe extern "C" {
6348 #[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."]
6349 pub fn otCoapMessageAppendUriQueryOption(
6350 aMessage: *mut otMessage,
6351 aUriQuery: *const ::std::os::raw::c_char,
6352 ) -> otError;
6353}
6354unsafe extern "C" {
6355 #[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."]
6356 pub fn otCoapMessageSetPayloadMarker(aMessage: *mut otMessage) -> otError;
6357}
6358unsafe extern "C" {
6359 #[doc = " Returns the Type value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Type value."]
6360 pub fn otCoapMessageGetType(aMessage: *const otMessage) -> otCoapType;
6361}
6362unsafe extern "C" {
6363 #[doc = " Returns the Code value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Code value."]
6364 pub fn otCoapMessageGetCode(aMessage: *const otMessage) -> otCoapCode;
6365}
6366unsafe extern "C" {
6367 #[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."]
6368 pub fn otCoapMessageSetCode(aMessage: *mut otMessage, aCode: otCoapCode);
6369}
6370unsafe extern "C" {
6371 #[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."]
6372 pub fn otCoapMessageCodeToString(aMessage: *const otMessage) -> *const ::std::os::raw::c_char;
6373}
6374unsafe extern "C" {
6375 #[doc = " Returns the Message ID value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Message ID value."]
6376 pub fn otCoapMessageGetMessageId(aMessage: *const otMessage) -> u16;
6377}
6378unsafe extern "C" {
6379 #[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."]
6380 pub fn otCoapMessageReadToken(aMessage: *const otMessage, aToken: *mut otCoapToken) -> otError;
6381}
6382unsafe extern "C" {
6383 #[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."]
6384 pub fn otCoapMessageAreTokensEqual(
6385 aFirstToken: *const otCoapToken,
6386 aSecondToken: *const otCoapToken,
6387 ) -> bool;
6388}
6389unsafe extern "C" {
6390 #[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."]
6391 pub fn otCoapOptionIteratorInit(
6392 aIterator: *mut otCoapOptionIterator,
6393 aMessage: *const otMessage,
6394 ) -> otError;
6395}
6396unsafe extern "C" {
6397 #[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."]
6398 pub fn otCoapOptionIteratorGetFirstOptionMatching(
6399 aIterator: *mut otCoapOptionIterator,
6400 aOption: u16,
6401 ) -> *const otCoapOption;
6402}
6403unsafe extern "C" {
6404 #[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."]
6405 pub fn otCoapOptionIteratorGetFirstOption(
6406 aIterator: *mut otCoapOptionIterator,
6407 ) -> *const otCoapOption;
6408}
6409unsafe extern "C" {
6410 #[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."]
6411 pub fn otCoapOptionIteratorGetNextOptionMatching(
6412 aIterator: *mut otCoapOptionIterator,
6413 aOption: u16,
6414 ) -> *const otCoapOption;
6415}
6416unsafe extern "C" {
6417 #[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."]
6418 pub fn otCoapOptionIteratorGetNextOption(
6419 aIterator: *mut otCoapOptionIterator,
6420 ) -> *const otCoapOption;
6421}
6422unsafe extern "C" {
6423 #[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"]
6424 pub fn otCoapOptionIteratorGetOptionUintValue(
6425 aIterator: *mut otCoapOptionIterator,
6426 aValue: *mut u64,
6427 ) -> otError;
6428}
6429unsafe extern "C" {
6430 #[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."]
6431 pub fn otCoapOptionIteratorGetOptionValue(
6432 aIterator: *mut otCoapOptionIterator,
6433 aValue: *mut ::std::os::raw::c_void,
6434 ) -> otError;
6435}
6436unsafe extern "C" {
6437 #[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."]
6438 pub fn otCoapNewMessage(
6439 aInstance: *mut otInstance,
6440 aSettings: *const otMessageSettings,
6441 ) -> *mut otMessage;
6442}
6443unsafe extern "C" {
6444 #[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."]
6445 pub fn otCoapSendRequestWithParameters(
6446 aInstance: *mut otInstance,
6447 aMessage: *mut otMessage,
6448 aMessageInfo: *const otMessageInfo,
6449 aHandler: otCoapResponseHandler,
6450 aContext: *mut ::std::os::raw::c_void,
6451 aTxParameters: *const otCoapTxParameters,
6452 ) -> otError;
6453}
6454unsafe extern "C" {
6455 #[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."]
6456 pub fn otCoapSendRequest(
6457 aInstance: *mut otInstance,
6458 aMessage: *mut otMessage,
6459 aMessageInfo: *const otMessageInfo,
6460 aHandler: otCoapResponseHandler,
6461 aContext: *mut ::std::os::raw::c_void,
6462 ) -> otError;
6463}
6464unsafe extern "C" {
6465 #[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."]
6466 pub fn otCoapStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6467}
6468unsafe extern "C" {
6469 #[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."]
6470 pub fn otCoapStop(aInstance: *mut otInstance) -> otError;
6471}
6472unsafe extern "C" {
6473 #[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."]
6474 pub fn otCoapAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6475}
6476unsafe extern "C" {
6477 #[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."]
6478 pub fn otCoapRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6479}
6480unsafe extern "C" {
6481 #[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."]
6482 pub fn otCoapSetDefaultHandler(
6483 aInstance: *mut otInstance,
6484 aHandler: otCoapRequestHandler,
6485 aContext: *mut ::std::os::raw::c_void,
6486 );
6487}
6488unsafe extern "C" {
6489 #[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."]
6490 pub fn otCoapSetResponseFallback(
6491 aInstance: *mut otInstance,
6492 aHandler: otCoapResponseFallback,
6493 aContext: *mut ::std::os::raw::c_void,
6494 );
6495}
6496unsafe extern "C" {
6497 #[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."]
6498 pub fn otCoapSendResponseWithParameters(
6499 aInstance: *mut otInstance,
6500 aMessage: *mut otMessage,
6501 aMessageInfo: *const otMessageInfo,
6502 aTxParameters: *const otCoapTxParameters,
6503 ) -> otError;
6504}
6505unsafe extern "C" {
6506 #[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."]
6507 pub fn otCoapSendResponse(
6508 aInstance: *mut otInstance,
6509 aMessage: *mut otMessage,
6510 aMessageInfo: *const otMessageInfo,
6511 ) -> otError;
6512}
6513#[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."]
6514pub type otCoapBlockwiseReceiveHook = ::std::option::Option<
6515 unsafe extern "C" fn(
6516 aContext: *mut ::std::os::raw::c_void,
6517 aBlock: *const u8,
6518 aPosition: u32,
6519 aBlockLength: u16,
6520 aMore: bool,
6521 aTotalLength: u32,
6522 ) -> otError,
6523>;
6524#[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."]
6525pub type otCoapBlockwiseTransmitHook = ::std::option::Option<
6526 unsafe extern "C" fn(
6527 aContext: *mut ::std::os::raw::c_void,
6528 aBlock: *mut u8,
6529 aPosition: u32,
6530 aBlockLength: *mut u16,
6531 aMore: *mut bool,
6532 ) -> otError,
6533>;
6534#[doc = " Represents a CoAP resource with block-wise transfer."]
6535#[repr(C)]
6536#[derive(Debug, Copy, Clone)]
6537pub struct otCoapBlockwiseResource {
6538 #[doc = "< The URI Path string"]
6539 pub mUriPath: *const ::std::os::raw::c_char,
6540 #[doc = "< The callback for handling a received request"]
6541 pub mHandler: otCoapRequestHandler,
6542 #[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."]
6543 pub mReceiveHook: otCoapBlockwiseReceiveHook,
6544 #[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."]
6545 pub mTransmitHook: otCoapBlockwiseTransmitHook,
6546 #[doc = "< Application-specific context"]
6547 pub mContext: *mut ::std::os::raw::c_void,
6548 #[doc = "< The next CoAP resource in the list"]
6549 pub mNext: *mut otCoapBlockwiseResource,
6550}
6551impl Default for otCoapBlockwiseResource {
6552 fn default() -> Self {
6553 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6554 unsafe {
6555 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6556 s.assume_init()
6557 }
6558 }
6559}
6560unsafe extern "C" {
6561 #[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."]
6562 pub fn otCoapAddBlockWiseResource(
6563 aInstance: *mut otInstance,
6564 aResource: *mut otCoapBlockwiseResource,
6565 );
6566}
6567unsafe extern "C" {
6568 #[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."]
6569 pub fn otCoapRemoveBlockWiseResource(
6570 aInstance: *mut otInstance,
6571 aResource: *mut otCoapBlockwiseResource,
6572 );
6573}
6574unsafe extern "C" {
6575 #[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."]
6576 pub fn otCoapSendRequestBlockWiseWithParameters(
6577 aInstance: *mut otInstance,
6578 aMessage: *mut otMessage,
6579 aMessageInfo: *const otMessageInfo,
6580 aHandler: otCoapResponseHandler,
6581 aContext: *mut ::std::os::raw::c_void,
6582 aTxParameters: *const otCoapTxParameters,
6583 aTransmitHook: otCoapBlockwiseTransmitHook,
6584 aReceiveHook: otCoapBlockwiseReceiveHook,
6585 ) -> otError;
6586}
6587unsafe extern "C" {
6588 #[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."]
6589 pub fn otCoapSendRequestBlockWise(
6590 aInstance: *mut otInstance,
6591 aMessage: *mut otMessage,
6592 aMessageInfo: *const otMessageInfo,
6593 aHandler: otCoapResponseHandler,
6594 aContext: *mut ::std::os::raw::c_void,
6595 aTransmitHook: otCoapBlockwiseTransmitHook,
6596 aReceiveHook: otCoapBlockwiseReceiveHook,
6597 ) -> otError;
6598}
6599unsafe extern "C" {
6600 #[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."]
6601 pub fn otCoapSendResponseBlockWiseWithParameters(
6602 aInstance: *mut otInstance,
6603 aMessage: *mut otMessage,
6604 aMessageInfo: *const otMessageInfo,
6605 aTxParameters: *const otCoapTxParameters,
6606 aContext: *mut ::std::os::raw::c_void,
6607 aTransmitHook: otCoapBlockwiseTransmitHook,
6608 ) -> otError;
6609}
6610unsafe extern "C" {
6611 #[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."]
6612 pub fn otCoapSendResponseBlockWise(
6613 aInstance: *mut otInstance,
6614 aMessage: *mut otMessage,
6615 aMessageInfo: *const otMessageInfo,
6616 aContext: *mut ::std::os::raw::c_void,
6617 aTransmitHook: otCoapBlockwiseTransmitHook,
6618 ) -> otError;
6619}
6620unsafe extern "C" {
6621 #[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."]
6622 pub fn otCoapMessageSetToken(
6623 aMessage: *mut otMessage,
6624 aToken: *const u8,
6625 aTokenLength: u8,
6626 ) -> otError;
6627}
6628unsafe extern "C" {
6629 #[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."]
6630 pub fn otCoapMessageGetTokenLength(aMessage: *const otMessage) -> u8;
6631}
6632unsafe extern "C" {
6633 #[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."]
6634 pub fn otCoapMessageGetToken(aMessage: *const otMessage) -> *const u8;
6635}
6636#[doc = "< Connection established"]
6637pub const OT_COAP_SECURE_CONNECTED: otCoapSecureConnectEvent = 0;
6638#[doc = "< Disconnected by peer"]
6639pub const OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED: otCoapSecureConnectEvent = 1;
6640#[doc = "< Disconnected locally"]
6641pub const OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED: otCoapSecureConnectEvent = 2;
6642#[doc = "< Disconnected due to reaching the max connection attempts"]
6643pub const OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS: otCoapSecureConnectEvent = 3;
6644#[doc = "< Disconnected due to an error"]
6645pub const OT_COAP_SECURE_DISCONNECTED_ERROR: otCoapSecureConnectEvent = 4;
6646#[doc = "< Disconnected locally due to session timeout"]
6647pub const OT_COAP_SECURE_DISCONNECTED_TIMEOUT: otCoapSecureConnectEvent = 5;
6648#[doc = " CoAP secure connection event types."]
6649pub type otCoapSecureConnectEvent = ::std::os::raw::c_uint;
6650#[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."]
6651pub type otHandleCoapSecureClientConnect = ::std::option::Option<
6652 unsafe extern "C" fn(aEvent: otCoapSecureConnectEvent, aContext: *mut ::std::os::raw::c_void),
6653>;
6654#[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."]
6655pub type otCoapSecureAutoStopCallback =
6656 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
6657unsafe extern "C" {
6658 #[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."]
6659 pub fn otCoapSecureStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6660}
6661unsafe extern "C" {
6662 #[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."]
6663 pub fn otCoapSecureStartWithMaxConnAttempts(
6664 aInstance: *mut otInstance,
6665 aPort: u16,
6666 aMaxAttempts: u16,
6667 aCallback: otCoapSecureAutoStopCallback,
6668 aContext: *mut ::std::os::raw::c_void,
6669 ) -> otError;
6670}
6671unsafe extern "C" {
6672 #[doc = " Stops the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6673 pub fn otCoapSecureStop(aInstance: *mut otInstance);
6674}
6675unsafe extern "C" {
6676 #[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."]
6677 pub fn otCoapSecureSetPsk(
6678 aInstance: *mut otInstance,
6679 aPsk: *const u8,
6680 aPskLength: u16,
6681 aPskIdentity: *const u8,
6682 aPskIdLength: u16,
6683 );
6684}
6685unsafe extern "C" {
6686 #[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."]
6687 pub fn otCoapSecureGetPeerCertificateBase64(
6688 aInstance: *mut otInstance,
6689 aPeerCert: *mut ::std::os::raw::c_uchar,
6690 aCertLength: *mut usize,
6691 aCertBufferSize: usize,
6692 ) -> otError;
6693}
6694unsafe extern "C" {
6695 #[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."]
6696 pub fn otCoapSecureSetSslAuthMode(aInstance: *mut otInstance, aVerifyPeerCertificate: bool);
6697}
6698unsafe extern "C" {
6699 #[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."]
6700 pub fn otCoapSecureSetCertificate(
6701 aInstance: *mut otInstance,
6702 aX509Cert: *const u8,
6703 aX509Length: u32,
6704 aPrivateKey: *const u8,
6705 aPrivateKeyLength: u32,
6706 );
6707}
6708unsafe extern "C" {
6709 #[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."]
6710 pub fn otCoapSecureSetCaCertificateChain(
6711 aInstance: *mut otInstance,
6712 aX509CaCertificateChain: *const u8,
6713 aX509CaCertChainLength: u32,
6714 );
6715}
6716unsafe extern "C" {
6717 #[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."]
6718 pub fn otCoapSecureConnect(
6719 aInstance: *mut otInstance,
6720 aSockAddr: *const otSockAddr,
6721 aHandler: otHandleCoapSecureClientConnect,
6722 aContext: *mut ::std::os::raw::c_void,
6723 ) -> otError;
6724}
6725unsafe extern "C" {
6726 #[doc = " Stops the DTLS connection.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6727 pub fn otCoapSecureDisconnect(aInstance: *mut otInstance);
6728}
6729unsafe extern "C" {
6730 #[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."]
6731 pub fn otCoapSecureIsConnected(aInstance: *mut otInstance) -> bool;
6732}
6733unsafe extern "C" {
6734 #[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."]
6735 pub fn otCoapSecureIsConnectionActive(aInstance: *mut otInstance) -> bool;
6736}
6737unsafe extern "C" {
6738 #[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."]
6739 pub fn otCoapSecureIsClosed(aInstance: *mut otInstance) -> bool;
6740}
6741unsafe extern "C" {
6742 #[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."]
6743 pub fn otCoapSecureSendRequestBlockWise(
6744 aInstance: *mut otInstance,
6745 aMessage: *mut otMessage,
6746 aHandler: otCoapResponseHandler,
6747 aContext: *mut ::std::os::raw::c_void,
6748 aTransmitHook: otCoapBlockwiseTransmitHook,
6749 aReceiveHook: otCoapBlockwiseReceiveHook,
6750 ) -> otError;
6751}
6752unsafe extern "C" {
6753 #[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."]
6754 pub fn otCoapSecureSendRequest(
6755 aInstance: *mut otInstance,
6756 aMessage: *mut otMessage,
6757 aHandler: otCoapResponseHandler,
6758 aContext: *mut ::std::os::raw::c_void,
6759 ) -> otError;
6760}
6761unsafe extern "C" {
6762 #[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."]
6763 pub fn otCoapSecureAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6764}
6765unsafe extern "C" {
6766 #[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."]
6767 pub fn otCoapSecureRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6768}
6769unsafe extern "C" {
6770 #[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."]
6771 pub fn otCoapSecureAddBlockWiseResource(
6772 aInstance: *mut otInstance,
6773 aResource: *mut otCoapBlockwiseResource,
6774 );
6775}
6776unsafe extern "C" {
6777 #[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."]
6778 pub fn otCoapSecureRemoveBlockWiseResource(
6779 aInstance: *mut otInstance,
6780 aResource: *mut otCoapBlockwiseResource,
6781 );
6782}
6783unsafe extern "C" {
6784 #[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."]
6785 pub fn otCoapSecureSetDefaultHandler(
6786 aInstance: *mut otInstance,
6787 aHandler: otCoapRequestHandler,
6788 aContext: *mut ::std::os::raw::c_void,
6789 );
6790}
6791unsafe extern "C" {
6792 #[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."]
6793 pub fn otCoapSecureSetClientConnectEventCallback(
6794 aInstance: *mut otInstance,
6795 aHandler: otHandleCoapSecureClientConnect,
6796 aContext: *mut ::std::os::raw::c_void,
6797 );
6798}
6799unsafe extern "C" {
6800 #[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."]
6801 pub fn otCoapSecureSendResponseBlockWise(
6802 aInstance: *mut otInstance,
6803 aMessage: *mut otMessage,
6804 aMessageInfo: *const otMessageInfo,
6805 aContext: *mut ::std::os::raw::c_void,
6806 aTransmitHook: otCoapBlockwiseTransmitHook,
6807 ) -> otError;
6808}
6809unsafe extern "C" {
6810 #[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."]
6811 pub fn otCoapSecureSendResponse(
6812 aInstance: *mut otInstance,
6813 aMessage: *mut otMessage,
6814 aMessageInfo: *const otMessageInfo,
6815 ) -> otError;
6816}
6817#[doc = " @struct otNetworkKey\n\n Represents a Thread Network Key."]
6818#[repr(C, packed)]
6819#[derive(Debug, Default, Copy, Clone)]
6820pub struct otNetworkKey {
6821 #[doc = "< Byte values"]
6822 pub m8: [u8; 16usize],
6823}
6824#[doc = " This datatype represents KeyRef to NetworkKey."]
6825pub type otNetworkKeyRef = otCryptoKeyRef;
6826#[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`)."]
6827#[repr(C)]
6828#[derive(Debug, Default, Copy, Clone)]
6829pub struct otNetworkName {
6830 #[doc = "< Byte values. The `+ 1` is for null char."]
6831 pub m8: [::std::os::raw::c_char; 17usize],
6832}
6833#[doc = " Represents an Extended PAN ID."]
6834#[repr(C, packed)]
6835#[derive(Debug, Default, Copy, Clone)]
6836pub struct otExtendedPanId {
6837 #[doc = "< Byte values"]
6838 pub m8: [u8; 8usize],
6839}
6840#[doc = " Represents a Mesh Local Prefix."]
6841pub type otMeshLocalPrefix = otIp6NetworkPrefix;
6842#[doc = " Represents PSKc."]
6843#[repr(C, packed)]
6844#[derive(Debug, Default, Copy, Clone)]
6845pub struct otPskc {
6846 #[doc = "< Byte values"]
6847 pub m8: [u8; 16usize],
6848}
6849#[doc = " This datatype represents KeyRef to PSKc."]
6850pub type otPskcRef = otCryptoKeyRef;
6851#[doc = " Represent Security Policy."]
6852#[repr(C)]
6853#[derive(Debug, Default, Copy, Clone)]
6854pub struct otSecurityPolicy {
6855 #[doc = "< The value for thrKeyRotation in units of hours."]
6856 pub mRotationTime: u16,
6857 pub _bitfield_align_1: [u8; 0],
6858 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
6859}
6860impl otSecurityPolicy {
6861 #[inline]
6862 pub fn mObtainNetworkKeyEnabled(&self) -> bool {
6863 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
6864 }
6865 #[inline]
6866 pub fn set_mObtainNetworkKeyEnabled(&mut self, val: bool) {
6867 unsafe {
6868 let val: u8 = ::std::mem::transmute(val);
6869 self._bitfield_1.set(0usize, 1u8, val as u64)
6870 }
6871 }
6872 #[inline]
6873 pub unsafe fn mObtainNetworkKeyEnabled_raw(this: *const Self) -> bool {
6874 unsafe {
6875 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6876 ::std::ptr::addr_of!((*this)._bitfield_1),
6877 0usize,
6878 1u8,
6879 ) as u8)
6880 }
6881 }
6882 #[inline]
6883 pub unsafe fn set_mObtainNetworkKeyEnabled_raw(this: *mut Self, val: bool) {
6884 unsafe {
6885 let val: u8 = ::std::mem::transmute(val);
6886 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6887 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6888 0usize,
6889 1u8,
6890 val as u64,
6891 )
6892 }
6893 }
6894 #[inline]
6895 pub fn mNativeCommissioningEnabled(&self) -> bool {
6896 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
6897 }
6898 #[inline]
6899 pub fn set_mNativeCommissioningEnabled(&mut self, val: bool) {
6900 unsafe {
6901 let val: u8 = ::std::mem::transmute(val);
6902 self._bitfield_1.set(1usize, 1u8, val as u64)
6903 }
6904 }
6905 #[inline]
6906 pub unsafe fn mNativeCommissioningEnabled_raw(this: *const Self) -> bool {
6907 unsafe {
6908 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6909 ::std::ptr::addr_of!((*this)._bitfield_1),
6910 1usize,
6911 1u8,
6912 ) as u8)
6913 }
6914 }
6915 #[inline]
6916 pub unsafe fn set_mNativeCommissioningEnabled_raw(this: *mut Self, val: bool) {
6917 unsafe {
6918 let val: u8 = ::std::mem::transmute(val);
6919 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6920 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6921 1usize,
6922 1u8,
6923 val as u64,
6924 )
6925 }
6926 }
6927 #[inline]
6928 pub fn mRoutersEnabled(&self) -> bool {
6929 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
6930 }
6931 #[inline]
6932 pub fn set_mRoutersEnabled(&mut self, val: bool) {
6933 unsafe {
6934 let val: u8 = ::std::mem::transmute(val);
6935 self._bitfield_1.set(2usize, 1u8, val as u64)
6936 }
6937 }
6938 #[inline]
6939 pub unsafe fn mRoutersEnabled_raw(this: *const Self) -> bool {
6940 unsafe {
6941 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6942 ::std::ptr::addr_of!((*this)._bitfield_1),
6943 2usize,
6944 1u8,
6945 ) as u8)
6946 }
6947 }
6948 #[inline]
6949 pub unsafe fn set_mRoutersEnabled_raw(this: *mut Self, val: bool) {
6950 unsafe {
6951 let val: u8 = ::std::mem::transmute(val);
6952 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6953 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6954 2usize,
6955 1u8,
6956 val as u64,
6957 )
6958 }
6959 }
6960 #[inline]
6961 pub fn mExternalCommissioningEnabled(&self) -> bool {
6962 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
6963 }
6964 #[inline]
6965 pub fn set_mExternalCommissioningEnabled(&mut self, val: bool) {
6966 unsafe {
6967 let val: u8 = ::std::mem::transmute(val);
6968 self._bitfield_1.set(3usize, 1u8, val as u64)
6969 }
6970 }
6971 #[inline]
6972 pub unsafe fn mExternalCommissioningEnabled_raw(this: *const Self) -> bool {
6973 unsafe {
6974 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6975 ::std::ptr::addr_of!((*this)._bitfield_1),
6976 3usize,
6977 1u8,
6978 ) as u8)
6979 }
6980 }
6981 #[inline]
6982 pub unsafe fn set_mExternalCommissioningEnabled_raw(this: *mut Self, val: bool) {
6983 unsafe {
6984 let val: u8 = ::std::mem::transmute(val);
6985 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6986 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6987 3usize,
6988 1u8,
6989 val as u64,
6990 )
6991 }
6992 }
6993 #[inline]
6994 pub fn mCommercialCommissioningEnabled(&self) -> bool {
6995 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
6996 }
6997 #[inline]
6998 pub fn set_mCommercialCommissioningEnabled(&mut self, val: bool) {
6999 unsafe {
7000 let val: u8 = ::std::mem::transmute(val);
7001 self._bitfield_1.set(4usize, 1u8, val as u64)
7002 }
7003 }
7004 #[inline]
7005 pub unsafe fn mCommercialCommissioningEnabled_raw(this: *const Self) -> bool {
7006 unsafe {
7007 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7008 ::std::ptr::addr_of!((*this)._bitfield_1),
7009 4usize,
7010 1u8,
7011 ) as u8)
7012 }
7013 }
7014 #[inline]
7015 pub unsafe fn set_mCommercialCommissioningEnabled_raw(this: *mut Self, val: bool) {
7016 unsafe {
7017 let val: u8 = ::std::mem::transmute(val);
7018 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7019 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7020 4usize,
7021 1u8,
7022 val as u64,
7023 )
7024 }
7025 }
7026 #[inline]
7027 pub fn mAutonomousEnrollmentEnabled(&self) -> bool {
7028 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
7029 }
7030 #[inline]
7031 pub fn set_mAutonomousEnrollmentEnabled(&mut self, val: bool) {
7032 unsafe {
7033 let val: u8 = ::std::mem::transmute(val);
7034 self._bitfield_1.set(5usize, 1u8, val as u64)
7035 }
7036 }
7037 #[inline]
7038 pub unsafe fn mAutonomousEnrollmentEnabled_raw(this: *const Self) -> bool {
7039 unsafe {
7040 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7041 ::std::ptr::addr_of!((*this)._bitfield_1),
7042 5usize,
7043 1u8,
7044 ) as u8)
7045 }
7046 }
7047 #[inline]
7048 pub unsafe fn set_mAutonomousEnrollmentEnabled_raw(this: *mut Self, val: bool) {
7049 unsafe {
7050 let val: u8 = ::std::mem::transmute(val);
7051 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7052 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7053 5usize,
7054 1u8,
7055 val as u64,
7056 )
7057 }
7058 }
7059 #[inline]
7060 pub fn mNetworkKeyProvisioningEnabled(&self) -> bool {
7061 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
7062 }
7063 #[inline]
7064 pub fn set_mNetworkKeyProvisioningEnabled(&mut self, val: bool) {
7065 unsafe {
7066 let val: u8 = ::std::mem::transmute(val);
7067 self._bitfield_1.set(6usize, 1u8, val as u64)
7068 }
7069 }
7070 #[inline]
7071 pub unsafe fn mNetworkKeyProvisioningEnabled_raw(this: *const Self) -> bool {
7072 unsafe {
7073 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7074 ::std::ptr::addr_of!((*this)._bitfield_1),
7075 6usize,
7076 1u8,
7077 ) as u8)
7078 }
7079 }
7080 #[inline]
7081 pub unsafe fn set_mNetworkKeyProvisioningEnabled_raw(this: *mut Self, val: bool) {
7082 unsafe {
7083 let val: u8 = ::std::mem::transmute(val);
7084 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7085 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7086 6usize,
7087 1u8,
7088 val as u64,
7089 )
7090 }
7091 }
7092 #[inline]
7093 pub fn mTobleLinkEnabled(&self) -> bool {
7094 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
7095 }
7096 #[inline]
7097 pub fn set_mTobleLinkEnabled(&mut self, val: bool) {
7098 unsafe {
7099 let val: u8 = ::std::mem::transmute(val);
7100 self._bitfield_1.set(7usize, 1u8, val as u64)
7101 }
7102 }
7103 #[inline]
7104 pub unsafe fn mTobleLinkEnabled_raw(this: *const Self) -> bool {
7105 unsafe {
7106 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7107 ::std::ptr::addr_of!((*this)._bitfield_1),
7108 7usize,
7109 1u8,
7110 ) as u8)
7111 }
7112 }
7113 #[inline]
7114 pub unsafe fn set_mTobleLinkEnabled_raw(this: *mut Self, val: bool) {
7115 unsafe {
7116 let val: u8 = ::std::mem::transmute(val);
7117 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7118 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7119 7usize,
7120 1u8,
7121 val as u64,
7122 )
7123 }
7124 }
7125 #[inline]
7126 pub fn mNonCcmRoutersEnabled(&self) -> bool {
7127 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
7128 }
7129 #[inline]
7130 pub fn set_mNonCcmRoutersEnabled(&mut self, val: bool) {
7131 unsafe {
7132 let val: u8 = ::std::mem::transmute(val);
7133 self._bitfield_1.set(8usize, 1u8, val as u64)
7134 }
7135 }
7136 #[inline]
7137 pub unsafe fn mNonCcmRoutersEnabled_raw(this: *const Self) -> bool {
7138 unsafe {
7139 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7140 ::std::ptr::addr_of!((*this)._bitfield_1),
7141 8usize,
7142 1u8,
7143 ) as u8)
7144 }
7145 }
7146 #[inline]
7147 pub unsafe fn set_mNonCcmRoutersEnabled_raw(this: *mut Self, val: bool) {
7148 unsafe {
7149 let val: u8 = ::std::mem::transmute(val);
7150 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7151 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7152 8usize,
7153 1u8,
7154 val as u64,
7155 )
7156 }
7157 }
7158 #[inline]
7159 pub fn mVersionThresholdForRouting(&self) -> u8 {
7160 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 3u8) as u8) }
7161 }
7162 #[inline]
7163 pub fn set_mVersionThresholdForRouting(&mut self, val: u8) {
7164 unsafe {
7165 let val: u8 = ::std::mem::transmute(val);
7166 self._bitfield_1.set(9usize, 3u8, val as u64)
7167 }
7168 }
7169 #[inline]
7170 pub unsafe fn mVersionThresholdForRouting_raw(this: *const Self) -> u8 {
7171 unsafe {
7172 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
7173 ::std::ptr::addr_of!((*this)._bitfield_1),
7174 9usize,
7175 3u8,
7176 ) as u8)
7177 }
7178 }
7179 #[inline]
7180 pub unsafe fn set_mVersionThresholdForRouting_raw(this: *mut Self, val: u8) {
7181 unsafe {
7182 let val: u8 = ::std::mem::transmute(val);
7183 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
7184 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
7185 9usize,
7186 3u8,
7187 val as u64,
7188 )
7189 }
7190 }
7191 #[inline]
7192 pub fn new_bitfield_1(
7193 mObtainNetworkKeyEnabled: bool,
7194 mNativeCommissioningEnabled: bool,
7195 mRoutersEnabled: bool,
7196 mExternalCommissioningEnabled: bool,
7197 mCommercialCommissioningEnabled: bool,
7198 mAutonomousEnrollmentEnabled: bool,
7199 mNetworkKeyProvisioningEnabled: bool,
7200 mTobleLinkEnabled: bool,
7201 mNonCcmRoutersEnabled: bool,
7202 mVersionThresholdForRouting: u8,
7203 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
7204 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
7205 __bindgen_bitfield_unit.set(0usize, 1u8, {
7206 let mObtainNetworkKeyEnabled: u8 =
7207 unsafe { ::std::mem::transmute(mObtainNetworkKeyEnabled) };
7208 mObtainNetworkKeyEnabled as u64
7209 });
7210 __bindgen_bitfield_unit.set(1usize, 1u8, {
7211 let mNativeCommissioningEnabled: u8 =
7212 unsafe { ::std::mem::transmute(mNativeCommissioningEnabled) };
7213 mNativeCommissioningEnabled as u64
7214 });
7215 __bindgen_bitfield_unit.set(2usize, 1u8, {
7216 let mRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mRoutersEnabled) };
7217 mRoutersEnabled as u64
7218 });
7219 __bindgen_bitfield_unit.set(3usize, 1u8, {
7220 let mExternalCommissioningEnabled: u8 =
7221 unsafe { ::std::mem::transmute(mExternalCommissioningEnabled) };
7222 mExternalCommissioningEnabled as u64
7223 });
7224 __bindgen_bitfield_unit.set(4usize, 1u8, {
7225 let mCommercialCommissioningEnabled: u8 =
7226 unsafe { ::std::mem::transmute(mCommercialCommissioningEnabled) };
7227 mCommercialCommissioningEnabled as u64
7228 });
7229 __bindgen_bitfield_unit.set(5usize, 1u8, {
7230 let mAutonomousEnrollmentEnabled: u8 =
7231 unsafe { ::std::mem::transmute(mAutonomousEnrollmentEnabled) };
7232 mAutonomousEnrollmentEnabled as u64
7233 });
7234 __bindgen_bitfield_unit.set(6usize, 1u8, {
7235 let mNetworkKeyProvisioningEnabled: u8 =
7236 unsafe { ::std::mem::transmute(mNetworkKeyProvisioningEnabled) };
7237 mNetworkKeyProvisioningEnabled as u64
7238 });
7239 __bindgen_bitfield_unit.set(7usize, 1u8, {
7240 let mTobleLinkEnabled: u8 = unsafe { ::std::mem::transmute(mTobleLinkEnabled) };
7241 mTobleLinkEnabled as u64
7242 });
7243 __bindgen_bitfield_unit.set(8usize, 1u8, {
7244 let mNonCcmRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mNonCcmRoutersEnabled) };
7245 mNonCcmRoutersEnabled as u64
7246 });
7247 __bindgen_bitfield_unit.set(9usize, 3u8, {
7248 let mVersionThresholdForRouting: u8 =
7249 unsafe { ::std::mem::transmute(mVersionThresholdForRouting) };
7250 mVersionThresholdForRouting as u64
7251 });
7252 __bindgen_bitfield_unit
7253 }
7254}
7255#[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."]
7256pub type otChannelMask = u32;
7257#[doc = " Represents presence of different components in Active or Pending Operational Dataset."]
7258#[repr(C)]
7259#[derive(Debug, Default, Copy, Clone)]
7260pub struct otOperationalDatasetComponents {
7261 #[doc = "< TRUE if Active Timestamp is present, FALSE otherwise."]
7262 pub mIsActiveTimestampPresent: bool,
7263 #[doc = "< TRUE if Pending Timestamp is present, FALSE otherwise."]
7264 pub mIsPendingTimestampPresent: bool,
7265 #[doc = "< TRUE if Network Key is present, FALSE otherwise."]
7266 pub mIsNetworkKeyPresent: bool,
7267 #[doc = "< TRUE if Network Name is present, FALSE otherwise."]
7268 pub mIsNetworkNamePresent: bool,
7269 #[doc = "< TRUE if Extended PAN ID is present, FALSE otherwise."]
7270 pub mIsExtendedPanIdPresent: bool,
7271 #[doc = "< TRUE if Mesh Local Prefix is present, FALSE otherwise."]
7272 pub mIsMeshLocalPrefixPresent: bool,
7273 #[doc = "< TRUE if Delay Timer is present, FALSE otherwise."]
7274 pub mIsDelayPresent: bool,
7275 #[doc = "< TRUE if PAN ID is present, FALSE otherwise."]
7276 pub mIsPanIdPresent: bool,
7277 #[doc = "< TRUE if Channel is present, FALSE otherwise."]
7278 pub mIsChannelPresent: bool,
7279 #[doc = "< TRUE if PSKc is present, FALSE otherwise."]
7280 pub mIsPskcPresent: bool,
7281 #[doc = "< TRUE if Security Policy is present, FALSE otherwise."]
7282 pub mIsSecurityPolicyPresent: bool,
7283 #[doc = "< TRUE if Channel Mask is present, FALSE otherwise."]
7284 pub mIsChannelMaskPresent: bool,
7285}
7286#[doc = " Represents a Thread Dataset timestamp component."]
7287#[repr(C)]
7288#[derive(Debug, Default, Copy, Clone)]
7289pub struct otTimestamp {
7290 pub mSeconds: u64,
7291 pub mTicks: u16,
7292 pub mAuthoritative: bool,
7293}
7294#[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."]
7295#[repr(C)]
7296#[derive(Debug, Default, Copy, Clone)]
7297pub struct otOperationalDataset {
7298 #[doc = "< Active Timestamp"]
7299 pub mActiveTimestamp: otTimestamp,
7300 #[doc = "< Pending Timestamp"]
7301 pub mPendingTimestamp: otTimestamp,
7302 #[doc = "< Network Key"]
7303 pub mNetworkKey: otNetworkKey,
7304 #[doc = "< Network Name"]
7305 pub mNetworkName: otNetworkName,
7306 #[doc = "< Extended PAN ID"]
7307 pub mExtendedPanId: otExtendedPanId,
7308 #[doc = "< Mesh Local Prefix"]
7309 pub mMeshLocalPrefix: otMeshLocalPrefix,
7310 #[doc = "< Delay Timer"]
7311 pub mDelay: u32,
7312 #[doc = "< PAN ID"]
7313 pub mPanId: otPanId,
7314 #[doc = "< Channel"]
7315 pub mChannel: u16,
7316 #[doc = "< PSKc"]
7317 pub mPskc: otPskc,
7318 #[doc = "< Security Policy"]
7319 pub mSecurityPolicy: otSecurityPolicy,
7320 #[doc = "< Channel Mask"]
7321 pub mChannelMask: otChannelMask,
7322 #[doc = "< Specifies which components are set in the Dataset."]
7323 pub mComponents: otOperationalDatasetComponents,
7324}
7325#[doc = " Represents an Active or Pending Operational Dataset.\n\n The Operational Dataset is TLV encoded as specified by Thread."]
7326#[repr(C)]
7327#[derive(Debug, Copy, Clone)]
7328pub struct otOperationalDatasetTlvs {
7329 #[doc = "< Operational Dataset TLVs."]
7330 pub mTlvs: [u8; 254usize],
7331 #[doc = "< Size of Operational Dataset in bytes."]
7332 pub mLength: u8,
7333}
7334impl Default for otOperationalDatasetTlvs {
7335 fn default() -> Self {
7336 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7337 unsafe {
7338 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7339 s.assume_init()
7340 }
7341 }
7342}
7343#[doc = "< meshcop Channel TLV"]
7344pub const OT_MESHCOP_TLV_CHANNEL: otMeshcopTlvType = 0;
7345#[doc = "< meshcop Pan Id TLV"]
7346pub const OT_MESHCOP_TLV_PANID: otMeshcopTlvType = 1;
7347#[doc = "< meshcop Extended Pan Id TLV"]
7348pub const OT_MESHCOP_TLV_EXTPANID: otMeshcopTlvType = 2;
7349#[doc = "< meshcop Network Name TLV"]
7350pub const OT_MESHCOP_TLV_NETWORKNAME: otMeshcopTlvType = 3;
7351#[doc = "< meshcop PSKc TLV"]
7352pub const OT_MESHCOP_TLV_PSKC: otMeshcopTlvType = 4;
7353#[doc = "< meshcop Network Key TLV"]
7354pub const OT_MESHCOP_TLV_NETWORKKEY: otMeshcopTlvType = 5;
7355#[doc = "< meshcop Network Key Sequence TLV"]
7356pub const OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE: otMeshcopTlvType = 6;
7357#[doc = "< meshcop Mesh Local Prefix TLV"]
7358pub const OT_MESHCOP_TLV_MESHLOCALPREFIX: otMeshcopTlvType = 7;
7359#[doc = "< meshcop Steering Data TLV"]
7360pub const OT_MESHCOP_TLV_STEERING_DATA: otMeshcopTlvType = 8;
7361#[doc = "< meshcop Border Agent Locator TLV"]
7362pub const OT_MESHCOP_TLV_BORDER_AGENT_RLOC: otMeshcopTlvType = 9;
7363#[doc = "< meshcop Commissioner ID TLV"]
7364pub const OT_MESHCOP_TLV_COMMISSIONER_ID: otMeshcopTlvType = 10;
7365#[doc = "< meshcop Commissioner Session ID TLV"]
7366pub const OT_MESHCOP_TLV_COMM_SESSION_ID: otMeshcopTlvType = 11;
7367#[doc = "< meshcop Security Policy TLV"]
7368pub const OT_MESHCOP_TLV_SECURITYPOLICY: otMeshcopTlvType = 12;
7369#[doc = "< meshcop Get TLV"]
7370pub const OT_MESHCOP_TLV_GET: otMeshcopTlvType = 13;
7371#[doc = "< meshcop Active Timestamp TLV"]
7372pub const OT_MESHCOP_TLV_ACTIVETIMESTAMP: otMeshcopTlvType = 14;
7373#[doc = "< meshcop Commissioner UDP Port TLV"]
7374pub const OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT: otMeshcopTlvType = 15;
7375#[doc = "< meshcop State TLV"]
7376pub const OT_MESHCOP_TLV_STATE: otMeshcopTlvType = 16;
7377#[doc = "< meshcop Joiner DTLS Encapsulation TLV"]
7378pub const OT_MESHCOP_TLV_JOINER_DTLS: otMeshcopTlvType = 17;
7379#[doc = "< meshcop Joiner UDP Port TLV"]
7380pub const OT_MESHCOP_TLV_JOINER_UDP_PORT: otMeshcopTlvType = 18;
7381#[doc = "< meshcop Joiner IID TLV"]
7382pub const OT_MESHCOP_TLV_JOINER_IID: otMeshcopTlvType = 19;
7383#[doc = "< meshcop Joiner Router Locator TLV"]
7384pub const OT_MESHCOP_TLV_JOINER_RLOC: otMeshcopTlvType = 20;
7385#[doc = "< meshcop Joiner Router KEK TLV"]
7386pub const OT_MESHCOP_TLV_JOINER_ROUTER_KEK: otMeshcopTlvType = 21;
7387#[doc = "< meshcop Duration TLV"]
7388pub const OT_MESHCOP_TLV_DURATION: otMeshcopTlvType = 23;
7389#[doc = "< meshcop Provisioning URL TLV"]
7390pub const OT_MESHCOP_TLV_PROVISIONING_URL: otMeshcopTlvType = 32;
7391#[doc = "< meshcop Vendor Name TLV"]
7392pub const OT_MESHCOP_TLV_VENDOR_NAME_TLV: otMeshcopTlvType = 33;
7393#[doc = "< meshcop Vendor Model TLV"]
7394pub const OT_MESHCOP_TLV_VENDOR_MODEL_TLV: otMeshcopTlvType = 34;
7395#[doc = "< meshcop Vendor SW Version TLV"]
7396pub const OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV: otMeshcopTlvType = 35;
7397#[doc = "< meshcop Vendor Data TLV"]
7398pub const OT_MESHCOP_TLV_VENDOR_DATA_TLV: otMeshcopTlvType = 36;
7399#[doc = "< meshcop Vendor Stack Version TLV"]
7400pub const OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV: otMeshcopTlvType = 37;
7401#[doc = "< meshcop UDP encapsulation TLV"]
7402pub const OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV: otMeshcopTlvType = 48;
7403#[doc = "< meshcop IPv6 address TLV"]
7404pub const OT_MESHCOP_TLV_IPV6_ADDRESS_TLV: otMeshcopTlvType = 49;
7405#[doc = "< meshcop Pending Timestamp TLV"]
7406pub const OT_MESHCOP_TLV_PENDINGTIMESTAMP: otMeshcopTlvType = 51;
7407#[doc = "< meshcop Delay Timer TLV"]
7408pub const OT_MESHCOP_TLV_DELAYTIMER: otMeshcopTlvType = 52;
7409#[doc = "< meshcop Channel Mask TLV"]
7410pub const OT_MESHCOP_TLV_CHANNELMASK: otMeshcopTlvType = 53;
7411#[doc = "< meshcop Count TLV"]
7412pub const OT_MESHCOP_TLV_COUNT: otMeshcopTlvType = 54;
7413#[doc = "< meshcop Period TLV"]
7414pub const OT_MESHCOP_TLV_PERIOD: otMeshcopTlvType = 55;
7415#[doc = "< meshcop Scan Duration TLV"]
7416pub const OT_MESHCOP_TLV_SCAN_DURATION: otMeshcopTlvType = 56;
7417#[doc = "< meshcop Energy List TLV"]
7418pub const OT_MESHCOP_TLV_ENERGY_LIST: otMeshcopTlvType = 57;
7419#[doc = "< meshcop Thread Domain Name TLV"]
7420pub const OT_MESHCOP_TLV_THREAD_DOMAIN_NAME: otMeshcopTlvType = 59;
7421#[doc = "< meshcop Admitter State TLV"]
7422pub const OT_MESHCOP_TLV_ADMITTER_STATE: otMeshcopTlvType = 90;
7423#[doc = "< meshcop Enroller ID TLV"]
7424pub const OT_MESHCOP_TLV_ENROLLER_ID: otMeshcopTlvType = 91;
7425#[doc = "< meshcop Enroller Mode TLV"]
7426pub const OT_MESHCOP_TLV_ENROLLER_MODE: otMeshcopTlvType = 92;
7427#[doc = "< meshcop Discovery Request TLV"]
7428pub const OT_MESHCOP_TLV_DISCOVERYREQUEST: otMeshcopTlvType = 128;
7429#[doc = "< meshcop Discovery Response TLV"]
7430pub const OT_MESHCOP_TLV_DISCOVERYRESPONSE: otMeshcopTlvType = 129;
7431#[doc = "< meshcop Joiner Advertisement TLV (experimental)"]
7432pub const OT_MESHCOP_TLV_JOINERADVERTISEMENT: otMeshcopTlvType = 241;
7433#[doc = " Represents meshcop TLV types."]
7434pub type otMeshcopTlvType = ::std::os::raw::c_uint;
7435#[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."]
7436pub type otDatasetMgmtSetCallback = ::std::option::Option<
7437 unsafe extern "C" fn(aResult: otError, aContext: *mut ::std::os::raw::c_void),
7438>;
7439unsafe extern "C" {
7440 #[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."]
7441 pub fn otDatasetIsCommissioned(aInstance: *mut otInstance) -> bool;
7442}
7443unsafe extern "C" {
7444 #[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."]
7445 pub fn otDatasetGetActive(
7446 aInstance: *mut otInstance,
7447 aDataset: *mut otOperationalDataset,
7448 ) -> otError;
7449}
7450unsafe extern "C" {
7451 #[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."]
7452 pub fn otDatasetGetActiveTlvs(
7453 aInstance: *mut otInstance,
7454 aDataset: *mut otOperationalDatasetTlvs,
7455 ) -> otError;
7456}
7457unsafe extern "C" {
7458 #[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."]
7459 pub fn otDatasetSetActive(
7460 aInstance: *mut otInstance,
7461 aDataset: *const otOperationalDataset,
7462 ) -> otError;
7463}
7464unsafe extern "C" {
7465 #[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."]
7466 pub fn otDatasetSetActiveTlvs(
7467 aInstance: *mut otInstance,
7468 aDataset: *const otOperationalDatasetTlvs,
7469 ) -> otError;
7470}
7471unsafe extern "C" {
7472 #[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."]
7473 pub fn otDatasetGetPending(
7474 aInstance: *mut otInstance,
7475 aDataset: *mut otOperationalDataset,
7476 ) -> otError;
7477}
7478unsafe extern "C" {
7479 #[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."]
7480 pub fn otDatasetGetPendingTlvs(
7481 aInstance: *mut otInstance,
7482 aDataset: *mut otOperationalDatasetTlvs,
7483 ) -> otError;
7484}
7485unsafe extern "C" {
7486 #[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."]
7487 pub fn otDatasetSetPending(
7488 aInstance: *mut otInstance,
7489 aDataset: *const otOperationalDataset,
7490 ) -> otError;
7491}
7492unsafe extern "C" {
7493 #[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."]
7494 pub fn otDatasetSetPendingTlvs(
7495 aInstance: *mut otInstance,
7496 aDataset: *const otOperationalDatasetTlvs,
7497 ) -> otError;
7498}
7499unsafe extern "C" {
7500 #[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."]
7501 pub fn otDatasetSendMgmtActiveGet(
7502 aInstance: *mut otInstance,
7503 aDatasetComponents: *const otOperationalDatasetComponents,
7504 aTlvTypes: *const u8,
7505 aLength: u8,
7506 aAddress: *const otIp6Address,
7507 ) -> otError;
7508}
7509unsafe extern "C" {
7510 #[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."]
7511 pub fn otDatasetSendMgmtActiveSet(
7512 aInstance: *mut otInstance,
7513 aDataset: *const otOperationalDataset,
7514 aTlvs: *const u8,
7515 aLength: u8,
7516 aCallback: otDatasetMgmtSetCallback,
7517 aContext: *mut ::std::os::raw::c_void,
7518 ) -> otError;
7519}
7520unsafe extern "C" {
7521 #[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."]
7522 pub fn otDatasetSendMgmtPendingGet(
7523 aInstance: *mut otInstance,
7524 aDatasetComponents: *const otOperationalDatasetComponents,
7525 aTlvTypes: *const u8,
7526 aLength: u8,
7527 aAddress: *const otIp6Address,
7528 ) -> otError;
7529}
7530unsafe extern "C" {
7531 #[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."]
7532 pub fn otDatasetSendMgmtPendingSet(
7533 aInstance: *mut otInstance,
7534 aDataset: *const otOperationalDataset,
7535 aTlvs: *const u8,
7536 aLength: u8,
7537 aCallback: otDatasetMgmtSetCallback,
7538 aContext: *mut ::std::os::raw::c_void,
7539 ) -> otError;
7540}
7541unsafe extern "C" {
7542 #[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."]
7543 pub fn otDatasetGeneratePskc(
7544 aPassPhrase: *const ::std::os::raw::c_char,
7545 aNetworkName: *const otNetworkName,
7546 aExtPanId: *const otExtendedPanId,
7547 aPskc: *mut otPskc,
7548 ) -> otError;
7549}
7550unsafe extern "C" {
7551 #[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)."]
7552 pub fn otNetworkNameFromString(
7553 aNetworkName: *mut otNetworkName,
7554 aNameString: *const ::std::os::raw::c_char,
7555 ) -> otError;
7556}
7557unsafe extern "C" {
7558 #[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 In addition to the TLV lengths, the values of the following TLVs are validated: Channel and Wake-up Channel (the\n channel page must be supported and the channel within range), Channel Mask (well-formed entries), PAN ID (must not\n be the broadcast PAN ID 0xffff), Extended PAN ID (must not be all-zeros or all-ones), Mesh-Local Prefix (must be a\n locally assigned ULA prefix, i.e., `fd00::/8`), Network Name (1 to 16 bytes, valid UTF-8, no control characters),\n and Security Policy.\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."]
7559 pub fn otDatasetIsValid(aDatasetTlvs: *const otOperationalDatasetTlvs, aActive: bool) -> bool;
7560}
7561unsafe extern "C" {
7562 #[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`."]
7563 pub fn otDatasetParseTlvs(
7564 aDatasetTlvs: *const otOperationalDatasetTlvs,
7565 aDataset: *mut otOperationalDataset,
7566 ) -> otError;
7567}
7568unsafe extern "C" {
7569 #[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)."]
7570 pub fn otDatasetTlvsCompare(
7571 aDatasetTlvsA: *const otOperationalDatasetTlvs,
7572 aDatasetTlvsB: *const otOperationalDatasetTlvs,
7573 ) -> bool;
7574}
7575unsafe extern "C" {
7576 #[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."]
7577 pub fn otDatasetConvertToTlvs(
7578 aDataset: *const otOperationalDataset,
7579 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7580 );
7581}
7582unsafe extern "C" {
7583 #[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."]
7584 pub fn otDatasetUpdateTlvs(
7585 aDataset: *const otOperationalDataset,
7586 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7587 ) -> otError;
7588}
7589unsafe extern "C" {
7590 #[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."]
7591 pub fn otDatasetAffectsConnectivity(
7592 aInstance: *mut otInstance,
7593 aDatasetTlvs: *const otOperationalDatasetTlvs,
7594 ) -> bool;
7595}
7596unsafe extern "C" {
7597 #[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."]
7598 pub fn otDatasetCreateNewNetwork(
7599 aInstance: *mut otInstance,
7600 aDataset: *mut otOperationalDataset,
7601 ) -> otError;
7602}
7603unsafe extern "C" {
7604 #[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)."]
7605 pub fn otDatasetGetDelayTimerMinimal(aInstance: *mut otInstance) -> u32;
7606}
7607unsafe extern "C" {
7608 #[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."]
7609 pub fn otDatasetSetDelayTimerMinimal(
7610 aInstance: *mut otInstance,
7611 aDelayTimerMinimal: u32,
7612 ) -> otError;
7613}
7614#[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()`)."]
7615pub type otDatasetUpdaterCallback = ::std::option::Option<
7616 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
7617>;
7618unsafe extern "C" {
7619 #[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."]
7620 pub fn otDatasetUpdaterRequestUpdate(
7621 aInstance: *mut otInstance,
7622 aDataset: *const otOperationalDataset,
7623 aCallback: otDatasetUpdaterCallback,
7624 aContext: *mut ::std::os::raw::c_void,
7625 ) -> otError;
7626}
7627unsafe extern "C" {
7628 #[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."]
7629 pub fn otDatasetUpdaterCancelUpdate(aInstance: *mut otInstance);
7630}
7631unsafe extern "C" {
7632 #[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."]
7633 pub fn otDatasetUpdaterIsUpdateOngoing(aInstance: *mut otInstance) -> bool;
7634}
7635#[doc = "< Input mode without pull resistor."]
7636pub const OT_GPIO_MODE_INPUT: otGpioMode = 0;
7637#[doc = "< Output mode."]
7638pub const OT_GPIO_MODE_OUTPUT: otGpioMode = 1;
7639#[doc = " Defines the gpio modes."]
7640pub type otGpioMode = ::std::os::raw::c_uint;
7641#[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."]
7642pub type otPlatDiagOutputCallback = ::std::option::Option<
7643 unsafe extern "C" fn(
7644 aFormat: *const ::std::os::raw::c_char,
7645 aArguments: *mut __va_list_tag,
7646 aContext: *mut ::std::os::raw::c_void,
7647 ),
7648>;
7649unsafe extern "C" {
7650 #[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."]
7651 pub fn otPlatDiagSetOutputCallback(
7652 aInstance: *mut otInstance,
7653 aCallback: otPlatDiagOutputCallback,
7654 aContext: *mut ::std::os::raw::c_void,
7655 );
7656}
7657unsafe extern "C" {
7658 #[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."]
7659 pub fn otPlatDiagProcess(
7660 aInstance: *mut otInstance,
7661 aArgsLength: u8,
7662 aArgs: *mut *mut ::std::os::raw::c_char,
7663 ) -> otError;
7664}
7665unsafe extern "C" {
7666 #[doc = " Enables/disables the factory diagnostics mode.\n\n @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise."]
7667 pub fn otPlatDiagModeSet(aMode: bool);
7668}
7669unsafe extern "C" {
7670 #[doc = " Indicates whether or not factory diagnostics mode is enabled.\n\n @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise."]
7671 pub fn otPlatDiagModeGet() -> bool;
7672}
7673unsafe extern "C" {
7674 #[doc = " Sets the channel to use for factory diagnostics.\n\n @param[in] aChannel The channel value."]
7675 pub fn otPlatDiagChannelSet(aChannel: u8);
7676}
7677unsafe extern "C" {
7678 #[doc = " Sets the transmit power to use for factory diagnostics.\n\n @param[in] aTxPower The transmit power value."]
7679 pub fn otPlatDiagTxPowerSet(aTxPower: i8);
7680}
7681unsafe extern "C" {
7682 #[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."]
7683 pub fn otPlatDiagRadioReceived(
7684 aInstance: *mut otInstance,
7685 aFrame: *mut otRadioFrame,
7686 aError: otError,
7687 );
7688}
7689unsafe extern "C" {
7690 #[doc = " Processes the alarm event.\n\n @param[in] aInstance The OpenThread instance for current request."]
7691 pub fn otPlatDiagAlarmCallback(aInstance: *mut otInstance);
7692}
7693unsafe extern "C" {
7694 #[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."]
7695 pub fn otPlatDiagGpioSet(aGpio: u32, aValue: bool) -> otError;
7696}
7697unsafe extern "C" {
7698 #[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."]
7699 pub fn otPlatDiagGpioGet(aGpio: u32, aValue: *mut bool) -> otError;
7700}
7701unsafe extern "C" {
7702 #[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."]
7703 pub fn otPlatDiagGpioSetMode(aGpio: u32, aMode: otGpioMode) -> otError;
7704}
7705unsafe extern "C" {
7706 #[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."]
7707 pub fn otPlatDiagGpioGetMode(aGpio: u32, aMode: *mut otGpioMode) -> otError;
7708}
7709unsafe extern "C" {
7710 #[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."]
7711 pub fn otPlatDiagRadioSetRawPowerSetting(
7712 aInstance: *mut otInstance,
7713 aRawPowerSetting: *const u8,
7714 aRawPowerSettingLength: u16,
7715 ) -> otError;
7716}
7717unsafe extern "C" {
7718 #[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."]
7719 pub fn otPlatDiagRadioGetRawPowerSetting(
7720 aInstance: *mut otInstance,
7721 aRawPowerSetting: *mut u8,
7722 aRawPowerSettingLength: *mut u16,
7723 ) -> otError;
7724}
7725unsafe extern "C" {
7726 #[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."]
7727 pub fn otPlatDiagRadioRawPowerSettingEnable(
7728 aInstance: *mut otInstance,
7729 aEnable: bool,
7730 ) -> otError;
7731}
7732unsafe extern "C" {
7733 #[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."]
7734 pub fn otPlatDiagRadioTransmitCarrier(aInstance: *mut otInstance, aEnable: bool) -> otError;
7735}
7736unsafe extern "C" {
7737 #[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."]
7738 pub fn otPlatDiagRadioTransmitStream(aInstance: *mut otInstance, aEnable: bool) -> otError;
7739}
7740unsafe extern "C" {
7741 #[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."]
7742 pub fn otPlatDiagRadioGetPowerSettings(
7743 aInstance: *mut otInstance,
7744 aChannel: u8,
7745 aTargetPower: *mut i16,
7746 aActualPower: *mut i16,
7747 aRawPowerSetting: *mut u8,
7748 aRawPowerSettingLength: *mut u16,
7749 ) -> otError;
7750}
7751#[doc = " @addtogroup api-factory-diagnostics\n\n @brief\n This module includes functions that control the Thread stack's execution.\n\n @{"]
7752pub type otDiagOutputCallback = otPlatDiagOutputCallback;
7753unsafe extern "C" {
7754 #[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."]
7755 pub fn otDiagSetOutputCallback(
7756 aInstance: *mut otInstance,
7757 aCallback: otDiagOutputCallback,
7758 aContext: *mut ::std::os::raw::c_void,
7759 );
7760}
7761unsafe extern "C" {
7762 #[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."]
7763 pub fn otDiagProcessCmd(
7764 aInstance: *mut otInstance,
7765 aArgsLength: u8,
7766 aArgs: *mut *mut ::std::os::raw::c_char,
7767 ) -> otError;
7768}
7769unsafe extern "C" {
7770 #[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."]
7771 pub fn otDiagProcessCmdLine(
7772 aInstance: *mut otInstance,
7773 aString: *const ::std::os::raw::c_char,
7774 ) -> otError;
7775}
7776unsafe extern "C" {
7777 #[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."]
7778 pub fn otDiagIsEnabled(aInstance: *mut otInstance) -> bool;
7779}
7780#[doc = "< Indicates the flag is not specified."]
7781pub const OT_DNS_FLAG_UNSPECIFIED: otDnsRecursionFlag = 0;
7782#[doc = "< Indicates DNS name server can resolve the query recursively."]
7783pub const OT_DNS_FLAG_RECURSION_DESIRED: otDnsRecursionFlag = 1;
7784#[doc = "< Indicates DNS name server can not resolve the query recursively."]
7785pub const OT_DNS_FLAG_NO_RECURSION: otDnsRecursionFlag = 2;
7786#[doc = " Type represents the \"Recursion Desired\" (RD) flag in an `otDnsQueryConfig`."]
7787pub type otDnsRecursionFlag = ::std::os::raw::c_uint;
7788#[doc = "< NAT64 mode is not specified. Use default NAT64 mode."]
7789pub const OT_DNS_NAT64_UNSPECIFIED: otDnsNat64Mode = 0;
7790#[doc = "< Allow NAT64 address translation during DNS client address resolution."]
7791pub const OT_DNS_NAT64_ALLOW: otDnsNat64Mode = 1;
7792#[doc = "< Do not allow NAT64 address translation during DNS client address resolution."]
7793pub const OT_DNS_NAT64_DISALLOW: otDnsNat64Mode = 2;
7794#[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."]
7795pub type otDnsNat64Mode = ::std::os::raw::c_uint;
7796#[doc = "< Mode is not specified. Use default service mode."]
7797pub const OT_DNS_SERVICE_MODE_UNSPECIFIED: otDnsServiceMode = 0;
7798#[doc = "< Query for SRV record only."]
7799pub const OT_DNS_SERVICE_MODE_SRV: otDnsServiceMode = 1;
7800#[doc = "< Query for TXT record only."]
7801pub const OT_DNS_SERVICE_MODE_TXT: otDnsServiceMode = 2;
7802#[doc = "< Query for both SRV and TXT records in same message."]
7803pub const OT_DNS_SERVICE_MODE_SRV_TXT: otDnsServiceMode = 3;
7804#[doc = "< Query in parallel for SRV and TXT using separate messages."]
7805pub const OT_DNS_SERVICE_MODE_SRV_TXT_SEPARATE: otDnsServiceMode = 4;
7806#[doc = "< Query for TXT/SRV together first, if fails then query separately."]
7807pub const OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE: otDnsServiceMode = 5;
7808#[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."]
7809pub type otDnsServiceMode = ::std::os::raw::c_uint;
7810pub const OT_DNS_TRANSPORT_UNSPECIFIED: otDnsTransportProto = 0;
7811#[doc = " DNS transport is unspecified."]
7812pub const OT_DNS_TRANSPORT_UDP: otDnsTransportProto = 1;
7813#[doc = " DNS query should be sent via UDP."]
7814pub const OT_DNS_TRANSPORT_TCP: otDnsTransportProto = 2;
7815#[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."]
7816pub type otDnsTransportProto = ::std::os::raw::c_uint;
7817#[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`."]
7818#[repr(C)]
7819#[derive(Copy, Clone)]
7820pub struct otDnsQueryConfig {
7821 #[doc = "< Server address (IPv6 addr/port). All zero or zero port for unspecified."]
7822 pub mServerSockAddr: otSockAddr,
7823 #[doc = "< Wait time (in msec) to rx response. Zero indicates unspecified value."]
7824 pub mResponseTimeout: u32,
7825 #[doc = "< Maximum tx attempts before reporting failure. Zero for unspecified value."]
7826 pub mMaxTxAttempts: u8,
7827 #[doc = "< Indicates whether the server can resolve the query recursively or not."]
7828 pub mRecursionFlag: otDnsRecursionFlag,
7829 #[doc = "< Allow/Disallow NAT64 address translation during address resolution."]
7830 pub mNat64Mode: otDnsNat64Mode,
7831 #[doc = "< Determines which records to query during service resolution."]
7832 pub mServiceMode: otDnsServiceMode,
7833 #[doc = "< Select default transport protocol."]
7834 pub mTransportProto: otDnsTransportProto,
7835}
7836impl Default for otDnsQueryConfig {
7837 fn default() -> Self {
7838 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7839 unsafe {
7840 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7841 s.assume_init()
7842 }
7843 }
7844}
7845unsafe extern "C" {
7846 #[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."]
7847 pub fn otDnsClientGetDefaultConfig(aInstance: *mut otInstance) -> *const otDnsQueryConfig;
7848}
7849unsafe extern "C" {
7850 #[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."]
7851 pub fn otDnsClientSetDefaultConfig(
7852 aInstance: *mut otInstance,
7853 aConfig: *const otDnsQueryConfig,
7854 );
7855}
7856#[repr(C)]
7857#[derive(Debug, Copy, Clone)]
7858pub struct otDnsAddressResponse {
7859 _unused: [u8; 0],
7860}
7861#[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"]
7862pub type otDnsAddressCallback = ::std::option::Option<
7863 unsafe extern "C" fn(
7864 aError: otError,
7865 aResponse: *const otDnsAddressResponse,
7866 aContext: *mut ::std::os::raw::c_void,
7867 ),
7868>;
7869unsafe extern "C" {
7870 #[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."]
7871 pub fn otDnsClientResolveAddress(
7872 aInstance: *mut otInstance,
7873 aHostName: *const ::std::os::raw::c_char,
7874 aCallback: otDnsAddressCallback,
7875 aContext: *mut ::std::os::raw::c_void,
7876 aConfig: *const otDnsQueryConfig,
7877 ) -> otError;
7878}
7879unsafe extern "C" {
7880 #[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."]
7881 pub fn otDnsClientResolveIp4Address(
7882 aInstance: *mut otInstance,
7883 aHostName: *const ::std::os::raw::c_char,
7884 aCallback: otDnsAddressCallback,
7885 aContext: *mut ::std::os::raw::c_void,
7886 aConfig: *const otDnsQueryConfig,
7887 ) -> otError;
7888}
7889unsafe extern "C" {
7890 #[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."]
7891 pub fn otDnsAddressResponseGetHostName(
7892 aResponse: *const otDnsAddressResponse,
7893 aNameBuffer: *mut ::std::os::raw::c_char,
7894 aNameBufferSize: u16,
7895 ) -> otError;
7896}
7897unsafe extern "C" {
7898 #[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)."]
7899 pub fn otDnsAddressResponseGetAddress(
7900 aResponse: *const otDnsAddressResponse,
7901 aIndex: u16,
7902 aAddress: *mut otIp6Address,
7903 aTtl: *mut u32,
7904 ) -> otError;
7905}
7906#[repr(C)]
7907#[derive(Debug, Copy, Clone)]
7908pub struct otDnsBrowseResponse {
7909 _unused: [u8; 0],
7910}
7911#[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()`."]
7912pub type otDnsBrowseCallback = ::std::option::Option<
7913 unsafe extern "C" fn(
7914 aError: otError,
7915 aResponse: *const otDnsBrowseResponse,
7916 aContext: *mut ::std::os::raw::c_void,
7917 ),
7918>;
7919#[doc = " Provides info for a DNS service instance."]
7920#[repr(C)]
7921#[derive(Copy, Clone)]
7922pub struct otDnsServiceInfo {
7923 #[doc = "< Service record TTL (in seconds)."]
7924 pub mTtl: u32,
7925 #[doc = "< Service port number."]
7926 pub mPort: u16,
7927 #[doc = "< Service priority."]
7928 pub mPriority: u16,
7929 #[doc = "< Service weight."]
7930 pub mWeight: u16,
7931 #[doc = "< Buffer to output the service host name (can be NULL if not needed)."]
7932 pub mHostNameBuffer: *mut ::std::os::raw::c_char,
7933 #[doc = "< Size of `mHostNameBuffer`."]
7934 pub mHostNameBufferSize: u16,
7935 #[doc = "< The host IPv6 address. Set to all zero if not available."]
7936 pub mHostAddress: otIp6Address,
7937 #[doc = "< The host address TTL."]
7938 pub mHostAddressTtl: u32,
7939 #[doc = "< Buffer to output TXT data (can be NULL if not needed)."]
7940 pub mTxtData: *mut u8,
7941 #[doc = "< On input, size of `mTxtData` buffer. On output number bytes written."]
7942 pub mTxtDataSize: u16,
7943 #[doc = "< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated."]
7944 pub mTxtDataTruncated: bool,
7945 #[doc = "< The TXT data TTL."]
7946 pub mTxtDataTtl: u32,
7947}
7948impl Default for otDnsServiceInfo {
7949 fn default() -> Self {
7950 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7951 unsafe {
7952 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7953 s.assume_init()
7954 }
7955 }
7956}
7957unsafe extern "C" {
7958 #[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."]
7959 pub fn otDnsClientBrowse(
7960 aInstance: *mut otInstance,
7961 aServiceName: *const ::std::os::raw::c_char,
7962 aCallback: otDnsBrowseCallback,
7963 aContext: *mut ::std::os::raw::c_void,
7964 aConfig: *const otDnsQueryConfig,
7965 ) -> otError;
7966}
7967unsafe extern "C" {
7968 #[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."]
7969 pub fn otDnsBrowseResponseGetServiceName(
7970 aResponse: *const otDnsBrowseResponse,
7971 aNameBuffer: *mut ::std::os::raw::c_char,
7972 aNameBufferSize: u16,
7973 ) -> otError;
7974}
7975unsafe extern "C" {
7976 #[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."]
7977 pub fn otDnsBrowseResponseGetServiceInstance(
7978 aResponse: *const otDnsBrowseResponse,
7979 aIndex: u16,
7980 aLabelBuffer: *mut ::std::os::raw::c_char,
7981 aLabelBufferSize: u8,
7982 ) -> otError;
7983}
7984unsafe extern "C" {
7985 #[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."]
7986 pub fn otDnsBrowseResponseGetServiceInfo(
7987 aResponse: *const otDnsBrowseResponse,
7988 aInstanceLabel: *const ::std::os::raw::c_char,
7989 aServiceInfo: *mut otDnsServiceInfo,
7990 ) -> otError;
7991}
7992unsafe extern "C" {
7993 #[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."]
7994 pub fn otDnsBrowseResponseGetHostAddress(
7995 aResponse: *const otDnsBrowseResponse,
7996 aHostName: *const ::std::os::raw::c_char,
7997 aIndex: u16,
7998 aAddress: *mut otIp6Address,
7999 aTtl: *mut u32,
8000 ) -> otError;
8001}
8002#[repr(C)]
8003#[derive(Debug, Copy, Clone)]
8004pub struct otDnsServiceResponse {
8005 _unused: [u8; 0],
8006}
8007#[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()`."]
8008pub type otDnsServiceCallback = ::std::option::Option<
8009 unsafe extern "C" fn(
8010 aError: otError,
8011 aResponse: *const otDnsServiceResponse,
8012 aContext: *mut ::std::os::raw::c_void,
8013 ),
8014>;
8015unsafe extern "C" {
8016 #[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."]
8017 pub fn otDnsClientResolveService(
8018 aInstance: *mut otInstance,
8019 aInstanceLabel: *const ::std::os::raw::c_char,
8020 aServiceName: *const ::std::os::raw::c_char,
8021 aCallback: otDnsServiceCallback,
8022 aContext: *mut ::std::os::raw::c_void,
8023 aConfig: *const otDnsQueryConfig,
8024 ) -> otError;
8025}
8026unsafe extern "C" {
8027 #[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."]
8028 pub fn otDnsClientResolveServiceAndHostAddress(
8029 aInstance: *mut otInstance,
8030 aInstanceLabel: *const ::std::os::raw::c_char,
8031 aServiceName: *const ::std::os::raw::c_char,
8032 aCallback: otDnsServiceCallback,
8033 aContext: *mut ::std::os::raw::c_void,
8034 aConfig: *const otDnsQueryConfig,
8035 ) -> otError;
8036}
8037unsafe extern "C" {
8038 #[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."]
8039 pub fn otDnsServiceResponseGetServiceName(
8040 aResponse: *const otDnsServiceResponse,
8041 aLabelBuffer: *mut ::std::os::raw::c_char,
8042 aLabelBufferSize: u8,
8043 aNameBuffer: *mut ::std::os::raw::c_char,
8044 aNameBufferSize: u16,
8045 ) -> otError;
8046}
8047unsafe extern "C" {
8048 #[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."]
8049 pub fn otDnsServiceResponseGetServiceInfo(
8050 aResponse: *const otDnsServiceResponse,
8051 aServiceInfo: *mut otDnsServiceInfo,
8052 ) -> otError;
8053}
8054unsafe extern "C" {
8055 #[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."]
8056 pub fn otDnsServiceResponseGetHostAddress(
8057 aResponse: *const otDnsServiceResponse,
8058 aHostName: *const ::std::os::raw::c_char,
8059 aIndex: u16,
8060 aAddress: *mut otIp6Address,
8061 aTtl: *mut u32,
8062 ) -> otError;
8063}
8064#[repr(C)]
8065#[derive(Debug, Copy, Clone)]
8066pub struct otDnsRecordResponse {
8067 _unused: [u8; 0],
8068}
8069#[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."]
8070pub type otDnsRecordCallback = ::std::option::Option<
8071 unsafe extern "C" fn(
8072 aError: otError,
8073 aResponse: *const otDnsRecordResponse,
8074 aContext: *mut ::std::os::raw::c_void,
8075 ),
8076>;
8077#[doc = "< Answer section."]
8078pub const OT_DNS_SECTION_ANSWER: otDnsRecordSection = 0;
8079#[doc = "< Authority section."]
8080pub const OT_DNS_SECTION_AUTHORITY: otDnsRecordSection = 1;
8081#[doc = "< Additional section."]
8082pub const OT_DNS_SECTION_ADDITIONAL: otDnsRecordSection = 2;
8083#[doc = " Represents a section in a DNS query/response message."]
8084pub type otDnsRecordSection = ::std::os::raw::c_uint;
8085#[doc = " Represents info for a record in an `otDnsRecordResponse`.\n\n This struct is used as input to `otDnsRecordResponseGetRecordInfo()`."]
8086#[repr(C)]
8087#[derive(Debug, Copy, Clone)]
8088pub struct otDnsRecordInfo {
8089 #[doc = "< Buffer to output the name (MUST NOT be NULL)."]
8090 pub mNameBuffer: *mut ::std::os::raw::c_char,
8091 #[doc = "< Size of `mNameBuffer`."]
8092 pub mNameBufferSize: u16,
8093 #[doc = "< The record type."]
8094 pub mRecordType: u16,
8095 #[doc = "< The record data length (in bytes)."]
8096 pub mRecordLength: u16,
8097 #[doc = "< Record TTL (in seconds)."]
8098 pub mTtl: u32,
8099 #[doc = "< Buffer to output the data (Can be NULL if data not needed)."]
8100 pub mDataBuffer: *mut u8,
8101 #[doc = "< On input, size of `mDataBuffer`. On output number of bytes written."]
8102 pub mDataBufferSize: u16,
8103 #[doc = "< Indicates the section of the record."]
8104 pub mSection: otDnsRecordSection,
8105}
8106impl Default for otDnsRecordInfo {
8107 fn default() -> Self {
8108 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8109 unsafe {
8110 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8111 s.assume_init()
8112 }
8113 }
8114}
8115unsafe extern "C" {
8116 #[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."]
8117 pub fn otDnsClientQueryRecord(
8118 aInstance: *mut otInstance,
8119 aRecordType: u16,
8120 aFirstLabel: *const ::std::os::raw::c_char,
8121 aNextLabels: *const ::std::os::raw::c_char,
8122 aCallback: otDnsRecordCallback,
8123 aContext: *mut ::std::os::raw::c_void,
8124 aConfig: *const otDnsQueryConfig,
8125 ) -> otError;
8126}
8127unsafe extern "C" {
8128 #[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."]
8129 pub fn otDnsRecordResponseGetQueryName(
8130 aResponse: *const otDnsRecordResponse,
8131 aNameBuffer: *mut ::std::os::raw::c_char,
8132 aNameBufferSize: u16,
8133 ) -> otError;
8134}
8135unsafe extern "C" {
8136 #[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."]
8137 pub fn otDnsRecordResponseGetRecordInfo(
8138 aResponse: *const otDnsRecordResponse,
8139 aIndex: u16,
8140 aRecordInfo: *mut otDnsRecordInfo,
8141 ) -> otError;
8142}
8143#[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"]
8144pub type otDnssdQuerySubscribeCallback = ::std::option::Option<
8145 unsafe extern "C" fn(
8146 aContext: *mut ::std::os::raw::c_void,
8147 aFullName: *const ::std::os::raw::c_char,
8148 ),
8149>;
8150#[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.\")."]
8151pub type otDnssdQueryUnsubscribeCallback = ::std::option::Option<
8152 unsafe extern "C" fn(
8153 aContext: *mut ::std::os::raw::c_void,
8154 aFullName: *const ::std::os::raw::c_char,
8155 ),
8156>;
8157#[doc = " This opaque type represents a DNS-SD query."]
8158pub type otDnssdQuery = ::std::os::raw::c_void;
8159#[doc = " Represents information of a discovered service instance for a DNS-SD query."]
8160#[repr(C)]
8161#[derive(Debug, Copy, Clone)]
8162pub struct otDnssdServiceInstanceInfo {
8163 #[doc = "< Full instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
8164 pub mFullName: *const ::std::os::raw::c_char,
8165 #[doc = "< Host name (e.g. \"ot-host.default.service.arpa.\")."]
8166 pub mHostName: *const ::std::os::raw::c_char,
8167 #[doc = "< Number of host IPv6 addresses."]
8168 pub mAddressNum: u8,
8169 #[doc = "< Host IPv6 addresses."]
8170 pub mAddresses: *const otIp6Address,
8171 #[doc = "< Service port."]
8172 pub mPort: u16,
8173 #[doc = "< Service priority."]
8174 pub mPriority: u16,
8175 #[doc = "< Service weight."]
8176 pub mWeight: u16,
8177 #[doc = "< Service TXT RDATA length."]
8178 pub mTxtLength: u16,
8179 #[doc = "< Service TXT RDATA."]
8180 pub mTxtData: *const u8,
8181 #[doc = "< Service TTL (in seconds)."]
8182 pub mTtl: u32,
8183}
8184impl Default for otDnssdServiceInstanceInfo {
8185 fn default() -> Self {
8186 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8187 unsafe {
8188 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8189 s.assume_init()
8190 }
8191 }
8192}
8193#[doc = " Represents information of a discovered host for a DNS-SD query."]
8194#[repr(C)]
8195#[derive(Debug, Copy, Clone)]
8196pub struct otDnssdHostInfo {
8197 #[doc = "< Number of host IPv6 addresses."]
8198 pub mAddressNum: u8,
8199 #[doc = "< Host IPv6 addresses."]
8200 pub mAddresses: *const otIp6Address,
8201 #[doc = "< Service TTL (in seconds)."]
8202 pub mTtl: u32,
8203}
8204impl Default for otDnssdHostInfo {
8205 fn default() -> Self {
8206 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8207 unsafe {
8208 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8209 s.assume_init()
8210 }
8211 }
8212}
8213#[doc = "< Service type unspecified."]
8214pub const OT_DNSSD_QUERY_TYPE_NONE: otDnssdQueryType = 0;
8215#[doc = "< Service type browse service."]
8216pub const OT_DNSSD_QUERY_TYPE_BROWSE: otDnssdQueryType = 1;
8217#[doc = "< Service type resolve service instance."]
8218pub const OT_DNSSD_QUERY_TYPE_RESOLVE: otDnssdQueryType = 2;
8219#[doc = "< Service type resolve hostname."]
8220pub const OT_DNSSD_QUERY_TYPE_RESOLVE_HOST: otDnssdQueryType = 3;
8221#[doc = " Specifies a DNS-SD query type."]
8222pub type otDnssdQueryType = ::std::os::raw::c_uint;
8223#[doc = " Represents the count of queries, responses, failures handled by upstream DNS server.\n\n Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`."]
8224#[repr(C)]
8225#[derive(Debug, Default, Copy, Clone)]
8226pub struct otUpstreamDnsCounters {
8227 #[doc = "< The number of queries forwarded."]
8228 pub mQueries: u32,
8229 #[doc = "< The number of responses forwarded."]
8230 pub mResponses: u32,
8231 #[doc = "< The number of upstream DNS failures."]
8232 pub mFailures: u32,
8233}
8234#[doc = " Contains the counters of DNS-SD server."]
8235#[repr(C)]
8236#[derive(Debug, Default, Copy, Clone)]
8237pub struct otDnssdCounters {
8238 #[doc = "< The number of successful responses."]
8239 pub mSuccessResponse: u32,
8240 #[doc = "< The number of server failure responses."]
8241 pub mServerFailureResponse: u32,
8242 #[doc = "< The number of format error responses."]
8243 pub mFormatErrorResponse: u32,
8244 #[doc = "< The number of name error responses."]
8245 pub mNameErrorResponse: u32,
8246 #[doc = "< The number of 'not implemented' responses."]
8247 pub mNotImplementedResponse: u32,
8248 #[doc = "< The number of other responses."]
8249 pub mOtherResponse: u32,
8250 #[doc = "< The number of queries resolved by the local SRP server."]
8251 pub mResolvedBySrp: u32,
8252 #[doc = "< The number of queries, responses,\n< failures handled by upstream DNS server."]
8253 pub mUpstreamDnsCounters: otUpstreamDnsCounters,
8254}
8255unsafe extern "C" {
8256 #[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."]
8257 pub fn otDnssdQuerySetCallbacks(
8258 aInstance: *mut otInstance,
8259 aSubscribe: otDnssdQuerySubscribeCallback,
8260 aUnsubscribe: otDnssdQueryUnsubscribeCallback,
8261 aContext: *mut ::std::os::raw::c_void,
8262 );
8263}
8264unsafe extern "C" {
8265 #[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."]
8266 pub fn otDnssdQueryHandleDiscoveredServiceInstance(
8267 aInstance: *mut otInstance,
8268 aServiceFullName: *const ::std::os::raw::c_char,
8269 aInstanceInfo: *mut otDnssdServiceInstanceInfo,
8270 );
8271}
8272unsafe extern "C" {
8273 #[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."]
8274 pub fn otDnssdQueryHandleDiscoveredHost(
8275 aInstance: *mut otInstance,
8276 aHostFullName: *const ::std::os::raw::c_char,
8277 aHostInfo: *mut otDnssdHostInfo,
8278 );
8279}
8280unsafe extern "C" {
8281 #[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."]
8282 pub fn otDnssdGetNextQuery(
8283 aInstance: *mut otInstance,
8284 aQuery: *const otDnssdQuery,
8285 ) -> *const otDnssdQuery;
8286}
8287unsafe extern "C" {
8288 #[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."]
8289 pub fn otDnssdGetQueryTypeAndName(
8290 aQuery: *const otDnssdQuery,
8291 aNameOutput: *mut [::std::os::raw::c_char; 255usize],
8292 ) -> otDnssdQueryType;
8293}
8294unsafe extern "C" {
8295 #[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."]
8296 pub fn otDnssdGetCounters(aInstance: *mut otInstance) -> *const otDnssdCounters;
8297}
8298unsafe extern "C" {
8299 #[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"]
8300 pub fn otDnssdUpstreamQuerySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8301}
8302unsafe extern "C" {
8303 #[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"]
8304 pub fn otDnssdUpstreamQueryIsEnabled(aInstance: *mut otInstance) -> bool;
8305}
8306unsafe extern "C" {
8307 #[doc = " @note This API is deprecated and use of it is discouraged."]
8308 pub fn otHeapCAlloc(aCount: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
8309}
8310unsafe extern "C" {
8311 #[doc = " @note This API is deprecated and use of it is discouraged."]
8312 pub fn otHeapFree(aPointer: *mut ::std::os::raw::c_void);
8313}
8314#[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()`."]
8315pub type otBorderRoutingMultiAilCallback = ::std::option::Option<
8316 unsafe extern "C" fn(aDetected: bool, aContext: *mut ::std::os::raw::c_void),
8317>;
8318unsafe extern "C" {
8319 #[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."]
8320 pub fn otBorderRoutingSetMultiAilDetectionEnabled(aInstance: *mut otInstance, aEnable: bool);
8321}
8322unsafe extern "C" {
8323 #[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."]
8324 pub fn otBorderRoutingIsMultiAilDetectionEnabled(aInstance: *mut otInstance) -> bool;
8325}
8326unsafe extern "C" {
8327 #[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."]
8328 pub fn otBorderRoutingIsMultiAilDetectionRunning(aInstance: *mut otInstance) -> bool;
8329}
8330unsafe extern "C" {
8331 #[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."]
8332 pub fn otBorderRoutingIsMultiAilDetected(aInstance: *mut otInstance) -> bool;
8333}
8334unsafe extern "C" {
8335 #[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."]
8336 pub fn otBorderRoutingSetMultiAilCallback(
8337 aInstance: *mut otInstance,
8338 aCallback: otBorderRoutingMultiAilCallback,
8339 aContext: *mut ::std::os::raw::c_void,
8340 );
8341}
8342#[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()`."]
8343#[repr(C)]
8344#[derive(Debug, Copy, Clone)]
8345pub struct otBorderRoutingPrefixTableIterator {
8346 pub mPtr1: *const ::std::os::raw::c_void,
8347 pub mPtr2: *const ::std::os::raw::c_void,
8348 pub mData0: u32,
8349 pub mData1: u32,
8350 pub mData2: u8,
8351 pub mData3: u8,
8352}
8353impl Default for otBorderRoutingPrefixTableIterator {
8354 fn default() -> Self {
8355 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8356 unsafe {
8357 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8358 s.assume_init()
8359 }
8360 }
8361}
8362#[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."]
8363#[repr(C)]
8364#[derive(Copy, Clone)]
8365pub struct otBorderRoutingRouterEntry {
8366 #[doc = "< IPv6 address of the router."]
8367 pub mAddress: otIp6Address,
8368 #[doc = "< Milliseconds since last update (any message rx) from this router."]
8369 pub mMsecSinceLastUpdate: u32,
8370 #[doc = "< The router's age in seconds (duration since its first discovery)."]
8371 pub mAge: u32,
8372 pub _bitfield_align_1: [u8; 0],
8373 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8374 pub __bindgen_padding_0: [u8; 3usize],
8375}
8376impl Default for otBorderRoutingRouterEntry {
8377 fn default() -> Self {
8378 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8379 unsafe {
8380 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8381 s.assume_init()
8382 }
8383 }
8384}
8385impl otBorderRoutingRouterEntry {
8386 #[inline]
8387 pub fn mManagedAddressConfigFlag(&self) -> bool {
8388 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
8389 }
8390 #[inline]
8391 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
8392 unsafe {
8393 let val: u8 = ::std::mem::transmute(val);
8394 self._bitfield_1.set(0usize, 1u8, val as u64)
8395 }
8396 }
8397 #[inline]
8398 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
8399 unsafe {
8400 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8401 ::std::ptr::addr_of!((*this)._bitfield_1),
8402 0usize,
8403 1u8,
8404 ) as u8)
8405 }
8406 }
8407 #[inline]
8408 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
8409 unsafe {
8410 let val: u8 = ::std::mem::transmute(val);
8411 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8412 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8413 0usize,
8414 1u8,
8415 val as u64,
8416 )
8417 }
8418 }
8419 #[inline]
8420 pub fn mOtherConfigFlag(&self) -> bool {
8421 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
8422 }
8423 #[inline]
8424 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
8425 unsafe {
8426 let val: u8 = ::std::mem::transmute(val);
8427 self._bitfield_1.set(1usize, 1u8, val as u64)
8428 }
8429 }
8430 #[inline]
8431 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
8432 unsafe {
8433 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8434 ::std::ptr::addr_of!((*this)._bitfield_1),
8435 1usize,
8436 1u8,
8437 ) as u8)
8438 }
8439 }
8440 #[inline]
8441 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
8442 unsafe {
8443 let val: u8 = ::std::mem::transmute(val);
8444 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8445 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8446 1usize,
8447 1u8,
8448 val as u64,
8449 )
8450 }
8451 }
8452 #[inline]
8453 pub fn mSnacRouterFlag(&self) -> bool {
8454 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
8455 }
8456 #[inline]
8457 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
8458 unsafe {
8459 let val: u8 = ::std::mem::transmute(val);
8460 self._bitfield_1.set(2usize, 1u8, val as u64)
8461 }
8462 }
8463 #[inline]
8464 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
8465 unsafe {
8466 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8467 ::std::ptr::addr_of!((*this)._bitfield_1),
8468 2usize,
8469 1u8,
8470 ) as u8)
8471 }
8472 }
8473 #[inline]
8474 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
8475 unsafe {
8476 let val: u8 = ::std::mem::transmute(val);
8477 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8478 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8479 2usize,
8480 1u8,
8481 val as u64,
8482 )
8483 }
8484 }
8485 #[inline]
8486 pub fn mIsLocalDevice(&self) -> bool {
8487 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
8488 }
8489 #[inline]
8490 pub fn set_mIsLocalDevice(&mut self, val: bool) {
8491 unsafe {
8492 let val: u8 = ::std::mem::transmute(val);
8493 self._bitfield_1.set(3usize, 1u8, val as u64)
8494 }
8495 }
8496 #[inline]
8497 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
8498 unsafe {
8499 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8500 ::std::ptr::addr_of!((*this)._bitfield_1),
8501 3usize,
8502 1u8,
8503 ) as u8)
8504 }
8505 }
8506 #[inline]
8507 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
8508 unsafe {
8509 let val: u8 = ::std::mem::transmute(val);
8510 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8511 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8512 3usize,
8513 1u8,
8514 val as u64,
8515 )
8516 }
8517 }
8518 #[inline]
8519 pub fn mIsReachable(&self) -> bool {
8520 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
8521 }
8522 #[inline]
8523 pub fn set_mIsReachable(&mut self, val: bool) {
8524 unsafe {
8525 let val: u8 = ::std::mem::transmute(val);
8526 self._bitfield_1.set(4usize, 1u8, val as u64)
8527 }
8528 }
8529 #[inline]
8530 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
8531 unsafe {
8532 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8533 ::std::ptr::addr_of!((*this)._bitfield_1),
8534 4usize,
8535 1u8,
8536 ) as u8)
8537 }
8538 }
8539 #[inline]
8540 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
8541 unsafe {
8542 let val: u8 = ::std::mem::transmute(val);
8543 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8544 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8545 4usize,
8546 1u8,
8547 val as u64,
8548 )
8549 }
8550 }
8551 #[inline]
8552 pub fn mIsPeerBr(&self) -> bool {
8553 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
8554 }
8555 #[inline]
8556 pub fn set_mIsPeerBr(&mut self, val: bool) {
8557 unsafe {
8558 let val: u8 = ::std::mem::transmute(val);
8559 self._bitfield_1.set(5usize, 1u8, val as u64)
8560 }
8561 }
8562 #[inline]
8563 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
8564 unsafe {
8565 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8566 ::std::ptr::addr_of!((*this)._bitfield_1),
8567 5usize,
8568 1u8,
8569 ) as u8)
8570 }
8571 }
8572 #[inline]
8573 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
8574 unsafe {
8575 let val: u8 = ::std::mem::transmute(val);
8576 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8577 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8578 5usize,
8579 1u8,
8580 val as u64,
8581 )
8582 }
8583 }
8584 #[inline]
8585 pub fn new_bitfield_1(
8586 mManagedAddressConfigFlag: bool,
8587 mOtherConfigFlag: bool,
8588 mSnacRouterFlag: bool,
8589 mIsLocalDevice: bool,
8590 mIsReachable: bool,
8591 mIsPeerBr: bool,
8592 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8593 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8594 __bindgen_bitfield_unit.set(0usize, 1u8, {
8595 let mManagedAddressConfigFlag: u8 =
8596 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
8597 mManagedAddressConfigFlag as u64
8598 });
8599 __bindgen_bitfield_unit.set(1usize, 1u8, {
8600 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
8601 mOtherConfigFlag as u64
8602 });
8603 __bindgen_bitfield_unit.set(2usize, 1u8, {
8604 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
8605 mSnacRouterFlag as u64
8606 });
8607 __bindgen_bitfield_unit.set(3usize, 1u8, {
8608 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
8609 mIsLocalDevice as u64
8610 });
8611 __bindgen_bitfield_unit.set(4usize, 1u8, {
8612 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
8613 mIsReachable as u64
8614 });
8615 __bindgen_bitfield_unit.set(5usize, 1u8, {
8616 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
8617 mIsPeerBr as u64
8618 });
8619 __bindgen_bitfield_unit
8620 }
8621}
8622#[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."]
8623#[repr(C)]
8624#[derive(Copy, Clone)]
8625pub struct otBorderRoutingPrefixTableEntry {
8626 #[doc = "< Information about the router advertising this prefix."]
8627 pub mRouter: otBorderRoutingRouterEntry,
8628 #[doc = "< The discovered IPv6 prefix."]
8629 pub mPrefix: otIp6Prefix,
8630 #[doc = "< Indicates whether the prefix is on-link or route prefix."]
8631 pub mIsOnLink: bool,
8632 #[doc = "< Milliseconds since last update of this prefix."]
8633 pub mMsecSinceLastUpdate: u32,
8634 #[doc = "< Valid lifetime of the prefix (in seconds)."]
8635 pub mValidLifetime: u32,
8636 #[doc = "< Route preference when `mIsOnlink` is false."]
8637 pub mRoutePreference: otRoutePreference,
8638 #[doc = "< Preferred lifetime of the on-link prefix when `mIsOnLink`."]
8639 pub mPreferredLifetime: u32,
8640}
8641impl Default for otBorderRoutingPrefixTableEntry {
8642 fn default() -> Self {
8643 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8644 unsafe {
8645 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8646 s.assume_init()
8647 }
8648 }
8649}
8650#[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."]
8651#[repr(C)]
8652#[derive(Copy, Clone)]
8653pub struct otBorderRoutingNat64PrefixEntry {
8654 #[doc = "< Information about the router advertising this NAT64 prefix."]
8655 pub mRouter: otBorderRoutingRouterEntry,
8656 #[doc = "< The discovered IPv6 prefix."]
8657 pub mPrefix: otIp6Prefix,
8658 #[doc = "< Milliseconds since last update of this prefix."]
8659 pub mMsecSinceLastUpdate: u32,
8660 #[doc = "< Lifetime of the prefix (in seconds)."]
8661 pub mLifetime: u32,
8662}
8663impl Default for otBorderRoutingNat64PrefixEntry {
8664 fn default() -> Self {
8665 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8666 unsafe {
8667 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8668 s.assume_init()
8669 }
8670 }
8671}
8672#[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."]
8673#[repr(C)]
8674#[derive(Copy, Clone)]
8675pub struct otBorderRoutingRdnssAddrEntry {
8676 #[doc = "< Information about the router advertising this address."]
8677 pub mRouter: otBorderRoutingRouterEntry,
8678 #[doc = "< The DNS Server IPv6 address."]
8679 pub mAddress: otIp6Address,
8680 #[doc = "< Milliseconds since last update of this address."]
8681 pub mMsecSinceLastUpdate: u32,
8682 #[doc = "< Lifetime of the address (in seconds)."]
8683 pub mLifetime: u32,
8684}
8685impl Default for otBorderRoutingRdnssAddrEntry {
8686 fn default() -> Self {
8687 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8688 unsafe {
8689 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8690 s.assume_init()
8691 }
8692 }
8693}
8694#[doc = " Represents information about a peer Border Router found in the Network Data."]
8695#[repr(C)]
8696#[derive(Debug, Default, Copy, Clone)]
8697pub struct otBorderRoutingPeerBorderRouterEntry {
8698 #[doc = "< The RLOC16 of BR."]
8699 pub mRloc16: u16,
8700 #[doc = "< Seconds since the BR appeared in the Network Data."]
8701 pub mAge: u32,
8702}
8703#[doc = " Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL)."]
8704#[repr(C)]
8705#[derive(Copy, Clone)]
8706pub struct otBorderRoutingIfAddrEntry {
8707 #[doc = "< The IPv6 address."]
8708 pub mAddress: otIp6Address,
8709 #[doc = "< Seconds since the last RA was sent from this BR using this address."]
8710 pub mSecSinceLastUse: u32,
8711}
8712impl Default for otBorderRoutingIfAddrEntry {
8713 fn default() -> Self {
8714 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8715 unsafe {
8716 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8717 s.assume_init()
8718 }
8719 }
8720}
8721#[doc = " Represents a group of data of platform-generated RA messages processed."]
8722#[repr(C)]
8723#[derive(Debug, Default, Copy, Clone)]
8724pub struct otPdProcessedRaInfo {
8725 #[doc = "< The number of platform generated RA handled by ProcessPlatformGeneratedRa."]
8726 pub mNumPlatformRaReceived: u32,
8727 #[doc = "< The number of PIO processed for adding OMR prefixes."]
8728 pub mNumPlatformPioProcessed: u32,
8729 #[doc = "< The timestamp of last processed RA message."]
8730 pub mLastPlatformRaMsec: u32,
8731}
8732#[doc = "< BR auto-generates the local OMR prefix."]
8733pub const OT_BORDER_ROUTING_OMR_CONFIG_AUTO: otBorderRoutingOmrConfig = 0;
8734#[doc = "< BR uses a given custom OMR prefix."]
8735pub const OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM: otBorderRoutingOmrConfig = 1;
8736#[doc = "< BR does not add local/PD OMR prefix in Network Data."]
8737pub const OT_BORDER_ROUTING_OMR_CONFIG_DISABLED: otBorderRoutingOmrConfig = 2;
8738#[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."]
8739pub type otBorderRoutingOmrConfig = ::std::os::raw::c_uint;
8740#[doc = "< Routing Manager is uninitialized."]
8741pub const OT_BORDER_ROUTING_STATE_UNINITIALIZED: otBorderRoutingState = 0;
8742#[doc = "< Routing Manager is initialized but disabled."]
8743pub const OT_BORDER_ROUTING_STATE_DISABLED: otBorderRoutingState = 1;
8744#[doc = "< Routing Manager in initialized and enabled but currently stopped."]
8745pub const OT_BORDER_ROUTING_STATE_STOPPED: otBorderRoutingState = 2;
8746#[doc = "< Routing Manager is initialized, enabled, and running."]
8747pub const OT_BORDER_ROUTING_STATE_RUNNING: otBorderRoutingState = 3;
8748#[doc = " Represents the state of Border Routing Manager."]
8749pub type otBorderRoutingState = ::std::os::raw::c_uint;
8750#[doc = "< DHCPv6 PD is disabled on the border router."]
8751pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED: otBorderRoutingDhcp6PdState = 0;
8752#[doc = "< DHCPv6 PD in enabled but won't try to request and publish a prefix."]
8753pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED: otBorderRoutingDhcp6PdState = 1;
8754#[doc = "< DHCPv6 PD is enabled and will try to request and publish a prefix."]
8755pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING: otBorderRoutingDhcp6PdState = 2;
8756#[doc = "< DHCPv6 PD is idle; Higher-prf prefix published by other BRs."]
8757pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE: otBorderRoutingDhcp6PdState = 3;
8758#[doc = " This enumeration represents the state of DHCPv6 Prefix Delegation State."]
8759pub type otBorderRoutingDhcp6PdState = ::std::os::raw::c_uint;
8760unsafe extern "C" {
8761 #[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."]
8762 pub fn otBorderRoutingInit(
8763 aInstance: *mut otInstance,
8764 aInfraIfIndex: u32,
8765 aInfraIfIsRunning: bool,
8766 ) -> otError;
8767}
8768unsafe extern "C" {
8769 #[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"]
8770 pub fn otBorderRoutingGetInfraIfInfo(
8771 aInstance: *mut otInstance,
8772 aInfraIfIndex: *mut u32,
8773 aInfraIfIsRunning: *mut bool,
8774 ) -> otError;
8775}
8776unsafe extern "C" {
8777 #[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."]
8778 pub fn otBorderRoutingSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
8779}
8780unsafe extern "C" {
8781 #[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."]
8782 pub fn otBorderRoutingGetState(aInstance: *mut otInstance) -> otBorderRoutingState;
8783}
8784unsafe extern "C" {
8785 #[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."]
8786 pub fn otBorderRoutingSetOmrConfig(
8787 aInstance: *mut otInstance,
8788 aConfig: otBorderRoutingOmrConfig,
8789 aOmrPrefix: *const otIp6Prefix,
8790 aPreference: otRoutePreference,
8791 ) -> otError;
8792}
8793unsafe extern "C" {
8794 #[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."]
8795 pub fn otBorderRoutingGetOmrConfig(
8796 aInstance: *mut otInstance,
8797 aOmrPrefix: *mut otIp6Prefix,
8798 aPreference: *mut otRoutePreference,
8799 ) -> otBorderRoutingOmrConfig;
8800}
8801unsafe extern "C" {
8802 #[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."]
8803 pub fn otBorderRoutingGetRouteInfoOptionPreference(
8804 aInstance: *mut otInstance,
8805 ) -> otRoutePreference;
8806}
8807unsafe extern "C" {
8808 #[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."]
8809 pub fn otBorderRoutingSetRouteInfoOptionPreference(
8810 aInstance: *mut otInstance,
8811 aPreference: otRoutePreference,
8812 );
8813}
8814unsafe extern "C" {
8815 #[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."]
8816 pub fn otBorderRoutingClearRouteInfoOptionPreference(aInstance: *mut otInstance);
8817}
8818unsafe extern "C" {
8819 #[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."]
8820 pub fn otBorderRoutingSetExtraRouterAdvertOptions(
8821 aInstance: *mut otInstance,
8822 aOptions: *const u8,
8823 aLength: u16,
8824 ) -> otError;
8825}
8826unsafe extern "C" {
8827 #[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."]
8828 pub fn otBorderRoutingGetRoutePreference(aInstance: *mut otInstance) -> otRoutePreference;
8829}
8830unsafe extern "C" {
8831 #[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."]
8832 pub fn otBorderRoutingSetRoutePreference(
8833 aInstance: *mut otInstance,
8834 aPreference: otRoutePreference,
8835 );
8836}
8837unsafe extern "C" {
8838 #[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."]
8839 pub fn otBorderRoutingClearRoutePreference(aInstance: *mut otInstance);
8840}
8841unsafe extern "C" {
8842 #[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"]
8843 pub fn otBorderRoutingGetOmrPrefix(
8844 aInstance: *mut otInstance,
8845 aPrefix: *mut otIp6Prefix,
8846 ) -> otError;
8847}
8848unsafe extern "C" {
8849 #[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"]
8850 pub fn otBorderRoutingGetPdOmrPrefix(
8851 aInstance: *mut otInstance,
8852 aPrefixInfo: *mut otBorderRoutingPrefixTableEntry,
8853 ) -> otError;
8854}
8855unsafe extern "C" {
8856 #[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."]
8857 pub fn otBorderRoutingGetPdProcessedRaInfo(
8858 aInstance: *mut otInstance,
8859 aPdProcessedRaInfo: *mut otPdProcessedRaInfo,
8860 ) -> otError;
8861}
8862unsafe extern "C" {
8863 #[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."]
8864 pub fn otBorderRoutingGetFavoredOmrPrefix(
8865 aInstance: *mut otInstance,
8866 aPrefix: *mut otIp6Prefix,
8867 aPreference: *mut otRoutePreference,
8868 ) -> otError;
8869}
8870unsafe extern "C" {
8871 #[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."]
8872 pub fn otBorderRoutingGetOnLinkPrefix(
8873 aInstance: *mut otInstance,
8874 aPrefix: *mut otIp6Prefix,
8875 ) -> otError;
8876}
8877unsafe extern "C" {
8878 #[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."]
8879 pub fn otBorderRoutingGetFavoredOnLinkPrefix(
8880 aInstance: *mut otInstance,
8881 aPrefix: *mut otIp6Prefix,
8882 ) -> otError;
8883}
8884unsafe extern "C" {
8885 #[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."]
8886 pub fn otBorderRoutingGetNat64Prefix(
8887 aInstance: *mut otInstance,
8888 aPrefix: *mut otIp6Prefix,
8889 ) -> otError;
8890}
8891unsafe extern "C" {
8892 #[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."]
8893 pub fn otBorderRoutingGetFavoredNat64Prefix(
8894 aInstance: *mut otInstance,
8895 aPrefix: *mut otIp6Prefix,
8896 aPreference: *mut otRoutePreference,
8897 ) -> otError;
8898}
8899unsafe extern "C" {
8900 #[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."]
8901 pub fn otBorderRoutingPrefixTableInitIterator(
8902 aInstance: *mut otInstance,
8903 aIterator: *mut otBorderRoutingPrefixTableIterator,
8904 );
8905}
8906unsafe extern "C" {
8907 #[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."]
8908 pub fn otBorderRoutingGetNextPrefixTableEntry(
8909 aInstance: *mut otInstance,
8910 aIterator: *mut otBorderRoutingPrefixTableIterator,
8911 aEntry: *mut otBorderRoutingPrefixTableEntry,
8912 ) -> otError;
8913}
8914unsafe extern "C" {
8915 #[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."]
8916 pub fn otBorderRoutingGetNextRouterEntry(
8917 aInstance: *mut otInstance,
8918 aIterator: *mut otBorderRoutingPrefixTableIterator,
8919 aEntry: *mut otBorderRoutingRouterEntry,
8920 ) -> otError;
8921}
8922unsafe extern "C" {
8923 #[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."]
8924 pub fn otBorderRoutingGetNextPeerBrEntry(
8925 aInstance: *mut otInstance,
8926 aIterator: *mut otBorderRoutingPrefixTableIterator,
8927 aEntry: *mut otBorderRoutingPeerBorderRouterEntry,
8928 ) -> otError;
8929}
8930unsafe extern "C" {
8931 #[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."]
8932 pub fn otBorderRoutingCountPeerBrs(aInstance: *mut otInstance, aMinAge: *mut u32) -> u16;
8933}
8934unsafe extern "C" {
8935 #[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)."]
8936 pub fn otBorderRoutingGetNextRdnssAddrEntry(
8937 aInstance: *mut otInstance,
8938 aIterator: *mut otBorderRoutingPrefixTableIterator,
8939 aEntry: *mut otBorderRoutingRdnssAddrEntry,
8940 ) -> otError;
8941}
8942unsafe extern "C" {
8943 #[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"]
8944 pub fn otBorderRoutingGetNextNat64PrefixEntry(
8945 aInstance: *mut otInstance,
8946 aIterator: *mut otBorderRoutingPrefixTableIterator,
8947 aEntry: *mut otBorderRoutingNat64PrefixEntry,
8948 ) -> otError;
8949}
8950#[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."]
8951pub type otBorderRoutingRdnssAddrCallback =
8952 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
8953unsafe extern "C" {
8954 #[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)."]
8955 pub fn otBorderRoutingSetRdnssAddrCallback(
8956 aInstance: *mut otInstance,
8957 aCallback: otBorderRoutingRdnssAddrCallback,
8958 aContext: *mut ::std::os::raw::c_void,
8959 );
8960}
8961unsafe extern "C" {
8962 #[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)."]
8963 pub fn otBorderRoutingGetNextIfAddrEntry(
8964 aInstance: *mut otInstance,
8965 aIterator: *mut otBorderRoutingPrefixTableIterator,
8966 aEntry: *mut otBorderRoutingIfAddrEntry,
8967 ) -> otError;
8968}
8969unsafe extern "C" {
8970 #[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."]
8971 pub fn otBorderRoutingDhcp6PdSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8972}
8973unsafe extern "C" {
8974 #[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."]
8975 pub fn otBorderRoutingDhcp6PdGetState(
8976 aInstance: *mut otInstance,
8977 ) -> otBorderRoutingDhcp6PdState;
8978}
8979#[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."]
8980pub type otBorderRoutingRequestDhcp6PdCallback = ::std::option::Option<
8981 unsafe extern "C" fn(
8982 aState: otBorderRoutingDhcp6PdState,
8983 aContext: *mut ::std::os::raw::c_void,
8984 ),
8985>;
8986unsafe extern "C" {
8987 #[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."]
8988 pub fn otBorderRoutingDhcp6PdSetRequestCallback(
8989 aInstance: *mut otInstance,
8990 aCallback: otBorderRoutingRequestDhcp6PdCallback,
8991 aContext: *mut ::std::os::raw::c_void,
8992 );
8993}
8994unsafe extern "C" {
8995 #[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."]
8996 pub fn otBorderRoutingSetOnLinkPrefix(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix);
8997}
8998pub type otMacFilterIterator = u8;
8999#[doc = "< Address filter is disabled."]
9000pub const OT_MAC_FILTER_ADDRESS_MODE_DISABLED: otMacFilterAddressMode = 0;
9001#[doc = "< Allowlist address filter mode is enabled."]
9002pub const OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST: otMacFilterAddressMode = 1;
9003#[doc = "< Denylist address filter mode is enabled."]
9004pub const OT_MAC_FILTER_ADDRESS_MODE_DENYLIST: otMacFilterAddressMode = 2;
9005#[doc = " Defines address mode of the mac filter."]
9006pub type otMacFilterAddressMode = ::std::os::raw::c_uint;
9007#[doc = " Represents a Mac Filter entry."]
9008#[repr(C)]
9009#[derive(Debug, Default, Copy, Clone)]
9010pub struct otMacFilterEntry {
9011 #[doc = "< IEEE 802.15.4 Extended Address"]
9012 pub mExtAddress: otExtAddress,
9013 #[doc = "< Received signal strength"]
9014 pub mRssIn: i8,
9015}
9016#[doc = " Represents the MAC layer counters."]
9017#[repr(C)]
9018#[derive(Debug, Default, Copy, Clone)]
9019pub struct otMacCounters {
9020 #[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"]
9021 pub mTxTotal: u32,
9022 #[doc = " The total number of unique unicast MAC frame transmission requests."]
9023 pub mTxUnicast: u32,
9024 #[doc = " The total number of unique broadcast MAC frame transmission requests."]
9025 pub mTxBroadcast: u32,
9026 #[doc = " The total number of unique MAC frame transmission requests with requested acknowledgment."]
9027 pub mTxAckRequested: u32,
9028 #[doc = " The total number of unique MAC frame transmission requests that were acked."]
9029 pub mTxAcked: u32,
9030 #[doc = " The total number of unique MAC frame transmission requests without requested acknowledgment."]
9031 pub mTxNoAckRequested: u32,
9032 #[doc = " The total number of unique MAC Data frame transmission requests."]
9033 pub mTxData: u32,
9034 #[doc = " The total number of unique MAC Data Poll frame transmission requests."]
9035 pub mTxDataPoll: u32,
9036 #[doc = " The total number of unique MAC Beacon frame transmission requests."]
9037 pub mTxBeacon: u32,
9038 #[doc = " The total number of unique MAC Beacon Request frame transmission requests."]
9039 pub mTxBeaconRequest: u32,
9040 #[doc = " The total number of unique other MAC frame transmission requests.\n\n This counter is currently used for counting out-of-band frames."]
9041 pub mTxOther: u32,
9042 #[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."]
9043 pub mTxRetry: u32,
9044 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for direct packets."]
9045 pub mTxDirectMaxRetryExpiry: u32,
9046 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets."]
9047 pub mTxIndirectMaxRetryExpiry: u32,
9048 #[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)."]
9049 pub mTxErrCca: u32,
9050 #[doc = " The total number of unique MAC transmission request failures cause by an abort error."]
9051 pub mTxErrAbort: u32,
9052 #[doc = " The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail)."]
9053 pub mTxErrBusyChannel: u32,
9054 #[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."]
9055 pub mRxTotal: u32,
9056 #[doc = " The total number of unicast frames received."]
9057 pub mRxUnicast: u32,
9058 #[doc = " The total number of broadcast frames received."]
9059 pub mRxBroadcast: u32,
9060 #[doc = " The total number of MAC Data frames received."]
9061 pub mRxData: u32,
9062 #[doc = " The total number of MAC Data Poll frames received."]
9063 pub mRxDataPoll: u32,
9064 #[doc = " The total number of MAC Beacon frames received."]
9065 pub mRxBeacon: u32,
9066 #[doc = " The total number of MAC Beacon Request frames received."]
9067 pub mRxBeaconRequest: u32,
9068 #[doc = " The total number of other types of frames received."]
9069 pub mRxOther: u32,
9070 #[doc = " The total number of frames dropped by MAC Filter module, for example received from denylisted node."]
9071 pub mRxAddressFiltered: u32,
9072 #[doc = " The total number of frames dropped by destination address check, for example received frame for other node."]
9073 pub mRxDestAddrFiltered: u32,
9074 #[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."]
9075 pub mRxDuplicated: u32,
9076 #[doc = " The total number of frames dropped because of missing or malformed content."]
9077 pub mRxErrNoFrame: u32,
9078 #[doc = " The total number of frames dropped due to unknown neighbor."]
9079 pub mRxErrUnknownNeighbor: u32,
9080 #[doc = " The total number of frames dropped due to invalid source address."]
9081 pub mRxErrInvalidSrcAddr: u32,
9082 #[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."]
9083 pub mRxErrSec: u32,
9084 #[doc = " The total number of frames dropped due to invalid FCS."]
9085 pub mRxErrFcs: u32,
9086 #[doc = " The total number of frames dropped due to other error."]
9087 pub mRxErrOther: u32,
9088}
9089#[doc = " Represents a received IEEE 802.15.4 Beacon."]
9090#[repr(C)]
9091#[repr(align(4))]
9092#[derive(Debug, Default, Copy, Clone)]
9093pub struct otActiveScanResult {
9094 #[doc = "< IEEE 802.15.4 Extended Address"]
9095 pub mExtAddress: otExtAddress,
9096 #[doc = "< Thread Network Name"]
9097 pub mNetworkName: otNetworkName,
9098 #[doc = "< Thread Extended PAN ID"]
9099 pub mExtendedPanId: otExtendedPanId,
9100 #[doc = "< Steering Data"]
9101 pub mSteeringData: otSteeringData,
9102 #[doc = "< IEEE 802.15.4 PAN ID"]
9103 pub mPanId: u16,
9104 #[doc = "< Joiner UDP Port"]
9105 pub mJoinerUdpPort: u16,
9106 #[doc = "< IEEE 802.15.4 Channel"]
9107 pub mChannel: u8,
9108 #[doc = "< RSSI (dBm)"]
9109 pub mRssi: i8,
9110 #[doc = "< LQI"]
9111 pub mLqi: u8,
9112 pub _bitfield_align_1: [u8; 0],
9113 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9114 pub __bindgen_padding_0: u16,
9115}
9116impl otActiveScanResult {
9117 #[inline]
9118 pub fn mVersion(&self) -> ::std::os::raw::c_uint {
9119 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) }
9120 }
9121 #[inline]
9122 pub fn set_mVersion(&mut self, val: ::std::os::raw::c_uint) {
9123 unsafe {
9124 let val: u32 = ::std::mem::transmute(val);
9125 self._bitfield_1.set(0usize, 4u8, val as u64)
9126 }
9127 }
9128 #[inline]
9129 pub unsafe fn mVersion_raw(this: *const Self) -> ::std::os::raw::c_uint {
9130 unsafe {
9131 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9132 ::std::ptr::addr_of!((*this)._bitfield_1),
9133 0usize,
9134 4u8,
9135 ) as u32)
9136 }
9137 }
9138 #[inline]
9139 pub unsafe fn set_mVersion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
9140 unsafe {
9141 let val: u32 = ::std::mem::transmute(val);
9142 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9143 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9144 0usize,
9145 4u8,
9146 val as u64,
9147 )
9148 }
9149 }
9150 #[inline]
9151 pub fn mIsNative(&self) -> bool {
9152 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
9153 }
9154 #[inline]
9155 pub fn set_mIsNative(&mut self, val: bool) {
9156 unsafe {
9157 let val: u8 = ::std::mem::transmute(val);
9158 self._bitfield_1.set(4usize, 1u8, val as u64)
9159 }
9160 }
9161 #[inline]
9162 pub unsafe fn mIsNative_raw(this: *const Self) -> bool {
9163 unsafe {
9164 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9165 ::std::ptr::addr_of!((*this)._bitfield_1),
9166 4usize,
9167 1u8,
9168 ) as u8)
9169 }
9170 }
9171 #[inline]
9172 pub unsafe fn set_mIsNative_raw(this: *mut Self, val: bool) {
9173 unsafe {
9174 let val: u8 = ::std::mem::transmute(val);
9175 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9176 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9177 4usize,
9178 1u8,
9179 val as u64,
9180 )
9181 }
9182 }
9183 #[inline]
9184 pub fn mDiscover(&self) -> bool {
9185 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
9186 }
9187 #[inline]
9188 pub fn set_mDiscover(&mut self, val: bool) {
9189 unsafe {
9190 let val: u8 = ::std::mem::transmute(val);
9191 self._bitfield_1.set(5usize, 1u8, val as u64)
9192 }
9193 }
9194 #[inline]
9195 pub unsafe fn mDiscover_raw(this: *const Self) -> bool {
9196 unsafe {
9197 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9198 ::std::ptr::addr_of!((*this)._bitfield_1),
9199 5usize,
9200 1u8,
9201 ) as u8)
9202 }
9203 }
9204 #[inline]
9205 pub unsafe fn set_mDiscover_raw(this: *mut Self, val: bool) {
9206 unsafe {
9207 let val: u8 = ::std::mem::transmute(val);
9208 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9209 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9210 5usize,
9211 1u8,
9212 val as u64,
9213 )
9214 }
9215 }
9216 #[inline]
9217 pub fn mIsJoinable(&self) -> bool {
9218 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
9219 }
9220 #[inline]
9221 pub fn set_mIsJoinable(&mut self, val: bool) {
9222 unsafe {
9223 let val: u8 = ::std::mem::transmute(val);
9224 self._bitfield_1.set(6usize, 1u8, val as u64)
9225 }
9226 }
9227 #[inline]
9228 pub unsafe fn mIsJoinable_raw(this: *const Self) -> bool {
9229 unsafe {
9230 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9231 ::std::ptr::addr_of!((*this)._bitfield_1),
9232 6usize,
9233 1u8,
9234 ) as u8)
9235 }
9236 }
9237 #[inline]
9238 pub unsafe fn set_mIsJoinable_raw(this: *mut Self, val: bool) {
9239 unsafe {
9240 let val: u8 = ::std::mem::transmute(val);
9241 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9242 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9243 6usize,
9244 1u8,
9245 val as u64,
9246 )
9247 }
9248 }
9249 #[inline]
9250 pub fn new_bitfield_1(
9251 mVersion: ::std::os::raw::c_uint,
9252 mIsNative: bool,
9253 mDiscover: bool,
9254 mIsJoinable: bool,
9255 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9256 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9257 __bindgen_bitfield_unit.set(0usize, 4u8, {
9258 let mVersion: u32 = unsafe { ::std::mem::transmute(mVersion) };
9259 mVersion as u64
9260 });
9261 __bindgen_bitfield_unit.set(4usize, 1u8, {
9262 let mIsNative: u8 = unsafe { ::std::mem::transmute(mIsNative) };
9263 mIsNative as u64
9264 });
9265 __bindgen_bitfield_unit.set(5usize, 1u8, {
9266 let mDiscover: u8 = unsafe { ::std::mem::transmute(mDiscover) };
9267 mDiscover as u64
9268 });
9269 __bindgen_bitfield_unit.set(6usize, 1u8, {
9270 let mIsJoinable: u8 = unsafe { ::std::mem::transmute(mIsJoinable) };
9271 mIsJoinable as u64
9272 });
9273 __bindgen_bitfield_unit
9274 }
9275}
9276#[doc = " Represents an energy scan result."]
9277#[repr(C)]
9278#[derive(Debug, Default, Copy, Clone)]
9279pub struct otEnergyScanResult {
9280 #[doc = "< IEEE 802.15.4 Channel"]
9281 pub mChannel: u8,
9282 #[doc = "< The max RSSI (dBm)"]
9283 pub mMaxRssi: i8,
9284}
9285#[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."]
9286pub type otHandleActiveScanResult = ::std::option::Option<
9287 unsafe extern "C" fn(aResult: *mut otActiveScanResult, aContext: *mut ::std::os::raw::c_void),
9288>;
9289unsafe extern "C" {
9290 #[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."]
9291 pub fn otLinkActiveScan(
9292 aInstance: *mut otInstance,
9293 aScanChannels: u32,
9294 aScanDuration: u16,
9295 aCallback: otHandleActiveScanResult,
9296 aCallbackContext: *mut ::std::os::raw::c_void,
9297 ) -> otError;
9298}
9299unsafe extern "C" {
9300 #[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."]
9301 pub fn otLinkIsActiveScanInProgress(aInstance: *mut otInstance) -> bool;
9302}
9303#[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."]
9304pub type otHandleEnergyScanResult = ::std::option::Option<
9305 unsafe extern "C" fn(aResult: *mut otEnergyScanResult, aContext: *mut ::std::os::raw::c_void),
9306>;
9307unsafe extern "C" {
9308 #[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."]
9309 pub fn otLinkEnergyScan(
9310 aInstance: *mut otInstance,
9311 aScanChannels: u32,
9312 aScanDuration: u16,
9313 aCallback: otHandleEnergyScanResult,
9314 aCallbackContext: *mut ::std::os::raw::c_void,
9315 ) -> otError;
9316}
9317unsafe extern "C" {
9318 #[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."]
9319 pub fn otLinkIsEnergyScanInProgress(aInstance: *mut otInstance) -> bool;
9320}
9321unsafe extern "C" {
9322 #[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."]
9323 pub fn otLinkSendDataRequest(aInstance: *mut otInstance) -> otError;
9324}
9325unsafe extern "C" {
9326 #[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."]
9327 pub fn otLinkIsInTransmitState(aInstance: *mut otInstance) -> bool;
9328}
9329unsafe extern "C" {
9330 #[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"]
9331 pub fn otLinkGetChannel(aInstance: *mut otInstance) -> u8;
9332}
9333unsafe extern "C" {
9334 #[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"]
9335 pub fn otLinkSetChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9336}
9337unsafe extern "C" {
9338 #[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."]
9339 pub fn otLinkGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
9340}
9341unsafe extern "C" {
9342 #[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."]
9343 pub fn otLinkSetSupportedChannelMask(aInstance: *mut otInstance, aChannelMask: u32) -> otError;
9344}
9345unsafe extern "C" {
9346 #[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."]
9347 pub fn otLinkGetExtendedAddress(aInstance: *mut otInstance) -> *const otExtAddress;
9348}
9349unsafe extern "C" {
9350 #[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."]
9351 pub fn otLinkSetExtendedAddress(
9352 aInstance: *mut otInstance,
9353 aExtAddress: *const otExtAddress,
9354 ) -> otError;
9355}
9356unsafe extern "C" {
9357 #[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."]
9358 pub fn otLinkGetFactoryAssignedIeeeEui64(aInstance: *mut otInstance, aEui64: *mut otExtAddress);
9359}
9360unsafe extern "C" {
9361 #[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"]
9362 pub fn otLinkGetPanId(aInstance: *mut otInstance) -> otPanId;
9363}
9364unsafe extern "C" {
9365 #[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"]
9366 pub fn otLinkSetPanId(aInstance: *mut otInstance, aPanId: otPanId) -> otError;
9367}
9368unsafe extern "C" {
9369 #[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"]
9370 pub fn otLinkGetPollPeriod(aInstance: *mut otInstance) -> u32;
9371}
9372unsafe extern "C" {
9373 #[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"]
9374 pub fn otLinkSetPollPeriod(aInstance: *mut otInstance, aPollPeriod: u32) -> otError;
9375}
9376unsafe extern "C" {
9377 #[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."]
9378 pub fn otLinkGetShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9379}
9380unsafe extern "C" {
9381 #[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."]
9382 pub fn otLinkGetAlternateShortAddress(aInstance: *mut otInstance) -> otShortAddress;
9383}
9384unsafe extern "C" {
9385 #[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."]
9386 pub fn otLinkGetMaxFrameRetriesDirect(aInstance: *mut otInstance) -> u8;
9387}
9388unsafe extern "C" {
9389 #[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."]
9390 pub fn otLinkSetMaxFrameRetriesDirect(aInstance: *mut otInstance, aMaxFrameRetriesDirect: u8);
9391}
9392unsafe extern "C" {
9393 #[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."]
9394 pub fn otLinkGetMaxFrameRetriesIndirect(aInstance: *mut otInstance) -> u8;
9395}
9396unsafe extern "C" {
9397 #[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."]
9398 pub fn otLinkSetMaxFrameRetriesIndirect(
9399 aInstance: *mut otInstance,
9400 aMaxFrameRetriesIndirect: u8,
9401 );
9402}
9403unsafe extern "C" {
9404 #[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."]
9405 pub fn otLinkGetFrameCounter(aInstance: *mut otInstance) -> u32;
9406}
9407unsafe extern "C" {
9408 #[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."]
9409 pub fn otLinkFilterGetAddressMode(aInstance: *mut otInstance) -> otMacFilterAddressMode;
9410}
9411unsafe extern "C" {
9412 #[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."]
9413 pub fn otLinkFilterSetAddressMode(aInstance: *mut otInstance, aMode: otMacFilterAddressMode);
9414}
9415unsafe extern "C" {
9416 #[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."]
9417 pub fn otLinkFilterAddAddress(
9418 aInstance: *mut otInstance,
9419 aExtAddress: *const otExtAddress,
9420 ) -> otError;
9421}
9422unsafe extern "C" {
9423 #[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)."]
9424 pub fn otLinkFilterRemoveAddress(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9425}
9426unsafe extern "C" {
9427 #[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."]
9428 pub fn otLinkFilterClearAddresses(aInstance: *mut otInstance);
9429}
9430unsafe extern "C" {
9431 #[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."]
9432 pub fn otLinkFilterGetNextAddress(
9433 aInstance: *mut otInstance,
9434 aIterator: *mut otMacFilterIterator,
9435 aEntry: *mut otMacFilterEntry,
9436 ) -> otError;
9437}
9438unsafe extern "C" {
9439 #[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."]
9440 pub fn otLinkFilterAddRssIn(
9441 aInstance: *mut otInstance,
9442 aExtAddress: *const otExtAddress,
9443 aRss: i8,
9444 ) -> otError;
9445}
9446unsafe extern "C" {
9447 #[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."]
9448 pub fn otLinkFilterRemoveRssIn(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
9449}
9450unsafe extern "C" {
9451 #[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."]
9452 pub fn otLinkFilterSetDefaultRssIn(aInstance: *mut otInstance, aRss: i8);
9453}
9454unsafe extern "C" {
9455 #[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."]
9456 pub fn otLinkFilterClearDefaultRssIn(aInstance: *mut otInstance);
9457}
9458unsafe extern "C" {
9459 #[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."]
9460 pub fn otLinkFilterClearAllRssIn(aInstance: *mut otInstance);
9461}
9462unsafe extern "C" {
9463 #[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."]
9464 pub fn otLinkFilterGetNextRssIn(
9465 aInstance: *mut otInstance,
9466 aIterator: *mut otMacFilterIterator,
9467 aEntry: *mut otMacFilterEntry,
9468 ) -> otError;
9469}
9470unsafe extern "C" {
9471 #[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"]
9472 pub fn otLinkSetRadioFilterEnabled(aInstance: *mut otInstance, aFilterEnabled: bool);
9473}
9474unsafe extern "C" {
9475 #[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."]
9476 pub fn otLinkIsRadioFilterEnabled(aInstance: *mut otInstance) -> bool;
9477}
9478unsafe extern "C" {
9479 #[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."]
9480 pub fn otLinkConvertRssToLinkQuality(aInstance: *mut otInstance, aRss: i8) -> u8;
9481}
9482unsafe extern "C" {
9483 #[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."]
9484 pub fn otLinkConvertLinkQualityToRss(aInstance: *mut otInstance, aLinkQuality: u8) -> i8;
9485}
9486unsafe extern "C" {
9487 #[doc = " Gets histogram of retries for a single direct packet until success.\n\n Requires `OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE`.\n\n The configuration `OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_DIRECT` specifies the size of the\n direct TX histogram array.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aSize 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.\n If the number of retries is larger than the histogram array max size, the last entry\n counts all retries at or above the limit."]
9488 pub fn otLinkGetTxDirectRetrySuccessHistogram(
9489 aInstance: *mut otInstance,
9490 aSize: *mut u16,
9491 ) -> *const u32;
9492}
9493unsafe extern "C" {
9494 #[doc = " Gets histogram of retries for a single indirect packet until success.\n\n Requires `OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE`.\n\n The configuration `OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_INDIRECT` specifies the size of the\n indirect TX histogram array.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aSize 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.\n If the number of retries is larger than the histogram array max size, the last entry\n counts all retries at or above the limit."]
9495 pub fn otLinkGetTxIndirectRetrySuccessHistogram(
9496 aInstance: *mut otInstance,
9497 aSize: *mut u16,
9498 ) -> *const u32;
9499}
9500unsafe extern "C" {
9501 #[doc = " Clears histogram statistics for direct and indirect transmissions.\n\n Requires `OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9502 pub fn otLinkResetTxRetrySuccessHistogram(aInstance: *mut otInstance);
9503}
9504unsafe extern "C" {
9505 #[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."]
9506 pub fn otLinkGetCounters(aInstance: *mut otInstance) -> *const otMacCounters;
9507}
9508unsafe extern "C" {
9509 #[doc = " Resets the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
9510 pub fn otLinkResetCounters(aInstance: *mut otInstance);
9511}
9512#[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."]
9513pub type otLinkPcapCallback = ::std::option::Option<
9514 unsafe extern "C" fn(
9515 aFrame: *const otRadioFrame,
9516 aIsTx: bool,
9517 aContext: *mut ::std::os::raw::c_void,
9518 ),
9519>;
9520unsafe extern "C" {
9521 #[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."]
9522 pub fn otLinkSetPcapCallback(
9523 aInstance: *mut otInstance,
9524 aPcapCallback: otLinkPcapCallback,
9525 aCallbackContext: *mut ::std::os::raw::c_void,
9526 );
9527}
9528unsafe extern "C" {
9529 #[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."]
9530 pub fn otLinkIsPromiscuous(aInstance: *mut otInstance) -> bool;
9531}
9532unsafe extern "C" {
9533 #[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."]
9534 pub fn otLinkSetPromiscuous(aInstance: *mut otInstance, aPromiscuous: bool) -> otError;
9535}
9536unsafe extern "C" {
9537 #[doc = " Gets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL channel."]
9538 pub fn otLinkGetCslChannel(aInstance: *mut otInstance) -> u8;
9539}
9540unsafe extern "C" {
9541 #[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."]
9542 pub fn otLinkSetCslChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9543}
9544unsafe extern "C" {
9545 #[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."]
9546 pub fn otLinkGetCslPeriod(aInstance: *mut otInstance) -> u32;
9547}
9548unsafe extern "C" {
9549 #[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"]
9550 pub fn otLinkSetCslPeriod(aInstance: *mut otInstance, aPeriod: u32) -> otError;
9551}
9552unsafe extern "C" {
9553 #[doc = " Gets the CSL timeout.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL timeout in seconds."]
9554 pub fn otLinkGetCslTimeout(aInstance: *mut otInstance) -> u32;
9555}
9556unsafe extern "C" {
9557 #[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."]
9558 pub fn otLinkSetCslTimeout(aInstance: *mut otInstance, aTimeout: u32) -> otError;
9559}
9560unsafe extern "C" {
9561 #[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."]
9562 pub fn otLinkGetCcaFailureRate(aInstance: *mut otInstance) -> u16;
9563}
9564unsafe extern "C" {
9565 #[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."]
9566 pub fn otLinkSetEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9567}
9568unsafe extern "C" {
9569 #[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."]
9570 pub fn otLinkIsEnabled(aInstance: *mut otInstance) -> bool;
9571}
9572unsafe extern "C" {
9573 #[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."]
9574 pub fn otLinkIsCslEnabled(aInstance: *mut otInstance) -> bool;
9575}
9576unsafe extern "C" {
9577 #[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."]
9578 pub fn otLinkIsCslSupported(aInstance: *mut otInstance) -> bool;
9579}
9580unsafe extern "C" {
9581 #[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."]
9582 pub fn otLinkSendEmptyData(aInstance: *mut otInstance) -> otError;
9583}
9584unsafe extern "C" {
9585 #[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."]
9586 pub fn otLinkSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
9587}
9588unsafe extern "C" {
9589 #[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."]
9590 pub fn otLinkGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
9591}
9592unsafe extern "C" {
9593 #[doc = " Gets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_INITIATOR_ENABLE` or `OPENTHREAD_CONFIG_TD_WAKE_LISTENER_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Wake-up channel."]
9594 pub fn otLinkGetWakeupChannel(aInstance: *mut otInstance) -> u8;
9595}
9596unsafe extern "C" {
9597 #[doc = " Sets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_INITIATOR_ENABLE` or `OPENTHREAD_CONFIG_TD_WAKE_LISTENER_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."]
9598 pub fn otLinkSetWakeupChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9599}
9600unsafe extern "C" {
9601 #[doc = " Enables or disables listening for wake-up frames.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_LISTENER_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."]
9602 pub fn otLinkSetWakeUpListenEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9603}
9604unsafe extern "C" {
9605 #[doc = " Returns whether listening for wake-up frames is enabled.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_LISTENER_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."]
9606 pub fn otLinkIsWakeupListenEnabled(aInstance: *mut otInstance) -> bool;
9607}
9608unsafe extern "C" {
9609 #[doc = " Get the wake-up listen parameters.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_LISTENER_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."]
9610 pub fn otLinkGetWakeupListenParameters(
9611 aInstance: *mut otInstance,
9612 aInterval: *mut u32,
9613 aDuration: *mut u32,
9614 );
9615}
9616unsafe extern "C" {
9617 #[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_TD_WAKE_LISTENER_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."]
9618 pub fn otLinkSetWakeupListenParameters(
9619 aInstance: *mut otInstance,
9620 aInterval: u32,
9621 aDuration: u32,
9622 ) -> otError;
9623}
9624unsafe extern "C" {
9625 #[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."]
9626 pub fn otLinkSetRxOnWhenIdle(aInstance: *mut otInstance, aRxOnWhenIdle: bool) -> otError;
9627}
9628#[doc = "< The Thread stack is disabled."]
9629pub const OT_DEVICE_ROLE_DISABLED: otDeviceRole = 0;
9630#[doc = "< Not currently participating in a Thread network/partition."]
9631pub const OT_DEVICE_ROLE_DETACHED: otDeviceRole = 1;
9632#[doc = "< The Thread Child role."]
9633pub const OT_DEVICE_ROLE_CHILD: otDeviceRole = 2;
9634#[doc = "< The Thread Router role."]
9635pub const OT_DEVICE_ROLE_ROUTER: otDeviceRole = 3;
9636#[doc = "< The Thread Leader role."]
9637pub const OT_DEVICE_ROLE_LEADER: otDeviceRole = 4;
9638#[doc = " Represents a Thread device role."]
9639pub type otDeviceRole = ::std::os::raw::c_uint;
9640#[doc = " Represents an MLE Link Mode configuration."]
9641#[repr(C)]
9642#[derive(Debug, Default, Copy, Clone)]
9643pub struct otLinkModeConfig {
9644 pub _bitfield_align_1: [u8; 0],
9645 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9646}
9647impl otLinkModeConfig {
9648 #[inline]
9649 pub fn mRxOnWhenIdle(&self) -> bool {
9650 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9651 }
9652 #[inline]
9653 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9654 unsafe {
9655 let val: u8 = ::std::mem::transmute(val);
9656 self._bitfield_1.set(0usize, 1u8, val as u64)
9657 }
9658 }
9659 #[inline]
9660 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9661 unsafe {
9662 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9663 ::std::ptr::addr_of!((*this)._bitfield_1),
9664 0usize,
9665 1u8,
9666 ) as u8)
9667 }
9668 }
9669 #[inline]
9670 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9671 unsafe {
9672 let val: u8 = ::std::mem::transmute(val);
9673 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9674 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9675 0usize,
9676 1u8,
9677 val as u64,
9678 )
9679 }
9680 }
9681 #[inline]
9682 pub fn mDeviceType(&self) -> bool {
9683 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9684 }
9685 #[inline]
9686 pub fn set_mDeviceType(&mut self, val: bool) {
9687 unsafe {
9688 let val: u8 = ::std::mem::transmute(val);
9689 self._bitfield_1.set(1usize, 1u8, val as u64)
9690 }
9691 }
9692 #[inline]
9693 pub unsafe fn mDeviceType_raw(this: *const Self) -> bool {
9694 unsafe {
9695 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9696 ::std::ptr::addr_of!((*this)._bitfield_1),
9697 1usize,
9698 1u8,
9699 ) as u8)
9700 }
9701 }
9702 #[inline]
9703 pub unsafe fn set_mDeviceType_raw(this: *mut Self, val: bool) {
9704 unsafe {
9705 let val: u8 = ::std::mem::transmute(val);
9706 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9707 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9708 1usize,
9709 1u8,
9710 val as u64,
9711 )
9712 }
9713 }
9714 #[inline]
9715 pub fn mNetworkData(&self) -> bool {
9716 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9717 }
9718 #[inline]
9719 pub fn set_mNetworkData(&mut self, val: bool) {
9720 unsafe {
9721 let val: u8 = ::std::mem::transmute(val);
9722 self._bitfield_1.set(2usize, 1u8, val as u64)
9723 }
9724 }
9725 #[inline]
9726 pub unsafe fn mNetworkData_raw(this: *const Self) -> bool {
9727 unsafe {
9728 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9729 ::std::ptr::addr_of!((*this)._bitfield_1),
9730 2usize,
9731 1u8,
9732 ) as u8)
9733 }
9734 }
9735 #[inline]
9736 pub unsafe fn set_mNetworkData_raw(this: *mut Self, val: bool) {
9737 unsafe {
9738 let val: u8 = ::std::mem::transmute(val);
9739 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9740 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9741 2usize,
9742 1u8,
9743 val as u64,
9744 )
9745 }
9746 }
9747 #[inline]
9748 pub fn new_bitfield_1(
9749 mRxOnWhenIdle: bool,
9750 mDeviceType: bool,
9751 mNetworkData: bool,
9752 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9753 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9754 __bindgen_bitfield_unit.set(0usize, 1u8, {
9755 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9756 mRxOnWhenIdle as u64
9757 });
9758 __bindgen_bitfield_unit.set(1usize, 1u8, {
9759 let mDeviceType: u8 = unsafe { ::std::mem::transmute(mDeviceType) };
9760 mDeviceType as u64
9761 });
9762 __bindgen_bitfield_unit.set(2usize, 1u8, {
9763 let mNetworkData: u8 = unsafe { ::std::mem::transmute(mNetworkData) };
9764 mNetworkData as u64
9765 });
9766 __bindgen_bitfield_unit
9767 }
9768}
9769#[doc = " Holds diagnostic information for a neighboring Thread node"]
9770#[repr(C)]
9771#[derive(Debug, Default, Copy, Clone)]
9772pub struct otNeighborInfo {
9773 #[doc = "< IEEE 802.15.4 Extended Address"]
9774 pub mExtAddress: otExtAddress,
9775 #[doc = "< Seconds since last heard"]
9776 pub mAge: u32,
9777 #[doc = "< Seconds since link establishment (requires `CONFIG_UPTIME_ENABLE`)"]
9778 pub mConnectionTime: u32,
9779 #[doc = "< RLOC16"]
9780 pub mRloc16: u16,
9781 #[doc = "< Link Frame Counter"]
9782 pub mLinkFrameCounter: u32,
9783 #[doc = "< MLE Frame Counter"]
9784 pub mMleFrameCounter: u32,
9785 #[doc = "< Link Quality In"]
9786 pub mLinkQualityIn: u8,
9787 #[doc = "< Average RSSI"]
9788 pub mAverageRssi: i8,
9789 #[doc = "< Last observed RSSI"]
9790 pub mLastRssi: i8,
9791 #[doc = "< Link Margin"]
9792 pub mLinkMargin: u8,
9793 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
9794 pub mFrameErrorRate: u16,
9795 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
9796 pub mMessageErrorRate: u16,
9797 #[doc = "< Thread version of the neighbor"]
9798 pub mVersion: u16,
9799 pub _bitfield_align_1: [u8; 0],
9800 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9801 pub __bindgen_padding_0: u8,
9802}
9803impl otNeighborInfo {
9804 #[inline]
9805 pub fn mRxOnWhenIdle(&self) -> bool {
9806 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9807 }
9808 #[inline]
9809 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9810 unsafe {
9811 let val: u8 = ::std::mem::transmute(val);
9812 self._bitfield_1.set(0usize, 1u8, val as u64)
9813 }
9814 }
9815 #[inline]
9816 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9817 unsafe {
9818 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9819 ::std::ptr::addr_of!((*this)._bitfield_1),
9820 0usize,
9821 1u8,
9822 ) as u8)
9823 }
9824 }
9825 #[inline]
9826 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9827 unsafe {
9828 let val: u8 = ::std::mem::transmute(val);
9829 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9830 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9831 0usize,
9832 1u8,
9833 val as u64,
9834 )
9835 }
9836 }
9837 #[inline]
9838 pub fn mFullThreadDevice(&self) -> bool {
9839 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9840 }
9841 #[inline]
9842 pub fn set_mFullThreadDevice(&mut self, val: bool) {
9843 unsafe {
9844 let val: u8 = ::std::mem::transmute(val);
9845 self._bitfield_1.set(1usize, 1u8, val as u64)
9846 }
9847 }
9848 #[inline]
9849 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
9850 unsafe {
9851 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9852 ::std::ptr::addr_of!((*this)._bitfield_1),
9853 1usize,
9854 1u8,
9855 ) as u8)
9856 }
9857 }
9858 #[inline]
9859 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
9860 unsafe {
9861 let val: u8 = ::std::mem::transmute(val);
9862 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9863 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9864 1usize,
9865 1u8,
9866 val as u64,
9867 )
9868 }
9869 }
9870 #[inline]
9871 pub fn mFullNetworkData(&self) -> bool {
9872 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9873 }
9874 #[inline]
9875 pub fn set_mFullNetworkData(&mut self, val: bool) {
9876 unsafe {
9877 let val: u8 = ::std::mem::transmute(val);
9878 self._bitfield_1.set(2usize, 1u8, val as u64)
9879 }
9880 }
9881 #[inline]
9882 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
9883 unsafe {
9884 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9885 ::std::ptr::addr_of!((*this)._bitfield_1),
9886 2usize,
9887 1u8,
9888 ) as u8)
9889 }
9890 }
9891 #[inline]
9892 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
9893 unsafe {
9894 let val: u8 = ::std::mem::transmute(val);
9895 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9896 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9897 2usize,
9898 1u8,
9899 val as u64,
9900 )
9901 }
9902 }
9903 #[inline]
9904 pub fn mIsChild(&self) -> bool {
9905 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
9906 }
9907 #[inline]
9908 pub fn set_mIsChild(&mut self, val: bool) {
9909 unsafe {
9910 let val: u8 = ::std::mem::transmute(val);
9911 self._bitfield_1.set(3usize, 1u8, val as u64)
9912 }
9913 }
9914 #[inline]
9915 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
9916 unsafe {
9917 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9918 ::std::ptr::addr_of!((*this)._bitfield_1),
9919 3usize,
9920 1u8,
9921 ) as u8)
9922 }
9923 }
9924 #[inline]
9925 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
9926 unsafe {
9927 let val: u8 = ::std::mem::transmute(val);
9928 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9929 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9930 3usize,
9931 1u8,
9932 val as u64,
9933 )
9934 }
9935 }
9936 #[inline]
9937 pub fn new_bitfield_1(
9938 mRxOnWhenIdle: bool,
9939 mFullThreadDevice: bool,
9940 mFullNetworkData: bool,
9941 mIsChild: bool,
9942 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9943 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9944 __bindgen_bitfield_unit.set(0usize, 1u8, {
9945 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9946 mRxOnWhenIdle as u64
9947 });
9948 __bindgen_bitfield_unit.set(1usize, 1u8, {
9949 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
9950 mFullThreadDevice as u64
9951 });
9952 __bindgen_bitfield_unit.set(2usize, 1u8, {
9953 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
9954 mFullNetworkData as u64
9955 });
9956 __bindgen_bitfield_unit.set(3usize, 1u8, {
9957 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
9958 mIsChild as u64
9959 });
9960 __bindgen_bitfield_unit
9961 }
9962}
9963pub type otNeighborInfoIterator = i16;
9964#[doc = " Represents the Thread Leader Data."]
9965#[repr(C)]
9966#[derive(Debug, Default, Copy, Clone)]
9967pub struct otLeaderData {
9968 #[doc = "< Partition ID"]
9969 pub mPartitionId: u32,
9970 #[doc = "< Leader Weight"]
9971 pub mWeighting: u8,
9972 #[doc = "< Full Network Data Version"]
9973 pub mDataVersion: u8,
9974 #[doc = "< Stable Network Data Version"]
9975 pub mStableDataVersion: u8,
9976 #[doc = "< Leader Router ID"]
9977 pub mLeaderRouterId: u8,
9978}
9979#[doc = " Holds diagnostic information for a Thread Router"]
9980#[repr(C)]
9981#[derive(Debug, Default, Copy, Clone)]
9982pub struct otRouterInfo {
9983 #[doc = "< IEEE 802.15.4 Extended Address"]
9984 pub mExtAddress: otExtAddress,
9985 #[doc = "< RLOC16"]
9986 pub mRloc16: u16,
9987 #[doc = "< Router ID"]
9988 pub mRouterId: u8,
9989 #[doc = "< Next hop to router"]
9990 pub mNextHop: u8,
9991 #[doc = "< Path cost to router"]
9992 pub mPathCost: u8,
9993 #[doc = "< Link Quality In"]
9994 pub mLinkQualityIn: u8,
9995 #[doc = "< Link Quality Out"]
9996 pub mLinkQualityOut: u8,
9997 #[doc = "< Time last heard"]
9998 pub mAge: u8,
9999 pub _bitfield_align_1: [u8; 0],
10000 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10001 #[doc = "< Thread version"]
10002 pub mVersion: u8,
10003 #[doc = "< CSL clock accuracy, in ± ppm"]
10004 pub mCslClockAccuracy: u8,
10005 #[doc = "< CSL uncertainty, in ±10 us"]
10006 pub mCslUncertainty: u8,
10007}
10008impl otRouterInfo {
10009 #[inline]
10010 pub fn mAllocated(&self) -> bool {
10011 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10012 }
10013 #[inline]
10014 pub fn set_mAllocated(&mut self, val: bool) {
10015 unsafe {
10016 let val: u8 = ::std::mem::transmute(val);
10017 self._bitfield_1.set(0usize, 1u8, val as u64)
10018 }
10019 }
10020 #[inline]
10021 pub unsafe fn mAllocated_raw(this: *const Self) -> bool {
10022 unsafe {
10023 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10024 ::std::ptr::addr_of!((*this)._bitfield_1),
10025 0usize,
10026 1u8,
10027 ) as u8)
10028 }
10029 }
10030 #[inline]
10031 pub unsafe fn set_mAllocated_raw(this: *mut Self, val: bool) {
10032 unsafe {
10033 let val: u8 = ::std::mem::transmute(val);
10034 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10035 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10036 0usize,
10037 1u8,
10038 val as u64,
10039 )
10040 }
10041 }
10042 #[inline]
10043 pub fn mLinkEstablished(&self) -> bool {
10044 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10045 }
10046 #[inline]
10047 pub fn set_mLinkEstablished(&mut self, val: bool) {
10048 unsafe {
10049 let val: u8 = ::std::mem::transmute(val);
10050 self._bitfield_1.set(1usize, 1u8, val as u64)
10051 }
10052 }
10053 #[inline]
10054 pub unsafe fn mLinkEstablished_raw(this: *const Self) -> bool {
10055 unsafe {
10056 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10057 ::std::ptr::addr_of!((*this)._bitfield_1),
10058 1usize,
10059 1u8,
10060 ) as u8)
10061 }
10062 }
10063 #[inline]
10064 pub unsafe fn set_mLinkEstablished_raw(this: *mut Self, val: bool) {
10065 unsafe {
10066 let val: u8 = ::std::mem::transmute(val);
10067 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10068 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10069 1usize,
10070 1u8,
10071 val as u64,
10072 )
10073 }
10074 }
10075 #[inline]
10076 pub fn new_bitfield_1(
10077 mAllocated: bool,
10078 mLinkEstablished: bool,
10079 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10080 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10081 __bindgen_bitfield_unit.set(0usize, 1u8, {
10082 let mAllocated: u8 = unsafe { ::std::mem::transmute(mAllocated) };
10083 mAllocated as u64
10084 });
10085 __bindgen_bitfield_unit.set(1usize, 1u8, {
10086 let mLinkEstablished: u8 = unsafe { ::std::mem::transmute(mLinkEstablished) };
10087 mLinkEstablished as u64
10088 });
10089 __bindgen_bitfield_unit
10090 }
10091}
10092#[doc = " Represents the IP level counters."]
10093#[repr(C)]
10094#[derive(Debug, Default, Copy, Clone)]
10095pub struct otIpCounters {
10096 #[doc = "< The number of IPv6 packets successfully transmitted."]
10097 pub mTxSuccess: u32,
10098 #[doc = "< The number of IPv6 packets successfully received."]
10099 pub mRxSuccess: u32,
10100 #[doc = "< The number of IPv6 packets failed to transmit."]
10101 pub mTxFailure: u32,
10102 #[doc = "< The number of IPv6 packets failed to receive."]
10103 pub mRxFailure: u32,
10104}
10105#[doc = " Represents the Thread MLE counters."]
10106#[repr(C)]
10107#[derive(Debug, Default, Copy, Clone)]
10108pub struct otMleCounters {
10109 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DISABLED role."]
10110 pub mDisabledRole: u16,
10111 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DETACHED role."]
10112 pub mDetachedRole: u16,
10113 #[doc = "< Number of times device entered OT_DEVICE_ROLE_CHILD role."]
10114 pub mChildRole: u16,
10115 #[doc = "< Number of times device entered OT_DEVICE_ROLE_ROUTER role."]
10116 pub mRouterRole: u16,
10117 #[doc = "< Number of times device entered OT_DEVICE_ROLE_LEADER role."]
10118 pub mLeaderRole: u16,
10119 #[doc = "< Number of attach attempts while device was detached."]
10120 pub mAttachAttempts: u16,
10121 #[doc = "< Number of changes to partition ID."]
10122 pub mPartitionIdChanges: u16,
10123 #[doc = "< Number of attempts to attach to a better partition."]
10124 pub mBetterPartitionAttachAttempts: u16,
10125 #[doc = "< Number of attempts to attach to find a better parent (parent search)."]
10126 pub mBetterParentAttachAttempts: u16,
10127 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role."]
10128 pub mDisabledTime: u64,
10129 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role."]
10130 pub mDetachedTime: u64,
10131 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role."]
10132 pub mChildTime: u64,
10133 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role."]
10134 pub mRouterTime: u64,
10135 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role."]
10136 pub mLeaderTime: u64,
10137 #[doc = "< Number of milliseconds tracked by previous counters."]
10138 pub mTrackedTime: u64,
10139 #[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)."]
10140 pub mParentChanges: u16,
10141}
10142#[doc = " Represents the MLE Parent Response data."]
10143#[repr(C)]
10144#[derive(Debug, Default, Copy, Clone)]
10145pub struct otThreadParentResponseInfo {
10146 #[doc = "< IEEE 802.15.4 Extended Address of the Parent"]
10147 pub mExtAddr: otExtAddress,
10148 #[doc = "< Short address of the Parent"]
10149 pub mRloc16: u16,
10150 #[doc = "< Rssi of the Parent"]
10151 pub mRssi: i8,
10152 #[doc = "< Parent priority"]
10153 pub mPriority: i8,
10154 #[doc = "< Parent Link Quality 3"]
10155 pub mLinkQuality3: u8,
10156 #[doc = "< Parent Link Quality 2"]
10157 pub mLinkQuality2: u8,
10158 #[doc = "< Parent Link Quality 1"]
10159 pub mLinkQuality1: u8,
10160 #[doc = "< Is the node receiving parent response attached"]
10161 pub mIsAttached: bool,
10162}
10163#[doc = " This callback informs the application that the detaching process has finished.\n\n @param[in] aContext A pointer to application-specific context."]
10164pub type otDetachGracefullyCallback =
10165 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
10166#[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."]
10167pub type otWakeupCallback = ::std::option::Option<
10168 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
10169>;
10170unsafe extern "C" {
10171 #[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."]
10172 pub fn otThreadSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
10173}
10174unsafe extern "C" {
10175 #[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."]
10176 pub fn otThreadGetVersion() -> u16;
10177}
10178unsafe extern "C" {
10179 #[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."]
10180 pub fn otThreadIsSingleton(aInstance: *mut otInstance) -> bool;
10181}
10182unsafe extern "C" {
10183 #[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."]
10184 pub fn otThreadDiscover(
10185 aInstance: *mut otInstance,
10186 aScanChannels: u32,
10187 aPanId: u16,
10188 aJoiner: bool,
10189 aEnableEui64Filtering: bool,
10190 aCallback: otHandleActiveScanResult,
10191 aCallbackContext: *mut ::std::os::raw::c_void,
10192 ) -> otError;
10193}
10194unsafe extern "C" {
10195 #[doc = " Determines if an MLE Thread Discovery is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10196 pub fn otThreadIsDiscoverInProgress(aInstance: *mut otInstance) -> bool;
10197}
10198unsafe extern "C" {
10199 #[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."]
10200 pub fn otThreadSetJoinerAdvertisement(
10201 aInstance: *mut otInstance,
10202 aOui: u32,
10203 aAdvData: *const u8,
10204 aAdvDataLength: u8,
10205 ) -> otError;
10206}
10207unsafe extern "C" {
10208 #[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"]
10209 pub fn otThreadGetChildTimeout(aInstance: *mut otInstance) -> u32;
10210}
10211unsafe extern "C" {
10212 #[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"]
10213 pub fn otThreadSetChildTimeout(aInstance: *mut otInstance, aTimeout: u32);
10214}
10215unsafe extern "C" {
10216 #[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"]
10217 pub fn otThreadGetExtendedPanId(aInstance: *mut otInstance) -> *const otExtendedPanId;
10218}
10219unsafe extern "C" {
10220 #[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"]
10221 pub fn otThreadSetExtendedPanId(
10222 aInstance: *mut otInstance,
10223 aExtendedPanId: *const otExtendedPanId,
10224 ) -> otError;
10225}
10226unsafe extern "C" {
10227 #[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."]
10228 pub fn otThreadGetLeaderRloc(
10229 aInstance: *mut otInstance,
10230 aLeaderRloc: *mut otIp6Address,
10231 ) -> otError;
10232}
10233unsafe extern "C" {
10234 #[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"]
10235 pub fn otThreadGetLinkMode(aInstance: *mut otInstance) -> otLinkModeConfig;
10236}
10237unsafe extern "C" {
10238 #[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"]
10239 pub fn otThreadSetLinkMode(aInstance: *mut otInstance, aConfig: otLinkModeConfig) -> otError;
10240}
10241unsafe extern "C" {
10242 #[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"]
10243 pub fn otThreadGetNetworkKey(aInstance: *mut otInstance, aNetworkKey: *mut otNetworkKey);
10244}
10245unsafe extern "C" {
10246 #[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"]
10247 pub fn otThreadGetNetworkKeyRef(aInstance: *mut otInstance) -> otNetworkKeyRef;
10248}
10249unsafe extern "C" {
10250 #[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"]
10251 pub fn otThreadSetNetworkKey(aInstance: *mut otInstance, aKey: *const otNetworkKey) -> otError;
10252}
10253unsafe extern "C" {
10254 #[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"]
10255 pub fn otThreadSetNetworkKeyRef(
10256 aInstance: *mut otInstance,
10257 aKeyRef: otNetworkKeyRef,
10258 ) -> otError;
10259}
10260unsafe extern "C" {
10261 #[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."]
10262 pub fn otThreadGetRloc(aInstance: *mut otInstance) -> *const otIp6Address;
10263}
10264unsafe extern "C" {
10265 #[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."]
10266 pub fn otThreadGetMeshLocalEid(aInstance: *mut otInstance) -> *const otIp6Address;
10267}
10268unsafe extern "C" {
10269 #[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."]
10270 pub fn otThreadGetMeshLocalPrefix(aInstance: *mut otInstance) -> *const otMeshLocalPrefix;
10271}
10272unsafe extern "C" {
10273 #[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."]
10274 pub fn otThreadSetMeshLocalPrefix(
10275 aInstance: *mut otInstance,
10276 aMeshLocalPrefix: *const otMeshLocalPrefix,
10277 ) -> otError;
10278}
10279unsafe extern "C" {
10280 #[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."]
10281 pub fn otThreadGetLinkLocalIp6Address(aInstance: *mut otInstance) -> *const otIp6Address;
10282}
10283unsafe extern "C" {
10284 #[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."]
10285 pub fn otThreadGetLinkLocalAllThreadNodesMulticastAddress(
10286 aInstance: *mut otInstance,
10287 ) -> *const otIp6Address;
10288}
10289unsafe extern "C" {
10290 #[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."]
10291 pub fn otThreadGetRealmLocalAllThreadNodesMulticastAddress(
10292 aInstance: *mut otInstance,
10293 ) -> *const otIp6Address;
10294}
10295unsafe extern "C" {
10296 #[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."]
10297 pub fn otThreadGetServiceAloc(
10298 aInstance: *mut otInstance,
10299 aServiceId: u8,
10300 aServiceAloc: *mut otIp6Address,
10301 ) -> otError;
10302}
10303unsafe extern "C" {
10304 #[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"]
10305 pub fn otThreadGetNetworkName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10306}
10307unsafe extern "C" {
10308 #[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"]
10309 pub fn otThreadSetNetworkName(
10310 aInstance: *mut otInstance,
10311 aNetworkName: *const ::std::os::raw::c_char,
10312 ) -> otError;
10313}
10314unsafe extern "C" {
10315 #[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"]
10316 pub fn otThreadGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10317}
10318unsafe extern "C" {
10319 #[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"]
10320 pub fn otThreadSetDomainName(
10321 aInstance: *mut otInstance,
10322 aDomainName: *const ::std::os::raw::c_char,
10323 ) -> otError;
10324}
10325unsafe extern "C" {
10326 #[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"]
10327 pub fn otThreadGetKeySequenceCounter(aInstance: *mut otInstance) -> u32;
10328}
10329unsafe extern "C" {
10330 #[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"]
10331 pub fn otThreadSetKeySequenceCounter(aInstance: *mut otInstance, aKeySequenceCounter: u32);
10332}
10333unsafe extern "C" {
10334 #[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"]
10335 pub fn otThreadGetKeySwitchGuardTime(aInstance: *mut otInstance) -> u16;
10336}
10337unsafe extern "C" {
10338 #[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"]
10339 pub fn otThreadSetKeySwitchGuardTime(aInstance: *mut otInstance, aKeySwitchGuardTime: u16);
10340}
10341unsafe extern "C" {
10342 #[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."]
10343 pub fn otThreadBecomeDetached(aInstance: *mut otInstance) -> otError;
10344}
10345unsafe extern "C" {
10346 #[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."]
10347 pub fn otThreadBecomeChild(aInstance: *mut otInstance) -> otError;
10348}
10349unsafe extern "C" {
10350 #[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."]
10351 pub fn otThreadGetNextNeighborInfo(
10352 aInstance: *mut otInstance,
10353 aIterator: *mut otNeighborInfoIterator,
10354 aInfo: *mut otNeighborInfo,
10355 ) -> otError;
10356}
10357unsafe extern "C" {
10358 #[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."]
10359 pub fn otThreadGetDeviceRole(aInstance: *mut otInstance) -> otDeviceRole;
10360}
10361unsafe extern "C" {
10362 #[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."]
10363 pub fn otThreadDeviceRoleToString(aRole: otDeviceRole) -> *const ::std::os::raw::c_char;
10364}
10365unsafe extern "C" {
10366 #[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."]
10367 pub fn otThreadGetLeaderData(
10368 aInstance: *mut otInstance,
10369 aLeaderData: *mut otLeaderData,
10370 ) -> otError;
10371}
10372unsafe extern "C" {
10373 #[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."]
10374 pub fn otThreadGetLeaderRouterId(aInstance: *mut otInstance) -> u8;
10375}
10376unsafe extern "C" {
10377 #[doc = " Get the Leader's Weight.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Weight."]
10378 pub fn otThreadGetLeaderWeight(aInstance: *mut otInstance) -> u8;
10379}
10380unsafe extern "C" {
10381 #[doc = " Get the Partition ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Partition ID."]
10382 pub fn otThreadGetPartitionId(aInstance: *mut otInstance) -> u32;
10383}
10384unsafe extern "C" {
10385 #[doc = " Get the RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RLOC16."]
10386 pub fn otThreadGetRloc16(aInstance: *mut otInstance) -> u16;
10387}
10388unsafe extern "C" {
10389 #[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."]
10390 pub fn otThreadGetParentInfo(
10391 aInstance: *mut otInstance,
10392 aParentInfo: *mut otRouterInfo,
10393 ) -> otError;
10394}
10395unsafe extern "C" {
10396 #[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."]
10397 pub fn otThreadGetParentAverageRssi(
10398 aInstance: *mut otInstance,
10399 aParentRssi: *mut i8,
10400 ) -> otError;
10401}
10402unsafe extern "C" {
10403 #[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."]
10404 pub fn otThreadGetParentLastRssi(aInstance: *mut otInstance, aLastRssi: *mut i8) -> otError;
10405}
10406unsafe extern "C" {
10407 #[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."]
10408 pub fn otThreadSearchForBetterParent(aInstance: *mut otInstance) -> otError;
10409}
10410unsafe extern "C" {
10411 #[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."]
10412 pub fn otThreadGetIp6Counters(aInstance: *mut otInstance) -> *const otIpCounters;
10413}
10414unsafe extern "C" {
10415 #[doc = " Resets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10416 pub fn otThreadResetIp6Counters(aInstance: *mut otInstance);
10417}
10418unsafe extern "C" {
10419 #[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."]
10420 pub fn otThreadGetTimeInQueueHistogram(
10421 aInstance: *mut otInstance,
10422 aNumBins: *mut u16,
10423 aBinInterval: *mut u32,
10424 ) -> *const u32;
10425}
10426unsafe extern "C" {
10427 #[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)."]
10428 pub fn otThreadGetMaxTimeInQueue(aInstance: *mut otInstance) -> u32;
10429}
10430unsafe extern "C" {
10431 #[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."]
10432 pub fn otThreadResetTimeInQueueStat(aInstance: *mut otInstance);
10433}
10434unsafe extern "C" {
10435 #[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."]
10436 pub fn otThreadGetMleCounters(aInstance: *mut otInstance) -> *const otMleCounters;
10437}
10438unsafe extern "C" {
10439 #[doc = " Resets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10440 pub fn otThreadResetMleCounters(aInstance: *mut otInstance);
10441}
10442unsafe extern "C" {
10443 #[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."]
10444 pub fn otThreadGetCurrentAttachDuration(aInstance: *mut otInstance) -> u32;
10445}
10446#[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."]
10447pub type otThreadParentResponseCallback = ::std::option::Option<
10448 unsafe extern "C" fn(
10449 aInfo: *mut otThreadParentResponseInfo,
10450 aContext: *mut ::std::os::raw::c_void,
10451 ),
10452>;
10453unsafe extern "C" {
10454 #[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."]
10455 pub fn otThreadRegisterParentResponseCallback(
10456 aInstance: *mut otInstance,
10457 aCallback: otThreadParentResponseCallback,
10458 aContext: *mut ::std::os::raw::c_void,
10459 );
10460}
10461#[doc = " Represents the Thread Discovery Request data."]
10462#[repr(C)]
10463#[derive(Debug, Default, Copy, Clone)]
10464pub struct otThreadDiscoveryRequestInfo {
10465 #[doc = "< IEEE 802.15.4 Extended Address of the requester"]
10466 pub mExtAddress: otExtAddress,
10467 pub _bitfield_align_1: [u8; 0],
10468 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10469}
10470impl otThreadDiscoveryRequestInfo {
10471 #[inline]
10472 pub fn mVersion(&self) -> u8 {
10473 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10474 }
10475 #[inline]
10476 pub fn set_mVersion(&mut self, val: u8) {
10477 unsafe {
10478 let val: u8 = ::std::mem::transmute(val);
10479 self._bitfield_1.set(0usize, 4u8, val as u64)
10480 }
10481 }
10482 #[inline]
10483 pub unsafe fn mVersion_raw(this: *const Self) -> u8 {
10484 unsafe {
10485 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10486 ::std::ptr::addr_of!((*this)._bitfield_1),
10487 0usize,
10488 4u8,
10489 ) as u8)
10490 }
10491 }
10492 #[inline]
10493 pub unsafe fn set_mVersion_raw(this: *mut Self, val: u8) {
10494 unsafe {
10495 let val: u8 = ::std::mem::transmute(val);
10496 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10497 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10498 0usize,
10499 4u8,
10500 val as u64,
10501 )
10502 }
10503 }
10504 #[inline]
10505 pub fn mIsJoiner(&self) -> bool {
10506 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10507 }
10508 #[inline]
10509 pub fn set_mIsJoiner(&mut self, val: bool) {
10510 unsafe {
10511 let val: u8 = ::std::mem::transmute(val);
10512 self._bitfield_1.set(4usize, 1u8, val as u64)
10513 }
10514 }
10515 #[inline]
10516 pub unsafe fn mIsJoiner_raw(this: *const Self) -> bool {
10517 unsafe {
10518 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10519 ::std::ptr::addr_of!((*this)._bitfield_1),
10520 4usize,
10521 1u8,
10522 ) as u8)
10523 }
10524 }
10525 #[inline]
10526 pub unsafe fn set_mIsJoiner_raw(this: *mut Self, val: bool) {
10527 unsafe {
10528 let val: u8 = ::std::mem::transmute(val);
10529 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10530 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10531 4usize,
10532 1u8,
10533 val as u64,
10534 )
10535 }
10536 }
10537 #[inline]
10538 pub fn new_bitfield_1(mVersion: u8, mIsJoiner: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10539 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10540 __bindgen_bitfield_unit.set(0usize, 4u8, {
10541 let mVersion: u8 = unsafe { ::std::mem::transmute(mVersion) };
10542 mVersion as u64
10543 });
10544 __bindgen_bitfield_unit.set(4usize, 1u8, {
10545 let mIsJoiner: u8 = unsafe { ::std::mem::transmute(mIsJoiner) };
10546 mIsJoiner as u64
10547 });
10548 __bindgen_bitfield_unit
10549 }
10550}
10551#[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."]
10552pub type otThreadDiscoveryRequestCallback = ::std::option::Option<
10553 unsafe extern "C" fn(
10554 aInfo: *const otThreadDiscoveryRequestInfo,
10555 aContext: *mut ::std::os::raw::c_void,
10556 ),
10557>;
10558unsafe extern "C" {
10559 #[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."]
10560 pub fn otThreadSetDiscoveryRequestCallback(
10561 aInstance: *mut otInstance,
10562 aCallback: otThreadDiscoveryRequestCallback,
10563 aContext: *mut ::std::os::raw::c_void,
10564 );
10565}
10566#[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)."]
10567pub type otThreadAnycastLocatorCallback = ::std::option::Option<
10568 unsafe extern "C" fn(
10569 aContext: *mut ::std::os::raw::c_void,
10570 aError: otError,
10571 aMeshLocalAddress: *const otIp6Address,
10572 aRloc16: u16,
10573 ),
10574>;
10575unsafe extern "C" {
10576 #[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."]
10577 pub fn otThreadLocateAnycastDestination(
10578 aInstance: *mut otInstance,
10579 aAnycastAddress: *const otIp6Address,
10580 aCallback: otThreadAnycastLocatorCallback,
10581 aContext: *mut ::std::os::raw::c_void,
10582 ) -> otError;
10583}
10584unsafe extern "C" {
10585 #[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."]
10586 pub fn otThreadIsAnycastLocateInProgress(aInstance: *mut otInstance) -> bool;
10587}
10588unsafe extern "C" {
10589 #[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."]
10590 pub fn otThreadSendAddressNotification(
10591 aInstance: *mut otInstance,
10592 aDestination: *mut otIp6Address,
10593 aTarget: *mut otIp6Address,
10594 aMlIid: *mut otIp6InterfaceIdentifier,
10595 );
10596}
10597unsafe extern "C" {
10598 #[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."]
10599 pub fn otThreadDetachGracefully(
10600 aInstance: *mut otInstance,
10601 aCallback: otDetachGracefullyCallback,
10602 aContext: *mut ::std::os::raw::c_void,
10603 ) -> otError;
10604}
10605unsafe extern "C" {
10606 #[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`."]
10607 pub fn otConvertDurationInSecondsToString(
10608 aDuration: u32,
10609 aBuffer: *mut ::std::os::raw::c_char,
10610 aSize: u16,
10611 );
10612}
10613unsafe extern "C" {
10614 #[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."]
10615 pub fn otThreadSetStoreFrameCounterAhead(
10616 aInstance: *mut otInstance,
10617 aStoreFrameCounterAhead: u32,
10618 );
10619}
10620unsafe extern "C" {
10621 #[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."]
10622 pub fn otThreadGetStoreFrameCounterAhead(aInstance: *mut otInstance) -> u32;
10623}
10624unsafe extern "C" {
10625 #[doc = " Attempts to wake a Wake-up End Device.\n\n Requires `OPENTHREAD_CONFIG_TD_WAKE_INITIATOR_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."]
10626 pub fn otThreadWakeup(
10627 aInstance: *mut otInstance,
10628 aWedAddress: *const otExtAddress,
10629 aWakeupIntervalUs: u16,
10630 aWakeupDurationMs: u16,
10631 aCallback: otWakeupCallback,
10632 aCallbackContext: *mut ::std::os::raw::c_void,
10633 ) -> otError;
10634}
10635#[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()`,"]
10636#[repr(C)]
10637#[derive(Debug, Default, Copy, Clone)]
10638pub struct otHistoryTrackerIterator {
10639 pub mData32: u32,
10640 pub mData16: u16,
10641}
10642#[doc = " Represents Thread network info."]
10643#[repr(C)]
10644#[derive(Debug, Copy, Clone)]
10645pub struct otHistoryTrackerNetworkInfo {
10646 #[doc = "< Device Role."]
10647 pub mRole: otDeviceRole,
10648 #[doc = "< Device Mode."]
10649 pub mMode: otLinkModeConfig,
10650 #[doc = "< Device RLOC16."]
10651 pub mRloc16: u16,
10652 #[doc = "< Partition ID (valid when attached)."]
10653 pub mPartitionId: u32,
10654}
10655impl Default for otHistoryTrackerNetworkInfo {
10656 fn default() -> Self {
10657 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10658 unsafe {
10659 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10660 s.assume_init()
10661 }
10662 }
10663}
10664#[doc = "< Address is added."]
10665pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_ADDED: otHistoryTrackerAddressEvent = 0;
10666#[doc = "< Address is removed."]
10667pub const OT_HISTORY_TRACKER_ADDRESS_EVENT_REMOVED: otHistoryTrackerAddressEvent = 1;
10668#[doc = " Defines the events for an IPv6 (unicast or multicast) address info (i.e., whether address is added\n or removed)."]
10669pub type otHistoryTrackerAddressEvent = ::std::os::raw::c_uint;
10670#[doc = " Represent a unicast IPv6 address info."]
10671#[repr(C)]
10672#[derive(Copy, Clone)]
10673pub struct otHistoryTrackerUnicastAddressInfo {
10674 #[doc = "< The unicast IPv6 address."]
10675 pub mAddress: otIp6Address,
10676 #[doc = "< The Prefix length (in bits)."]
10677 pub mPrefixLength: u8,
10678 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10679 pub mAddressOrigin: u8,
10680 #[doc = "< Indicates the event (address is added/removed)."]
10681 pub mEvent: otHistoryTrackerAddressEvent,
10682 pub _bitfield_align_1: [u8; 0],
10683 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10684 pub __bindgen_padding_0: [u8; 3usize],
10685}
10686impl Default for otHistoryTrackerUnicastAddressInfo {
10687 fn default() -> Self {
10688 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10689 unsafe {
10690 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10691 s.assume_init()
10692 }
10693 }
10694}
10695impl otHistoryTrackerUnicastAddressInfo {
10696 #[inline]
10697 pub fn mScope(&self) -> u8 {
10698 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10699 }
10700 #[inline]
10701 pub fn set_mScope(&mut self, val: u8) {
10702 unsafe {
10703 let val: u8 = ::std::mem::transmute(val);
10704 self._bitfield_1.set(0usize, 4u8, val as u64)
10705 }
10706 }
10707 #[inline]
10708 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
10709 unsafe {
10710 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10711 ::std::ptr::addr_of!((*this)._bitfield_1),
10712 0usize,
10713 4u8,
10714 ) as u8)
10715 }
10716 }
10717 #[inline]
10718 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
10719 unsafe {
10720 let val: u8 = ::std::mem::transmute(val);
10721 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10722 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10723 0usize,
10724 4u8,
10725 val as u64,
10726 )
10727 }
10728 }
10729 #[inline]
10730 pub fn mPreferred(&self) -> bool {
10731 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10732 }
10733 #[inline]
10734 pub fn set_mPreferred(&mut self, val: bool) {
10735 unsafe {
10736 let val: u8 = ::std::mem::transmute(val);
10737 self._bitfield_1.set(4usize, 1u8, val as u64)
10738 }
10739 }
10740 #[inline]
10741 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
10742 unsafe {
10743 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10744 ::std::ptr::addr_of!((*this)._bitfield_1),
10745 4usize,
10746 1u8,
10747 ) as u8)
10748 }
10749 }
10750 #[inline]
10751 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
10752 unsafe {
10753 let val: u8 = ::std::mem::transmute(val);
10754 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10755 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10756 4usize,
10757 1u8,
10758 val as u64,
10759 )
10760 }
10761 }
10762 #[inline]
10763 pub fn mValid(&self) -> bool {
10764 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
10765 }
10766 #[inline]
10767 pub fn set_mValid(&mut self, val: bool) {
10768 unsafe {
10769 let val: u8 = ::std::mem::transmute(val);
10770 self._bitfield_1.set(5usize, 1u8, val as u64)
10771 }
10772 }
10773 #[inline]
10774 pub unsafe fn mValid_raw(this: *const Self) -> bool {
10775 unsafe {
10776 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10777 ::std::ptr::addr_of!((*this)._bitfield_1),
10778 5usize,
10779 1u8,
10780 ) as u8)
10781 }
10782 }
10783 #[inline]
10784 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
10785 unsafe {
10786 let val: u8 = ::std::mem::transmute(val);
10787 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10788 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10789 5usize,
10790 1u8,
10791 val as u64,
10792 )
10793 }
10794 }
10795 #[inline]
10796 pub fn mRloc(&self) -> bool {
10797 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
10798 }
10799 #[inline]
10800 pub fn set_mRloc(&mut self, val: bool) {
10801 unsafe {
10802 let val: u8 = ::std::mem::transmute(val);
10803 self._bitfield_1.set(6usize, 1u8, val as u64)
10804 }
10805 }
10806 #[inline]
10807 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
10808 unsafe {
10809 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10810 ::std::ptr::addr_of!((*this)._bitfield_1),
10811 6usize,
10812 1u8,
10813 ) as u8)
10814 }
10815 }
10816 #[inline]
10817 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
10818 unsafe {
10819 let val: u8 = ::std::mem::transmute(val);
10820 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10821 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10822 6usize,
10823 1u8,
10824 val as u64,
10825 )
10826 }
10827 }
10828 #[inline]
10829 pub fn new_bitfield_1(
10830 mScope: u8,
10831 mPreferred: bool,
10832 mValid: bool,
10833 mRloc: bool,
10834 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10835 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10836 __bindgen_bitfield_unit.set(0usize, 4u8, {
10837 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
10838 mScope as u64
10839 });
10840 __bindgen_bitfield_unit.set(4usize, 1u8, {
10841 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
10842 mPreferred as u64
10843 });
10844 __bindgen_bitfield_unit.set(5usize, 1u8, {
10845 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
10846 mValid as u64
10847 });
10848 __bindgen_bitfield_unit.set(6usize, 1u8, {
10849 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
10850 mRloc as u64
10851 });
10852 __bindgen_bitfield_unit
10853 }
10854}
10855#[doc = " Represent an IPv6 multicast address info."]
10856#[repr(C)]
10857#[derive(Copy, Clone)]
10858pub struct otHistoryTrackerMulticastAddressInfo {
10859 #[doc = "< The IPv6 multicast address."]
10860 pub mAddress: otIp6Address,
10861 #[doc = "< The address origin (`OT_ADDRESS_ORIGIN_*` constants)."]
10862 pub mAddressOrigin: u8,
10863 #[doc = "< Indicates the event (address is added/removed)."]
10864 pub mEvent: otHistoryTrackerAddressEvent,
10865}
10866impl Default for otHistoryTrackerMulticastAddressInfo {
10867 fn default() -> Self {
10868 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10869 unsafe {
10870 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10871 s.assume_init()
10872 }
10873 }
10874}
10875#[doc = "< Low priority level."]
10876pub const OT_HISTORY_TRACKER_MSG_PRIORITY_LOW: _bindgen_ty_10 = 0;
10877#[doc = "< Normal priority level."]
10878pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NORMAL: _bindgen_ty_10 = 1;
10879#[doc = "< High priority level."]
10880pub const OT_HISTORY_TRACKER_MSG_PRIORITY_HIGH: _bindgen_ty_10 = 2;
10881#[doc = "< Network Control priority level."]
10882pub const OT_HISTORY_TRACKER_MSG_PRIORITY_NET: _bindgen_ty_10 = 3;
10883#[doc = " Constants representing message priority used in `otHistoryTrackerMessageInfo` struct."]
10884pub type _bindgen_ty_10 = ::std::os::raw::c_uint;
10885#[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."]
10886#[repr(C)]
10887#[derive(Copy, Clone)]
10888pub struct otHistoryTrackerMessageInfo {
10889 #[doc = "< IPv6 payload length (exclude IP6 header itself)."]
10890 pub mPayloadLength: u16,
10891 #[doc = "< RLOC16 of neighbor which sent/received the msg (`0xfffe` if no RLOC16)."]
10892 pub mNeighborRloc16: u16,
10893 #[doc = "< Source IPv6 address and port (if UDP/TCP)"]
10894 pub mSource: otSockAddr,
10895 #[doc = "< Destination IPv6 address and port (if UDP/TCP)."]
10896 pub mDestination: otSockAddr,
10897 #[doc = "< Message checksum (valid only for UDP/TCP/ICMP6)."]
10898 pub mChecksum: u16,
10899 #[doc = "< IP Protocol number (`OT_IP6_PROTO_*` enumeration)."]
10900 pub mIpProto: u8,
10901 #[doc = "< ICMP6 type if msg is ICMP6, zero otherwise (`OT_ICMP6_TYPE_*` enumeration)."]
10902 pub mIcmp6Type: u8,
10903 #[doc = "< RSS of received message or OT_RADIO_INVALID_RSSI if not known."]
10904 pub mAveRxRss: i8,
10905 pub _bitfield_align_1: [u8; 0],
10906 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10907}
10908impl Default for otHistoryTrackerMessageInfo {
10909 fn default() -> Self {
10910 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10911 unsafe {
10912 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10913 s.assume_init()
10914 }
10915 }
10916}
10917impl otHistoryTrackerMessageInfo {
10918 #[inline]
10919 pub fn mLinkSecurity(&self) -> bool {
10920 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10921 }
10922 #[inline]
10923 pub fn set_mLinkSecurity(&mut self, val: bool) {
10924 unsafe {
10925 let val: u8 = ::std::mem::transmute(val);
10926 self._bitfield_1.set(0usize, 1u8, val as u64)
10927 }
10928 }
10929 #[inline]
10930 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
10931 unsafe {
10932 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10933 ::std::ptr::addr_of!((*this)._bitfield_1),
10934 0usize,
10935 1u8,
10936 ) as u8)
10937 }
10938 }
10939 #[inline]
10940 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
10941 unsafe {
10942 let val: u8 = ::std::mem::transmute(val);
10943 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10944 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10945 0usize,
10946 1u8,
10947 val as u64,
10948 )
10949 }
10950 }
10951 #[inline]
10952 pub fn mTxSuccess(&self) -> bool {
10953 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10954 }
10955 #[inline]
10956 pub fn set_mTxSuccess(&mut self, val: bool) {
10957 unsafe {
10958 let val: u8 = ::std::mem::transmute(val);
10959 self._bitfield_1.set(1usize, 1u8, val as u64)
10960 }
10961 }
10962 #[inline]
10963 pub unsafe fn mTxSuccess_raw(this: *const Self) -> bool {
10964 unsafe {
10965 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10966 ::std::ptr::addr_of!((*this)._bitfield_1),
10967 1usize,
10968 1u8,
10969 ) as u8)
10970 }
10971 }
10972 #[inline]
10973 pub unsafe fn set_mTxSuccess_raw(this: *mut Self, val: bool) {
10974 unsafe {
10975 let val: u8 = ::std::mem::transmute(val);
10976 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10977 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10978 1usize,
10979 1u8,
10980 val as u64,
10981 )
10982 }
10983 }
10984 #[inline]
10985 pub fn mPriority(&self) -> u8 {
10986 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
10987 }
10988 #[inline]
10989 pub fn set_mPriority(&mut self, val: u8) {
10990 unsafe {
10991 let val: u8 = ::std::mem::transmute(val);
10992 self._bitfield_1.set(2usize, 2u8, val as u64)
10993 }
10994 }
10995 #[inline]
10996 pub unsafe fn mPriority_raw(this: *const Self) -> u8 {
10997 unsafe {
10998 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10999 ::std::ptr::addr_of!((*this)._bitfield_1),
11000 2usize,
11001 2u8,
11002 ) as u8)
11003 }
11004 }
11005 #[inline]
11006 pub unsafe fn set_mPriority_raw(this: *mut Self, val: u8) {
11007 unsafe {
11008 let val: u8 = ::std::mem::transmute(val);
11009 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11010 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11011 2usize,
11012 2u8,
11013 val as u64,
11014 )
11015 }
11016 }
11017 #[inline]
11018 pub fn mRadioIeee802154(&self) -> bool {
11019 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11020 }
11021 #[inline]
11022 pub fn set_mRadioIeee802154(&mut self, val: bool) {
11023 unsafe {
11024 let val: u8 = ::std::mem::transmute(val);
11025 self._bitfield_1.set(4usize, 1u8, val as u64)
11026 }
11027 }
11028 #[inline]
11029 pub unsafe fn mRadioIeee802154_raw(this: *const Self) -> bool {
11030 unsafe {
11031 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11032 ::std::ptr::addr_of!((*this)._bitfield_1),
11033 4usize,
11034 1u8,
11035 ) as u8)
11036 }
11037 }
11038 #[inline]
11039 pub unsafe fn set_mRadioIeee802154_raw(this: *mut Self, val: bool) {
11040 unsafe {
11041 let val: u8 = ::std::mem::transmute(val);
11042 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11043 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11044 4usize,
11045 1u8,
11046 val as u64,
11047 )
11048 }
11049 }
11050 #[inline]
11051 pub fn mRadioTrelUdp6(&self) -> bool {
11052 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11053 }
11054 #[inline]
11055 pub fn set_mRadioTrelUdp6(&mut self, val: bool) {
11056 unsafe {
11057 let val: u8 = ::std::mem::transmute(val);
11058 self._bitfield_1.set(5usize, 1u8, val as u64)
11059 }
11060 }
11061 #[inline]
11062 pub unsafe fn mRadioTrelUdp6_raw(this: *const Self) -> bool {
11063 unsafe {
11064 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11065 ::std::ptr::addr_of!((*this)._bitfield_1),
11066 5usize,
11067 1u8,
11068 ) as u8)
11069 }
11070 }
11071 #[inline]
11072 pub unsafe fn set_mRadioTrelUdp6_raw(this: *mut Self, val: bool) {
11073 unsafe {
11074 let val: u8 = ::std::mem::transmute(val);
11075 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11076 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11077 5usize,
11078 1u8,
11079 val as u64,
11080 )
11081 }
11082 }
11083 #[inline]
11084 pub fn new_bitfield_1(
11085 mLinkSecurity: bool,
11086 mTxSuccess: bool,
11087 mPriority: u8,
11088 mRadioIeee802154: bool,
11089 mRadioTrelUdp6: bool,
11090 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11091 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11092 __bindgen_bitfield_unit.set(0usize, 1u8, {
11093 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
11094 mLinkSecurity as u64
11095 });
11096 __bindgen_bitfield_unit.set(1usize, 1u8, {
11097 let mTxSuccess: u8 = unsafe { ::std::mem::transmute(mTxSuccess) };
11098 mTxSuccess as u64
11099 });
11100 __bindgen_bitfield_unit.set(2usize, 2u8, {
11101 let mPriority: u8 = unsafe { ::std::mem::transmute(mPriority) };
11102 mPriority as u64
11103 });
11104 __bindgen_bitfield_unit.set(4usize, 1u8, {
11105 let mRadioIeee802154: u8 = unsafe { ::std::mem::transmute(mRadioIeee802154) };
11106 mRadioIeee802154 as u64
11107 });
11108 __bindgen_bitfield_unit.set(5usize, 1u8, {
11109 let mRadioTrelUdp6: u8 = unsafe { ::std::mem::transmute(mRadioTrelUdp6) };
11110 mRadioTrelUdp6 as u64
11111 });
11112 __bindgen_bitfield_unit
11113 }
11114}
11115#[doc = "< Neighbor is added."]
11116pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_ADDED: otHistoryTrackerNeighborEvent = 0;
11117#[doc = "< Neighbor is removed."]
11118pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_REMOVED: otHistoryTrackerNeighborEvent = 1;
11119#[doc = "< Neighbor changed (e.g., device mode flags changed)."]
11120pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_CHANGED: otHistoryTrackerNeighborEvent = 2;
11121#[doc = "< Neighbor is being restored (applicable to child only)."]
11122pub const OT_HISTORY_TRACKER_NEIGHBOR_EVENT_RESTORING: otHistoryTrackerNeighborEvent = 3;
11123#[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."]
11124pub type otHistoryTrackerNeighborEvent = ::std::os::raw::c_uint;
11125#[doc = " Represents a neighbor info."]
11126#[repr(C)]
11127#[derive(Debug, Default, Copy, Clone)]
11128pub struct otHistoryTrackerNeighborInfo {
11129 #[doc = "< Neighbor's Extended Address."]
11130 pub mExtAddress: otExtAddress,
11131 #[doc = "< Neighbor's RLOC16."]
11132 pub mRloc16: u16,
11133 #[doc = "< Average RSSI of rx frames from neighbor at the time of recording entry."]
11134 pub mAverageRssi: i8,
11135 pub _bitfield_align_1: [u8; 0],
11136 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11137}
11138impl otHistoryTrackerNeighborInfo {
11139 #[inline]
11140 pub fn mEvent(&self) -> u8 {
11141 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11142 }
11143 #[inline]
11144 pub fn set_mEvent(&mut self, val: u8) {
11145 unsafe {
11146 let val: u8 = ::std::mem::transmute(val);
11147 self._bitfield_1.set(0usize, 2u8, val as u64)
11148 }
11149 }
11150 #[inline]
11151 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11152 unsafe {
11153 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11154 ::std::ptr::addr_of!((*this)._bitfield_1),
11155 0usize,
11156 2u8,
11157 ) as u8)
11158 }
11159 }
11160 #[inline]
11161 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11162 unsafe {
11163 let val: u8 = ::std::mem::transmute(val);
11164 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11165 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11166 0usize,
11167 2u8,
11168 val as u64,
11169 )
11170 }
11171 }
11172 #[inline]
11173 pub fn mRxOnWhenIdle(&self) -> bool {
11174 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11175 }
11176 #[inline]
11177 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
11178 unsafe {
11179 let val: u8 = ::std::mem::transmute(val);
11180 self._bitfield_1.set(2usize, 1u8, val as u64)
11181 }
11182 }
11183 #[inline]
11184 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
11185 unsafe {
11186 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11187 ::std::ptr::addr_of!((*this)._bitfield_1),
11188 2usize,
11189 1u8,
11190 ) as u8)
11191 }
11192 }
11193 #[inline]
11194 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
11195 unsafe {
11196 let val: u8 = ::std::mem::transmute(val);
11197 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11198 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11199 2usize,
11200 1u8,
11201 val as u64,
11202 )
11203 }
11204 }
11205 #[inline]
11206 pub fn mFullThreadDevice(&self) -> bool {
11207 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11208 }
11209 #[inline]
11210 pub fn set_mFullThreadDevice(&mut self, val: bool) {
11211 unsafe {
11212 let val: u8 = ::std::mem::transmute(val);
11213 self._bitfield_1.set(3usize, 1u8, val as u64)
11214 }
11215 }
11216 #[inline]
11217 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
11218 unsafe {
11219 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11220 ::std::ptr::addr_of!((*this)._bitfield_1),
11221 3usize,
11222 1u8,
11223 ) as u8)
11224 }
11225 }
11226 #[inline]
11227 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
11228 unsafe {
11229 let val: u8 = ::std::mem::transmute(val);
11230 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11231 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11232 3usize,
11233 1u8,
11234 val as u64,
11235 )
11236 }
11237 }
11238 #[inline]
11239 pub fn mFullNetworkData(&self) -> bool {
11240 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11241 }
11242 #[inline]
11243 pub fn set_mFullNetworkData(&mut self, val: bool) {
11244 unsafe {
11245 let val: u8 = ::std::mem::transmute(val);
11246 self._bitfield_1.set(4usize, 1u8, val as u64)
11247 }
11248 }
11249 #[inline]
11250 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
11251 unsafe {
11252 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11253 ::std::ptr::addr_of!((*this)._bitfield_1),
11254 4usize,
11255 1u8,
11256 ) as u8)
11257 }
11258 }
11259 #[inline]
11260 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
11261 unsafe {
11262 let val: u8 = ::std::mem::transmute(val);
11263 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11264 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11265 4usize,
11266 1u8,
11267 val as u64,
11268 )
11269 }
11270 }
11271 #[inline]
11272 pub fn mIsChild(&self) -> bool {
11273 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
11274 }
11275 #[inline]
11276 pub fn set_mIsChild(&mut self, val: bool) {
11277 unsafe {
11278 let val: u8 = ::std::mem::transmute(val);
11279 self._bitfield_1.set(5usize, 1u8, val as u64)
11280 }
11281 }
11282 #[inline]
11283 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
11284 unsafe {
11285 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11286 ::std::ptr::addr_of!((*this)._bitfield_1),
11287 5usize,
11288 1u8,
11289 ) as u8)
11290 }
11291 }
11292 #[inline]
11293 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
11294 unsafe {
11295 let val: u8 = ::std::mem::transmute(val);
11296 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11297 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11298 5usize,
11299 1u8,
11300 val as u64,
11301 )
11302 }
11303 }
11304 #[inline]
11305 pub fn new_bitfield_1(
11306 mEvent: u8,
11307 mRxOnWhenIdle: bool,
11308 mFullThreadDevice: bool,
11309 mFullNetworkData: bool,
11310 mIsChild: bool,
11311 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11312 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11313 __bindgen_bitfield_unit.set(0usize, 2u8, {
11314 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11315 mEvent as u64
11316 });
11317 __bindgen_bitfield_unit.set(2usize, 1u8, {
11318 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
11319 mRxOnWhenIdle as u64
11320 });
11321 __bindgen_bitfield_unit.set(3usize, 1u8, {
11322 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
11323 mFullThreadDevice as u64
11324 });
11325 __bindgen_bitfield_unit.set(4usize, 1u8, {
11326 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
11327 mFullNetworkData as u64
11328 });
11329 __bindgen_bitfield_unit.set(5usize, 1u8, {
11330 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
11331 mIsChild as u64
11332 });
11333 __bindgen_bitfield_unit
11334 }
11335}
11336#[doc = "< Router is added (router ID allocated)."]
11337pub const OT_HISTORY_TRACKER_ROUTER_EVENT_ADDED: otHistoryTrackerRouterEvent = 0;
11338#[doc = "< Router entry is removed (router ID released)."]
11339pub const OT_HISTORY_TRACKER_ROUTER_EVENT_REMOVED: otHistoryTrackerRouterEvent = 1;
11340#[doc = "< Router entry next hop and cost changed."]
11341pub const OT_HISTORY_TRACKER_ROUTER_EVENT_NEXT_HOP_CHANGED: otHistoryTrackerRouterEvent = 2;
11342#[doc = "< Router entry path cost changed (next hop as before)."]
11343pub const OT_HISTORY_TRACKER_ROUTER_EVENT_COST_CHANGED: otHistoryTrackerRouterEvent = 3;
11344#[doc = " Defines the events in a router info (i.e. whether router is added, removed, or changed)."]
11345pub type otHistoryTrackerRouterEvent = ::std::os::raw::c_uint;
11346#[doc = " Represents a router table entry event."]
11347#[repr(C)]
11348#[derive(Debug, Default, Copy, Clone)]
11349pub struct otHistoryTrackerRouterInfo {
11350 pub _bitfield_align_1: [u8; 0],
11351 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11352 #[doc = "< Next Hop Router ID - `OT_HISTORY_TRACKER_NO_NEXT_HOP` if no next hop."]
11353 pub mNextHop: u8,
11354 pub _bitfield_align_2: [u8; 0],
11355 pub _bitfield_2: __BindgenBitfieldUnit<[u8; 1usize]>,
11356}
11357impl otHistoryTrackerRouterInfo {
11358 #[inline]
11359 pub fn mEvent(&self) -> u8 {
11360 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11361 }
11362 #[inline]
11363 pub fn set_mEvent(&mut self, val: u8) {
11364 unsafe {
11365 let val: u8 = ::std::mem::transmute(val);
11366 self._bitfield_1.set(0usize, 2u8, val as u64)
11367 }
11368 }
11369 #[inline]
11370 pub unsafe fn mEvent_raw(this: *const Self) -> u8 {
11371 unsafe {
11372 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11373 ::std::ptr::addr_of!((*this)._bitfield_1),
11374 0usize,
11375 2u8,
11376 ) as u8)
11377 }
11378 }
11379 #[inline]
11380 pub unsafe fn set_mEvent_raw(this: *mut Self, val: u8) {
11381 unsafe {
11382 let val: u8 = ::std::mem::transmute(val);
11383 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11384 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11385 0usize,
11386 2u8,
11387 val as u64,
11388 )
11389 }
11390 }
11391 #[inline]
11392 pub fn mRouterId(&self) -> u8 {
11393 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 6u8) as u8) }
11394 }
11395 #[inline]
11396 pub fn set_mRouterId(&mut self, val: u8) {
11397 unsafe {
11398 let val: u8 = ::std::mem::transmute(val);
11399 self._bitfield_1.set(2usize, 6u8, val as u64)
11400 }
11401 }
11402 #[inline]
11403 pub unsafe fn mRouterId_raw(this: *const Self) -> u8 {
11404 unsafe {
11405 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11406 ::std::ptr::addr_of!((*this)._bitfield_1),
11407 2usize,
11408 6u8,
11409 ) as u8)
11410 }
11411 }
11412 #[inline]
11413 pub unsafe fn set_mRouterId_raw(this: *mut Self, val: u8) {
11414 unsafe {
11415 let val: u8 = ::std::mem::transmute(val);
11416 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11417 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11418 2usize,
11419 6u8,
11420 val as u64,
11421 )
11422 }
11423 }
11424 #[inline]
11425 pub fn new_bitfield_1(mEvent: u8, mRouterId: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11426 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11427 __bindgen_bitfield_unit.set(0usize, 2u8, {
11428 let mEvent: u8 = unsafe { ::std::mem::transmute(mEvent) };
11429 mEvent as u64
11430 });
11431 __bindgen_bitfield_unit.set(2usize, 6u8, {
11432 let mRouterId: u8 = unsafe { ::std::mem::transmute(mRouterId) };
11433 mRouterId as u64
11434 });
11435 __bindgen_bitfield_unit
11436 }
11437 #[inline]
11438 pub fn mOldPathCost(&self) -> u8 {
11439 unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 4u8) as u8) }
11440 }
11441 #[inline]
11442 pub fn set_mOldPathCost(&mut self, val: u8) {
11443 unsafe {
11444 let val: u8 = ::std::mem::transmute(val);
11445 self._bitfield_2.set(0usize, 4u8, val as u64)
11446 }
11447 }
11448 #[inline]
11449 pub unsafe fn mOldPathCost_raw(this: *const Self) -> u8 {
11450 unsafe {
11451 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11452 ::std::ptr::addr_of!((*this)._bitfield_2),
11453 0usize,
11454 4u8,
11455 ) as u8)
11456 }
11457 }
11458 #[inline]
11459 pub unsafe fn set_mOldPathCost_raw(this: *mut Self, val: u8) {
11460 unsafe {
11461 let val: u8 = ::std::mem::transmute(val);
11462 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11463 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11464 0usize,
11465 4u8,
11466 val as u64,
11467 )
11468 }
11469 }
11470 #[inline]
11471 pub fn mPathCost(&self) -> u8 {
11472 unsafe { ::std::mem::transmute(self._bitfield_2.get(4usize, 4u8) as u8) }
11473 }
11474 #[inline]
11475 pub fn set_mPathCost(&mut self, val: u8) {
11476 unsafe {
11477 let val: u8 = ::std::mem::transmute(val);
11478 self._bitfield_2.set(4usize, 4u8, val as u64)
11479 }
11480 }
11481 #[inline]
11482 pub unsafe fn mPathCost_raw(this: *const Self) -> u8 {
11483 unsafe {
11484 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11485 ::std::ptr::addr_of!((*this)._bitfield_2),
11486 4usize,
11487 4u8,
11488 ) as u8)
11489 }
11490 }
11491 #[inline]
11492 pub unsafe fn set_mPathCost_raw(this: *mut Self, val: u8) {
11493 unsafe {
11494 let val: u8 = ::std::mem::transmute(val);
11495 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11496 ::std::ptr::addr_of_mut!((*this)._bitfield_2),
11497 4usize,
11498 4u8,
11499 val as u64,
11500 )
11501 }
11502 }
11503 #[inline]
11504 pub fn new_bitfield_2(mOldPathCost: u8, mPathCost: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11505 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11506 __bindgen_bitfield_unit.set(0usize, 4u8, {
11507 let mOldPathCost: u8 = unsafe { ::std::mem::transmute(mOldPathCost) };
11508 mOldPathCost as u64
11509 });
11510 __bindgen_bitfield_unit.set(4usize, 4u8, {
11511 let mPathCost: u8 = unsafe { ::std::mem::transmute(mPathCost) };
11512 mPathCost as u64
11513 });
11514 __bindgen_bitfield_unit
11515 }
11516}
11517#[doc = "< Network data entry is added."]
11518pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED: otHistoryTrackerNetDataEvent = 0;
11519#[doc = "< Network data entry is removed."]
11520pub const OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED: otHistoryTrackerNetDataEvent = 1;
11521#[doc = " Defines the events for a Network Data entry (i.e., whether an entry is added or removed)."]
11522pub type otHistoryTrackerNetDataEvent = ::std::os::raw::c_uint;
11523#[doc = " Represent a Network Data on mesh prefix info."]
11524#[repr(C)]
11525#[derive(Copy, Clone)]
11526pub struct otHistoryTrackerOnMeshPrefixInfo {
11527 #[doc = "< The on mesh prefix entry."]
11528 pub mPrefix: otBorderRouterConfig,
11529 #[doc = "< Indicates the event (added/removed)."]
11530 pub mEvent: otHistoryTrackerNetDataEvent,
11531}
11532impl Default for otHistoryTrackerOnMeshPrefixInfo {
11533 fn default() -> Self {
11534 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11535 unsafe {
11536 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11537 s.assume_init()
11538 }
11539 }
11540}
11541#[doc = " Represent a Network Data extern route info."]
11542#[repr(C)]
11543#[derive(Copy, Clone)]
11544pub struct otHistoryTrackerExternalRouteInfo {
11545 #[doc = "< The external route entry."]
11546 pub mRoute: otExternalRouteConfig,
11547 #[doc = "< Indicates the event (added/removed)."]
11548 pub mEvent: otHistoryTrackerNetDataEvent,
11549}
11550impl Default for otHistoryTrackerExternalRouteInfo {
11551 fn default() -> Self {
11552 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11553 unsafe {
11554 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11555 s.assume_init()
11556 }
11557 }
11558}
11559#[doc = "< Unicast address type local (in server data)."]
11560pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_LOCAL: otHistoryTrackerDnsSrpAddrType = 0;
11561#[doc = "< Unicast address type infrastructure (in service data)."]
11562pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_UNICAST_INFRA: otHistoryTrackerDnsSrpAddrType = 1;
11563#[doc = "< Anycast address type."]
11564pub const OT_HISTORY_TRACKER_DNS_SRP_ADDR_TYPE_ANYCAST: otHistoryTrackerDnsSrpAddrType = 2;
11565#[doc = " Represents the DNS/SRP server address type parsed from Network Data service entries."]
11566pub type otHistoryTrackerDnsSrpAddrType = ::std::os::raw::c_uint;
11567#[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."]
11568#[repr(C)]
11569#[derive(Copy, Clone)]
11570pub struct otHistoryTrackerDnsSrpAddrInfo {
11571 #[doc = "< The server address."]
11572 pub mAddress: otIp6Address,
11573 #[doc = "< The RLOC16 of the Border Router adding/removing the entry."]
11574 pub mRloc16: u16,
11575 #[doc = "< Port number."]
11576 pub mPort: u16,
11577 #[doc = "< Anycast sequence number."]
11578 pub mSequenceNumber: u8,
11579 #[doc = "< Version number."]
11580 pub mVersion: u8,
11581 #[doc = "< Address type."]
11582 pub mType: otHistoryTrackerDnsSrpAddrType,
11583 #[doc = "< Indicates the event (added/removed)."]
11584 pub mEvent: otHistoryTrackerNetDataEvent,
11585}
11586impl Default for otHistoryTrackerDnsSrpAddrInfo {
11587 fn default() -> Self {
11588 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11589 unsafe {
11590 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11591 s.assume_init()
11592 }
11593 }
11594}
11595#[doc = "< ePSKc mode is activated."]
11596pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_ACTIVATED:
11597 otHistoryTrackerBorderAgentEpskcEvent = 0;
11598#[doc = "< Secure session is connected."]
11599pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_CONNECTED:
11600 otHistoryTrackerBorderAgentEpskcEvent = 1;
11601#[doc = "< Commissioner petition is received."]
11602pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_PETITIONED:
11603 otHistoryTrackerBorderAgentEpskcEvent = 2;
11604#[doc = "< Active dataset is retrieved."]
11605pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_ACTIVE_DATASET:
11606 otHistoryTrackerBorderAgentEpskcEvent = 3;
11607#[doc = "< Pending dataset is retrieved."]
11608pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_RETRIEVED_PENDING_DATASET:
11609 otHistoryTrackerBorderAgentEpskcEvent = 4;
11610#[doc = "< Keep alive message is received."]
11611pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_KEEP_ALIVE:
11612 otHistoryTrackerBorderAgentEpskcEvent = 5;
11613#[doc = "< Deactivated by a call to the API."]
11614pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_LOCAL_CLOSE:
11615 otHistoryTrackerBorderAgentEpskcEvent = 6;
11616#[doc = "< Disconnected by the peer."]
11617pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_REMOTE_CLOSE:
11618 otHistoryTrackerBorderAgentEpskcEvent = 7;
11619#[doc = "< Disconnected due to some error."]
11620pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_ERROR:
11621 otHistoryTrackerBorderAgentEpskcEvent = 8;
11622#[doc = "< Disconnected due to timeout."]
11623pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_SESSION_TIMEOUT:
11624 otHistoryTrackerBorderAgentEpskcEvent = 9;
11625#[doc = "< Max allowed attempts reached."]
11626pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_MAX_ATTEMPTS:
11627 otHistoryTrackerBorderAgentEpskcEvent = 10;
11628#[doc = "< ePSKc mode timed out."]
11629pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_EPSKC_TIMEOUT:
11630 otHistoryTrackerBorderAgentEpskcEvent = 11;
11631#[doc = "< Deactivated for an unknown reason."]
11632pub const OT_HISTORY_TRACKER_BORDER_AGENT_EPSKC_EVENT_DEACTIVATED_UNKNOWN:
11633 otHistoryTrackerBorderAgentEpskcEvent = 12;
11634#[doc = " Represents events during the Border Agent's ePSKc journey."]
11635pub type otHistoryTrackerBorderAgentEpskcEvent = ::std::os::raw::c_uint;
11636#[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."]
11637#[repr(C)]
11638#[repr(align(4))]
11639#[derive(Copy, Clone)]
11640pub struct otHistoryTrackerFavoredOmrPrefix {
11641 #[doc = "< The OMR prefix."]
11642 pub mOmrPrefix: otIp6Prefix,
11643 pub _bitfield_align_1: [u8; 0],
11644 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11645 pub __bindgen_padding_0: u16,
11646}
11647impl Default for otHistoryTrackerFavoredOmrPrefix {
11648 fn default() -> Self {
11649 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11650 unsafe {
11651 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11652 s.assume_init()
11653 }
11654 }
11655}
11656impl otHistoryTrackerFavoredOmrPrefix {
11657 #[inline]
11658 pub fn mPreference(&self) -> ::std::os::raw::c_int {
11659 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
11660 }
11661 #[inline]
11662 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
11663 unsafe {
11664 let val: u32 = ::std::mem::transmute(val);
11665 self._bitfield_1.set(0usize, 2u8, val as u64)
11666 }
11667 }
11668 #[inline]
11669 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
11670 unsafe {
11671 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11672 ::std::ptr::addr_of!((*this)._bitfield_1),
11673 0usize,
11674 2u8,
11675 ) as u32)
11676 }
11677 }
11678 #[inline]
11679 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
11680 unsafe {
11681 let val: u32 = ::std::mem::transmute(val);
11682 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11683 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11684 0usize,
11685 2u8,
11686 val as u64,
11687 )
11688 }
11689 }
11690 #[inline]
11691 pub fn mIsLocal(&self) -> bool {
11692 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11693 }
11694 #[inline]
11695 pub fn set_mIsLocal(&mut self, val: bool) {
11696 unsafe {
11697 let val: u8 = ::std::mem::transmute(val);
11698 self._bitfield_1.set(2usize, 1u8, val as u64)
11699 }
11700 }
11701 #[inline]
11702 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11703 unsafe {
11704 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11705 ::std::ptr::addr_of!((*this)._bitfield_1),
11706 2usize,
11707 1u8,
11708 ) as u8)
11709 }
11710 }
11711 #[inline]
11712 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11713 unsafe {
11714 let val: u8 = ::std::mem::transmute(val);
11715 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11716 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11717 2usize,
11718 1u8,
11719 val as u64,
11720 )
11721 }
11722 }
11723 #[inline]
11724 pub fn new_bitfield_1(
11725 mPreference: ::std::os::raw::c_int,
11726 mIsLocal: bool,
11727 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11728 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11729 __bindgen_bitfield_unit.set(0usize, 2u8, {
11730 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
11731 mPreference as u64
11732 });
11733 __bindgen_bitfield_unit.set(2usize, 1u8, {
11734 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11735 mIsLocal as u64
11736 });
11737 __bindgen_bitfield_unit
11738 }
11739}
11740#[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."]
11741#[repr(C)]
11742#[derive(Copy, Clone)]
11743pub struct otHistoryTrackerFavoredOnLinkPrefix {
11744 #[doc = "< The on-link prefix."]
11745 pub mOnLinkPrefix: otIp6Prefix,
11746 pub _bitfield_align_1: [u8; 0],
11747 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11748}
11749impl Default for otHistoryTrackerFavoredOnLinkPrefix {
11750 fn default() -> Self {
11751 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11752 unsafe {
11753 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11754 s.assume_init()
11755 }
11756 }
11757}
11758impl otHistoryTrackerFavoredOnLinkPrefix {
11759 #[inline]
11760 pub fn mIsLocal(&self) -> bool {
11761 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11762 }
11763 #[inline]
11764 pub fn set_mIsLocal(&mut self, val: bool) {
11765 unsafe {
11766 let val: u8 = ::std::mem::transmute(val);
11767 self._bitfield_1.set(0usize, 1u8, val as u64)
11768 }
11769 }
11770 #[inline]
11771 pub unsafe fn mIsLocal_raw(this: *const Self) -> bool {
11772 unsafe {
11773 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11774 ::std::ptr::addr_of!((*this)._bitfield_1),
11775 0usize,
11776 1u8,
11777 ) as u8)
11778 }
11779 }
11780 #[inline]
11781 pub unsafe fn set_mIsLocal_raw(this: *mut Self, val: bool) {
11782 unsafe {
11783 let val: u8 = ::std::mem::transmute(val);
11784 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11785 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11786 0usize,
11787 1u8,
11788 val as u64,
11789 )
11790 }
11791 }
11792 #[inline]
11793 pub fn new_bitfield_1(mIsLocal: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11794 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11795 __bindgen_bitfield_unit.set(0usize, 1u8, {
11796 let mIsLocal: u8 = unsafe { ::std::mem::transmute(mIsLocal) };
11797 mIsLocal as u64
11798 });
11799 __bindgen_bitfield_unit
11800 }
11801}
11802#[doc = " Represents the DHCPv6-PD state and delegated prefix (if any) by a device acting as Border Router (BR)."]
11803#[repr(C)]
11804#[derive(Copy, Clone)]
11805pub struct otHistoryTrackerDhcp6PdInfo {
11806 #[doc = "< The delegated prefix if any. If none, it is set to `::/0`."]
11807 pub mPrefix: otIp6Prefix,
11808 #[doc = "< The DHCPv6 state."]
11809 pub mState: otBorderRoutingDhcp6PdState,
11810}
11811impl Default for otHistoryTrackerDhcp6PdInfo {
11812 fn default() -> Self {
11813 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11814 unsafe {
11815 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11816 s.assume_init()
11817 }
11818 }
11819}
11820#[doc = "< A new AIL router is discovered."]
11821pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_ADDED: otHistoryTrackerAilRouterEvent = 0;
11822#[doc = "< A property in the router's information has changed."]
11823pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_CHANGED: otHistoryTrackerAilRouterEvent = 1;
11824#[doc = "< The AIL router is removed and no longer tracked."]
11825pub const OT_HISTORY_TRACKER_AIL_ROUTER_EVENT_REMOVED: otHistoryTrackerAilRouterEvent = 2;
11826#[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."]
11827pub type otHistoryTrackerAilRouterEvent = ::std::os::raw::c_uint;
11828#[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)."]
11829#[repr(C)]
11830#[derive(Copy, Clone)]
11831pub struct otHistoryTrackerAilRouter {
11832 #[doc = "< The event type (e.g., added, changed, removed)."]
11833 pub mEvent: otHistoryTrackerAilRouterEvent,
11834 #[doc = "< Def route preference."]
11835 pub mDefRoutePreference: i8,
11836 #[doc = "< The IPv6 address of the AIL router."]
11837 pub mAddress: otIp6Address,
11838 #[doc = "< The favored on-link prefix, if any."]
11839 pub mFavoredOnLinkPrefix: otIp6Prefix,
11840 pub _bitfield_align_1: [u8; 0],
11841 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11842 pub __bindgen_padding_0: u8,
11843}
11844impl Default for otHistoryTrackerAilRouter {
11845 fn default() -> Self {
11846 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11847 unsafe {
11848 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11849 s.assume_init()
11850 }
11851 }
11852}
11853impl otHistoryTrackerAilRouter {
11854 #[inline]
11855 pub fn mProvidesDefaultRoute(&self) -> bool {
11856 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11857 }
11858 #[inline]
11859 pub fn set_mProvidesDefaultRoute(&mut self, val: bool) {
11860 unsafe {
11861 let val: u8 = ::std::mem::transmute(val);
11862 self._bitfield_1.set(0usize, 1u8, val as u64)
11863 }
11864 }
11865 #[inline]
11866 pub unsafe fn mProvidesDefaultRoute_raw(this: *const Self) -> bool {
11867 unsafe {
11868 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11869 ::std::ptr::addr_of!((*this)._bitfield_1),
11870 0usize,
11871 1u8,
11872 ) as u8)
11873 }
11874 }
11875 #[inline]
11876 pub unsafe fn set_mProvidesDefaultRoute_raw(this: *mut Self, val: bool) {
11877 unsafe {
11878 let val: u8 = ::std::mem::transmute(val);
11879 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11880 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11881 0usize,
11882 1u8,
11883 val as u64,
11884 )
11885 }
11886 }
11887 #[inline]
11888 pub fn mManagedAddressConfigFlag(&self) -> bool {
11889 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
11890 }
11891 #[inline]
11892 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
11893 unsafe {
11894 let val: u8 = ::std::mem::transmute(val);
11895 self._bitfield_1.set(1usize, 1u8, val as u64)
11896 }
11897 }
11898 #[inline]
11899 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
11900 unsafe {
11901 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11902 ::std::ptr::addr_of!((*this)._bitfield_1),
11903 1usize,
11904 1u8,
11905 ) as u8)
11906 }
11907 }
11908 #[inline]
11909 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
11910 unsafe {
11911 let val: u8 = ::std::mem::transmute(val);
11912 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11913 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11914 1usize,
11915 1u8,
11916 val as u64,
11917 )
11918 }
11919 }
11920 #[inline]
11921 pub fn mOtherConfigFlag(&self) -> bool {
11922 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11923 }
11924 #[inline]
11925 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
11926 unsafe {
11927 let val: u8 = ::std::mem::transmute(val);
11928 self._bitfield_1.set(2usize, 1u8, val as u64)
11929 }
11930 }
11931 #[inline]
11932 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
11933 unsafe {
11934 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11935 ::std::ptr::addr_of!((*this)._bitfield_1),
11936 2usize,
11937 1u8,
11938 ) as u8)
11939 }
11940 }
11941 #[inline]
11942 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
11943 unsafe {
11944 let val: u8 = ::std::mem::transmute(val);
11945 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11946 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11947 2usize,
11948 1u8,
11949 val as u64,
11950 )
11951 }
11952 }
11953 #[inline]
11954 pub fn mSnacRouterFlag(&self) -> bool {
11955 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11956 }
11957 #[inline]
11958 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
11959 unsafe {
11960 let val: u8 = ::std::mem::transmute(val);
11961 self._bitfield_1.set(3usize, 1u8, val as u64)
11962 }
11963 }
11964 #[inline]
11965 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
11966 unsafe {
11967 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11968 ::std::ptr::addr_of!((*this)._bitfield_1),
11969 3usize,
11970 1u8,
11971 ) as u8)
11972 }
11973 }
11974 #[inline]
11975 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
11976 unsafe {
11977 let val: u8 = ::std::mem::transmute(val);
11978 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11979 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11980 3usize,
11981 1u8,
11982 val as u64,
11983 )
11984 }
11985 }
11986 #[inline]
11987 pub fn mIsLocalDevice(&self) -> bool {
11988 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11989 }
11990 #[inline]
11991 pub fn set_mIsLocalDevice(&mut self, val: bool) {
11992 unsafe {
11993 let val: u8 = ::std::mem::transmute(val);
11994 self._bitfield_1.set(4usize, 1u8, val as u64)
11995 }
11996 }
11997 #[inline]
11998 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
11999 unsafe {
12000 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12001 ::std::ptr::addr_of!((*this)._bitfield_1),
12002 4usize,
12003 1u8,
12004 ) as u8)
12005 }
12006 }
12007 #[inline]
12008 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
12009 unsafe {
12010 let val: u8 = ::std::mem::transmute(val);
12011 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12012 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12013 4usize,
12014 1u8,
12015 val as u64,
12016 )
12017 }
12018 }
12019 #[inline]
12020 pub fn mIsReachable(&self) -> bool {
12021 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
12022 }
12023 #[inline]
12024 pub fn set_mIsReachable(&mut self, val: bool) {
12025 unsafe {
12026 let val: u8 = ::std::mem::transmute(val);
12027 self._bitfield_1.set(5usize, 1u8, val as u64)
12028 }
12029 }
12030 #[inline]
12031 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
12032 unsafe {
12033 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12034 ::std::ptr::addr_of!((*this)._bitfield_1),
12035 5usize,
12036 1u8,
12037 ) as u8)
12038 }
12039 }
12040 #[inline]
12041 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
12042 unsafe {
12043 let val: u8 = ::std::mem::transmute(val);
12044 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12045 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12046 5usize,
12047 1u8,
12048 val as u64,
12049 )
12050 }
12051 }
12052 #[inline]
12053 pub fn mIsPeerBr(&self) -> bool {
12054 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
12055 }
12056 #[inline]
12057 pub fn set_mIsPeerBr(&mut self, val: bool) {
12058 unsafe {
12059 let val: u8 = ::std::mem::transmute(val);
12060 self._bitfield_1.set(6usize, 1u8, val as u64)
12061 }
12062 }
12063 #[inline]
12064 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
12065 unsafe {
12066 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12067 ::std::ptr::addr_of!((*this)._bitfield_1),
12068 6usize,
12069 1u8,
12070 ) as u8)
12071 }
12072 }
12073 #[inline]
12074 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
12075 unsafe {
12076 let val: u8 = ::std::mem::transmute(val);
12077 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12078 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12079 6usize,
12080 1u8,
12081 val as u64,
12082 )
12083 }
12084 }
12085 #[inline]
12086 pub fn new_bitfield_1(
12087 mProvidesDefaultRoute: bool,
12088 mManagedAddressConfigFlag: bool,
12089 mOtherConfigFlag: bool,
12090 mSnacRouterFlag: bool,
12091 mIsLocalDevice: bool,
12092 mIsReachable: bool,
12093 mIsPeerBr: bool,
12094 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12095 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12096 __bindgen_bitfield_unit.set(0usize, 1u8, {
12097 let mProvidesDefaultRoute: u8 = unsafe { ::std::mem::transmute(mProvidesDefaultRoute) };
12098 mProvidesDefaultRoute as u64
12099 });
12100 __bindgen_bitfield_unit.set(1usize, 1u8, {
12101 let mManagedAddressConfigFlag: u8 =
12102 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
12103 mManagedAddressConfigFlag as u64
12104 });
12105 __bindgen_bitfield_unit.set(2usize, 1u8, {
12106 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
12107 mOtherConfigFlag as u64
12108 });
12109 __bindgen_bitfield_unit.set(3usize, 1u8, {
12110 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
12111 mSnacRouterFlag as u64
12112 });
12113 __bindgen_bitfield_unit.set(4usize, 1u8, {
12114 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
12115 mIsLocalDevice as u64
12116 });
12117 __bindgen_bitfield_unit.set(5usize, 1u8, {
12118 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
12119 mIsReachable as u64
12120 });
12121 __bindgen_bitfield_unit.set(6usize, 1u8, {
12122 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
12123 mIsPeerBr as u64
12124 });
12125 __bindgen_bitfield_unit
12126 }
12127}
12128unsafe extern "C" {
12129 #[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)."]
12130 pub fn otHistoryTrackerInitIterator(aIterator: *mut otHistoryTrackerIterator);
12131}
12132unsafe extern "C" {
12133 #[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."]
12134 pub fn otHistoryTrackerIterateNetInfoHistory(
12135 aInstance: *mut otInstance,
12136 aIterator: *mut otHistoryTrackerIterator,
12137 aEntryAge: *mut u32,
12138 ) -> *const otHistoryTrackerNetworkInfo;
12139}
12140unsafe extern "C" {
12141 #[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."]
12142 pub fn otHistoryTrackerIterateUnicastAddressHistory(
12143 aInstance: *mut otInstance,
12144 aIterator: *mut otHistoryTrackerIterator,
12145 aEntryAge: *mut u32,
12146 ) -> *const otHistoryTrackerUnicastAddressInfo;
12147}
12148unsafe extern "C" {
12149 #[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."]
12150 pub fn otHistoryTrackerIterateMulticastAddressHistory(
12151 aInstance: *mut otInstance,
12152 aIterator: *mut otHistoryTrackerIterator,
12153 aEntryAge: *mut u32,
12154 ) -> *const otHistoryTrackerMulticastAddressInfo;
12155}
12156unsafe extern "C" {
12157 #[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."]
12158 pub fn otHistoryTrackerIterateRxHistory(
12159 aInstance: *mut otInstance,
12160 aIterator: *mut otHistoryTrackerIterator,
12161 aEntryAge: *mut u32,
12162 ) -> *const otHistoryTrackerMessageInfo;
12163}
12164unsafe extern "C" {
12165 #[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."]
12166 pub fn otHistoryTrackerIterateTxHistory(
12167 aInstance: *mut otInstance,
12168 aIterator: *mut otHistoryTrackerIterator,
12169 aEntryAge: *mut u32,
12170 ) -> *const otHistoryTrackerMessageInfo;
12171}
12172unsafe extern "C" {
12173 #[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."]
12174 pub fn otHistoryTrackerIterateNeighborHistory(
12175 aInstance: *mut otInstance,
12176 aIterator: *mut otHistoryTrackerIterator,
12177 aEntryAge: *mut u32,
12178 ) -> *const otHistoryTrackerNeighborInfo;
12179}
12180unsafe extern "C" {
12181 #[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."]
12182 pub fn otHistoryTrackerIterateRouterHistory(
12183 aInstance: *mut otInstance,
12184 aIterator: *mut otHistoryTrackerIterator,
12185 aEntryAge: *mut u32,
12186 ) -> *const otHistoryTrackerRouterInfo;
12187}
12188unsafe extern "C" {
12189 #[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."]
12190 pub fn otHistoryTrackerIterateOnMeshPrefixHistory(
12191 aInstance: *mut otInstance,
12192 aIterator: *mut otHistoryTrackerIterator,
12193 aEntryAge: *mut u32,
12194 ) -> *const otHistoryTrackerOnMeshPrefixInfo;
12195}
12196unsafe extern "C" {
12197 #[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."]
12198 pub fn otHistoryTrackerIterateExternalRouteHistory(
12199 aInstance: *mut otInstance,
12200 aIterator: *mut otHistoryTrackerIterator,
12201 aEntryAge: *mut u32,
12202 ) -> *const otHistoryTrackerExternalRouteInfo;
12203}
12204unsafe extern "C" {
12205 #[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."]
12206 pub fn otHistoryTrackerIterateDnsSrpAddrHistory(
12207 aInstance: *mut otInstance,
12208 aIterator: *mut otHistoryTrackerIterator,
12209 aEntryAge: *mut u32,
12210 ) -> *const otHistoryTrackerDnsSrpAddrInfo;
12211}
12212unsafe extern "C" {
12213 #[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."]
12214 pub fn otHistoryTrackerIterateBorderAgentEpskcEventHistory(
12215 aInstance: *mut otInstance,
12216 aIterator: *mut otHistoryTrackerIterator,
12217 aEntryAge: *mut u32,
12218 ) -> *const otHistoryTrackerBorderAgentEpskcEvent;
12219}
12220unsafe extern "C" {
12221 #[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."]
12222 pub fn otHistoryTrackerIterateFavoredOmrPrefixHistory(
12223 aInstance: *mut otInstance,
12224 aIterator: *mut otHistoryTrackerIterator,
12225 aEntryAge: *mut u32,
12226 ) -> *const otHistoryTrackerFavoredOmrPrefix;
12227}
12228unsafe extern "C" {
12229 #[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."]
12230 pub fn otHistoryTrackerIterateFavoredOnLinkPrefixHistory(
12231 aInstance: *mut otInstance,
12232 aIterator: *mut otHistoryTrackerIterator,
12233 aEntryAge: *mut u32,
12234 ) -> *const otHistoryTrackerFavoredOnLinkPrefix;
12235}
12236unsafe extern "C" {
12237 #[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."]
12238 pub fn otHistoryTrackerIterateDhcp6PdHistory(
12239 aInstance: *mut otInstance,
12240 aIterator: *mut otHistoryTrackerIterator,
12241 aEntryAge: *mut u32,
12242 ) -> *const otHistoryTrackerDhcp6PdInfo;
12243}
12244unsafe extern "C" {
12245 #[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."]
12246 pub fn otHistoryTrackerIterateAilRoutersHistory(
12247 aInstance: *mut otInstance,
12248 aIterator: *mut otHistoryTrackerIterator,
12249 aEntryAge: *mut u32,
12250 ) -> *const otHistoryTrackerAilRouter;
12251}
12252unsafe extern "C" {
12253 #[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`."]
12254 pub fn otHistoryTrackerEntryAgeToString(
12255 aEntryAge: u32,
12256 aBuffer: *mut ::std::os::raw::c_char,
12257 aSize: u16,
12258 );
12259}
12260#[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."]
12261pub type otHistoryTrackerNetInfoCallback = ::std::option::Option<
12262 unsafe extern "C" fn(
12263 aError: otError,
12264 aNetworkInfo: *const otHistoryTrackerNetworkInfo,
12265 aEntryAge: u32,
12266 aContext: *mut ::std::os::raw::c_void,
12267 ),
12268>;
12269unsafe extern "C" {
12270 #[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."]
12271 pub fn otHistoryTrackerQueryNetInfo(
12272 aInstance: *mut otInstance,
12273 aRloc16: u16,
12274 aMaxEntries: u16,
12275 aMaxEntryAge: u32,
12276 aCallback: otHistoryTrackerNetInfoCallback,
12277 aContext: *mut ::std::os::raw::c_void,
12278 ) -> otError;
12279}
12280unsafe extern "C" {
12281 #[doc = " Cancels any ongoing query.\n\n Requires `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE`.\n\n @param[in] aInstance The OpenThread instance."]
12282 pub fn otHistoryTrackerCancelQuery(aInstance: *mut otInstance);
12283}
12284#[doc = "< Destination Unreachable"]
12285pub const OT_ICMP6_TYPE_DST_UNREACH: otIcmp6Type = 1;
12286#[doc = "< Packet To Big"]
12287pub const OT_ICMP6_TYPE_PACKET_TO_BIG: otIcmp6Type = 2;
12288#[doc = "< Time Exceeded"]
12289pub const OT_ICMP6_TYPE_TIME_EXCEEDED: otIcmp6Type = 3;
12290#[doc = "< Parameter Problem"]
12291pub const OT_ICMP6_TYPE_PARAMETER_PROBLEM: otIcmp6Type = 4;
12292#[doc = "< Echo Request"]
12293pub const OT_ICMP6_TYPE_ECHO_REQUEST: otIcmp6Type = 128;
12294#[doc = "< Echo Reply"]
12295pub const OT_ICMP6_TYPE_ECHO_REPLY: otIcmp6Type = 129;
12296#[doc = "< Router Solicitation"]
12297pub const OT_ICMP6_TYPE_ROUTER_SOLICIT: otIcmp6Type = 133;
12298#[doc = "< Router Advertisement"]
12299pub const OT_ICMP6_TYPE_ROUTER_ADVERT: otIcmp6Type = 134;
12300#[doc = "< Neighbor Solicitation"]
12301pub const OT_ICMP6_TYPE_NEIGHBOR_SOLICIT: otIcmp6Type = 135;
12302#[doc = "< Neighbor Advertisement"]
12303pub const OT_ICMP6_TYPE_NEIGHBOR_ADVERT: otIcmp6Type = 136;
12304#[doc = " ICMPv6 Message Types"]
12305pub type otIcmp6Type = ::std::os::raw::c_uint;
12306#[doc = "< Destination Unreachable (Type 1) - No Route"]
12307pub const OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE: otIcmp6Code = 0;
12308#[doc = "< Destination Unreachable (Type 1) - Administratively Prohibited"]
12309pub const OT_ICMP6_CODE_DST_UNREACH_PROHIBITED: otIcmp6Code = 1;
12310#[doc = "< Time Exceeded (Type 3) - Fragment Reassembly"]
12311pub const OT_ICMP6_CODE_FRAGM_REAS_TIME_EX: otIcmp6Code = 1;
12312#[doc = " ICMPv6 Message Codes"]
12313pub type otIcmp6Code = ::std::os::raw::c_uint;
12314#[doc = " @struct otIcmp6Header\n\n Represents an ICMPv6 header."]
12315#[repr(C, packed)]
12316#[derive(Copy, Clone)]
12317pub struct otIcmp6Header {
12318 #[doc = "< Type"]
12319 pub mType: u8,
12320 #[doc = "< Code"]
12321 pub mCode: u8,
12322 #[doc = "< Checksum"]
12323 pub mChecksum: u16,
12324 #[doc = "< Message-specific data"]
12325 pub mData: otIcmp6Header__bindgen_ty_1,
12326}
12327#[repr(C, packed)]
12328#[derive(Copy, Clone)]
12329pub union otIcmp6Header__bindgen_ty_1 {
12330 pub m8: [u8; 4usize],
12331 pub m16: [u16; 2usize],
12332 pub m32: [u32; 1usize],
12333}
12334impl Default for otIcmp6Header__bindgen_ty_1 {
12335 fn default() -> Self {
12336 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12337 unsafe {
12338 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12339 s.assume_init()
12340 }
12341 }
12342}
12343impl Default for otIcmp6Header {
12344 fn default() -> Self {
12345 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12346 unsafe {
12347 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12348 s.assume_init()
12349 }
12350 }
12351}
12352#[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."]
12353pub type otIcmp6ReceiveCallback = ::std::option::Option<
12354 unsafe extern "C" fn(
12355 aContext: *mut ::std::os::raw::c_void,
12356 aMessage: *mut otMessage,
12357 aMessageInfo: *const otMessageInfo,
12358 aIcmpHeader: *const otIcmp6Header,
12359 ),
12360>;
12361#[doc = " Implements ICMPv6 message handler."]
12362#[repr(C)]
12363#[derive(Debug, Copy, Clone)]
12364pub struct otIcmp6Handler {
12365 #[doc = "< The ICMPv6 received callback"]
12366 pub mReceiveCallback: otIcmp6ReceiveCallback,
12367 #[doc = "< A pointer to arbitrary context information."]
12368 pub mContext: *mut ::std::os::raw::c_void,
12369 #[doc = "< A pointer to the next handler in the list."]
12370 pub mNext: *mut otIcmp6Handler,
12371}
12372impl Default for otIcmp6Handler {
12373 fn default() -> Self {
12374 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12375 unsafe {
12376 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12377 s.assume_init()
12378 }
12379 }
12380}
12381#[doc = "< ICMPv6 Echo processing disabled"]
12382pub const OT_ICMP6_ECHO_HANDLER_DISABLED: otIcmp6EchoMode = 0;
12383#[doc = "< ICMPv6 Echo processing enabled only for unicast requests only"]
12384pub const OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: otIcmp6EchoMode = 1;
12385#[doc = "< ICMPv6 Echo processing enabled only for multicast requests only"]
12386pub const OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: otIcmp6EchoMode = 2;
12387#[doc = "< ICMPv6 Echo processing enabled for unicast and multicast requests"]
12388pub const OT_ICMP6_ECHO_HANDLER_ALL: otIcmp6EchoMode = 3;
12389#[doc = "< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only"]
12390pub const OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: otIcmp6EchoMode = 4;
12391#[doc = " ICMPv6 Echo Reply Modes"]
12392pub type otIcmp6EchoMode = ::std::os::raw::c_uint;
12393unsafe extern "C" {
12394 #[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"]
12395 pub fn otIcmp6GetEchoMode(aInstance: *mut otInstance) -> otIcmp6EchoMode;
12396}
12397unsafe extern "C" {
12398 #[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."]
12399 pub fn otIcmp6SetEchoMode(aInstance: *mut otInstance, aMode: otIcmp6EchoMode);
12400}
12401unsafe extern "C" {
12402 #[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."]
12403 pub fn otIcmp6RegisterHandler(
12404 aInstance: *mut otInstance,
12405 aHandler: *mut otIcmp6Handler,
12406 ) -> otError;
12407}
12408unsafe extern "C" {
12409 #[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."]
12410 pub fn otIcmp6SendEchoRequest(
12411 aInstance: *mut otInstance,
12412 aMessage: *mut otMessage,
12413 aMessageInfo: *const otMessageInfo,
12414 aIdentifier: u16,
12415 ) -> otError;
12416}
12417#[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."]
12418pub type otJamDetectionCallback = ::std::option::Option<
12419 unsafe extern "C" fn(aJamState: bool, aContext: *mut ::std::os::raw::c_void),
12420>;
12421unsafe extern "C" {
12422 #[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."]
12423 pub fn otJamDetectionSetRssiThreshold(
12424 aInstance: *mut otInstance,
12425 aRssiThreshold: i8,
12426 ) -> otError;
12427}
12428unsafe extern "C" {
12429 #[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."]
12430 pub fn otJamDetectionGetRssiThreshold(aInstance: *mut otInstance) -> i8;
12431}
12432unsafe extern "C" {
12433 #[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)"]
12434 pub fn otJamDetectionSetWindow(aInstance: *mut otInstance, aWindow: u8) -> otError;
12435}
12436unsafe extern "C" {
12437 #[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."]
12438 pub fn otJamDetectionGetWindow(aInstance: *mut otInstance) -> u8;
12439}
12440unsafe extern "C" {
12441 #[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."]
12442 pub fn otJamDetectionSetBusyPeriod(aInstance: *mut otInstance, aBusyPeriod: u8) -> otError;
12443}
12444unsafe extern "C" {
12445 #[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."]
12446 pub fn otJamDetectionGetBusyPeriod(aInstance: *mut otInstance) -> u8;
12447}
12448unsafe extern "C" {
12449 #[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."]
12450 pub fn otJamDetectionStart(
12451 aInstance: *mut otInstance,
12452 aCallback: otJamDetectionCallback,
12453 aContext: *mut ::std::os::raw::c_void,
12454 ) -> otError;
12455}
12456unsafe extern "C" {
12457 #[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."]
12458 pub fn otJamDetectionStop(aInstance: *mut otInstance) -> otError;
12459}
12460unsafe extern "C" {
12461 #[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)."]
12462 pub fn otJamDetectionIsEnabled(aInstance: *mut otInstance) -> bool;
12463}
12464unsafe extern "C" {
12465 #[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)."]
12466 pub fn otJamDetectionGetState(aInstance: *mut otInstance) -> bool;
12467}
12468unsafe extern "C" {
12469 #[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."]
12470 pub fn otJamDetectionGetHistoryBitmap(aInstance: *mut otInstance) -> u64;
12471}
12472#[doc = " Represents the result (value) for a Link Metrics query."]
12473#[repr(C)]
12474#[derive(Debug, Default, Copy, Clone)]
12475pub struct otLinkMetricsValues {
12476 #[doc = "< Specifies which metrics values are present/included."]
12477 pub mMetrics: otLinkMetrics,
12478 #[doc = "< The value of Pdu Count."]
12479 pub mPduCountValue: u32,
12480 #[doc = "< The value LQI."]
12481 pub mLqiValue: u8,
12482 #[doc = "< The value of Link Margin."]
12483 pub mLinkMarginValue: u8,
12484 #[doc = "< The value of Rssi."]
12485 pub mRssiValue: i8,
12486}
12487#[doc = " Represents which frames are accounted in a Forward Tracking Series."]
12488#[repr(C)]
12489#[derive(Debug, Default, Copy, Clone)]
12490pub struct otLinkMetricsSeriesFlags {
12491 pub _bitfield_align_1: [u8; 0],
12492 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
12493}
12494impl otLinkMetricsSeriesFlags {
12495 #[inline]
12496 pub fn mLinkProbe(&self) -> bool {
12497 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
12498 }
12499 #[inline]
12500 pub fn set_mLinkProbe(&mut self, val: bool) {
12501 unsafe {
12502 let val: u8 = ::std::mem::transmute(val);
12503 self._bitfield_1.set(0usize, 1u8, val as u64)
12504 }
12505 }
12506 #[inline]
12507 pub unsafe fn mLinkProbe_raw(this: *const Self) -> bool {
12508 unsafe {
12509 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12510 ::std::ptr::addr_of!((*this)._bitfield_1),
12511 0usize,
12512 1u8,
12513 ) as u8)
12514 }
12515 }
12516 #[inline]
12517 pub unsafe fn set_mLinkProbe_raw(this: *mut Self, val: bool) {
12518 unsafe {
12519 let val: u8 = ::std::mem::transmute(val);
12520 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12521 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12522 0usize,
12523 1u8,
12524 val as u64,
12525 )
12526 }
12527 }
12528 #[inline]
12529 pub fn mMacData(&self) -> bool {
12530 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
12531 }
12532 #[inline]
12533 pub fn set_mMacData(&mut self, val: bool) {
12534 unsafe {
12535 let val: u8 = ::std::mem::transmute(val);
12536 self._bitfield_1.set(1usize, 1u8, val as u64)
12537 }
12538 }
12539 #[inline]
12540 pub unsafe fn mMacData_raw(this: *const Self) -> bool {
12541 unsafe {
12542 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12543 ::std::ptr::addr_of!((*this)._bitfield_1),
12544 1usize,
12545 1u8,
12546 ) as u8)
12547 }
12548 }
12549 #[inline]
12550 pub unsafe fn set_mMacData_raw(this: *mut Self, val: bool) {
12551 unsafe {
12552 let val: u8 = ::std::mem::transmute(val);
12553 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12554 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12555 1usize,
12556 1u8,
12557 val as u64,
12558 )
12559 }
12560 }
12561 #[inline]
12562 pub fn mMacDataRequest(&self) -> bool {
12563 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
12564 }
12565 #[inline]
12566 pub fn set_mMacDataRequest(&mut self, val: bool) {
12567 unsafe {
12568 let val: u8 = ::std::mem::transmute(val);
12569 self._bitfield_1.set(2usize, 1u8, val as u64)
12570 }
12571 }
12572 #[inline]
12573 pub unsafe fn mMacDataRequest_raw(this: *const Self) -> bool {
12574 unsafe {
12575 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12576 ::std::ptr::addr_of!((*this)._bitfield_1),
12577 2usize,
12578 1u8,
12579 ) as u8)
12580 }
12581 }
12582 #[inline]
12583 pub unsafe fn set_mMacDataRequest_raw(this: *mut Self, val: bool) {
12584 unsafe {
12585 let val: u8 = ::std::mem::transmute(val);
12586 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12587 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12588 2usize,
12589 1u8,
12590 val as u64,
12591 )
12592 }
12593 }
12594 #[inline]
12595 pub fn mMacAck(&self) -> bool {
12596 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
12597 }
12598 #[inline]
12599 pub fn set_mMacAck(&mut self, val: bool) {
12600 unsafe {
12601 let val: u8 = ::std::mem::transmute(val);
12602 self._bitfield_1.set(3usize, 1u8, val as u64)
12603 }
12604 }
12605 #[inline]
12606 pub unsafe fn mMacAck_raw(this: *const Self) -> bool {
12607 unsafe {
12608 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12609 ::std::ptr::addr_of!((*this)._bitfield_1),
12610 3usize,
12611 1u8,
12612 ) as u8)
12613 }
12614 }
12615 #[inline]
12616 pub unsafe fn set_mMacAck_raw(this: *mut Self, val: bool) {
12617 unsafe {
12618 let val: u8 = ::std::mem::transmute(val);
12619 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12620 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12621 3usize,
12622 1u8,
12623 val as u64,
12624 )
12625 }
12626 }
12627 #[inline]
12628 pub fn new_bitfield_1(
12629 mLinkProbe: bool,
12630 mMacData: bool,
12631 mMacDataRequest: bool,
12632 mMacAck: bool,
12633 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12634 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12635 __bindgen_bitfield_unit.set(0usize, 1u8, {
12636 let mLinkProbe: u8 = unsafe { ::std::mem::transmute(mLinkProbe) };
12637 mLinkProbe as u64
12638 });
12639 __bindgen_bitfield_unit.set(1usize, 1u8, {
12640 let mMacData: u8 = unsafe { ::std::mem::transmute(mMacData) };
12641 mMacData as u64
12642 });
12643 __bindgen_bitfield_unit.set(2usize, 1u8, {
12644 let mMacDataRequest: u8 = unsafe { ::std::mem::transmute(mMacDataRequest) };
12645 mMacDataRequest as u64
12646 });
12647 __bindgen_bitfield_unit.set(3usize, 1u8, {
12648 let mMacAck: u8 = unsafe { ::std::mem::transmute(mMacAck) };
12649 mMacAck as u64
12650 });
12651 __bindgen_bitfield_unit
12652 }
12653}
12654#[doc = "< Clear."]
12655pub const OT_LINK_METRICS_ENH_ACK_CLEAR: otLinkMetricsEnhAckFlags = 0;
12656#[doc = "< Register."]
12657pub const OT_LINK_METRICS_ENH_ACK_REGISTER: otLinkMetricsEnhAckFlags = 1;
12658#[doc = " Enhanced-ACK Flags.\n\n These are used in Enhanced-ACK Based Probing to indicate whether to register or clear the probing."]
12659pub type otLinkMetricsEnhAckFlags = ::std::os::raw::c_uint;
12660pub const OT_LINK_METRICS_STATUS_SUCCESS: otLinkMetricsStatus = 0;
12661pub const OT_LINK_METRICS_STATUS_CANNOT_SUPPORT_NEW_SERIES: otLinkMetricsStatus = 1;
12662pub const OT_LINK_METRICS_STATUS_SERIESID_ALREADY_REGISTERED: otLinkMetricsStatus = 2;
12663pub const OT_LINK_METRICS_STATUS_SERIESID_NOT_RECOGNIZED: otLinkMetricsStatus = 3;
12664pub const OT_LINK_METRICS_STATUS_NO_MATCHING_FRAMES_RECEIVED: otLinkMetricsStatus = 4;
12665pub const OT_LINK_METRICS_STATUS_OTHER_ERROR: otLinkMetricsStatus = 254;
12666#[doc = " Link Metrics Status values."]
12667pub type otLinkMetricsStatus = ::std::os::raw::c_uint;
12668#[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."]
12669pub type otLinkMetricsReportCallback = ::std::option::Option<
12670 unsafe extern "C" fn(
12671 aSource: *const otIp6Address,
12672 aMetricsValues: *const otLinkMetricsValues,
12673 aStatus: otLinkMetricsStatus,
12674 aContext: *mut ::std::os::raw::c_void,
12675 ),
12676>;
12677#[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."]
12678pub type otLinkMetricsMgmtResponseCallback = ::std::option::Option<
12679 unsafe extern "C" fn(
12680 aSource: *const otIp6Address,
12681 aStatus: otLinkMetricsStatus,
12682 aContext: *mut ::std::os::raw::c_void,
12683 ),
12684>;
12685#[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."]
12686pub type otLinkMetricsEnhAckProbingIeReportCallback = ::std::option::Option<
12687 unsafe extern "C" fn(
12688 aShortAddress: otShortAddress,
12689 aExtAddress: *const otExtAddress,
12690 aMetricsValues: *const otLinkMetricsValues,
12691 aContext: *mut ::std::os::raw::c_void,
12692 ),
12693>;
12694unsafe extern "C" {
12695 #[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."]
12696 pub fn otLinkMetricsQuery(
12697 aInstance: *mut otInstance,
12698 aDestination: *const otIp6Address,
12699 aSeriesId: u8,
12700 aLinkMetricsFlags: *const otLinkMetrics,
12701 aCallback: otLinkMetricsReportCallback,
12702 aCallbackContext: *mut ::std::os::raw::c_void,
12703 ) -> otError;
12704}
12705unsafe extern "C" {
12706 #[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."]
12707 pub fn otLinkMetricsConfigForwardTrackingSeries(
12708 aInstance: *mut otInstance,
12709 aDestination: *const otIp6Address,
12710 aSeriesId: u8,
12711 aSeriesFlags: otLinkMetricsSeriesFlags,
12712 aLinkMetricsFlags: *const otLinkMetrics,
12713 aCallback: otLinkMetricsMgmtResponseCallback,
12714 aCallbackContext: *mut ::std::os::raw::c_void,
12715 ) -> otError;
12716}
12717unsafe extern "C" {
12718 #[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."]
12719 pub fn otLinkMetricsConfigEnhAckProbing(
12720 aInstance: *mut otInstance,
12721 aDestination: *const otIp6Address,
12722 aEnhAckFlags: otLinkMetricsEnhAckFlags,
12723 aLinkMetricsFlags: *const otLinkMetrics,
12724 aCallback: otLinkMetricsMgmtResponseCallback,
12725 aCallbackContext: *mut ::std::os::raw::c_void,
12726 aEnhAckCallback: otLinkMetricsEnhAckProbingIeReportCallback,
12727 aEnhAckCallbackContext: *mut ::std::os::raw::c_void,
12728 ) -> otError;
12729}
12730unsafe extern "C" {
12731 #[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."]
12732 pub fn otLinkMetricsSendLinkProbe(
12733 aInstance: *mut otInstance,
12734 aDestination: *const otIp6Address,
12735 aSeriesId: u8,
12736 aLength: u8,
12737 ) -> otError;
12738}
12739unsafe extern "C" {
12740 #[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."]
12741 pub fn otLinkMetricsManagerIsEnabled(aInstance: *mut otInstance) -> bool;
12742}
12743unsafe extern "C" {
12744 #[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."]
12745 pub fn otLinkMetricsManagerSetEnabled(aInstance: *mut otInstance, aEnable: bool);
12746}
12747unsafe extern "C" {
12748 #[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."]
12749 pub fn otLinkMetricsManagerGetMetricsValueByExtAddr(
12750 aInstance: *mut otInstance,
12751 aExtAddress: *const otExtAddress,
12752 aLinkMetricsValues: *mut otLinkMetricsValues,
12753 ) -> otError;
12754}
12755#[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."]
12756pub type otLinkRawReceiveDone = ::std::option::Option<
12757 unsafe extern "C" fn(aInstance: *mut otInstance, aFrame: *mut otRadioFrame, aError: otError),
12758>;
12759unsafe extern "C" {
12760 #[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."]
12761 pub fn otLinkRawSetReceiveDone(
12762 aInstance: *mut otInstance,
12763 aCallback: otLinkRawReceiveDone,
12764 ) -> otError;
12765}
12766unsafe extern "C" {
12767 #[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."]
12768 pub fn otLinkRawIsEnabled(aInstance: *mut otInstance) -> bool;
12769}
12770unsafe extern "C" {
12771 #[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."]
12772 pub fn otLinkRawGetPromiscuous(aInstance: *mut otInstance) -> bool;
12773}
12774unsafe extern "C" {
12775 #[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."]
12776 pub fn otLinkRawSetPromiscuous(aInstance: *mut otInstance, aEnable: bool) -> otError;
12777}
12778unsafe extern "C" {
12779 #[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."]
12780 pub fn otLinkRawSetShortAddress(aInstance: *mut otInstance, aShortAddress: u16) -> otError;
12781}
12782unsafe extern "C" {
12783 #[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."]
12784 pub fn otLinkRawSetAlternateShortAddress(
12785 aInstance: *mut otInstance,
12786 aShortAddress: otShortAddress,
12787 ) -> otError;
12788}
12789unsafe extern "C" {
12790 #[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"]
12791 pub fn otLinkRawSleep(aInstance: *mut otInstance) -> otError;
12792}
12793unsafe extern "C" {
12794 #[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."]
12795 pub fn otLinkRawReceive(aInstance: *mut otInstance) -> otError;
12796}
12797unsafe extern "C" {
12798 #[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."]
12799 pub fn otLinkRawGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
12800}
12801#[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."]
12802pub type otLinkRawTransmitDone = ::std::option::Option<
12803 unsafe extern "C" fn(
12804 aInstance: *mut otInstance,
12805 aFrame: *mut otRadioFrame,
12806 aAckFrame: *mut otRadioFrame,
12807 aError: otError,
12808 ),
12809>;
12810unsafe extern "C" {
12811 #[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."]
12812 pub fn otLinkRawTransmit(
12813 aInstance: *mut otInstance,
12814 aCallback: otLinkRawTransmitDone,
12815 ) -> otError;
12816}
12817unsafe extern "C" {
12818 #[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."]
12819 pub fn otLinkRawGetRssi(aInstance: *mut otInstance) -> i8;
12820}
12821unsafe extern "C" {
12822 #[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."]
12823 pub fn otLinkRawGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
12824}
12825#[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."]
12826pub type otLinkRawEnergyScanDone =
12827 ::std::option::Option<unsafe extern "C" fn(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8)>;
12828unsafe extern "C" {
12829 #[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."]
12830 pub fn otLinkRawEnergyScan(
12831 aInstance: *mut otInstance,
12832 aScanChannel: u8,
12833 aScanDuration: u16,
12834 aCallback: otLinkRawEnergyScanDone,
12835 ) -> otError;
12836}
12837unsafe extern "C" {
12838 #[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."]
12839 pub fn otLinkRawSrcMatchEnable(aInstance: *mut otInstance, aEnable: bool) -> otError;
12840}
12841unsafe extern "C" {
12842 #[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."]
12843 pub fn otLinkRawSrcMatchAddShortEntry(
12844 aInstance: *mut otInstance,
12845 aShortAddress: u16,
12846 ) -> otError;
12847}
12848unsafe extern "C" {
12849 #[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."]
12850 pub fn otLinkRawSrcMatchAddExtEntry(
12851 aInstance: *mut otInstance,
12852 aExtAddress: *const otExtAddress,
12853 ) -> otError;
12854}
12855unsafe extern "C" {
12856 #[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."]
12857 pub fn otLinkRawSrcMatchClearShortEntry(
12858 aInstance: *mut otInstance,
12859 aShortAddress: u16,
12860 ) -> otError;
12861}
12862unsafe extern "C" {
12863 #[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."]
12864 pub fn otLinkRawSrcMatchClearExtEntry(
12865 aInstance: *mut otInstance,
12866 aExtAddress: *const otExtAddress,
12867 ) -> otError;
12868}
12869unsafe extern "C" {
12870 #[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."]
12871 pub fn otLinkRawSrcMatchClearShortEntries(aInstance: *mut otInstance) -> otError;
12872}
12873unsafe extern "C" {
12874 #[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."]
12875 pub fn otLinkRawSrcMatchClearExtEntries(aInstance: *mut otInstance) -> otError;
12876}
12877unsafe extern "C" {
12878 #[doc = " Update MAC keys and key index.\n\n The input @p aKeyIdMode parameter is ignored and is always treated as Key ID Mode 1. This API mirrors the\n `otPlatRadioSetMacKey()` platform API. See `otPlatRadioSetMacKey()` for more information on Key ID Mode.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyIdMode The key ID mode (ignored).\n @param[in] aKeyIndex 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."]
12879 pub fn otLinkRawSetMacKey(
12880 aInstance: *mut otInstance,
12881 aKeyIdMode: u8,
12882 aKeyIndex: u8,
12883 aPrevKey: *const otMacKey,
12884 aCurrKey: *const otMacKey,
12885 aNextKey: *const otMacKey,
12886 ) -> otError;
12887}
12888unsafe extern "C" {
12889 #[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."]
12890 pub fn otLinkRawSetMacFrameCounter(
12891 aInstance: *mut otInstance,
12892 aMacFrameCounter: u32,
12893 ) -> otError;
12894}
12895unsafe extern "C" {
12896 #[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."]
12897 pub fn otLinkRawSetMacFrameCounterIfLarger(
12898 aInstance: *mut otInstance,
12899 aMacFrameCounter: u32,
12900 ) -> otError;
12901}
12902unsafe extern "C" {
12903 #[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."]
12904 pub fn otLinkRawGetRadioTime(aInstance: *mut otInstance) -> u64;
12905}
12906unsafe extern "C" {
12907 #[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."]
12908 pub fn otGetLogLevel(aInstance: *mut otInstance) -> otLogLevel;
12909}
12910unsafe extern "C" {
12911 #[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."]
12912 pub fn otSetLogLevel(aInstance: *mut otInstance, aLogLevel: otLogLevel) -> otError;
12913}
12914unsafe extern "C" {
12915 #[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."]
12916 pub fn otLoggingGetLevel() -> otLogLevel;
12917}
12918unsafe extern "C" {
12919 #[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."]
12920 pub fn otLoggingSetLevel(aLogLevel: otLogLevel) -> otError;
12921}
12922unsafe extern "C" {
12923 #[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."]
12924 pub fn otLogCritPlat(aFormat: *const ::std::os::raw::c_char, ...);
12925}
12926unsafe extern "C" {
12927 #[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."]
12928 pub fn otLogWarnPlat(aFormat: *const ::std::os::raw::c_char, ...);
12929}
12930unsafe extern "C" {
12931 #[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."]
12932 pub fn otLogNotePlat(aFormat: *const ::std::os::raw::c_char, ...);
12933}
12934unsafe extern "C" {
12935 #[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."]
12936 pub fn otLogInfoPlat(aFormat: *const ::std::os::raw::c_char, ...);
12937}
12938unsafe extern "C" {
12939 #[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."]
12940 pub fn otLogDebgPlat(aFormat: *const ::std::os::raw::c_char, ...);
12941}
12942unsafe extern "C" {
12943 #[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."]
12944 pub fn otDumpCritPlat(
12945 aText: *const ::std::os::raw::c_char,
12946 aData: *const ::std::os::raw::c_void,
12947 aDataLength: u16,
12948 );
12949}
12950unsafe extern "C" {
12951 #[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."]
12952 pub fn otDumpWarnPlat(
12953 aText: *const ::std::os::raw::c_char,
12954 aData: *const ::std::os::raw::c_void,
12955 aDataLength: u16,
12956 );
12957}
12958unsafe extern "C" {
12959 #[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."]
12960 pub fn otDumpNotePlat(
12961 aText: *const ::std::os::raw::c_char,
12962 aData: *const ::std::os::raw::c_void,
12963 aDataLength: u16,
12964 );
12965}
12966unsafe extern "C" {
12967 #[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."]
12968 pub fn otDumpInfoPlat(
12969 aText: *const ::std::os::raw::c_char,
12970 aData: *const ::std::os::raw::c_void,
12971 aDataLength: u16,
12972 );
12973}
12974unsafe extern "C" {
12975 #[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."]
12976 pub fn otDumpDebgPlat(
12977 aText: *const ::std::os::raw::c_char,
12978 aData: *const ::std::os::raw::c_void,
12979 aDataLength: u16,
12980 );
12981}
12982unsafe extern "C" {
12983 #[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."]
12984 pub fn otLogPlat(
12985 aLogLevel: otLogLevel,
12986 aPlatModuleName: *const ::std::os::raw::c_char,
12987 aFormat: *const ::std::os::raw::c_char,
12988 ...
12989 );
12990}
12991unsafe extern "C" {
12992 #[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."]
12993 pub fn otLogPlatArgs(
12994 aLogLevel: otLogLevel,
12995 aPlatModuleName: *const ::std::os::raw::c_char,
12996 aFormat: *const ::std::os::raw::c_char,
12997 aArgs: *mut __va_list_tag,
12998 );
12999}
13000unsafe extern "C" {
13001 #[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."]
13002 pub fn otLogCli(aLogLevel: otLogLevel, aFormat: *const ::std::os::raw::c_char, ...);
13003}
13004#[doc = " Represents information used for generating hex dump output."]
13005#[repr(C)]
13006#[derive(Debug, Copy, Clone)]
13007pub struct otLogHexDumpInfo {
13008 #[doc = "< The data byes."]
13009 pub mDataBytes: *const u8,
13010 #[doc = "< The data length (number of bytes in @p mDataBytes)"]
13011 pub mDataLength: u16,
13012 #[doc = "< Title string to add table header (MUST NOT be `NULL`)."]
13013 pub mTitle: *const ::std::os::raw::c_char,
13014 #[doc = "< Buffer to output one line of generated hex dump."]
13015 pub mLine: [::std::os::raw::c_char; 73usize],
13016 #[doc = "< Iterator used by OT stack. MUST be initialized to zero."]
13017 pub mIterator: u16,
13018}
13019impl Default for otLogHexDumpInfo {
13020 fn default() -> Self {
13021 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13022 unsafe {
13023 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13024 s.assume_init()
13025 }
13026 }
13027}
13028unsafe extern "C" {
13029 #[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."]
13030 pub fn otLogGenerateNextHexDumpLine(aInfo: *mut otLogHexDumpInfo) -> otError;
13031}
13032#[doc = " Represents information associated with a radio link."]
13033#[repr(C)]
13034#[derive(Debug, Default, Copy, Clone)]
13035pub struct otRadioLinkInfo {
13036 #[doc = "< Preference level of radio link"]
13037 pub mPreference: u8,
13038}
13039#[doc = " Represents multi radio link information associated with a neighbor."]
13040#[repr(C)]
13041#[derive(Debug, Default, Copy, Clone)]
13042pub struct otMultiRadioNeighborInfo {
13043 pub _bitfield_align_1: [u8; 0],
13044 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13045 #[doc = "< Additional info for 15.4 radio link (applicable when supported)."]
13046 pub mIeee802154Info: otRadioLinkInfo,
13047 #[doc = "< Additional info for TREL radio link (applicable when supported)."]
13048 pub mTrelUdp6Info: otRadioLinkInfo,
13049}
13050impl otMultiRadioNeighborInfo {
13051 #[inline]
13052 pub fn mSupportsIeee802154(&self) -> bool {
13053 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13054 }
13055 #[inline]
13056 pub fn set_mSupportsIeee802154(&mut self, val: bool) {
13057 unsafe {
13058 let val: u8 = ::std::mem::transmute(val);
13059 self._bitfield_1.set(0usize, 1u8, val as u64)
13060 }
13061 }
13062 #[inline]
13063 pub unsafe fn mSupportsIeee802154_raw(this: *const Self) -> bool {
13064 unsafe {
13065 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13066 ::std::ptr::addr_of!((*this)._bitfield_1),
13067 0usize,
13068 1u8,
13069 ) as u8)
13070 }
13071 }
13072 #[inline]
13073 pub unsafe fn set_mSupportsIeee802154_raw(this: *mut Self, val: bool) {
13074 unsafe {
13075 let val: u8 = ::std::mem::transmute(val);
13076 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13077 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13078 0usize,
13079 1u8,
13080 val as u64,
13081 )
13082 }
13083 }
13084 #[inline]
13085 pub fn mSupportsTrelUdp6(&self) -> bool {
13086 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13087 }
13088 #[inline]
13089 pub fn set_mSupportsTrelUdp6(&mut self, val: bool) {
13090 unsafe {
13091 let val: u8 = ::std::mem::transmute(val);
13092 self._bitfield_1.set(1usize, 1u8, val as u64)
13093 }
13094 }
13095 #[inline]
13096 pub unsafe fn mSupportsTrelUdp6_raw(this: *const Self) -> bool {
13097 unsafe {
13098 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13099 ::std::ptr::addr_of!((*this)._bitfield_1),
13100 1usize,
13101 1u8,
13102 ) as u8)
13103 }
13104 }
13105 #[inline]
13106 pub unsafe fn set_mSupportsTrelUdp6_raw(this: *mut Self, val: bool) {
13107 unsafe {
13108 let val: u8 = ::std::mem::transmute(val);
13109 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13110 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13111 1usize,
13112 1u8,
13113 val as u64,
13114 )
13115 }
13116 }
13117 #[inline]
13118 pub fn new_bitfield_1(
13119 mSupportsIeee802154: bool,
13120 mSupportsTrelUdp6: bool,
13121 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13122 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13123 __bindgen_bitfield_unit.set(0usize, 1u8, {
13124 let mSupportsIeee802154: u8 = unsafe { ::std::mem::transmute(mSupportsIeee802154) };
13125 mSupportsIeee802154 as u64
13126 });
13127 __bindgen_bitfield_unit.set(1usize, 1u8, {
13128 let mSupportsTrelUdp6: u8 = unsafe { ::std::mem::transmute(mSupportsTrelUdp6) };
13129 mSupportsTrelUdp6 as u64
13130 });
13131 __bindgen_bitfield_unit
13132 }
13133}
13134unsafe extern "C" {
13135 #[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."]
13136 pub fn otMultiRadioGetNeighborInfo(
13137 aInstance: *mut otInstance,
13138 aExtAddress: *const otExtAddress,
13139 aNeighborInfo: *mut otMultiRadioNeighborInfo,
13140 ) -> otError;
13141}
13142#[doc = " @struct otIp4Address\n\n Represents an IPv4 address."]
13143#[repr(C, packed)]
13144#[derive(Copy, Clone)]
13145pub struct otIp4Address {
13146 pub mFields: otIp4Address__bindgen_ty_1,
13147}
13148#[repr(C, packed)]
13149#[derive(Copy, Clone)]
13150pub union otIp4Address__bindgen_ty_1 {
13151 #[doc = "< 8-bit fields"]
13152 pub m8: [u8; 4usize],
13153 #[doc = "< 32-bit representation"]
13154 pub m32: u32,
13155}
13156impl Default for otIp4Address__bindgen_ty_1 {
13157 fn default() -> Self {
13158 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13159 unsafe {
13160 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13161 s.assume_init()
13162 }
13163 }
13164}
13165impl Default for otIp4Address {
13166 fn default() -> Self {
13167 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13168 unsafe {
13169 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13170 s.assume_init()
13171 }
13172 }
13173}
13174#[doc = " @struct otIp4Cidr\n\n Represents an IPv4 CIDR block."]
13175#[repr(C)]
13176#[derive(Copy, Clone)]
13177pub struct otIp4Cidr {
13178 pub mAddress: otIp4Address,
13179 pub mLength: u8,
13180}
13181impl Default for otIp4Cidr {
13182 fn default() -> Self {
13183 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13184 unsafe {
13185 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13186 s.assume_init()
13187 }
13188 }
13189}
13190#[doc = " Represents the counters for NAT64."]
13191#[repr(C)]
13192#[derive(Debug, Default, Copy, Clone)]
13193pub struct otNat64Counters {
13194 #[doc = "< Number of packets translated from IPv4 to IPv6."]
13195 pub m4To6Packets: u64,
13196 #[doc = "< Sum of size of packets translated from IPv4 to IPv6."]
13197 pub m4To6Bytes: u64,
13198 #[doc = "< Number of packets translated from IPv6 to IPv4."]
13199 pub m6To4Packets: u64,
13200 #[doc = "< Sum of size of packets translated from IPv6 to IPv4."]
13201 pub m6To4Bytes: u64,
13202}
13203#[doc = " Represents the counters for the protocols supported by NAT64."]
13204#[repr(C)]
13205#[derive(Debug, Default, Copy, Clone)]
13206pub struct otNat64ProtocolCounters {
13207 #[doc = "< Counters for sum of all protocols."]
13208 pub mTotal: otNat64Counters,
13209 #[doc = "< Counters for ICMP and ICMPv6."]
13210 pub mIcmp: otNat64Counters,
13211 #[doc = "< Counters for UDP."]
13212 pub mUdp: otNat64Counters,
13213 #[doc = "< Counters for TCP."]
13214 pub mTcp: otNat64Counters,
13215}
13216#[doc = "< Packet drop for unknown reasons."]
13217pub const OT_NAT64_DROP_REASON_UNKNOWN: otNat64DropReason = 0;
13218#[doc = "< Packet drop due to failed to parse the datagram."]
13219pub const OT_NAT64_DROP_REASON_ILLEGAL_PACKET: otNat64DropReason = 1;
13220#[doc = "< Packet drop due to unsupported IP protocol."]
13221pub const OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO: otNat64DropReason = 2;
13222#[doc = "< Packet drop due to no mappings found or mapping pool exhausted."]
13223pub const OT_NAT64_DROP_REASON_NO_MAPPING: otNat64DropReason = 3;
13224pub const OT_NAT64_DROP_REASON_COUNT: otNat64DropReason = 4;
13225#[doc = " Packet drop reasons."]
13226pub type otNat64DropReason = ::std::os::raw::c_uint;
13227#[doc = " Represents the counters of dropped packets due to errors when handling NAT64 packets."]
13228#[repr(C)]
13229#[derive(Debug, Default, Copy, Clone)]
13230pub struct otNat64ErrorCounters {
13231 #[doc = "< Errors translating IPv4 packets."]
13232 pub mCount4To6: [u64; 4usize],
13233 #[doc = "< Errors translating IPv6 packets."]
13234 pub mCount6To4: [u64; 4usize],
13235}
13236unsafe extern "C" {
13237 #[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."]
13238 pub fn otNat64GetCounters(aInstance: *mut otInstance, aCounters: *mut otNat64ProtocolCounters);
13239}
13240unsafe extern "C" {
13241 #[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."]
13242 pub fn otNat64GetErrorCounters(
13243 aInstance: *mut otInstance,
13244 aCounters: *mut otNat64ErrorCounters,
13245 );
13246}
13247#[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."]
13248#[repr(C)]
13249#[derive(Copy, Clone)]
13250pub struct otNat64AddressMapping {
13251 #[doc = "< The unique id for a mapping session."]
13252 pub mId: u64,
13253 #[doc = "< The IPv4 address of the mapping."]
13254 pub mIp4: otIp4Address,
13255 #[doc = "< The IPv6 address of the mapping."]
13256 pub mIp6: otIp6Address,
13257 #[doc = " The source port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13258 pub mSrcPortOrId: u16,
13259 #[doc = " The translated port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
13260 pub mTranslatedPortOrId: u16,
13261 #[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."]
13262 pub mRemainingTimeMs: u32,
13263 #[doc = "< Counters."]
13264 pub mCounters: otNat64ProtocolCounters,
13265}
13266impl Default for otNat64AddressMapping {
13267 fn default() -> Self {
13268 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13269 unsafe {
13270 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13271 s.assume_init()
13272 }
13273 }
13274}
13275#[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."]
13276#[repr(C)]
13277#[derive(Debug, Copy, Clone)]
13278pub struct otNat64AddressMappingIterator {
13279 pub mPtr: *const ::std::os::raw::c_void,
13280 pub mData32: u32,
13281}
13282impl Default for otNat64AddressMappingIterator {
13283 fn default() -> Self {
13284 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13285 unsafe {
13286 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13287 s.assume_init()
13288 }
13289 }
13290}
13291unsafe extern "C" {
13292 #[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."]
13293 pub fn otNat64InitAddressMappingIterator(
13294 aInstance: *mut otInstance,
13295 aIterator: *mut otNat64AddressMappingIterator,
13296 );
13297}
13298unsafe extern "C" {
13299 #[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."]
13300 pub fn otNat64GetNextAddressMapping(
13301 aInstance: *mut otInstance,
13302 aIterator: *mut otNat64AddressMappingIterator,
13303 aMapping: *mut otNat64AddressMapping,
13304 ) -> otError;
13305}
13306#[doc = "< NAT64 is disabled."]
13307pub const OT_NAT64_STATE_DISABLED: otNat64State = 0;
13308#[doc = "< NAT64 is enabled, but one or more dependencies of NAT64 are not running."]
13309pub const OT_NAT64_STATE_NOT_RUNNING: otNat64State = 1;
13310#[doc = "< NAT64 is enabled, but this BR is not an active NAT64 BR."]
13311pub const OT_NAT64_STATE_IDLE: otNat64State = 2;
13312#[doc = "< The BR is publishing a NAT64 prefix and/or translating packets."]
13313pub const OT_NAT64_STATE_ACTIVE: otNat64State = 3;
13314#[doc = " States of NAT64."]
13315pub type otNat64State = ::std::os::raw::c_uint;
13316unsafe extern "C" {
13317 #[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."]
13318 pub fn otNat64GetTranslatorState(aInstance: *mut otInstance) -> otNat64State;
13319}
13320unsafe extern "C" {
13321 #[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."]
13322 pub fn otNat64GetPrefixManagerState(aInstance: *mut otInstance) -> otNat64State;
13323}
13324unsafe extern "C" {
13325 #[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"]
13326 pub fn otNat64SetEnabled(aInstance: *mut otInstance, aEnabled: bool);
13327}
13328unsafe extern "C" {
13329 #[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"]
13330 pub fn otIp4NewMessage(
13331 aInstance: *mut otInstance,
13332 aSettings: *const otMessageSettings,
13333 ) -> *mut otMessage;
13334}
13335unsafe extern "C" {
13336 #[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"]
13337 pub fn otNat64SetIp4Cidr(aInstance: *mut otInstance, aCidr: *const otIp4Cidr) -> otError;
13338}
13339unsafe extern "C" {
13340 #[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"]
13341 pub fn otNat64ClearIp4Cidr(aInstance: *mut otInstance);
13342}
13343unsafe extern "C" {
13344 #[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."]
13345 pub fn otNat64Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
13346}
13347#[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."]
13348pub type otNat64ReceiveIp4Callback = ::std::option::Option<
13349 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
13350>;
13351unsafe extern "C" {
13352 #[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."]
13353 pub fn otNat64SetReceiveIp4Callback(
13354 aInstance: *mut otInstance,
13355 aCallback: otNat64ReceiveIp4Callback,
13356 aContext: *mut ::std::os::raw::c_void,
13357 );
13358}
13359unsafe extern "C" {
13360 #[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."]
13361 pub fn otNat64GetCidr(aInstance: *mut otInstance, aCidr: *mut otIp4Cidr) -> otError;
13362}
13363unsafe extern "C" {
13364 #[doc = " Gets the IPv6 prefix 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] aPrefix A pointer to an `otIp6Prefix` to output the prefix.\n\n @retval OT_ERROR_NONE The prefix was successfully filled.\n @retval OT_ERROR_NOT_FOUND The translator is not configured with an IPv6 prefix."]
13365 pub fn otNat64GetIp6Prefix(aInstance: *mut otInstance, aPrefix: *mut otIp6Prefix) -> otError;
13366}
13367unsafe extern "C" {
13368 #[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."]
13369 pub fn otIp4IsAddressEqual(aFirst: *const otIp4Address, aSecond: *const otIp4Address) -> bool;
13370}
13371unsafe extern "C" {
13372 #[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."]
13373 pub fn otIp4ExtractFromIp6Address(
13374 aPrefixLength: u8,
13375 aIp6Address: *const otIp6Address,
13376 aIp4Address: *mut otIp4Address,
13377 );
13378}
13379unsafe extern "C" {
13380 #[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."]
13381 pub fn otIp4FromIp4MappedIp6Address(
13382 aIp6Address: *const otIp6Address,
13383 aIp4Address: *mut otIp4Address,
13384 ) -> otError;
13385}
13386unsafe extern "C" {
13387 #[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."]
13388 pub fn otIp4ToIp4MappedIp6Address(
13389 aIp4Address: *const otIp4Address,
13390 aIp6Address: *mut otIp6Address,
13391 );
13392}
13393unsafe extern "C" {
13394 #[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)."]
13395 pub fn otIp4AddressToString(
13396 aAddress: *const otIp4Address,
13397 aBuffer: *mut ::std::os::raw::c_char,
13398 aSize: u16,
13399 );
13400}
13401unsafe extern "C" {
13402 #[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."]
13403 pub fn otIp4CidrFromString(
13404 aString: *const ::std::os::raw::c_char,
13405 aCidr: *mut otIp4Cidr,
13406 ) -> otError;
13407}
13408unsafe extern "C" {
13409 #[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)."]
13410 pub fn otIp4CidrToString(
13411 aCidr: *const otIp4Cidr,
13412 aBuffer: *mut ::std::os::raw::c_char,
13413 aSize: u16,
13414 );
13415}
13416unsafe extern "C" {
13417 #[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."]
13418 pub fn otIp4AddressFromString(
13419 aString: *const ::std::os::raw::c_char,
13420 aAddress: *mut otIp4Address,
13421 ) -> otError;
13422}
13423unsafe extern "C" {
13424 #[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."]
13425 pub fn otNat64SynthesizeIp6Address(
13426 aInstance: *mut otInstance,
13427 aIp4Address: *const otIp4Address,
13428 aIp6Address: *mut otIp6Address,
13429 ) -> otError;
13430}
13431unsafe extern "C" {
13432 #[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."]
13433 pub fn otNat64StateToString(aState: otNat64State) -> *const ::std::os::raw::c_char;
13434}
13435#[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."]
13436pub type otNcpHdlcSendCallback = ::std::option::Option<
13437 unsafe extern "C" fn(aBuf: *const u8, aBufLength: u16) -> ::std::os::raw::c_int,
13438>;
13439unsafe extern "C" {
13440 #[doc = " Is called after NCP send finished."]
13441 pub fn otNcpHdlcSendDone();
13442}
13443unsafe extern "C" {
13444 #[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."]
13445 pub fn otNcpHdlcReceive(aBuf: *const u8, aBufLength: u16);
13446}
13447unsafe extern "C" {
13448 #[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."]
13449 pub fn otNcpHdlcInit(aInstance: *mut otInstance, aSendCallback: otNcpHdlcSendCallback);
13450}
13451unsafe extern "C" {
13452 #[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."]
13453 pub fn otNcpHdlcInitMulti(
13454 aInstance: *mut *mut otInstance,
13455 aCount: u8,
13456 aSendCallback: otNcpHdlcSendCallback,
13457 );
13458}
13459unsafe extern "C" {
13460 #[doc = " Initialize the NCP based on SPI framing.\n\n @param[in] aInstance The OpenThread instance structure."]
13461 pub fn otNcpSpiInit(aInstance: *mut otInstance);
13462}
13463unsafe extern "C" {
13464 #[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."]
13465 pub fn otNcpStreamWrite(
13466 aStreamId: ::std::os::raw::c_int,
13467 aDataPtr: *const u8,
13468 aDataLen: ::std::os::raw::c_int,
13469 ) -> otError;
13470}
13471unsafe extern "C" {
13472 #[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."]
13473 pub fn otNcpPlatLogv(
13474 aLogLevel: otLogLevel,
13475 aLogRegion: otLogRegion,
13476 aFormat: *const ::std::os::raw::c_char,
13477 aArgs: *mut __va_list_tag,
13478 );
13479}
13480#[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."]
13481pub type otNcpDelegateAllowPeekPoke =
13482 ::std::option::Option<unsafe extern "C" fn(aAddress: u32, aCount: u16) -> bool>;
13483unsafe extern "C" {
13484 #[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."]
13485 pub fn otNcpRegisterPeekPokeDelegates(
13486 aAllowPeekDelegate: otNcpDelegateAllowPeekPoke,
13487 aAllowPokeDelegate: otNcpDelegateAllowPeekPoke,
13488 );
13489}
13490pub type otNetworkDiagIterator = u16;
13491#[doc = " Represents a Network Diagnostics IPv6 Address List TLV value."]
13492#[repr(C)]
13493#[derive(Copy, Clone)]
13494pub struct otNetworkDiagIp6AddrList {
13495 #[doc = "< Number of IPv6 addresses."]
13496 pub mCount: u8,
13497 #[doc = "< Array of IPv6 addresses."]
13498 pub mList: [otIp6Address; 15usize],
13499}
13500impl Default for otNetworkDiagIp6AddrList {
13501 fn default() -> Self {
13502 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13503 unsafe {
13504 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13505 s.assume_init()
13506 }
13507 }
13508}
13509#[doc = " Represents a Network Diagnostic TLV Data."]
13510#[repr(C)]
13511#[derive(Debug, Copy, Clone)]
13512pub struct otNetworkDiagData {
13513 #[doc = "< Number of bytes in the data."]
13514 pub mCount: u8,
13515 #[doc = "< Array containing the data bytes."]
13516 pub m8: [u8; 254usize],
13517}
13518impl Default for otNetworkDiagData {
13519 fn default() -> Self {
13520 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13521 unsafe {
13522 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13523 s.assume_init()
13524 }
13525 }
13526}
13527#[doc = " Represents a Network Diagnostic Connectivity value."]
13528#[repr(C)]
13529#[derive(Debug, Default, Copy, Clone)]
13530pub struct otNetworkDiagConnectivity {
13531 #[doc = "< The priority of the sender as a parent."]
13532 pub mParentPriority: i8,
13533 #[doc = "< Number of neighbors with link of quality 3."]
13534 pub mLinkQuality3: u8,
13535 #[doc = "< Number of neighbors with link of quality 2."]
13536 pub mLinkQuality2: u8,
13537 #[doc = "< Number of neighbors with link of quality 1."]
13538 pub mLinkQuality1: u8,
13539 #[doc = "< Cost to the Leader."]
13540 pub mLeaderCost: u8,
13541 #[doc = "< Most recent received ID seq number."]
13542 pub mIdSequence: u8,
13543 #[doc = "< Number of active routers."]
13544 pub mActiveRouters: u8,
13545 #[doc = "< Buffer capacity in bytes for SEDs. Optional."]
13546 pub mSedBufferSize: u16,
13547 #[doc = "< Queue capacity (number of IPv6 datagrams) per SED. Optional."]
13548 pub mSedDatagramCount: u8,
13549}
13550#[doc = " Represents a Network Diagnostic Route data."]
13551#[repr(C)]
13552#[derive(Debug, Default, Copy, Clone)]
13553pub struct otNetworkDiagRouteData {
13554 #[doc = "< The Assigned Router ID."]
13555 pub mRouterId: u8,
13556 pub _bitfield_align_1: [u8; 0],
13557 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13558}
13559impl otNetworkDiagRouteData {
13560 #[inline]
13561 pub fn mLinkQualityOut(&self) -> u8 {
13562 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
13563 }
13564 #[inline]
13565 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13566 unsafe {
13567 let val: u8 = ::std::mem::transmute(val);
13568 self._bitfield_1.set(0usize, 2u8, val as u64)
13569 }
13570 }
13571 #[inline]
13572 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13573 unsafe {
13574 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13575 ::std::ptr::addr_of!((*this)._bitfield_1),
13576 0usize,
13577 2u8,
13578 ) as u8)
13579 }
13580 }
13581 #[inline]
13582 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13583 unsafe {
13584 let val: u8 = ::std::mem::transmute(val);
13585 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13586 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13587 0usize,
13588 2u8,
13589 val as u64,
13590 )
13591 }
13592 }
13593 #[inline]
13594 pub fn mLinkQualityIn(&self) -> u8 {
13595 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13596 }
13597 #[inline]
13598 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13599 unsafe {
13600 let val: u8 = ::std::mem::transmute(val);
13601 self._bitfield_1.set(2usize, 2u8, val as u64)
13602 }
13603 }
13604 #[inline]
13605 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13606 unsafe {
13607 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13608 ::std::ptr::addr_of!((*this)._bitfield_1),
13609 2usize,
13610 2u8,
13611 ) as u8)
13612 }
13613 }
13614 #[inline]
13615 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13616 unsafe {
13617 let val: u8 = ::std::mem::transmute(val);
13618 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13619 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13620 2usize,
13621 2u8,
13622 val as u64,
13623 )
13624 }
13625 }
13626 #[inline]
13627 pub fn mRouteCost(&self) -> u8 {
13628 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) }
13629 }
13630 #[inline]
13631 pub fn set_mRouteCost(&mut self, val: u8) {
13632 unsafe {
13633 let val: u8 = ::std::mem::transmute(val);
13634 self._bitfield_1.set(4usize, 4u8, val as u64)
13635 }
13636 }
13637 #[inline]
13638 pub unsafe fn mRouteCost_raw(this: *const Self) -> u8 {
13639 unsafe {
13640 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13641 ::std::ptr::addr_of!((*this)._bitfield_1),
13642 4usize,
13643 4u8,
13644 ) as u8)
13645 }
13646 }
13647 #[inline]
13648 pub unsafe fn set_mRouteCost_raw(this: *mut Self, val: u8) {
13649 unsafe {
13650 let val: u8 = ::std::mem::transmute(val);
13651 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13652 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13653 4usize,
13654 4u8,
13655 val as u64,
13656 )
13657 }
13658 }
13659 #[inline]
13660 pub fn new_bitfield_1(
13661 mLinkQualityOut: u8,
13662 mLinkQualityIn: u8,
13663 mRouteCost: u8,
13664 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13665 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13666 __bindgen_bitfield_unit.set(0usize, 2u8, {
13667 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13668 mLinkQualityOut as u64
13669 });
13670 __bindgen_bitfield_unit.set(2usize, 2u8, {
13671 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13672 mLinkQualityIn as u64
13673 });
13674 __bindgen_bitfield_unit.set(4usize, 4u8, {
13675 let mRouteCost: u8 = unsafe { ::std::mem::transmute(mRouteCost) };
13676 mRouteCost as u64
13677 });
13678 __bindgen_bitfield_unit
13679 }
13680}
13681#[doc = " Represents a Network Diagnostic Route64 TLV value."]
13682#[repr(C)]
13683#[derive(Debug, Copy, Clone)]
13684pub struct otNetworkDiagRoute {
13685 #[doc = "< Sequence number for Router ID assignments."]
13686 pub mIdSequence: u8,
13687 #[doc = "< Number of routes."]
13688 pub mRouteCount: u8,
13689 #[doc = "< Link Quality and Routing Cost data."]
13690 pub mRouteData: [otNetworkDiagRouteData; 63usize],
13691}
13692impl Default for otNetworkDiagRoute {
13693 fn default() -> Self {
13694 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13695 unsafe {
13696 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13697 s.assume_init()
13698 }
13699 }
13700}
13701#[doc = " Represents a Network Diagnostic Enhanced Route data."]
13702#[repr(C)]
13703#[derive(Debug, Default, Copy, Clone)]
13704pub struct otNetworkDiagEnhRouteData {
13705 #[doc = "< The Router ID."]
13706 pub mRouterId: u8,
13707 pub _bitfield_align_1: [u8; 0],
13708 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13709 #[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."]
13710 pub mNextHop: u8,
13711 #[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."]
13712 pub mNextHopCost: u8,
13713}
13714impl otNetworkDiagEnhRouteData {
13715 #[inline]
13716 pub fn mIsSelf(&self) -> bool {
13717 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13718 }
13719 #[inline]
13720 pub fn set_mIsSelf(&mut self, val: bool) {
13721 unsafe {
13722 let val: u8 = ::std::mem::transmute(val);
13723 self._bitfield_1.set(0usize, 1u8, val as u64)
13724 }
13725 }
13726 #[inline]
13727 pub unsafe fn mIsSelf_raw(this: *const Self) -> bool {
13728 unsafe {
13729 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13730 ::std::ptr::addr_of!((*this)._bitfield_1),
13731 0usize,
13732 1u8,
13733 ) as u8)
13734 }
13735 }
13736 #[inline]
13737 pub unsafe fn set_mIsSelf_raw(this: *mut Self, val: bool) {
13738 unsafe {
13739 let val: u8 = ::std::mem::transmute(val);
13740 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13741 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13742 0usize,
13743 1u8,
13744 val as u64,
13745 )
13746 }
13747 }
13748 #[inline]
13749 pub fn mHasLink(&self) -> bool {
13750 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13751 }
13752 #[inline]
13753 pub fn set_mHasLink(&mut self, val: bool) {
13754 unsafe {
13755 let val: u8 = ::std::mem::transmute(val);
13756 self._bitfield_1.set(1usize, 1u8, val as u64)
13757 }
13758 }
13759 #[inline]
13760 pub unsafe fn mHasLink_raw(this: *const Self) -> bool {
13761 unsafe {
13762 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13763 ::std::ptr::addr_of!((*this)._bitfield_1),
13764 1usize,
13765 1u8,
13766 ) as u8)
13767 }
13768 }
13769 #[inline]
13770 pub unsafe fn set_mHasLink_raw(this: *mut Self, val: bool) {
13771 unsafe {
13772 let val: u8 = ::std::mem::transmute(val);
13773 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13774 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13775 1usize,
13776 1u8,
13777 val as u64,
13778 )
13779 }
13780 }
13781 #[inline]
13782 pub fn mLinkQualityOut(&self) -> u8 {
13783 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
13784 }
13785 #[inline]
13786 pub fn set_mLinkQualityOut(&mut self, val: u8) {
13787 unsafe {
13788 let val: u8 = ::std::mem::transmute(val);
13789 self._bitfield_1.set(2usize, 2u8, val as u64)
13790 }
13791 }
13792 #[inline]
13793 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
13794 unsafe {
13795 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13796 ::std::ptr::addr_of!((*this)._bitfield_1),
13797 2usize,
13798 2u8,
13799 ) as u8)
13800 }
13801 }
13802 #[inline]
13803 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
13804 unsafe {
13805 let val: u8 = ::std::mem::transmute(val);
13806 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13807 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13808 2usize,
13809 2u8,
13810 val as u64,
13811 )
13812 }
13813 }
13814 #[inline]
13815 pub fn mLinkQualityIn(&self) -> u8 {
13816 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
13817 }
13818 #[inline]
13819 pub fn set_mLinkQualityIn(&mut self, val: u8) {
13820 unsafe {
13821 let val: u8 = ::std::mem::transmute(val);
13822 self._bitfield_1.set(4usize, 2u8, val as u64)
13823 }
13824 }
13825 #[inline]
13826 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
13827 unsafe {
13828 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13829 ::std::ptr::addr_of!((*this)._bitfield_1),
13830 4usize,
13831 2u8,
13832 ) as u8)
13833 }
13834 }
13835 #[inline]
13836 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
13837 unsafe {
13838 let val: u8 = ::std::mem::transmute(val);
13839 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13840 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13841 4usize,
13842 2u8,
13843 val as u64,
13844 )
13845 }
13846 }
13847 #[inline]
13848 pub fn new_bitfield_1(
13849 mIsSelf: bool,
13850 mHasLink: bool,
13851 mLinkQualityOut: u8,
13852 mLinkQualityIn: u8,
13853 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13854 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13855 __bindgen_bitfield_unit.set(0usize, 1u8, {
13856 let mIsSelf: u8 = unsafe { ::std::mem::transmute(mIsSelf) };
13857 mIsSelf as u64
13858 });
13859 __bindgen_bitfield_unit.set(1usize, 1u8, {
13860 let mHasLink: u8 = unsafe { ::std::mem::transmute(mHasLink) };
13861 mHasLink as u64
13862 });
13863 __bindgen_bitfield_unit.set(2usize, 2u8, {
13864 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
13865 mLinkQualityOut as u64
13866 });
13867 __bindgen_bitfield_unit.set(4usize, 2u8, {
13868 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
13869 mLinkQualityIn as u64
13870 });
13871 __bindgen_bitfield_unit
13872 }
13873}
13874#[doc = " Represents a Network Diagnostic Enhanced Route TLV value."]
13875#[repr(C)]
13876#[derive(Debug, Copy, Clone)]
13877pub struct otNetworkDiagEnhRoute {
13878 #[doc = "< Number of `mRouteData` entries."]
13879 pub mRouteCount: u8,
13880 #[doc = "< Route Data per router."]
13881 pub mRouteData: [otNetworkDiagEnhRouteData; 63usize],
13882}
13883impl Default for otNetworkDiagEnhRoute {
13884 fn default() -> Self {
13885 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13886 unsafe {
13887 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13888 s.assume_init()
13889 }
13890 }
13891}
13892#[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."]
13893#[repr(C)]
13894#[derive(Debug, Default, Copy, Clone)]
13895pub struct otNetworkDiagMacCounters {
13896 pub mIfInUnknownProtos: u32,
13897 pub mIfInErrors: u32,
13898 pub mIfOutErrors: u32,
13899 pub mIfInUcastPkts: u32,
13900 pub mIfInBroadcastPkts: u32,
13901 pub mIfInDiscards: u32,
13902 pub mIfOutUcastPkts: u32,
13903 pub mIfOutBroadcastPkts: u32,
13904 pub mIfOutDiscards: u32,
13905}
13906#[doc = " Represents a Network Diagnostics MLE Counters value."]
13907#[repr(C)]
13908#[derive(Debug, Default, Copy, Clone)]
13909pub struct otNetworkDiagMleCounters {
13910 #[doc = "< Number of times device entered disabled role."]
13911 pub mDisabledRole: u16,
13912 #[doc = "< Number of times device entered detached role."]
13913 pub mDetachedRole: u16,
13914 #[doc = "< Number of times device entered child role."]
13915 pub mChildRole: u16,
13916 #[doc = "< Number of times device entered router role."]
13917 pub mRouterRole: u16,
13918 #[doc = "< Number of times device entered leader role."]
13919 pub mLeaderRole: u16,
13920 #[doc = "< Number of attach attempts while device was detached."]
13921 pub mAttachAttempts: u16,
13922 #[doc = "< Number of changes to partition ID."]
13923 pub mPartitionIdChanges: u16,
13924 #[doc = "< Number of attempts to attach to a better partition."]
13925 pub mBetterPartitionAttachAttempts: u16,
13926 #[doc = "< Number of time device changed its parent."]
13927 pub mParentChanges: u16,
13928 #[doc = "< Milliseconds tracked by next counters (zero if not supported)."]
13929 pub mTrackedTime: u64,
13930 #[doc = "< Milliseconds device has been in disabled role."]
13931 pub mDisabledTime: u64,
13932 #[doc = "< Milliseconds device has been in detached role."]
13933 pub mDetachedTime: u64,
13934 #[doc = "< Milliseconds device has been in child role."]
13935 pub mChildTime: u64,
13936 #[doc = "< Milliseconds device has been in router role."]
13937 pub mRouterTime: u64,
13938 #[doc = "< Milliseconds device has been in leader role."]
13939 pub mLeaderTime: u64,
13940}
13941#[doc = " Represents a Network Diagnostic Child Table Entry."]
13942#[repr(C)]
13943#[derive(Debug, Default, Copy, Clone)]
13944pub struct otNetworkDiagChildEntry {
13945 pub _bitfield_align_1: [u16; 0],
13946 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
13947 #[doc = "< Link mode."]
13948 pub mMode: otLinkModeConfig,
13949}
13950impl otNetworkDiagChildEntry {
13951 #[inline]
13952 pub fn mTimeout(&self) -> u16 {
13953 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 5u8) as u16) }
13954 }
13955 #[inline]
13956 pub fn set_mTimeout(&mut self, val: u16) {
13957 unsafe {
13958 let val: u16 = ::std::mem::transmute(val);
13959 self._bitfield_1.set(0usize, 5u8, val as u64)
13960 }
13961 }
13962 #[inline]
13963 pub unsafe fn mTimeout_raw(this: *const Self) -> u16 {
13964 unsafe {
13965 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13966 ::std::ptr::addr_of!((*this)._bitfield_1),
13967 0usize,
13968 5u8,
13969 ) as u16)
13970 }
13971 }
13972 #[inline]
13973 pub unsafe fn set_mTimeout_raw(this: *mut Self, val: u16) {
13974 unsafe {
13975 let val: u16 = ::std::mem::transmute(val);
13976 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
13977 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13978 0usize,
13979 5u8,
13980 val as u64,
13981 )
13982 }
13983 }
13984 #[inline]
13985 pub fn mLinkQuality(&self) -> u8 {
13986 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u8) }
13987 }
13988 #[inline]
13989 pub fn set_mLinkQuality(&mut self, val: u8) {
13990 unsafe {
13991 let val: u8 = ::std::mem::transmute(val);
13992 self._bitfield_1.set(5usize, 2u8, val as u64)
13993 }
13994 }
13995 #[inline]
13996 pub unsafe fn mLinkQuality_raw(this: *const Self) -> u8 {
13997 unsafe {
13998 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
13999 ::std::ptr::addr_of!((*this)._bitfield_1),
14000 5usize,
14001 2u8,
14002 ) as u8)
14003 }
14004 }
14005 #[inline]
14006 pub unsafe fn set_mLinkQuality_raw(this: *mut Self, val: u8) {
14007 unsafe {
14008 let val: u8 = ::std::mem::transmute(val);
14009 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
14010 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14011 5usize,
14012 2u8,
14013 val as u64,
14014 )
14015 }
14016 }
14017 #[inline]
14018 pub fn mChildId(&self) -> u16 {
14019 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u16) }
14020 }
14021 #[inline]
14022 pub fn set_mChildId(&mut self, val: u16) {
14023 unsafe {
14024 let val: u16 = ::std::mem::transmute(val);
14025 self._bitfield_1.set(7usize, 9u8, val as u64)
14026 }
14027 }
14028 #[inline]
14029 pub unsafe fn mChildId_raw(this: *const Self) -> u16 {
14030 unsafe {
14031 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
14032 ::std::ptr::addr_of!((*this)._bitfield_1),
14033 7usize,
14034 9u8,
14035 ) as u16)
14036 }
14037 }
14038 #[inline]
14039 pub unsafe fn set_mChildId_raw(this: *mut Self, val: u16) {
14040 unsafe {
14041 let val: u16 = ::std::mem::transmute(val);
14042 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
14043 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14044 7usize,
14045 9u8,
14046 val as u64,
14047 )
14048 }
14049 }
14050 #[inline]
14051 pub fn new_bitfield_1(
14052 mTimeout: u16,
14053 mLinkQuality: u8,
14054 mChildId: u16,
14055 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
14056 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
14057 __bindgen_bitfield_unit.set(0usize, 5u8, {
14058 let mTimeout: u16 = unsafe { ::std::mem::transmute(mTimeout) };
14059 mTimeout as u64
14060 });
14061 __bindgen_bitfield_unit.set(5usize, 2u8, {
14062 let mLinkQuality: u8 = unsafe { ::std::mem::transmute(mLinkQuality) };
14063 mLinkQuality as u64
14064 });
14065 __bindgen_bitfield_unit.set(7usize, 9u8, {
14066 let mChildId: u16 = unsafe { ::std::mem::transmute(mChildId) };
14067 mChildId as u64
14068 });
14069 __bindgen_bitfield_unit
14070 }
14071}
14072#[doc = " Represents a Network Diagnostic Child Table TLV value."]
14073#[repr(C)]
14074#[derive(Debug, Copy, Clone)]
14075pub struct otNetworkDiagChildTable {
14076 #[doc = "< Number of child entries in the table."]
14077 pub mCount: u8,
14078 #[doc = "< Child table."]
14079 pub mTable: [otNetworkDiagChildEntry; 63usize],
14080}
14081impl Default for otNetworkDiagChildTable {
14082 fn default() -> Self {
14083 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14084 unsafe {
14085 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14086 s.assume_init()
14087 }
14088 }
14089}
14090#[doc = " Represents a Border Router State TLV value."]
14091pub use self::otBorderRoutingState as otNetworkDiagBrState;
14092#[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]`."]
14093#[repr(C)]
14094#[derive(Debug, Default, Copy, Clone)]
14095pub struct otThreadVendorOui {
14096 #[doc = "< The OUI prefix length in bits (24, 28, or 36)."]
14097 pub mBitLength: u8,
14098 #[doc = "< The OUI bytes in big-endian order."]
14099 pub mBytes: [u8; 5usize],
14100}
14101#[doc = " Represents a Network Diagnostic TLV."]
14102#[repr(C)]
14103#[derive(Copy, Clone)]
14104pub struct otNetworkDiagTlv {
14105 #[doc = "< The Network Diagnostic TLV type."]
14106 pub mType: u8,
14107 pub mData: otNetworkDiagTlv__bindgen_ty_1,
14108}
14109#[repr(C)]
14110#[derive(Copy, Clone)]
14111pub union otNetworkDiagTlv__bindgen_ty_1 {
14112 pub mExtAddress: otExtAddress,
14113 pub mEui64: otExtAddress,
14114 pub mAddr16: u16,
14115 pub mMode: otLinkModeConfig,
14116 pub mTimeout: u32,
14117 pub mConnectivity: otNetworkDiagConnectivity,
14118 pub mRoute: otNetworkDiagRoute,
14119 pub mEnhRoute: otNetworkDiagEnhRoute,
14120 pub mLeaderData: otLeaderData,
14121 pub mNetworkData: otNetworkDiagData,
14122 pub mIp6AddrList: otNetworkDiagIp6AddrList,
14123 pub mMacCounters: otNetworkDiagMacCounters,
14124 pub mMleCounters: otNetworkDiagMleCounters,
14125 pub mBatteryLevel: u8,
14126 pub mSupplyVoltage: u16,
14127 pub mMaxChildTimeout: u32,
14128 pub mVersion: u16,
14129 pub mVendorName: [::std::os::raw::c_char; 33usize],
14130 pub mVendorModel: [::std::os::raw::c_char; 33usize],
14131 pub mVendorSwVersion: [::std::os::raw::c_char; 17usize],
14132 pub mThreadStackVersion: [::std::os::raw::c_char; 65usize],
14133 pub mVendorAppUrl: [::std::os::raw::c_char; 97usize],
14134 pub mVendorOui: otThreadVendorOui,
14135 pub mNonPreferredChannels: otChannelMask,
14136 pub mChannelPages: otNetworkDiagData,
14137 pub mChildTable: otNetworkDiagChildTable,
14138 pub mBrState: otNetworkDiagBrState,
14139 pub mBrIfAddrList: otNetworkDiagIp6AddrList,
14140 pub mBrPrefix: otIp6NetworkPrefix,
14141}
14142impl Default for otNetworkDiagTlv__bindgen_ty_1 {
14143 fn default() -> Self {
14144 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14145 unsafe {
14146 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14147 s.assume_init()
14148 }
14149 }
14150}
14151impl Default for otNetworkDiagTlv {
14152 fn default() -> Self {
14153 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14154 unsafe {
14155 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14156 s.assume_init()
14157 }
14158 }
14159}
14160unsafe extern "C" {
14161 #[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."]
14162 pub fn otThreadGetNextDiagnosticTlv(
14163 aMessage: *const otMessage,
14164 aIterator: *mut otNetworkDiagIterator,
14165 aNetworkDiagTlv: *mut otNetworkDiagTlv,
14166 ) -> otError;
14167}
14168#[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."]
14169pub type otReceiveDiagnosticGetCallback = ::std::option::Option<
14170 unsafe extern "C" fn(
14171 aError: otError,
14172 aMessage: *mut otMessage,
14173 aMessageInfo: *const otMessageInfo,
14174 aContext: *mut ::std::os::raw::c_void,
14175 ),
14176>;
14177unsafe extern "C" {
14178 #[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."]
14179 pub fn otThreadSendDiagnosticGet(
14180 aInstance: *mut otInstance,
14181 aDestination: *const otIp6Address,
14182 aTlvTypes: *const u8,
14183 aCount: u8,
14184 aCallback: otReceiveDiagnosticGetCallback,
14185 aCallbackContext: *mut ::std::os::raw::c_void,
14186 ) -> otError;
14187}
14188unsafe extern "C" {
14189 #[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."]
14190 pub fn otThreadSendDiagnosticReset(
14191 aInstance: *mut otInstance,
14192 aDestination: *const otIp6Address,
14193 aTlvTypes: *const u8,
14194 aCount: u8,
14195 ) -> otError;
14196}
14197unsafe extern "C" {
14198 #[doc = " Get the vendor name string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor name string."]
14199 pub fn otThreadGetVendorName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14200}
14201unsafe extern "C" {
14202 #[doc = " Get the vendor model string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor model string."]
14203 pub fn otThreadGetVendorModel(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14204}
14205unsafe extern "C" {
14206 #[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."]
14207 pub fn otThreadGetVendorSwVersion(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14208}
14209unsafe extern "C" {
14210 #[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."]
14211 pub fn otThreadGetVendorAppUrl(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
14212}
14213unsafe extern "C" {
14214 #[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."]
14215 pub fn otThreadGetVendorOuiInfo(aInstance: *mut otInstance, aOui: *mut otThreadVendorOui);
14216}
14217unsafe extern "C" {
14218 #[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."]
14219 pub fn otThreadSetVendorOuiInfo(
14220 aInstance: *mut otInstance,
14221 aOui: *const otThreadVendorOui,
14222 ) -> otError;
14223}
14224unsafe extern "C" {
14225 #[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`."]
14226 pub fn otThreadVendorOuiToString(
14227 aOui: *const otThreadVendorOui,
14228 aBuffer: *mut ::std::os::raw::c_char,
14229 aSize: u16,
14230 );
14231}
14232unsafe extern "C" {
14233 #[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."]
14234 pub fn otThreadGetVendorOui(aInstance: *mut otInstance) -> u32;
14235}
14236unsafe extern "C" {
14237 #[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."]
14238 pub fn otThreadSetVendorOui(aInstance: *mut otInstance, aVendorOui: u32) -> otError;
14239}
14240unsafe extern "C" {
14241 #[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."]
14242 pub fn otThreadSetVendorName(
14243 aInstance: *mut otInstance,
14244 aVendorName: *const ::std::os::raw::c_char,
14245 ) -> otError;
14246}
14247unsafe extern "C" {
14248 #[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)."]
14249 pub fn otThreadSetVendorModel(
14250 aInstance: *mut otInstance,
14251 aVendorModel: *const ::std::os::raw::c_char,
14252 ) -> otError;
14253}
14254unsafe extern "C" {
14255 #[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)."]
14256 pub fn otThreadSetVendorSwVersion(
14257 aInstance: *mut otInstance,
14258 aVendorSwVersion: *const ::std::os::raw::c_char,
14259 ) -> otError;
14260}
14261unsafe extern "C" {
14262 #[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)."]
14263 pub fn otThreadSetVendorAppUrl(
14264 aInstance: *mut otInstance,
14265 aVendorAppUrl: *const ::std::os::raw::c_char,
14266 ) -> otError;
14267}
14268#[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."]
14269pub type otThreadNonPreferredChannelsResetCallback =
14270 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14271unsafe extern "C" {
14272 #[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."]
14273 pub fn otThreadSetNonPreferredChannels(aInstance: *mut otInstance, aChannelMask: otChannelMask);
14274}
14275unsafe extern "C" {
14276 #[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."]
14277 pub fn otThreadGetNonPreferredChannels(aInstance: *mut otInstance) -> otChannelMask;
14278}
14279unsafe extern "C" {
14280 #[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."]
14281 pub fn otThreadSetNonPreferredChannelsResetCallback(
14282 aInstance: *mut otInstance,
14283 aCallback: otThreadNonPreferredChannelsResetCallback,
14284 aContext: *mut ::std::os::raw::c_void,
14285 );
14286}
14287#[doc = "< The device hasn't attached to a network."]
14288pub const OT_NETWORK_TIME_UNSYNCHRONIZED: otNetworkTimeStatus = -1;
14289#[doc = "< The device hasn’t received time sync for more than two periods time."]
14290pub const OT_NETWORK_TIME_RESYNC_NEEDED: otNetworkTimeStatus = 0;
14291#[doc = "< The device network time is synchronized."]
14292pub const OT_NETWORK_TIME_SYNCHRONIZED: otNetworkTimeStatus = 1;
14293#[doc = " Represents OpenThread time synchronization status."]
14294pub type otNetworkTimeStatus = ::std::os::raw::c_int;
14295#[doc = " Pointer is called when a network time sync or status change occurs."]
14296pub type otNetworkTimeSyncCallbackFn =
14297 ::std::option::Option<unsafe extern "C" fn(aCallbackContext: *mut ::std::os::raw::c_void)>;
14298unsafe extern "C" {
14299 #[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."]
14300 pub fn otNetworkTimeGet(
14301 aInstance: *mut otInstance,
14302 aNetworkTime: *mut u64,
14303 ) -> otNetworkTimeStatus;
14304}
14305unsafe extern "C" {
14306 #[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."]
14307 pub fn otNetworkTimeSetSyncPeriod(aInstance: *mut otInstance, aTimeSyncPeriod: u16) -> otError;
14308}
14309unsafe extern "C" {
14310 #[doc = " Get the time synchronization period.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The time synchronization period."]
14311 pub fn otNetworkTimeGetSyncPeriod(aInstance: *mut otInstance) -> u16;
14312}
14313unsafe extern "C" {
14314 #[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."]
14315 pub fn otNetworkTimeSetXtalThreshold(
14316 aInstance: *mut otInstance,
14317 aXTALThreshold: u16,
14318 ) -> otError;
14319}
14320unsafe extern "C" {
14321 #[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."]
14322 pub fn otNetworkTimeGetXtalThreshold(aInstance: *mut otInstance) -> u16;
14323}
14324unsafe extern "C" {
14325 #[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"]
14326 pub fn otNetworkTimeSyncSetCallback(
14327 aInstance: *mut otInstance,
14328 aCallbackFn: otNetworkTimeSyncCallbackFn,
14329 aCallbackContext: *mut ::std::os::raw::c_void,
14330 );
14331}
14332#[doc = " Represents a ping reply."]
14333#[repr(C)]
14334#[derive(Copy, Clone)]
14335pub struct otPingSenderReply {
14336 #[doc = "< Sender IPv6 address (address from which ping reply was received)."]
14337 pub mSenderAddress: otIp6Address,
14338 #[doc = "< Round trip time in msec."]
14339 pub mRoundTripTime: u16,
14340 #[doc = "< Data size (number of bytes) in reply (excluding IPv6 and ICMP6 headers)."]
14341 pub mSize: u16,
14342 #[doc = "< Sequence number."]
14343 pub mSequenceNumber: u16,
14344 #[doc = "< Hop limit."]
14345 pub mHopLimit: u8,
14346}
14347impl Default for otPingSenderReply {
14348 fn default() -> Self {
14349 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14350 unsafe {
14351 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14352 s.assume_init()
14353 }
14354 }
14355}
14356#[doc = " Represents statistics of a ping request."]
14357#[repr(C)]
14358#[derive(Debug, Default, Copy, Clone)]
14359pub struct otPingSenderStatistics {
14360 #[doc = "< The number of ping requests already sent."]
14361 pub mSentCount: u16,
14362 #[doc = "< The number of ping replies received."]
14363 pub mReceivedCount: u16,
14364 #[doc = "< The total round trip time of ping requests."]
14365 pub mTotalRoundTripTime: u32,
14366 #[doc = "< The min round trip time among ping requests."]
14367 pub mMinRoundTripTime: u16,
14368 #[doc = "< The max round trip time among ping requests."]
14369 pub mMaxRoundTripTime: u16,
14370 #[doc = "< Whether this is a multicast ping request."]
14371 pub mIsMulticast: bool,
14372}
14373#[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."]
14374pub type otPingSenderReplyCallback = ::std::option::Option<
14375 unsafe extern "C" fn(aReply: *const otPingSenderReply, aContext: *mut ::std::os::raw::c_void),
14376>;
14377#[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."]
14378pub type otPingSenderStatisticsCallback = ::std::option::Option<
14379 unsafe extern "C" fn(
14380 aStatistics: *const otPingSenderStatistics,
14381 aContext: *mut ::std::os::raw::c_void,
14382 ),
14383>;
14384#[doc = " Represents a ping request configuration."]
14385#[repr(C)]
14386#[derive(Copy, Clone)]
14387pub struct otPingSenderConfig {
14388 #[doc = "< Source address of the ping."]
14389 pub mSource: otIp6Address,
14390 #[doc = "< Destination address to ping."]
14391 pub mDestination: otIp6Address,
14392 #[doc = "< Callback function to report replies (can be NULL if not needed)."]
14393 pub mReplyCallback: otPingSenderReplyCallback,
14394 #[doc = "< Callback function to report statistics (can be NULL if not needed)."]
14395 pub mStatisticsCallback: otPingSenderStatisticsCallback,
14396 #[doc = "< A pointer to the callback application-specific context."]
14397 pub mCallbackContext: *mut ::std::os::raw::c_void,
14398 #[doc = "< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default."]
14399 pub mSize: u16,
14400 #[doc = "< Number of ping messages to send. Zero to use default."]
14401 pub mCount: u16,
14402 #[doc = "< Ping tx interval in milliseconds. Zero to use default."]
14403 pub mInterval: u32,
14404 #[doc = "< Time in milliseconds to wait for final reply after sending final request.\n< Zero to use default."]
14405 pub mTimeout: u16,
14406 #[doc = "< Hop limit (used if `mAllowZeroHopLimit` is false). Zero for default."]
14407 pub mHopLimit: u8,
14408 #[doc = "< Indicates whether hop limit is zero."]
14409 pub mAllowZeroHopLimit: bool,
14410 #[doc = "< Allow looping back pings to multicast address that device is subscribed to."]
14411 pub mMulticastLoop: bool,
14412}
14413impl Default for otPingSenderConfig {
14414 fn default() -> Self {
14415 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14416 unsafe {
14417 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14418 s.assume_init()
14419 }
14420 }
14421}
14422unsafe extern "C" {
14423 #[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"]
14424 pub fn otPingSenderPing(
14425 aInstance: *mut otInstance,
14426 aConfig: *const otPingSenderConfig,
14427 ) -> otError;
14428}
14429unsafe extern "C" {
14430 #[doc = " Stops an ongoing ping.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
14431 pub fn otPingSenderStop(aInstance: *mut otInstance);
14432}
14433unsafe extern "C" {
14434 #[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."]
14435 pub fn otPlatAlarmMicroStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14436}
14437unsafe extern "C" {
14438 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14439 pub fn otPlatAlarmMicroStop(aInstance: *mut otInstance);
14440}
14441unsafe extern "C" {
14442 #[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."]
14443 pub fn otPlatAlarmMicroGetNow() -> u32;
14444}
14445unsafe extern "C" {
14446 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14447 pub fn otPlatAlarmMicroFired(aInstance: *mut otInstance);
14448}
14449unsafe extern "C" {
14450 #[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."]
14451 pub fn otPlatAlarmMilliStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
14452}
14453unsafe extern "C" {
14454 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
14455 pub fn otPlatAlarmMilliStop(aInstance: *mut otInstance);
14456}
14457unsafe extern "C" {
14458 #[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."]
14459 pub fn otPlatAlarmMilliGetNow() -> u32;
14460}
14461unsafe extern "C" {
14462 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14463 pub fn otPlatAlarmMilliFired(aInstance: *mut otInstance);
14464}
14465unsafe extern "C" {
14466 #[doc = " Signal diagnostics module that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
14467 pub fn otPlatDiagAlarmFired(aInstance: *mut otInstance);
14468}
14469unsafe extern "C" {
14470 #[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."]
14471 pub fn otPlatBorderRoutingProcessIcmp6Ra(
14472 aInstance: *mut otInstance,
14473 aMessage: *const u8,
14474 aLength: u16,
14475 );
14476}
14477unsafe extern "C" {
14478 #[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."]
14479 pub fn otPlatBorderRoutingProcessDhcp6PdPrefix(
14480 aInstance: *mut otInstance,
14481 aPrefixInfo: *const otBorderRoutingPrefixTableEntry,
14482 );
14483}
14484unsafe extern "C" {
14485 #[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."]
14486 pub fn otPlatDebugUart_printf(fmt: *const ::std::os::raw::c_char, ...);
14487}
14488unsafe extern "C" {
14489 #[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."]
14490 pub fn otPlatDebugUart_vprintf(fmt: *const ::std::os::raw::c_char, ap: *mut __va_list_tag);
14491}
14492unsafe extern "C" {
14493 #[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"]
14494 pub fn otPlatDebugUart_putchar_raw(c: ::std::os::raw::c_int);
14495}
14496unsafe extern "C" {
14497 #[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."]
14498 pub fn otPlatDebugUart_kbhit() -> ::std::os::raw::c_int;
14499}
14500unsafe extern "C" {
14501 #[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"]
14502 pub fn otPlatDebugUart_getc() -> ::std::os::raw::c_int;
14503}
14504unsafe extern "C" {
14505 #[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"]
14506 pub fn otPlatDebugUart_putchar(c: ::std::os::raw::c_int);
14507}
14508unsafe extern "C" {
14509 #[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"]
14510 pub fn otPlatDebugUart_puts(s: *const ::std::os::raw::c_char);
14511}
14512unsafe extern "C" {
14513 #[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."]
14514 pub fn otPlatDebugUart_write_bytes(pBytes: *const u8, nBytes: ::std::os::raw::c_int);
14515}
14516unsafe extern "C" {
14517 #[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()"]
14518 pub fn otPlatDebugUart_puts_no_nl(s: *const ::std::os::raw::c_char);
14519}
14520unsafe extern "C" {
14521 #[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."]
14522 pub fn otPlatDebugUart_logfile(filename: *const ::std::os::raw::c_char) -> otError;
14523}
14524#[repr(C)]
14525#[derive(Debug, Copy, Clone)]
14526pub struct otPlatDnsUpstreamQuery {
14527 _unused: [u8; 0],
14528}
14529unsafe extern "C" {
14530 #[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."]
14531 pub fn otPlatDnsIsUpstreamQueryAvailable(aInstance: *mut otInstance) -> bool;
14532}
14533unsafe extern "C" {
14534 #[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."]
14535 pub fn otPlatDnsStartUpstreamQuery(
14536 aInstance: *mut otInstance,
14537 aTxn: *mut otPlatDnsUpstreamQuery,
14538 aQuery: *const otMessage,
14539 );
14540}
14541unsafe extern "C" {
14542 #[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."]
14543 pub fn otPlatDnsCancelUpstreamQuery(
14544 aInstance: *mut otInstance,
14545 aTxn: *mut otPlatDnsUpstreamQuery,
14546 );
14547}
14548unsafe extern "C" {
14549 #[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."]
14550 pub fn otPlatDnsUpstreamQueryDone(
14551 aInstance: *mut otInstance,
14552 aTxn: *mut otPlatDnsUpstreamQuery,
14553 aResponse: *mut otMessage,
14554 );
14555}
14556unsafe extern "C" {
14557 #[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."]
14558 pub fn otPlatEntropyGet(aOutput: *mut u8, aOutputLength: u16) -> otError;
14559}
14560unsafe extern "C" {
14561 #[doc = " Initializes the flash driver.\n\n @param[in] aInstance The OpenThread instance structure."]
14562 pub fn otPlatFlashInit(aInstance: *mut otInstance);
14563}
14564unsafe extern "C" {
14565 #[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."]
14566 pub fn otPlatFlashGetSwapSize(aInstance: *mut otInstance) -> u32;
14567}
14568unsafe extern "C" {
14569 #[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."]
14570 pub fn otPlatFlashErase(aInstance: *mut otInstance, aSwapIndex: u8);
14571}
14572unsafe extern "C" {
14573 #[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."]
14574 pub fn otPlatFlashRead(
14575 aInstance: *mut otInstance,
14576 aSwapIndex: u8,
14577 aOffset: u32,
14578 aData: *mut ::std::os::raw::c_void,
14579 aSize: u32,
14580 );
14581}
14582unsafe extern "C" {
14583 #[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."]
14584 pub fn otPlatFlashWrite(
14585 aInstance: *mut otInstance,
14586 aSwapIndex: u8,
14587 aOffset: u32,
14588 aData: *const ::std::os::raw::c_void,
14589 aSize: u32,
14590 );
14591}
14592#[doc = " Represents an InfraIf Link-Layer Address."]
14593#[repr(C)]
14594#[derive(Debug, Default, Copy, Clone)]
14595pub struct otPlatInfraIfLinkLayerAddress {
14596 #[doc = "< The link-layer address bytes."]
14597 pub mAddress: [u8; 16usize],
14598 #[doc = "< The address length (number of bytes)."]
14599 pub mLength: u8,
14600}
14601unsafe extern "C" {
14602 #[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."]
14603 pub fn otPlatInfraIfHasAddress(
14604 aInstance: *mut otInstance,
14605 aInfraIfIndex: u32,
14606 aAddress: *const otIp6Address,
14607 ) -> bool;
14608}
14609unsafe extern "C" {
14610 #[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."]
14611 pub fn otPlatInfraIfSendIcmp6Nd(
14612 aInstance: *mut otInstance,
14613 aInfraIfIndex: u32,
14614 aDestAddress: *const otIp6Address,
14615 aBuffer: *const u8,
14616 aBufferLength: u16,
14617 ) -> otError;
14618}
14619unsafe extern "C" {
14620 #[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."]
14621 pub fn otPlatInfraIfRecvIcmp6Nd(
14622 aInstance: *mut otInstance,
14623 aInfraIfIndex: u32,
14624 aSrcAddress: *const otIp6Address,
14625 aBuffer: *const u8,
14626 aBufferLength: u16,
14627 );
14628}
14629unsafe extern "C" {
14630 #[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."]
14631 pub fn otPlatInfraIfStateChanged(
14632 aInstance: *mut otInstance,
14633 aInfraIfIndex: u32,
14634 aIsRunning: bool,
14635 ) -> otError;
14636}
14637unsafe extern "C" {
14638 #[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)."]
14639 pub fn otPlatInfraIfDiscoverNat64Prefix(
14640 aInstance: *mut otInstance,
14641 aInfraIfIndex: u32,
14642 ) -> otError;
14643}
14644unsafe extern "C" {
14645 #[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)."]
14646 pub fn otPlatInfraIfDiscoverNat64PrefixDone(
14647 aInstance: *mut otInstance,
14648 aInfraIfIndex: u32,
14649 aIp6Prefix: *const otIp6Prefix,
14650 );
14651}
14652unsafe extern "C" {
14653 #[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."]
14654 pub fn otPlatGetInfraIfLinkLayerAddress(
14655 aInstance: *mut otInstance,
14656 aIfIndex: u32,
14657 aInfraIfLinkLayerAddress: *mut otPlatInfraIfLinkLayerAddress,
14658 ) -> otError;
14659}
14660unsafe extern "C" {
14661 #[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."]
14662 pub fn otPlatInfraIfDhcp6PdClientSetListeningEnabled(
14663 aInstance: *mut otInstance,
14664 aEnable: bool,
14665 aInfraIfIndex: u32,
14666 );
14667}
14668unsafe extern "C" {
14669 #[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."]
14670 pub fn otPlatInfraIfDhcp6PdClientSend(
14671 aInstance: *mut otInstance,
14672 aMessage: *mut otMessage,
14673 aDestAddress: *mut otIp6Address,
14674 aInfraIfIndex: u32,
14675 );
14676}
14677unsafe extern "C" {
14678 #[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.."]
14679 pub fn otPlatInfraIfDhcp6PdClientHandleReceived(
14680 aInstance: *mut otInstance,
14681 aMessage: *mut otMessage,
14682 aInfraIfIndex: u32,
14683 );
14684}
14685unsafe extern "C" {
14686 #[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."]
14687 pub fn otPlatCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
14688}
14689unsafe extern "C" {
14690 #[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."]
14691 pub fn otPlatFree(aPtr: *mut ::std::os::raw::c_void);
14692}
14693#[doc = " Represents an OpenThread message buffer."]
14694#[repr(C)]
14695#[derive(Debug, Copy, Clone)]
14696pub struct otMessageBuffer {
14697 #[doc = "< Pointer to the next buffer."]
14698 pub mNext: *mut otMessageBuffer,
14699}
14700impl Default for otMessageBuffer {
14701 fn default() -> Self {
14702 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14703 unsafe {
14704 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14705 s.assume_init()
14706 }
14707 }
14708}
14709unsafe extern "C" {
14710 #[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."]
14711 pub fn otPlatMessagePoolInit(
14712 aInstance: *mut otInstance,
14713 aMinNumFreeBuffers: u16,
14714 aBufferSize: usize,
14715 );
14716}
14717unsafe extern "C" {
14718 #[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."]
14719 pub fn otPlatMessagePoolNew(aInstance: *mut otInstance) -> *mut otMessageBuffer;
14720}
14721unsafe extern "C" {
14722 #[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."]
14723 pub fn otPlatMessagePoolFree(aInstance: *mut otInstance, aBuffer: *mut otMessageBuffer);
14724}
14725unsafe extern "C" {
14726 #[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."]
14727 pub fn otPlatMessagePoolNumFreeBuffers(aInstance: *mut otInstance) -> u16;
14728}
14729unsafe extern "C" {
14730 #[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."]
14731 pub fn otPlatMessagePoolDeinit(aInstance: *mut otInstance);
14732}
14733unsafe extern "C" {
14734 #[doc = " Performs a software reset on the platform, if supported.\n\n @param[in] aInstance The OpenThread instance structure."]
14735 pub fn otPlatReset(aInstance: *mut otInstance);
14736}
14737unsafe extern "C" {
14738 #[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."]
14739 pub fn otPlatResetToBootloader(aInstance: *mut otInstance) -> otError;
14740}
14741pub const OT_PLAT_RESET_REASON_POWER_ON: otPlatResetReason = 0;
14742pub const OT_PLAT_RESET_REASON_EXTERNAL: otPlatResetReason = 1;
14743pub const OT_PLAT_RESET_REASON_SOFTWARE: otPlatResetReason = 2;
14744pub const OT_PLAT_RESET_REASON_FAULT: otPlatResetReason = 3;
14745pub const OT_PLAT_RESET_REASON_CRASH: otPlatResetReason = 4;
14746pub const OT_PLAT_RESET_REASON_ASSERT: otPlatResetReason = 5;
14747pub const OT_PLAT_RESET_REASON_OTHER: otPlatResetReason = 6;
14748pub const OT_PLAT_RESET_REASON_UNKNOWN: otPlatResetReason = 7;
14749pub const OT_PLAT_RESET_REASON_WATCHDOG: otPlatResetReason = 8;
14750pub const OT_PLAT_RESET_REASON_COUNT: otPlatResetReason = 9;
14751#[doc = " Enumeration of possible reset reason codes.\n\n These are in the same order as the Spinel reset reason codes."]
14752pub type otPlatResetReason = ::std::os::raw::c_uint;
14753unsafe extern "C" {
14754 #[doc = " Returns the reason for the last platform reset.\n\n @param[in] aInstance The OpenThread instance structure."]
14755 pub fn otPlatGetResetReason(aInstance: *mut otInstance) -> otPlatResetReason;
14756}
14757unsafe extern "C" {
14758 #[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."]
14759 pub fn otPlatAssertFail(
14760 aFilename: *const ::std::os::raw::c_char,
14761 aLineNumber: ::std::os::raw::c_int,
14762 );
14763}
14764unsafe extern "C" {
14765 #[doc = " Performs a platform specific operation to wake the host MCU.\n This is used only for NCP configurations."]
14766 pub fn otPlatWakeHost();
14767}
14768#[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."]
14769pub const OT_PLAT_MCU_POWER_STATE_ON: otPlatMcuPowerState = 0;
14770#[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."]
14771pub const OT_PLAT_MCU_POWER_STATE_LOW_POWER: otPlatMcuPowerState = 1;
14772#[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."]
14773pub const OT_PLAT_MCU_POWER_STATE_OFF: otPlatMcuPowerState = 2;
14774#[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`."]
14775pub type otPlatMcuPowerState = ::std::os::raw::c_uint;
14776unsafe extern "C" {
14777 #[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."]
14778 pub fn otPlatSetMcuPowerState(
14779 aInstance: *mut otInstance,
14780 aState: otPlatMcuPowerState,
14781 ) -> otError;
14782}
14783unsafe extern "C" {
14784 #[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."]
14785 pub fn otPlatGetMcuPowerState(aInstance: *mut otInstance) -> otPlatMcuPowerState;
14786}
14787unsafe extern "C" {
14788 #[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"]
14789 pub fn otPlatLogCrashDump() -> otError;
14790}
14791unsafe extern "C" {
14792 #[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."]
14793 pub fn otPlatOtnsStatus(aStatus: *const ::std::os::raw::c_char);
14794}
14795#[doc = "< Active Operational Dataset."]
14796pub const OT_SETTINGS_KEY_ACTIVE_DATASET: _bindgen_ty_11 = 1;
14797#[doc = "< Pending Operational Dataset."]
14798pub const OT_SETTINGS_KEY_PENDING_DATASET: _bindgen_ty_11 = 2;
14799#[doc = "< Thread network information."]
14800pub const OT_SETTINGS_KEY_NETWORK_INFO: _bindgen_ty_11 = 3;
14801#[doc = "< Parent information."]
14802pub const OT_SETTINGS_KEY_PARENT_INFO: _bindgen_ty_11 = 4;
14803#[doc = "< Child information."]
14804pub const OT_SETTINGS_KEY_CHILD_INFO: _bindgen_ty_11 = 5;
14805#[doc = "< SLAAC key to generate semantically opaque IID."]
14806pub const OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY: _bindgen_ty_11 = 7;
14807#[doc = "< Duplicate Address Detection (DAD) information."]
14808pub const OT_SETTINGS_KEY_DAD_INFO: _bindgen_ty_11 = 8;
14809#[doc = "< SRP client ECDSA public/private key pair."]
14810pub const OT_SETTINGS_KEY_SRP_ECDSA_KEY: _bindgen_ty_11 = 11;
14811#[doc = "< The SRP client info (selected SRP server address)."]
14812pub const OT_SETTINGS_KEY_SRP_CLIENT_INFO: _bindgen_ty_11 = 12;
14813#[doc = "< The SRP server info (UDP port)."]
14814pub const OT_SETTINGS_KEY_SRP_SERVER_INFO: _bindgen_ty_11 = 13;
14815#[doc = "< BR ULA prefix."]
14816pub const OT_SETTINGS_KEY_BR_ULA_PREFIX: _bindgen_ty_11 = 15;
14817#[doc = "< BR local on-link prefixes."]
14818pub const OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES: _bindgen_ty_11 = 16;
14819#[doc = "< Unique Border Agent/Router ID."]
14820pub const OT_SETTINGS_KEY_BORDER_AGENT_ID: _bindgen_ty_11 = 17;
14821#[doc = "< TCAT Commissioner certificate"]
14822pub const OT_SETTINGS_KEY_TCAT_COMMR_CERT: _bindgen_ty_11 = 18;
14823pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MIN: _bindgen_ty_11 = 32768;
14824pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MAX: _bindgen_ty_11 = 65535;
14825#[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()`."]
14826pub type _bindgen_ty_11 = ::std::os::raw::c_uint;
14827unsafe extern "C" {
14828 #[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."]
14829 pub fn otPlatSettingsInit(
14830 aInstance: *mut otInstance,
14831 aSensitiveKeys: *const u16,
14832 aSensitiveKeysLength: u16,
14833 );
14834}
14835unsafe extern "C" {
14836 #[doc = " Performs any de-initialization for the settings subsystem, if necessary.\n\n @param[in] aInstance The OpenThread instance structure."]
14837 pub fn otPlatSettingsDeinit(aInstance: *mut otInstance);
14838}
14839unsafe extern "C" {
14840 #[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."]
14841 pub fn otPlatSettingsGet(
14842 aInstance: *mut otInstance,
14843 aKey: u16,
14844 aIndex: ::std::os::raw::c_int,
14845 aValue: *mut u8,
14846 aValueLength: *mut u16,
14847 ) -> otError;
14848}
14849unsafe extern "C" {
14850 #[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."]
14851 pub fn otPlatSettingsSet(
14852 aInstance: *mut otInstance,
14853 aKey: u16,
14854 aValue: *const u8,
14855 aValueLength: u16,
14856 ) -> otError;
14857}
14858unsafe extern "C" {
14859 #[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."]
14860 pub fn otPlatSettingsAdd(
14861 aInstance: *mut otInstance,
14862 aKey: u16,
14863 aValue: *const u8,
14864 aValueLength: u16,
14865 ) -> otError;
14866}
14867unsafe extern "C" {
14868 #[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."]
14869 pub fn otPlatSettingsDelete(
14870 aInstance: *mut otInstance,
14871 aKey: u16,
14872 aIndex: ::std::os::raw::c_int,
14873 ) -> otError;
14874}
14875unsafe extern "C" {
14876 #[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."]
14877 pub fn otPlatSettingsWipe(aInstance: *mut otInstance);
14878}
14879#[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."]
14880pub type otPlatSpiSlaveTransactionCompleteCallback = ::std::option::Option<
14881 unsafe extern "C" fn(
14882 aContext: *mut ::std::os::raw::c_void,
14883 aOutputBuf: *mut u8,
14884 aOutputBufLen: u16,
14885 aInputBuf: *mut u8,
14886 aInputBufLen: u16,
14887 aTransactionLength: u16,
14888 ) -> bool,
14889>;
14890#[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()`."]
14891pub type otPlatSpiSlaveTransactionProcessCallback =
14892 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
14893unsafe extern "C" {
14894 #[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."]
14895 pub fn otPlatSpiSlaveEnable(
14896 aCompleteCallback: otPlatSpiSlaveTransactionCompleteCallback,
14897 aProcessCallback: otPlatSpiSlaveTransactionProcessCallback,
14898 aContext: *mut ::std::os::raw::c_void,
14899 ) -> otError;
14900}
14901unsafe extern "C" {
14902 #[doc = " Shutdown and disable the SPI slave interface."]
14903 pub fn otPlatSpiSlaveDisable();
14904}
14905unsafe extern "C" {
14906 #[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."]
14907 pub fn otPlatSpiSlavePrepareTransaction(
14908 aOutputBuf: *mut u8,
14909 aOutputBufLen: u16,
14910 aInputBuf: *mut u8,
14911 aInputBufLen: u16,
14912 aRequestTransactionFlag: bool,
14913 ) -> otError;
14914}
14915unsafe extern "C" {
14916 #[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."]
14917 pub fn otPlatTimeGet() -> u64;
14918}
14919unsafe extern "C" {
14920 #[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."]
14921 pub fn otPlatTimeGetXtalAccuracy() -> u16;
14922}
14923unsafe extern "C" {
14924 #[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."]
14925 pub fn otPlatTrelEnable(aInstance: *mut otInstance, aUdpPort: *mut u16);
14926}
14927unsafe extern "C" {
14928 #[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."]
14929 pub fn otPlatTrelDisable(aInstance: *mut otInstance);
14930}
14931#[doc = " Represents a TREL peer info discovered using DNS-SD browse on the service name \"_trel._udp\"."]
14932#[repr(C)]
14933#[derive(Copy, Clone)]
14934pub struct otPlatTrelPeerInfo {
14935 #[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."]
14936 pub mRemoved: bool,
14937 #[doc = " The TXT record data (encoded as specified by DNS-SD) from the SRV record of the discovered TREL peer service\n instance."]
14938 pub mTxtData: *const u8,
14939 #[doc = "< Number of bytes in @p mTxtData buffer."]
14940 pub mTxtLength: u16,
14941 #[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."]
14942 pub mSockAddr: otSockAddr,
14943}
14944impl Default for otPlatTrelPeerInfo {
14945 fn default() -> Self {
14946 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14947 unsafe {
14948 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14949 s.assume_init()
14950 }
14951 }
14952}
14953unsafe extern "C" {
14954 #[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."]
14955 pub fn otPlatTrelHandleDiscoveredPeerInfo(
14956 aInstance: *mut otInstance,
14957 aInfo: *const otPlatTrelPeerInfo,
14958 );
14959}
14960unsafe extern "C" {
14961 #[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)."]
14962 pub fn otPlatTrelNotifyPeerSocketAddressDifference(
14963 aInstance: *mut otInstance,
14964 aPeerSockAddr: *const otSockAddr,
14965 aRxSockAddr: *const otSockAddr,
14966 );
14967}
14968unsafe extern "C" {
14969 #[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)."]
14970 pub fn otPlatTrelRegisterService(
14971 aInstance: *mut otInstance,
14972 aPort: u16,
14973 aTxtData: *const u8,
14974 aTxtLength: u8,
14975 );
14976}
14977unsafe extern "C" {
14978 #[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."]
14979 pub fn otPlatTrelSend(
14980 aInstance: *mut otInstance,
14981 aUdpPayload: *const u8,
14982 aUdpPayloadLen: u16,
14983 aDestSockAddr: *const otSockAddr,
14984 );
14985}
14986unsafe extern "C" {
14987 #[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."]
14988 pub fn otPlatTrelHandleReceived(
14989 aInstance: *mut otInstance,
14990 aBuffer: *mut u8,
14991 aLength: u16,
14992 aSenderAddr: *const otSockAddr,
14993 );
14994}
14995#[doc = " Represents a group of TREL related counters in the platform layer."]
14996#[repr(C)]
14997#[derive(Debug, Default, Copy, Clone)]
14998pub struct otPlatTrelCounters {
14999 #[doc = "< Number of packets successfully transmitted through TREL."]
15000 pub mTxPackets: u64,
15001 #[doc = "< Sum of size of packets successfully transmitted through TREL."]
15002 pub mTxBytes: u64,
15003 #[doc = "< Number of packet transmission failures through TREL."]
15004 pub mTxFailure: u64,
15005 #[doc = "< Number of packets received through TREL."]
15006 pub mRxPackets: u64,
15007 #[doc = "< Sum of size of packets received through TREL."]
15008 pub mRxBytes: u64,
15009}
15010unsafe extern "C" {
15011 #[doc = " Gets the pointer to the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
15012 pub fn otPlatTrelGetCounters(aInstance: *mut otInstance) -> *const otPlatTrelCounters;
15013}
15014unsafe extern "C" {
15015 #[doc = " Resets the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
15016 pub fn otPlatTrelResetCounters(aInstance: *mut otInstance);
15017}
15018#[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."]
15019pub type otUdpHandler = ::std::option::Option<
15020 unsafe extern "C" fn(
15021 aContext: *mut ::std::os::raw::c_void,
15022 aMessage: *const otMessage,
15023 aMessageInfo: *const otMessageInfo,
15024 ) -> bool,
15025>;
15026#[doc = " Represents a UDP receiver."]
15027#[repr(C)]
15028#[derive(Debug, Copy, Clone)]
15029pub struct otUdpReceiver {
15030 #[doc = "< A pointer to the next UDP receiver (internal use only)."]
15031 pub mNext: *mut otUdpReceiver,
15032 #[doc = "< A function pointer to the receiver callback."]
15033 pub mHandler: otUdpHandler,
15034 #[doc = "< A pointer to application-specific context."]
15035 pub mContext: *mut ::std::os::raw::c_void,
15036}
15037impl Default for otUdpReceiver {
15038 fn default() -> Self {
15039 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15040 unsafe {
15041 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15042 s.assume_init()
15043 }
15044 }
15045}
15046unsafe extern "C" {
15047 #[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."]
15048 pub fn otUdpAddReceiver(
15049 aInstance: *mut otInstance,
15050 aUdpReceiver: *mut otUdpReceiver,
15051 ) -> otError;
15052}
15053unsafe extern "C" {
15054 #[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."]
15055 pub fn otUdpRemoveReceiver(
15056 aInstance: *mut otInstance,
15057 aUdpReceiver: *mut otUdpReceiver,
15058 ) -> otError;
15059}
15060unsafe extern "C" {
15061 #[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."]
15062 pub fn otUdpSendDatagram(
15063 aInstance: *mut otInstance,
15064 aMessage: *mut otMessage,
15065 aMessageInfo: *mut otMessageInfo,
15066 ) -> otError;
15067}
15068#[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."]
15069pub type otUdpReceive = ::std::option::Option<
15070 unsafe extern "C" fn(
15071 aContext: *mut ::std::os::raw::c_void,
15072 aMessage: *mut otMessage,
15073 aMessageInfo: *const otMessageInfo,
15074 ),
15075>;
15076#[doc = "< Unspecified network interface."]
15077pub const OT_NETIF_UNSPECIFIED: otNetifIdentifier = 0;
15078#[doc = "< The host Thread interface - allow use of platform UDP."]
15079pub const OT_NETIF_THREAD_HOST: otNetifIdentifier = 1;
15080#[doc = "< The internal Thread interface (within OpenThread) - do not use platform UDP."]
15081pub const OT_NETIF_THREAD_INTERNAL: otNetifIdentifier = 2;
15082#[doc = "< The Backbone interface."]
15083pub const OT_NETIF_BACKBONE: otNetifIdentifier = 3;
15084#[doc = " Defines the OpenThread network interface identifiers."]
15085pub type otNetifIdentifier = ::std::os::raw::c_uint;
15086#[doc = " Represents a UDP socket."]
15087#[repr(C)]
15088#[derive(Copy, Clone)]
15089pub struct otUdpSocket {
15090 #[doc = "< The local IPv6 socket address."]
15091 pub mSockName: otSockAddr,
15092 #[doc = "< The peer IPv6 socket address."]
15093 pub mPeerName: otSockAddr,
15094 #[doc = "< A function pointer to the application callback."]
15095 pub mHandler: otUdpReceive,
15096 #[doc = "< A pointer to application-specific context."]
15097 pub mContext: *mut ::std::os::raw::c_void,
15098 #[doc = "< A handle to platform's UDP."]
15099 pub mHandle: *mut ::std::os::raw::c_void,
15100 #[doc = "< A pointer to the next UDP socket (internal use only)."]
15101 pub mNext: *mut otUdpSocket,
15102 #[doc = "< The network interface identifier."]
15103 pub mNetifId: otNetifIdentifier,
15104}
15105impl Default for otUdpSocket {
15106 fn default() -> Self {
15107 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15108 unsafe {
15109 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15110 s.assume_init()
15111 }
15112 }
15113}
15114unsafe extern "C" {
15115 #[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"]
15116 pub fn otUdpNewMessage(
15117 aInstance: *mut otInstance,
15118 aSettings: *const otMessageSettings,
15119 ) -> *mut otMessage;
15120}
15121unsafe extern "C" {
15122 #[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."]
15123 pub fn otUdpOpen(
15124 aInstance: *mut otInstance,
15125 aSocket: *mut otUdpSocket,
15126 aCallback: otUdpReceive,
15127 aContext: *mut ::std::os::raw::c_void,
15128 ) -> otError;
15129}
15130unsafe extern "C" {
15131 #[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."]
15132 pub fn otUdpIsOpen(aInstance: *mut otInstance, aSocket: *const otUdpSocket) -> bool;
15133}
15134unsafe extern "C" {
15135 #[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."]
15136 pub fn otUdpClose(aInstance: *mut otInstance, aSocket: *mut otUdpSocket) -> otError;
15137}
15138unsafe extern "C" {
15139 #[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."]
15140 pub fn otUdpBind(
15141 aInstance: *mut otInstance,
15142 aSocket: *mut otUdpSocket,
15143 aSockName: *const otSockAddr,
15144 aNetif: otNetifIdentifier,
15145 ) -> otError;
15146}
15147unsafe extern "C" {
15148 #[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."]
15149 pub fn otUdpConnect(
15150 aInstance: *mut otInstance,
15151 aSocket: *mut otUdpSocket,
15152 aSockName: *const otSockAddr,
15153 ) -> otError;
15154}
15155unsafe extern "C" {
15156 #[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."]
15157 pub fn otUdpSend(
15158 aInstance: *mut otInstance,
15159 aSocket: *mut otUdpSocket,
15160 aMessage: *mut otMessage,
15161 aMessageInfo: *const otMessageInfo,
15162 ) -> otError;
15163}
15164unsafe extern "C" {
15165 #[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."]
15166 pub fn otUdpGetSockets(aInstance: *mut otInstance) -> *mut otUdpSocket;
15167}
15168#[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."]
15169pub type otUdpForwarder = ::std::option::Option<
15170 unsafe extern "C" fn(
15171 aMessage: *mut otMessage,
15172 aPeerPort: u16,
15173 aPeerAddr: *mut otIp6Address,
15174 aSockPort: u16,
15175 aContext: *mut ::std::os::raw::c_void,
15176 ),
15177>;
15178unsafe extern "C" {
15179 #[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."]
15180 pub fn otUdpForwardSetForwarder(
15181 aInstance: *mut otInstance,
15182 aForwarder: otUdpForwarder,
15183 aContext: *mut ::std::os::raw::c_void,
15184 );
15185}
15186unsafe extern "C" {
15187 #[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."]
15188 pub fn otUdpForwardReceive(
15189 aInstance: *mut otInstance,
15190 aMessage: *mut otMessage,
15191 aPeerPort: u16,
15192 aPeerAddr: *const otIp6Address,
15193 aSockPort: u16,
15194 );
15195}
15196unsafe extern "C" {
15197 #[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)."]
15198 pub fn otUdpIsPortInUse(aInstance: *mut otInstance, port: u16) -> bool;
15199}
15200unsafe extern "C" {
15201 #[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."]
15202 pub fn otPlatUdpSocket(aUdpSocket: *mut otUdpSocket) -> otError;
15203}
15204unsafe extern "C" {
15205 #[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."]
15206 pub fn otPlatUdpClose(aUdpSocket: *mut otUdpSocket) -> otError;
15207}
15208unsafe extern "C" {
15209 #[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."]
15210 pub fn otPlatUdpBind(aUdpSocket: *mut otUdpSocket) -> otError;
15211}
15212unsafe extern "C" {
15213 #[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."]
15214 pub fn otPlatUdpBindToNetif(
15215 aUdpSocket: *mut otUdpSocket,
15216 aNetifIdentifier: otNetifIdentifier,
15217 ) -> otError;
15218}
15219unsafe extern "C" {
15220 #[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."]
15221 pub fn otPlatUdpConnect(aUdpSocket: *mut otUdpSocket) -> otError;
15222}
15223unsafe extern "C" {
15224 #[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."]
15225 pub fn otPlatUdpSend(
15226 aUdpSocket: *mut otUdpSocket,
15227 aMessage: *mut otMessage,
15228 aMessageInfo: *const otMessageInfo,
15229 ) -> otError;
15230}
15231unsafe extern "C" {
15232 #[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."]
15233 pub fn otPlatUdpJoinMulticastGroup(
15234 aUdpSocket: *mut otUdpSocket,
15235 aNetifIdentifier: otNetifIdentifier,
15236 aAddress: *const otIp6Address,
15237 ) -> otError;
15238}
15239unsafe extern "C" {
15240 #[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."]
15241 pub fn otPlatUdpLeaveMulticastGroup(
15242 aUdpSocket: *mut otUdpSocket,
15243 aNetifIdentifier: otNetifIdentifier,
15244 aAddress: *const otIp6Address,
15245 ) -> otError;
15246}
15247unsafe extern "C" {
15248 #[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)."]
15249 pub fn otRandomCryptoFillBuffer(aBuffer: *mut u8, aSize: u16) -> otError;
15250}
15251unsafe extern "C" {
15252 #[doc = " Generates and returns a random `uint32_t` value.\n\n @returns A random `uint32_t` value."]
15253 pub fn otRandomNonCryptoGetUint32() -> u32;
15254}
15255unsafe extern "C" {
15256 #[doc = " Generates and returns a random byte.\n\n @returns A random `uint8_t` value."]
15257 pub fn otRandomNonCryptoGetUint8() -> u8;
15258}
15259unsafe extern "C" {
15260 #[doc = " Generates and returns a random `uint16_t` value.\n\n @returns A random `uint16_t` value."]
15261 pub fn otRandomNonCryptoGetUint16() -> u16;
15262}
15263unsafe extern "C" {
15264 #[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)."]
15265 pub fn otRandomNonCryptoGetUint8InRange(aMin: u8, aMax: u8) -> u8;
15266}
15267unsafe extern "C" {
15268 #[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)."]
15269 pub fn otRandomNonCryptoGetUint16InRange(aMin: u16, aMax: u16) -> u16;
15270}
15271unsafe extern "C" {
15272 #[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)."]
15273 pub fn otRandomNonCryptoGetUint32InRange(aMin: u32, aMax: u32) -> u32;
15274}
15275unsafe extern "C" {
15276 #[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)."]
15277 pub fn otRandomNonCryptoFillBuffer(aBuffer: *mut u8, aSize: u16);
15278}
15279unsafe extern "C" {
15280 #[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."]
15281 pub fn otRandomNonCryptoAddJitter(aValue: u32, aJitter: u16) -> u32;
15282}
15283unsafe extern "C" {
15284 #[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."]
15285 pub fn otServerGetNetDataLocal(
15286 aInstance: *mut otInstance,
15287 aStable: bool,
15288 aData: *mut u8,
15289 aDataLength: *mut u8,
15290 ) -> otError;
15291}
15292unsafe extern "C" {
15293 #[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"]
15294 pub fn otServerAddService(
15295 aInstance: *mut otInstance,
15296 aConfig: *const otServiceConfig,
15297 ) -> otError;
15298}
15299unsafe extern "C" {
15300 #[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"]
15301 pub fn otServerRemoveService(
15302 aInstance: *mut otInstance,
15303 aEnterpriseNumber: u32,
15304 aServiceData: *const u8,
15305 aServiceDataLength: u8,
15306 ) -> otError;
15307}
15308unsafe extern "C" {
15309 #[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."]
15310 pub fn otServerGetNextService(
15311 aInstance: *mut otInstance,
15312 aIterator: *mut otNetworkDataIterator,
15313 aConfig: *mut otServiceConfig,
15314 ) -> otError;
15315}
15316unsafe extern "C" {
15317 #[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"]
15318 pub fn otServerRegister(aInstance: *mut otInstance) -> otError;
15319}
15320#[doc = " Implements SNTP Query parameters."]
15321#[repr(C)]
15322#[derive(Debug, Copy, Clone)]
15323pub struct otSntpQuery {
15324 #[doc = "< A reference to the message info related with SNTP Server."]
15325 pub mMessageInfo: *const otMessageInfo,
15326}
15327impl Default for otSntpQuery {
15328 fn default() -> Self {
15329 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15330 unsafe {
15331 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15332 s.assume_init()
15333 }
15334 }
15335}
15336#[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."]
15337pub type otSntpResponseHandler = ::std::option::Option<
15338 unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void, aTime: u64, aResult: otError),
15339>;
15340unsafe extern "C" {
15341 #[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."]
15342 pub fn otSntpClientQuery(
15343 aInstance: *mut otInstance,
15344 aQuery: *const otSntpQuery,
15345 aHandler: otSntpResponseHandler,
15346 aContext: *mut ::std::os::raw::c_void,
15347 ) -> otError;
15348}
15349unsafe extern "C" {
15350 #[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."]
15351 pub fn otSntpClientSetUnixEra(aInstance: *mut otInstance, aUnixEra: u32);
15352}
15353#[doc = "< Item to be added/registered."]
15354pub const OT_SRP_CLIENT_ITEM_STATE_TO_ADD: otSrpClientItemState = 0;
15355#[doc = "< Item is being added/registered."]
15356pub const OT_SRP_CLIENT_ITEM_STATE_ADDING: otSrpClientItemState = 1;
15357#[doc = "< Item to be refreshed (re-register to renew lease)."]
15358pub const OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: otSrpClientItemState = 2;
15359#[doc = "< Item is being refreshed."]
15360pub const OT_SRP_CLIENT_ITEM_STATE_REFRESHING: otSrpClientItemState = 3;
15361#[doc = "< Item to be removed."]
15362pub const OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: otSrpClientItemState = 4;
15363#[doc = "< Item is being removed."]
15364pub const OT_SRP_CLIENT_ITEM_STATE_REMOVING: otSrpClientItemState = 5;
15365#[doc = "< Item is registered with server."]
15366pub const OT_SRP_CLIENT_ITEM_STATE_REGISTERED: otSrpClientItemState = 6;
15367#[doc = "< Item is removed."]
15368pub const OT_SRP_CLIENT_ITEM_STATE_REMOVED: otSrpClientItemState = 7;
15369#[doc = " Specifies an SRP client item (service or host info) state."]
15370pub type otSrpClientItemState = ::std::os::raw::c_uint;
15371#[doc = " Represents an SRP client host info."]
15372#[repr(C)]
15373#[derive(Debug, Copy, Clone)]
15374pub struct otSrpClientHostInfo {
15375 #[doc = "< Host name (label) string (NULL if not yet set)."]
15376 pub mName: *const ::std::os::raw::c_char,
15377 #[doc = "< Array of host IPv6 addresses (NULL if not set or auto address is enabled)."]
15378 pub mAddresses: *const otIp6Address,
15379 #[doc = "< Number of IPv6 addresses in `mAddresses` array."]
15380 pub mNumAddresses: u8,
15381 #[doc = "< Indicates whether auto address mode is enabled or not."]
15382 pub mAutoAddress: bool,
15383 #[doc = "< Host info state."]
15384 pub mState: otSrpClientItemState,
15385}
15386impl Default for otSrpClientHostInfo {
15387 fn default() -> Self {
15388 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15389 unsafe {
15390 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15391 s.assume_init()
15392 }
15393 }
15394}
15395#[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."]
15396#[repr(C)]
15397#[derive(Debug, Copy, Clone)]
15398pub struct otSrpClientService {
15399 #[doc = "< The service labels (e.g., \"_mt._udp\", not the full domain name)."]
15400 pub mName: *const ::std::os::raw::c_char,
15401 #[doc = "< The service instance name label (not the full name)."]
15402 pub mInstanceName: *const ::std::os::raw::c_char,
15403 #[doc = "< Array of sub-type labels (must end with `NULL` or can be `NULL`)."]
15404 pub mSubTypeLabels: *const *const ::std::os::raw::c_char,
15405 #[doc = "< Array of TXT entries (`mNumTxtEntries` gives num of entries)."]
15406 pub mTxtEntries: *const otDnsTxtEntry,
15407 #[doc = "< The service port number."]
15408 pub mPort: u16,
15409 #[doc = "< The service priority."]
15410 pub mPriority: u16,
15411 #[doc = "< The service weight."]
15412 pub mWeight: u16,
15413 #[doc = "< Number of entries in the `mTxtEntries` array."]
15414 pub mNumTxtEntries: u8,
15415 #[doc = "< Service state (managed by OT core)."]
15416 pub mState: otSrpClientItemState,
15417 #[doc = "< Internal data (used by OT core)."]
15418 pub mData: u32,
15419 #[doc = "< Pointer to next entry in a linked-list (managed by OT core)."]
15420 pub mNext: *mut otSrpClientService,
15421 #[doc = "< Desired lease interval in sec - zero to use default."]
15422 pub mLease: u32,
15423 #[doc = "< Desired key lease interval in sec - zero to use default."]
15424 pub mKeyLease: u32,
15425}
15426impl Default for otSrpClientService {
15427 fn default() -> Self {
15428 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15429 unsafe {
15430 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15431 s.assume_init()
15432 }
15433 }
15434}
15435#[doc = " Represents the SRP client counters."]
15436#[repr(C)]
15437#[derive(Debug, Default, Copy, Clone)]
15438pub struct otSrpClientCounters {
15439 #[doc = "< Cumulative number of milliseconds spent in the registered state."]
15440 pub mRegisteredTime: u64,
15441 #[doc = "< Subset of `mRegisteredTime` while registered with an anycast server."]
15442 pub mAnycastAvailableTime: u64,
15443 #[doc = "< Subset of `mRegisteredTime` while registered with a unicast server."]
15444 pub mUnicastAvailableTime: u64,
15445 #[doc = "< Cumulative milliseconds since last counter reset, across all client states (including\n< stopped/paused)."]
15446 pub mTrackedTime: u64,
15447 #[doc = "< Number of SRP update transmissions (wire-level; includes retransmissions)."]
15448 pub mTxUpdates: u32,
15449 #[doc = "< Number of fresh SRP update transactions started."]
15450 pub mUpdateAttempts: u32,
15451 #[doc = "< Number of transactions completed with a successful server response."]
15452 pub mSuccess: u32,
15453 #[doc = "< Number of transactions completed with a name/record conflict response."]
15454 pub mRejectedDuplicate: u32,
15455 #[doc = "< Number of transactions completed with a security/policy/algorithm response."]
15456 pub mRejectedSecurity: u32,
15457 #[doc = "< Number of transactions completed with any other server error response."]
15458 pub mRejectedOther: u32,
15459 #[doc = "< Number of retransmission timers that expired before a response arrived."]
15460 pub mTimeouts: u32,
15461 #[doc = "< Number of host-address change events that triggered an SRP re-registration."]
15462 pub mHostAddressChanges: u32,
15463 #[doc = "< Number of auto-start server (re-)selections that triggered an SRP update."]
15464 pub mServerChanges: u32,
15465 #[doc = "< Number of times a service was successfully added."]
15466 pub mServiceAdds: u32,
15467 #[doc = "< Number of times a service was removed (sends an unregister to server)."]
15468 pub mServiceRemoves: u32,
15469 #[doc = "< Number of times a service was cleared (local-only, no server message)."]
15470 pub mServiceClears: u32,
15471 #[doc = "< Number of times the host and all services were removed (notifies server)."]
15472 pub mHostAndServicesRemoves: u32,
15473 #[doc = "< Number of times the host and all services were cleared (local-only)."]
15474 pub mHostAndServicesClears: u32,
15475 #[doc = "< Cumulative UDP payload bytes of transmitted SRP messages."]
15476 pub mTxTotalBytes: u32,
15477}
15478#[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)."]
15479pub type otSrpClientCallback = ::std::option::Option<
15480 unsafe extern "C" fn(
15481 aError: otError,
15482 aHostInfo: *const otSrpClientHostInfo,
15483 aServices: *const otSrpClientService,
15484 aRemovedServices: *const otSrpClientService,
15485 aContext: *mut ::std::os::raw::c_void,
15486 ),
15487>;
15488#[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)."]
15489pub type otSrpClientAutoStartCallback = ::std::option::Option<
15490 unsafe extern "C" fn(aServerSockAddr: *const otSockAddr, aContext: *mut ::std::os::raw::c_void),
15491>;
15492unsafe extern "C" {
15493 #[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."]
15494 pub fn otSrpClientStart(
15495 aInstance: *mut otInstance,
15496 aServerSockAddr: *const otSockAddr,
15497 ) -> otError;
15498}
15499unsafe extern "C" {
15500 #[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."]
15501 pub fn otSrpClientStop(aInstance: *mut otInstance);
15502}
15503unsafe extern "C" {
15504 #[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."]
15505 pub fn otSrpClientIsRunning(aInstance: *mut otInstance) -> bool;
15506}
15507unsafe extern "C" {
15508 #[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)."]
15509 pub fn otSrpClientGetServerAddress(aInstance: *mut otInstance) -> *const otSockAddr;
15510}
15511unsafe extern "C" {
15512 #[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."]
15513 pub fn otSrpClientSetCallback(
15514 aInstance: *mut otInstance,
15515 aCallback: otSrpClientCallback,
15516 aContext: *mut ::std::os::raw::c_void,
15517 );
15518}
15519unsafe extern "C" {
15520 #[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."]
15521 pub fn otSrpClientEnableAutoStartMode(
15522 aInstance: *mut otInstance,
15523 aCallback: otSrpClientAutoStartCallback,
15524 aContext: *mut ::std::os::raw::c_void,
15525 );
15526}
15527unsafe extern "C" {
15528 #[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."]
15529 pub fn otSrpClientDisableAutoStartMode(aInstance: *mut otInstance);
15530}
15531unsafe extern "C" {
15532 #[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."]
15533 pub fn otSrpClientIsAutoStartModeEnabled(aInstance: *mut otInstance) -> bool;
15534}
15535unsafe extern "C" {
15536 #[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)."]
15537 pub fn otSrpClientGetTtl(aInstance: *mut otInstance) -> u32;
15538}
15539unsafe extern "C" {
15540 #[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."]
15541 pub fn otSrpClientSetTtl(aInstance: *mut otInstance, aTtl: u32);
15542}
15543unsafe extern "C" {
15544 #[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)."]
15545 pub fn otSrpClientGetLeaseInterval(aInstance: *mut otInstance) -> u32;
15546}
15547unsafe extern "C" {
15548 #[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."]
15549 pub fn otSrpClientSetLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15550}
15551unsafe extern "C" {
15552 #[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)."]
15553 pub fn otSrpClientGetKeyLeaseInterval(aInstance: *mut otInstance) -> u32;
15554}
15555unsafe extern "C" {
15556 #[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."]
15557 pub fn otSrpClientSetKeyLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
15558}
15559unsafe extern "C" {
15560 #[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."]
15561 pub fn otSrpClientGetHostInfo(aInstance: *mut otInstance) -> *const otSrpClientHostInfo;
15562}
15563unsafe extern "C" {
15564 #[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."]
15565 pub fn otSrpClientSetHostName(
15566 aInstance: *mut otInstance,
15567 aName: *const ::std::os::raw::c_char,
15568 ) -> otError;
15569}
15570unsafe extern "C" {
15571 #[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."]
15572 pub fn otSrpClientEnableAutoHostAddress(aInstance: *mut otInstance) -> otError;
15573}
15574unsafe extern "C" {
15575 #[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."]
15576 pub fn otSrpClientSetHostAddresses(
15577 aInstance: *mut otInstance,
15578 aIp6Addresses: *const otIp6Address,
15579 aNumAddresses: u8,
15580 ) -> otError;
15581}
15582unsafe extern "C" {
15583 #[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`)."]
15584 pub fn otSrpClientAddService(
15585 aInstance: *mut otInstance,
15586 aService: *mut otSrpClientService,
15587 ) -> otError;
15588}
15589unsafe extern "C" {
15590 #[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."]
15591 pub fn otSrpClientRemoveService(
15592 aInstance: *mut otInstance,
15593 aService: *mut otSrpClientService,
15594 ) -> otError;
15595}
15596unsafe extern "C" {
15597 #[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."]
15598 pub fn otSrpClientClearService(
15599 aInstance: *mut otInstance,
15600 aService: *mut otSrpClientService,
15601 ) -> otError;
15602}
15603unsafe extern "C" {
15604 #[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."]
15605 pub fn otSrpClientGetServices(aInstance: *mut otInstance) -> *const otSrpClientService;
15606}
15607unsafe extern "C" {
15608 #[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."]
15609 pub fn otSrpClientRemoveHostAndServices(
15610 aInstance: *mut otInstance,
15611 aRemoveKeyLease: bool,
15612 aSendUnregToServer: bool,
15613 ) -> otError;
15614}
15615unsafe extern "C" {
15616 #[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."]
15617 pub fn otSrpClientClearHostAndServices(aInstance: *mut otInstance);
15618}
15619unsafe extern "C" {
15620 #[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."]
15621 pub fn otSrpClientGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15622}
15623unsafe extern "C" {
15624 #[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."]
15625 pub fn otSrpClientSetDomainName(
15626 aInstance: *mut otInstance,
15627 aName: *const ::std::os::raw::c_char,
15628 ) -> otError;
15629}
15630unsafe extern "C" {
15631 #[doc = " Converts a `otSrpClientItemState` to a string.\n\n @param[in] aItemState An item state.\n\n @returns A string representation of @p aItemState."]
15632 pub fn otSrpClientItemStateToString(
15633 aItemState: otSrpClientItemState,
15634 ) -> *const ::std::os::raw::c_char;
15635}
15636unsafe extern "C" {
15637 #[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."]
15638 pub fn otSrpClientSetServiceKeyRecordEnabled(aInstance: *mut otInstance, aEnabled: bool);
15639}
15640unsafe extern "C" {
15641 #[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."]
15642 pub fn otSrpClientIsServiceKeyRecordEnabled(aInstance: *mut otInstance) -> bool;
15643}
15644unsafe extern "C" {
15645 #[doc = " Gets the SRP client counters.\n\n Requires `OPENTHREAD_CONFIG_SRP_CLIENT_COUNTERS_ENABLE` to be enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the SRP client counters."]
15646 pub fn otSrpClientGetCounters(aInstance: *mut otInstance) -> *const otSrpClientCounters;
15647}
15648unsafe extern "C" {
15649 #[doc = " Resets the SRP client counters.\n\n Requires `OPENTHREAD_CONFIG_SRP_CLIENT_COUNTERS_ENABLE` to be enabled.\n\n All event counters are cleared and the time-tracking accumulators are restarted.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
15650 pub fn otSrpClientResetCounters(aInstance: *mut otInstance);
15651}
15652#[doc = " Represents a SRP client service pool entry."]
15653#[repr(C)]
15654#[derive(Debug, Copy, Clone)]
15655pub struct otSrpClientBuffersServiceEntry {
15656 #[doc = "< The SRP client service structure."]
15657 pub mService: otSrpClientService,
15658 #[doc = "< The SRP client TXT entry."]
15659 pub mTxtEntry: otDnsTxtEntry,
15660}
15661impl Default for otSrpClientBuffersServiceEntry {
15662 fn default() -> Self {
15663 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15664 unsafe {
15665 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15666 s.assume_init()
15667 }
15668 }
15669}
15670unsafe extern "C" {
15671 #[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."]
15672 pub fn otSrpClientBuffersGetHostNameString(
15673 aInstance: *mut otInstance,
15674 aSize: *mut u16,
15675 ) -> *mut ::std::os::raw::c_char;
15676}
15677unsafe extern "C" {
15678 #[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)."]
15679 pub fn otSrpClientBuffersGetHostAddressesArray(
15680 aInstance: *mut otInstance,
15681 aArrayLength: *mut u8,
15682 ) -> *mut otIp6Address;
15683}
15684unsafe extern "C" {
15685 #[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."]
15686 pub fn otSrpClientBuffersAllocateService(
15687 aInstance: *mut otInstance,
15688 ) -> *mut otSrpClientBuffersServiceEntry;
15689}
15690unsafe extern "C" {
15691 #[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)."]
15692 pub fn otSrpClientBuffersFreeService(
15693 aInstance: *mut otInstance,
15694 aService: *mut otSrpClientBuffersServiceEntry,
15695 );
15696}
15697unsafe extern "C" {
15698 #[doc = " Frees all previously allocated service entries.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
15699 pub fn otSrpClientBuffersFreeAllServices(aInstance: *mut otInstance);
15700}
15701unsafe extern "C" {
15702 #[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."]
15703 pub fn otSrpClientBuffersGetServiceEntryServiceNameString(
15704 aEntry: *mut otSrpClientBuffersServiceEntry,
15705 aSize: *mut u16,
15706 ) -> *mut ::std::os::raw::c_char;
15707}
15708unsafe extern "C" {
15709 #[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."]
15710 pub fn otSrpClientBuffersGetServiceEntryInstanceNameString(
15711 aEntry: *mut otSrpClientBuffersServiceEntry,
15712 aSize: *mut u16,
15713 ) -> *mut ::std::os::raw::c_char;
15714}
15715unsafe extern "C" {
15716 #[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."]
15717 pub fn otSrpClientBuffersGetServiceEntryTxtBuffer(
15718 aEntry: *mut otSrpClientBuffersServiceEntry,
15719 aSize: *mut u16,
15720 ) -> *mut u8;
15721}
15722unsafe extern "C" {
15723 #[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."]
15724 pub fn otSrpClientBuffersGetSubTypeLabelsArray(
15725 aEntry: *mut otSrpClientBuffersServiceEntry,
15726 aArrayLength: *mut u16,
15727 ) -> *mut *const ::std::os::raw::c_char;
15728}
15729#[repr(C)]
15730#[derive(Debug, Copy, Clone)]
15731pub struct otSrpServerHost {
15732 _unused: [u8; 0],
15733}
15734#[repr(C)]
15735#[derive(Debug, Copy, Clone)]
15736pub struct otSrpServerService {
15737 _unused: [u8; 0],
15738}
15739#[doc = " The ID of a SRP service update transaction on the SRP Server."]
15740pub type otSrpServerServiceUpdateId = u32;
15741#[doc = "< The SRP server is disabled."]
15742pub const OT_SRP_SERVER_STATE_DISABLED: otSrpServerState = 0;
15743#[doc = "< The SRP server is enabled and running."]
15744pub const OT_SRP_SERVER_STATE_RUNNING: otSrpServerState = 1;
15745#[doc = "< The SRP server is enabled but stopped."]
15746pub const OT_SRP_SERVER_STATE_STOPPED: otSrpServerState = 2;
15747#[doc = " Represents the state of the SRP server."]
15748pub type otSrpServerState = ::std::os::raw::c_uint;
15749#[doc = "< Unicast address mode. Use Network Data publisher."]
15750pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST: otSrpServerAddressMode = 0;
15751#[doc = "< Anycast address mode. Use Network Data publisher"]
15752pub const OT_SRP_SERVER_ADDRESS_MODE_ANYCAST: otSrpServerAddressMode = 1;
15753#[doc = "< Unicast address mode. Immediately force add to Network Data."]
15754pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD: otSrpServerAddressMode = 2;
15755#[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."]
15756pub type otSrpServerAddressMode = ::std::os::raw::c_uint;
15757#[doc = " Includes SRP server TTL configurations."]
15758#[repr(C)]
15759#[derive(Debug, Default, Copy, Clone)]
15760pub struct otSrpServerTtlConfig {
15761 #[doc = "< The minimum TTL in seconds."]
15762 pub mMinTtl: u32,
15763 #[doc = "< The maximum TTL in seconds."]
15764 pub mMaxTtl: u32,
15765}
15766#[doc = " Includes SRP server LEASE and KEY-LEASE configurations."]
15767#[repr(C)]
15768#[derive(Debug, Default, Copy, Clone)]
15769pub struct otSrpServerLeaseConfig {
15770 #[doc = "< The minimum LEASE interval in seconds."]
15771 pub mMinLease: u32,
15772 #[doc = "< The maximum LEASE interval in seconds."]
15773 pub mMaxLease: u32,
15774 #[doc = "< The minimum KEY-LEASE interval in seconds."]
15775 pub mMinKeyLease: u32,
15776 #[doc = "< The maximum KEY-LEASE interval in seconds."]
15777 pub mMaxKeyLease: u32,
15778}
15779#[doc = " Includes SRP server lease information of a host/service."]
15780#[repr(C)]
15781#[derive(Debug, Default, Copy, Clone)]
15782pub struct otSrpServerLeaseInfo {
15783 #[doc = "< The lease time of a host/service in milliseconds."]
15784 pub mLease: u32,
15785 #[doc = "< The key lease time of a host/service in milliseconds."]
15786 pub mKeyLease: u32,
15787 #[doc = "< The remaining lease time of the host/service in milliseconds."]
15788 pub mRemainingLease: u32,
15789 #[doc = "< The remaining key lease time of a host/service in milliseconds."]
15790 pub mRemainingKeyLease: u32,
15791}
15792#[doc = " Includes the statistics of SRP server responses."]
15793#[repr(C)]
15794#[derive(Debug, Default, Copy, Clone)]
15795pub struct otSrpServerResponseCounters {
15796 #[doc = "< The number of successful responses."]
15797 pub mSuccess: u32,
15798 #[doc = "< The number of server failure responses."]
15799 pub mServerFailure: u32,
15800 #[doc = "< The number of format error responses."]
15801 pub mFormatError: u32,
15802 #[doc = "< The number of 'name exists' responses."]
15803 pub mNameExists: u32,
15804 #[doc = "< The number of refused responses."]
15805 pub mRefused: u32,
15806 #[doc = "< The number of other responses."]
15807 pub mOther: u32,
15808}
15809unsafe extern "C" {
15810 #[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."]
15811 pub fn otSrpServerGetDomain(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
15812}
15813unsafe extern "C" {
15814 #[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."]
15815 pub fn otSrpServerSetDomain(
15816 aInstance: *mut otInstance,
15817 aDomain: *const ::std::os::raw::c_char,
15818 ) -> otError;
15819}
15820unsafe extern "C" {
15821 #[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."]
15822 pub fn otSrpServerGetState(aInstance: *mut otInstance) -> otSrpServerState;
15823}
15824unsafe extern "C" {
15825 #[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."]
15826 pub fn otSrpServerGetPort(aInstance: *mut otInstance) -> u16;
15827}
15828unsafe extern "C" {
15829 #[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."]
15830 pub fn otSrpServerGetAddressMode(aInstance: *mut otInstance) -> otSrpServerAddressMode;
15831}
15832unsafe extern "C" {
15833 #[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."]
15834 pub fn otSrpServerSetAddressMode(
15835 aInstance: *mut otInstance,
15836 aMode: otSrpServerAddressMode,
15837 ) -> otError;
15838}
15839unsafe extern "C" {
15840 #[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."]
15841 pub fn otSrpServerGetAnycastModeSequenceNumber(aInstance: *mut otInstance) -> u8;
15842}
15843unsafe extern "C" {
15844 #[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."]
15845 pub fn otSrpServerSetAnycastModeSequenceNumber(
15846 aInstance: *mut otInstance,
15847 aSequenceNumber: u8,
15848 ) -> otError;
15849}
15850unsafe extern "C" {
15851 #[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."]
15852 pub fn otSrpServerSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
15853}
15854unsafe extern "C" {
15855 #[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."]
15856 pub fn otSrpServerSetAutoEnableMode(aInstance: *mut otInstance, aEnabled: bool);
15857}
15858unsafe extern "C" {
15859 #[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."]
15860 pub fn otSrpServerIsAutoEnableMode(aInstance: *mut otInstance) -> bool;
15861}
15862unsafe extern "C" {
15863 #[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)."]
15864 pub fn otSrpServerEnableFastStartMode(aInstance: *mut otInstance) -> otError;
15865}
15866unsafe extern "C" {
15867 #[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."]
15868 pub fn otSrpServerIsFastStartModeEnabled(aInstance: *mut otInstance) -> bool;
15869}
15870unsafe extern "C" {
15871 #[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."]
15872 pub fn otSrpServerGetTtlConfig(
15873 aInstance: *mut otInstance,
15874 aTtlConfig: *mut otSrpServerTtlConfig,
15875 );
15876}
15877unsafe extern "C" {
15878 #[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."]
15879 pub fn otSrpServerSetTtlConfig(
15880 aInstance: *mut otInstance,
15881 aTtlConfig: *const otSrpServerTtlConfig,
15882 ) -> otError;
15883}
15884unsafe extern "C" {
15885 #[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."]
15886 pub fn otSrpServerGetLeaseConfig(
15887 aInstance: *mut otInstance,
15888 aLeaseConfig: *mut otSrpServerLeaseConfig,
15889 );
15890}
15891unsafe extern "C" {
15892 #[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."]
15893 pub fn otSrpServerSetLeaseConfig(
15894 aInstance: *mut otInstance,
15895 aLeaseConfig: *const otSrpServerLeaseConfig,
15896 ) -> otError;
15897}
15898#[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"]
15899pub type otSrpServerServiceUpdateHandler = ::std::option::Option<
15900 unsafe extern "C" fn(
15901 aId: otSrpServerServiceUpdateId,
15902 aHost: *const otSrpServerHost,
15903 aTimeout: u32,
15904 aContext: *mut ::std::os::raw::c_void,
15905 ),
15906>;
15907unsafe extern "C" {
15908 #[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."]
15909 pub fn otSrpServerSetServiceUpdateHandler(
15910 aInstance: *mut otInstance,
15911 aServiceHandler: otSrpServerServiceUpdateHandler,
15912 aContext: *mut ::std::os::raw::c_void,
15913 );
15914}
15915unsafe extern "C" {
15916 #[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."]
15917 pub fn otSrpServerHandleServiceUpdateResult(
15918 aInstance: *mut otInstance,
15919 aId: otSrpServerServiceUpdateId,
15920 aError: otError,
15921 );
15922}
15923unsafe extern "C" {
15924 #[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."]
15925 pub fn otSrpServerGetNextHost(
15926 aInstance: *mut otInstance,
15927 aHost: *const otSrpServerHost,
15928 ) -> *const otSrpServerHost;
15929}
15930unsafe extern "C" {
15931 #[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."]
15932 pub fn otSrpServerGetResponseCounters(
15933 aInstance: *mut otInstance,
15934 ) -> *const otSrpServerResponseCounters;
15935}
15936unsafe extern "C" {
15937 #[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."]
15938 pub fn otSrpServerHostIsDeleted(aHost: *const otSrpServerHost) -> bool;
15939}
15940unsafe extern "C" {
15941 #[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."]
15942 pub fn otSrpServerHostGetFullName(
15943 aHost: *const otSrpServerHost,
15944 ) -> *const ::std::os::raw::c_char;
15945}
15946unsafe extern "C" {
15947 #[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."]
15948 pub fn otSrpServerHostMatchesFullName(
15949 aHost: *const otSrpServerHost,
15950 aFullName: *const ::std::os::raw::c_char,
15951 ) -> bool;
15952}
15953unsafe extern "C" {
15954 #[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."]
15955 pub fn otSrpServerHostGetAddresses(
15956 aHost: *const otSrpServerHost,
15957 aAddressesNum: *mut u8,
15958 ) -> *const otIp6Address;
15959}
15960unsafe extern "C" {
15961 #[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."]
15962 pub fn otSrpServerHostGetLeaseInfo(
15963 aHost: *const otSrpServerHost,
15964 aLeaseInfo: *mut otSrpServerLeaseInfo,
15965 );
15966}
15967unsafe extern "C" {
15968 #[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."]
15969 pub fn otSrpServerHostGetNextService(
15970 aHost: *const otSrpServerHost,
15971 aService: *const otSrpServerService,
15972 ) -> *const otSrpServerService;
15973}
15974unsafe extern "C" {
15975 #[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."]
15976 pub fn otSrpServerServiceIsDeleted(aService: *const otSrpServerService) -> bool;
15977}
15978unsafe extern "C" {
15979 #[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."]
15980 pub fn otSrpServerServiceGetInstanceName(
15981 aService: *const otSrpServerService,
15982 ) -> *const ::std::os::raw::c_char;
15983}
15984unsafe extern "C" {
15985 #[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."]
15986 pub fn otSrpServerServiceMatchesInstanceName(
15987 aService: *const otSrpServerService,
15988 aInstanceName: *const ::std::os::raw::c_char,
15989 ) -> bool;
15990}
15991unsafe extern "C" {
15992 #[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.."]
15993 pub fn otSrpServerServiceGetInstanceLabel(
15994 aService: *const otSrpServerService,
15995 ) -> *const ::std::os::raw::c_char;
15996}
15997unsafe extern "C" {
15998 #[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."]
15999 pub fn otSrpServerServiceGetServiceName(
16000 aService: *const otSrpServerService,
16001 ) -> *const ::std::os::raw::c_char;
16002}
16003unsafe extern "C" {
16004 #[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."]
16005 pub fn otSrpServerServiceMatchesServiceName(
16006 aService: *const otSrpServerService,
16007 aServiceName: *const ::std::os::raw::c_char,
16008 ) -> bool;
16009}
16010unsafe extern "C" {
16011 #[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."]
16012 pub fn otSrpServerServiceGetNumberOfSubTypes(aService: *const otSrpServerService) -> u16;
16013}
16014unsafe extern "C" {
16015 #[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."]
16016 pub fn otSrpServerServiceGetSubTypeServiceNameAt(
16017 aService: *const otSrpServerService,
16018 aIndex: u16,
16019 ) -> *const ::std::os::raw::c_char;
16020}
16021unsafe extern "C" {
16022 #[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."]
16023 pub fn otSrpServerServiceHasSubTypeServiceName(
16024 aService: *const otSrpServerService,
16025 aSubTypeServiceName: *const ::std::os::raw::c_char,
16026 ) -> bool;
16027}
16028unsafe extern "C" {
16029 #[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."]
16030 pub fn otSrpServerParseSubTypeServiceName(
16031 aSubTypeServiceName: *const ::std::os::raw::c_char,
16032 aLabel: *mut ::std::os::raw::c_char,
16033 aLabelSize: u8,
16034 ) -> otError;
16035}
16036unsafe extern "C" {
16037 #[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."]
16038 pub fn otSrpServerServiceGetPort(aService: *const otSrpServerService) -> u16;
16039}
16040unsafe extern "C" {
16041 #[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."]
16042 pub fn otSrpServerServiceGetWeight(aService: *const otSrpServerService) -> u16;
16043}
16044unsafe extern "C" {
16045 #[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."]
16046 pub fn otSrpServerServiceGetPriority(aService: *const otSrpServerService) -> u16;
16047}
16048unsafe extern "C" {
16049 #[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.."]
16050 pub fn otSrpServerServiceGetTtl(aService: *const otSrpServerService) -> u32;
16051}
16052unsafe extern "C" {
16053 #[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)."]
16054 pub fn otSrpServerServiceGetTxtData(
16055 aService: *const otSrpServerService,
16056 aDataLength: *mut u16,
16057 ) -> *const u8;
16058}
16059unsafe extern "C" {
16060 #[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."]
16061 pub fn otSrpServerServiceGetHost(aService: *const otSrpServerService)
16062 -> *const otSrpServerHost;
16063}
16064unsafe extern "C" {
16065 #[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."]
16066 pub fn otSrpServerServiceGetLeaseInfo(
16067 aService: *const otSrpServerService,
16068 aLeaseInfo: *mut otSrpServerLeaseInfo,
16069 );
16070}
16071unsafe extern "C" {
16072 #[doc = " Run all queued OpenThread tasklets at the time this is called.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
16073 pub fn otTaskletsProcess(aInstance: *mut otInstance);
16074}
16075unsafe extern "C" {
16076 #[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."]
16077 pub fn otTaskletsArePending(aInstance: *mut otInstance) -> bool;
16078}
16079unsafe extern "C" {
16080 #[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."]
16081 pub fn otTaskletsSignalPending(aInstance: *mut otInstance);
16082}
16083#[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."]
16084#[repr(C)]
16085#[derive(Debug, Copy, Clone)]
16086pub struct otLinkedBuffer {
16087 #[doc = "< Pointer to the next linked buffer in the chain, or NULL if it is the end."]
16088 pub mNext: *mut otLinkedBuffer,
16089 #[doc = "< Pointer to data referenced by this linked buffer."]
16090 pub mData: *const u8,
16091 #[doc = "< Length of this linked buffer (number of bytes)."]
16092 pub mLength: usize,
16093}
16094impl Default for otLinkedBuffer {
16095 fn default() -> Self {
16096 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16097 unsafe {
16098 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16099 s.assume_init()
16100 }
16101 }
16102}
16103#[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."]
16104pub type otTcpEstablished =
16105 ::std::option::Option<unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint)>;
16106#[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."]
16107pub type otTcpSendDone = ::std::option::Option<
16108 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aData: *mut otLinkedBuffer),
16109>;
16110#[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)."]
16111pub type otTcpForwardProgress = ::std::option::Option<
16112 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aInSendBuffer: usize, aBacklog: usize),
16113>;
16114#[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."]
16115pub type otTcpReceiveAvailable = ::std::option::Option<
16116 unsafe extern "C" fn(
16117 aEndpoint: *mut otTcpEndpoint,
16118 aBytesAvailable: usize,
16119 aEndOfStream: bool,
16120 aBytesRemaining: usize,
16121 ),
16122>;
16123pub const OT_TCP_DISCONNECTED_REASON_NORMAL: otTcpDisconnectedReason = 0;
16124pub const OT_TCP_DISCONNECTED_REASON_REFUSED: otTcpDisconnectedReason = 1;
16125pub const OT_TCP_DISCONNECTED_REASON_RESET: otTcpDisconnectedReason = 2;
16126pub const OT_TCP_DISCONNECTED_REASON_TIME_WAIT: otTcpDisconnectedReason = 3;
16127pub const OT_TCP_DISCONNECTED_REASON_TIMED_OUT: otTcpDisconnectedReason = 4;
16128pub type otTcpDisconnectedReason = ::std::os::raw::c_uint;
16129#[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."]
16130pub type otTcpDisconnected = ::std::option::Option<
16131 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aReason: otTcpDisconnectedReason),
16132>;
16133#[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."]
16134#[repr(C)]
16135#[derive(Copy, Clone)]
16136pub struct otTcpEndpoint {
16137 pub mTcb: otTcpEndpoint__bindgen_ty_1,
16138 #[doc = "< A pointer to the next TCP endpoint (internal use only)"]
16139 pub mNext: *mut otTcpEndpoint,
16140 #[doc = "< A pointer to application-specific context"]
16141 pub mContext: *mut ::std::os::raw::c_void,
16142 #[doc = "< \"Established\" callback function"]
16143 pub mEstablishedCallback: otTcpEstablished,
16144 #[doc = "< \"Send done\" callback function"]
16145 pub mSendDoneCallback: otTcpSendDone,
16146 #[doc = "< \"Forward progress\" callback function"]
16147 pub mForwardProgressCallback: otTcpForwardProgress,
16148 #[doc = "< \"Receive available\" callback function"]
16149 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
16150 #[doc = "< \"Disconnected\" callback function"]
16151 pub mDisconnectedCallback: otTcpDisconnected,
16152 pub mTimers: [u32; 4usize],
16153 pub mReceiveLinks: [otLinkedBuffer; 2usize],
16154 pub mSockAddr: otSockAddr,
16155 pub mPendingCallbacks: u8,
16156}
16157#[repr(C)]
16158#[derive(Copy, Clone)]
16159pub union otTcpEndpoint__bindgen_ty_1 {
16160 pub mSize: [u8; 680usize],
16161 pub mAlign: u64,
16162}
16163impl Default for otTcpEndpoint__bindgen_ty_1 {
16164 fn default() -> Self {
16165 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16166 unsafe {
16167 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16168 s.assume_init()
16169 }
16170 }
16171}
16172impl Default for otTcpEndpoint {
16173 fn default() -> Self {
16174 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16175 unsafe {
16176 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16177 s.assume_init()
16178 }
16179 }
16180}
16181#[doc = " Contains arguments to the otTcpEndpointInitialize() function."]
16182#[repr(C)]
16183#[derive(Debug, Copy, Clone)]
16184pub struct otTcpEndpointInitializeArgs {
16185 #[doc = "< Pointer to application-specific context"]
16186 pub mContext: *mut ::std::os::raw::c_void,
16187 #[doc = "< \"Established\" callback function"]
16188 pub mEstablishedCallback: otTcpEstablished,
16189 #[doc = "< \"Send done\" callback function"]
16190 pub mSendDoneCallback: otTcpSendDone,
16191 #[doc = "< \"Forward progress\" callback function"]
16192 pub mForwardProgressCallback: otTcpForwardProgress,
16193 #[doc = "< \"Receive available\" callback function"]
16194 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
16195 #[doc = "< \"Disconnected\" callback function"]
16196 pub mDisconnectedCallback: otTcpDisconnected,
16197 #[doc = "< Pointer to memory provided to the system for the TCP receive buffer"]
16198 pub mReceiveBuffer: *mut ::std::os::raw::c_void,
16199 #[doc = "< Size of memory provided to the system for the TCP receive buffer"]
16200 pub mReceiveBufferSize: usize,
16201}
16202impl Default for otTcpEndpointInitializeArgs {
16203 fn default() -> Self {
16204 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16205 unsafe {
16206 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16207 s.assume_init()
16208 }
16209 }
16210}
16211unsafe extern "C" {
16212 #[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."]
16213 pub fn otTcpEndpointInitialize(
16214 aInstance: *mut otInstance,
16215 aEndpoint: *mut otTcpEndpoint,
16216 aArgs: *const otTcpEndpointInitializeArgs,
16217 ) -> otError;
16218}
16219unsafe extern "C" {
16220 #[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."]
16221 pub fn otTcpEndpointGetInstance(aEndpoint: *mut otTcpEndpoint) -> *mut otInstance;
16222}
16223unsafe extern "C" {
16224 #[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."]
16225 pub fn otTcpEndpointGetContext(aEndpoint: *mut otTcpEndpoint) -> *mut ::std::os::raw::c_void;
16226}
16227unsafe extern "C" {
16228 #[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."]
16229 pub fn otTcpGetLocalAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16230}
16231unsafe extern "C" {
16232 #[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."]
16233 pub fn otTcpGetPeerAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
16234}
16235unsafe extern "C" {
16236 #[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."]
16237 pub fn otTcpBind(aEndpoint: *mut otTcpEndpoint, aSockName: *const otSockAddr) -> otError;
16238}
16239pub const OT_TCP_CONNECT_NO_FAST_OPEN: _bindgen_ty_12 = 1;
16240#[doc = " Defines flags passed to otTcpConnect()."]
16241pub type _bindgen_ty_12 = ::std::os::raw::c_uint;
16242unsafe extern "C" {
16243 #[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."]
16244 pub fn otTcpConnect(
16245 aEndpoint: *mut otTcpEndpoint,
16246 aSockName: *const otSockAddr,
16247 aFlags: u32,
16248 ) -> otError;
16249}
16250pub const OT_TCP_SEND_MORE_TO_COME: _bindgen_ty_13 = 1;
16251#[doc = " Defines flags passed to @p otTcpSendByReference."]
16252pub type _bindgen_ty_13 = ::std::os::raw::c_uint;
16253unsafe extern "C" {
16254 #[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."]
16255 pub fn otTcpSendByReference(
16256 aEndpoint: *mut otTcpEndpoint,
16257 aBuffer: *mut otLinkedBuffer,
16258 aFlags: u32,
16259 ) -> otError;
16260}
16261unsafe extern "C" {
16262 #[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."]
16263 pub fn otTcpSendByExtension(
16264 aEndpoint: *mut otTcpEndpoint,
16265 aNumBytes: usize,
16266 aFlags: u32,
16267 ) -> otError;
16268}
16269unsafe extern "C" {
16270 #[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."]
16271 pub fn otTcpReceiveByReference(
16272 aEndpoint: *mut otTcpEndpoint,
16273 aBuffer: *mut *const otLinkedBuffer,
16274 ) -> otError;
16275}
16276unsafe extern "C" {
16277 #[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."]
16278 pub fn otTcpReceiveContiguify(aEndpoint: *mut otTcpEndpoint) -> otError;
16279}
16280unsafe extern "C" {
16281 #[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."]
16282 pub fn otTcpCommitReceive(
16283 aEndpoint: *mut otTcpEndpoint,
16284 aNumBytes: usize,
16285 aFlags: u32,
16286 ) -> otError;
16287}
16288unsafe extern "C" {
16289 #[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."]
16290 pub fn otTcpSendEndOfStream(aEndpoint: *mut otTcpEndpoint) -> otError;
16291}
16292unsafe extern "C" {
16293 #[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."]
16294 pub fn otTcpAbort(aEndpoint: *mut otTcpEndpoint) -> otError;
16295}
16296unsafe extern "C" {
16297 #[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."]
16298 pub fn otTcpEndpointDeinitialize(aEndpoint: *mut otTcpEndpoint) -> otError;
16299}
16300#[doc = "< Accept the incoming connection."]
16301pub const OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT: otTcpIncomingConnectionAction = 0;
16302#[doc = "< Defer (silently ignore) the incoming connection."]
16303pub const OT_TCP_INCOMING_CONNECTION_ACTION_DEFER: otTcpIncomingConnectionAction = 1;
16304#[doc = "< Refuse the incoming connection."]
16305pub const OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE: otTcpIncomingConnectionAction = 2;
16306#[doc = " Defines incoming connection actions.\n\n This is used in otTcpAcceptReady() callback."]
16307pub type otTcpIncomingConnectionAction = ::std::os::raw::c_uint;
16308#[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."]
16309pub type otTcpAcceptReady = ::std::option::Option<
16310 unsafe extern "C" fn(
16311 aListener: *mut otTcpListener,
16312 aPeer: *const otSockAddr,
16313 aAcceptInto: *mut *mut otTcpEndpoint,
16314 ) -> otTcpIncomingConnectionAction,
16315>;
16316#[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."]
16317pub type otTcpAcceptDone = ::std::option::Option<
16318 unsafe extern "C" fn(
16319 aListener: *mut otTcpListener,
16320 aEndpoint: *mut otTcpEndpoint,
16321 aPeer: *const otSockAddr,
16322 ),
16323>;
16324#[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."]
16325#[repr(C)]
16326#[derive(Copy, Clone)]
16327pub struct otTcpListener {
16328 pub mTcbListen: otTcpListener__bindgen_ty_1,
16329 #[doc = "< A pointer to the next TCP listener (internal use only)"]
16330 pub mNext: *mut otTcpListener,
16331 #[doc = "< A pointer to application-specific context"]
16332 pub mContext: *mut ::std::os::raw::c_void,
16333 #[doc = "< \"Accept ready\" callback function"]
16334 pub mAcceptReadyCallback: otTcpAcceptReady,
16335 #[doc = "< \"Accept done\" callback function"]
16336 pub mAcceptDoneCallback: otTcpAcceptDone,
16337}
16338#[repr(C)]
16339#[derive(Copy, Clone)]
16340pub union otTcpListener__bindgen_ty_1 {
16341 pub mSize: [u8; 40usize],
16342 pub mAlign: *mut ::std::os::raw::c_void,
16343}
16344impl Default for otTcpListener__bindgen_ty_1 {
16345 fn default() -> Self {
16346 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16347 unsafe {
16348 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16349 s.assume_init()
16350 }
16351 }
16352}
16353impl Default for otTcpListener {
16354 fn default() -> Self {
16355 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16356 unsafe {
16357 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16358 s.assume_init()
16359 }
16360 }
16361}
16362#[doc = " Contains arguments to the otTcpListenerInitialize() function."]
16363#[repr(C)]
16364#[derive(Debug, Copy, Clone)]
16365pub struct otTcpListenerInitializeArgs {
16366 #[doc = "< Pointer to application-specific context"]
16367 pub mContext: *mut ::std::os::raw::c_void,
16368 #[doc = "< \"Accept ready\" callback function"]
16369 pub mAcceptReadyCallback: otTcpAcceptReady,
16370 #[doc = "< \"Accept done\" callback function"]
16371 pub mAcceptDoneCallback: otTcpAcceptDone,
16372}
16373impl Default for otTcpListenerInitializeArgs {
16374 fn default() -> Self {
16375 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16376 unsafe {
16377 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16378 s.assume_init()
16379 }
16380 }
16381}
16382unsafe extern "C" {
16383 #[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."]
16384 pub fn otTcpListenerInitialize(
16385 aInstance: *mut otInstance,
16386 aListener: *mut otTcpListener,
16387 aArgs: *const otTcpListenerInitializeArgs,
16388 ) -> otError;
16389}
16390unsafe extern "C" {
16391 #[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."]
16392 pub fn otTcpListenerGetInstance(aListener: *mut otTcpListener) -> *mut otInstance;
16393}
16394unsafe extern "C" {
16395 #[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."]
16396 pub fn otTcpListenerGetContext(aListener: *mut otTcpListener) -> *mut ::std::os::raw::c_void;
16397}
16398unsafe extern "C" {
16399 #[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."]
16400 pub fn otTcpListen(aListener: *mut otTcpListener, aSockName: *const otSockAddr) -> otError;
16401}
16402unsafe extern "C" {
16403 #[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."]
16404 pub fn otTcpStopListening(aListener: *mut otTcpListener) -> otError;
16405}
16406unsafe extern "C" {
16407 #[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."]
16408 pub fn otTcpListenerDeinitialize(aListener: *mut otTcpListener) -> otError;
16409}
16410#[doc = " Holds diagnostic information for a Thread Child"]
16411#[repr(C)]
16412#[derive(Debug, Default, Copy, Clone)]
16413pub struct otChildInfo {
16414 #[doc = "< IEEE 802.15.4 Extended Address"]
16415 pub mExtAddress: otExtAddress,
16416 #[doc = "< Timeout"]
16417 pub mTimeout: u32,
16418 #[doc = "< Seconds since last heard"]
16419 pub mAge: u32,
16420 #[doc = "< Seconds since attach"]
16421 pub mConnectionTime: u64,
16422 #[doc = "< RLOC16"]
16423 pub mRloc16: u16,
16424 #[doc = "< Child ID"]
16425 pub mChildId: u16,
16426 #[doc = "< Network Data Version"]
16427 pub mNetworkDataVersion: u8,
16428 #[doc = "< Link Quality In"]
16429 pub mLinkQualityIn: u8,
16430 #[doc = "< Average RSSI"]
16431 pub mAverageRssi: i8,
16432 #[doc = "< Last observed RSSI"]
16433 pub mLastRssi: i8,
16434 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
16435 pub mFrameErrorRate: u16,
16436 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
16437 pub mMessageErrorRate: u16,
16438 #[doc = "< Number of queued messages for the child."]
16439 pub mQueuedMessageCnt: u16,
16440 #[doc = "< Supervision interval (in seconds)."]
16441 pub mSupervisionInterval: u16,
16442 #[doc = "< MLE version"]
16443 pub mVersion: u8,
16444 pub _bitfield_align_1: [u8; 0],
16445 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16446 pub __bindgen_padding_0: [u16; 3usize],
16447}
16448impl otChildInfo {
16449 #[inline]
16450 pub fn mRxOnWhenIdle(&self) -> bool {
16451 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16452 }
16453 #[inline]
16454 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
16455 unsafe {
16456 let val: u8 = ::std::mem::transmute(val);
16457 self._bitfield_1.set(0usize, 1u8, val as u64)
16458 }
16459 }
16460 #[inline]
16461 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
16462 unsafe {
16463 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16464 ::std::ptr::addr_of!((*this)._bitfield_1),
16465 0usize,
16466 1u8,
16467 ) as u8)
16468 }
16469 }
16470 #[inline]
16471 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
16472 unsafe {
16473 let val: u8 = ::std::mem::transmute(val);
16474 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16475 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16476 0usize,
16477 1u8,
16478 val as u64,
16479 )
16480 }
16481 }
16482 #[inline]
16483 pub fn mFullThreadDevice(&self) -> bool {
16484 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16485 }
16486 #[inline]
16487 pub fn set_mFullThreadDevice(&mut self, val: bool) {
16488 unsafe {
16489 let val: u8 = ::std::mem::transmute(val);
16490 self._bitfield_1.set(1usize, 1u8, val as u64)
16491 }
16492 }
16493 #[inline]
16494 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
16495 unsafe {
16496 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16497 ::std::ptr::addr_of!((*this)._bitfield_1),
16498 1usize,
16499 1u8,
16500 ) as u8)
16501 }
16502 }
16503 #[inline]
16504 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
16505 unsafe {
16506 let val: u8 = ::std::mem::transmute(val);
16507 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16508 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16509 1usize,
16510 1u8,
16511 val as u64,
16512 )
16513 }
16514 }
16515 #[inline]
16516 pub fn mFullNetworkData(&self) -> bool {
16517 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16518 }
16519 #[inline]
16520 pub fn set_mFullNetworkData(&mut self, val: bool) {
16521 unsafe {
16522 let val: u8 = ::std::mem::transmute(val);
16523 self._bitfield_1.set(2usize, 1u8, val as u64)
16524 }
16525 }
16526 #[inline]
16527 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
16528 unsafe {
16529 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16530 ::std::ptr::addr_of!((*this)._bitfield_1),
16531 2usize,
16532 1u8,
16533 ) as u8)
16534 }
16535 }
16536 #[inline]
16537 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
16538 unsafe {
16539 let val: u8 = ::std::mem::transmute(val);
16540 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16541 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16542 2usize,
16543 1u8,
16544 val as u64,
16545 )
16546 }
16547 }
16548 #[inline]
16549 pub fn mIsStateRestoring(&self) -> bool {
16550 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
16551 }
16552 #[inline]
16553 pub fn set_mIsStateRestoring(&mut self, val: bool) {
16554 unsafe {
16555 let val: u8 = ::std::mem::transmute(val);
16556 self._bitfield_1.set(3usize, 1u8, val as u64)
16557 }
16558 }
16559 #[inline]
16560 pub unsafe fn mIsStateRestoring_raw(this: *const Self) -> bool {
16561 unsafe {
16562 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16563 ::std::ptr::addr_of!((*this)._bitfield_1),
16564 3usize,
16565 1u8,
16566 ) as u8)
16567 }
16568 }
16569 #[inline]
16570 pub unsafe fn set_mIsStateRestoring_raw(this: *mut Self, val: bool) {
16571 unsafe {
16572 let val: u8 = ::std::mem::transmute(val);
16573 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16574 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16575 3usize,
16576 1u8,
16577 val as u64,
16578 )
16579 }
16580 }
16581 #[inline]
16582 pub fn mIsCslSynced(&self) -> bool {
16583 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
16584 }
16585 #[inline]
16586 pub fn set_mIsCslSynced(&mut self, val: bool) {
16587 unsafe {
16588 let val: u8 = ::std::mem::transmute(val);
16589 self._bitfield_1.set(4usize, 1u8, val as u64)
16590 }
16591 }
16592 #[inline]
16593 pub unsafe fn mIsCslSynced_raw(this: *const Self) -> bool {
16594 unsafe {
16595 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16596 ::std::ptr::addr_of!((*this)._bitfield_1),
16597 4usize,
16598 1u8,
16599 ) as u8)
16600 }
16601 }
16602 #[inline]
16603 pub unsafe fn set_mIsCslSynced_raw(this: *mut Self, val: bool) {
16604 unsafe {
16605 let val: u8 = ::std::mem::transmute(val);
16606 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16607 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16608 4usize,
16609 1u8,
16610 val as u64,
16611 )
16612 }
16613 }
16614 #[inline]
16615 pub fn new_bitfield_1(
16616 mRxOnWhenIdle: bool,
16617 mFullThreadDevice: bool,
16618 mFullNetworkData: bool,
16619 mIsStateRestoring: bool,
16620 mIsCslSynced: bool,
16621 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16622 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16623 __bindgen_bitfield_unit.set(0usize, 1u8, {
16624 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
16625 mRxOnWhenIdle as u64
16626 });
16627 __bindgen_bitfield_unit.set(1usize, 1u8, {
16628 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
16629 mFullThreadDevice as u64
16630 });
16631 __bindgen_bitfield_unit.set(2usize, 1u8, {
16632 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
16633 mFullNetworkData as u64
16634 });
16635 __bindgen_bitfield_unit.set(3usize, 1u8, {
16636 let mIsStateRestoring: u8 = unsafe { ::std::mem::transmute(mIsStateRestoring) };
16637 mIsStateRestoring as u64
16638 });
16639 __bindgen_bitfield_unit.set(4usize, 1u8, {
16640 let mIsCslSynced: u8 = unsafe { ::std::mem::transmute(mIsCslSynced) };
16641 mIsCslSynced as u64
16642 });
16643 __bindgen_bitfield_unit
16644 }
16645}
16646pub type otChildIp6AddressIterator = u16;
16647pub const OT_CACHE_ENTRY_STATE_CACHED: otCacheEntryState = 0;
16648pub const OT_CACHE_ENTRY_STATE_SNOOPED: otCacheEntryState = 1;
16649pub const OT_CACHE_ENTRY_STATE_QUERY: otCacheEntryState = 2;
16650pub const OT_CACHE_ENTRY_STATE_RETRY_QUERY: otCacheEntryState = 3;
16651#[doc = " Defines the EID cache entry state."]
16652pub type otCacheEntryState = ::std::os::raw::c_uint;
16653#[doc = " Represents an EID cache entry."]
16654#[repr(C)]
16655#[derive(Copy, Clone)]
16656pub struct otCacheEntryInfo {
16657 #[doc = "< Target EID"]
16658 pub mTarget: otIp6Address,
16659 #[doc = "< RLOC16"]
16660 pub mRloc16: otShortAddress,
16661 #[doc = "< Entry state"]
16662 pub mState: otCacheEntryState,
16663 pub _bitfield_align_1: [u8; 0],
16664 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16665 #[doc = "< Last transaction time (applicable in cached state)."]
16666 pub mLastTransTime: u32,
16667 #[doc = "< Mesh Local EID (applicable if entry in cached state)."]
16668 pub mMeshLocalEid: otIp6Address,
16669 #[doc = "< Timeout in seconds (applicable if in snooped/query/retry-query states)."]
16670 pub mTimeout: u16,
16671 #[doc = "< Retry delay in seconds (applicable if in query-retry state)."]
16672 pub mRetryDelay: u16,
16673}
16674impl Default for otCacheEntryInfo {
16675 fn default() -> Self {
16676 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16677 unsafe {
16678 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16679 s.assume_init()
16680 }
16681 }
16682}
16683impl otCacheEntryInfo {
16684 #[inline]
16685 pub fn mCanEvict(&self) -> bool {
16686 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16687 }
16688 #[inline]
16689 pub fn set_mCanEvict(&mut self, val: bool) {
16690 unsafe {
16691 let val: u8 = ::std::mem::transmute(val);
16692 self._bitfield_1.set(0usize, 1u8, val as u64)
16693 }
16694 }
16695 #[inline]
16696 pub unsafe fn mCanEvict_raw(this: *const Self) -> bool {
16697 unsafe {
16698 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16699 ::std::ptr::addr_of!((*this)._bitfield_1),
16700 0usize,
16701 1u8,
16702 ) as u8)
16703 }
16704 }
16705 #[inline]
16706 pub unsafe fn set_mCanEvict_raw(this: *mut Self, val: bool) {
16707 unsafe {
16708 let val: u8 = ::std::mem::transmute(val);
16709 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16710 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16711 0usize,
16712 1u8,
16713 val as u64,
16714 )
16715 }
16716 }
16717 #[inline]
16718 pub fn mRampDown(&self) -> bool {
16719 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16720 }
16721 #[inline]
16722 pub fn set_mRampDown(&mut self, val: bool) {
16723 unsafe {
16724 let val: u8 = ::std::mem::transmute(val);
16725 self._bitfield_1.set(1usize, 1u8, val as u64)
16726 }
16727 }
16728 #[inline]
16729 pub unsafe fn mRampDown_raw(this: *const Self) -> bool {
16730 unsafe {
16731 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16732 ::std::ptr::addr_of!((*this)._bitfield_1),
16733 1usize,
16734 1u8,
16735 ) as u8)
16736 }
16737 }
16738 #[inline]
16739 pub unsafe fn set_mRampDown_raw(this: *mut Self, val: bool) {
16740 unsafe {
16741 let val: u8 = ::std::mem::transmute(val);
16742 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16743 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16744 1usize,
16745 1u8,
16746 val as u64,
16747 )
16748 }
16749 }
16750 #[inline]
16751 pub fn mValidLastTrans(&self) -> bool {
16752 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16753 }
16754 #[inline]
16755 pub fn set_mValidLastTrans(&mut self, val: bool) {
16756 unsafe {
16757 let val: u8 = ::std::mem::transmute(val);
16758 self._bitfield_1.set(2usize, 1u8, val as u64)
16759 }
16760 }
16761 #[inline]
16762 pub unsafe fn mValidLastTrans_raw(this: *const Self) -> bool {
16763 unsafe {
16764 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16765 ::std::ptr::addr_of!((*this)._bitfield_1),
16766 2usize,
16767 1u8,
16768 ) as u8)
16769 }
16770 }
16771 #[inline]
16772 pub unsafe fn set_mValidLastTrans_raw(this: *mut Self, val: bool) {
16773 unsafe {
16774 let val: u8 = ::std::mem::transmute(val);
16775 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16776 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16777 2usize,
16778 1u8,
16779 val as u64,
16780 )
16781 }
16782 }
16783 #[inline]
16784 pub fn new_bitfield_1(
16785 mCanEvict: bool,
16786 mRampDown: bool,
16787 mValidLastTrans: bool,
16788 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16789 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16790 __bindgen_bitfield_unit.set(0usize, 1u8, {
16791 let mCanEvict: u8 = unsafe { ::std::mem::transmute(mCanEvict) };
16792 mCanEvict as u64
16793 });
16794 __bindgen_bitfield_unit.set(1usize, 1u8, {
16795 let mRampDown: u8 = unsafe { ::std::mem::transmute(mRampDown) };
16796 mRampDown as u64
16797 });
16798 __bindgen_bitfield_unit.set(2usize, 1u8, {
16799 let mValidLastTrans: u8 = unsafe { ::std::mem::transmute(mValidLastTrans) };
16800 mValidLastTrans as u64
16801 });
16802 __bindgen_bitfield_unit
16803 }
16804}
16805#[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)."]
16806#[repr(C)]
16807#[derive(Debug, Copy, Clone)]
16808pub struct otCacheEntryIterator {
16809 #[doc = "< Opaque data used by the core implementation. Should not be changed by user."]
16810 pub mData: [*const ::std::os::raw::c_void; 2usize],
16811}
16812impl Default for otCacheEntryIterator {
16813 fn default() -> Self {
16814 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16815 unsafe {
16816 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16817 s.assume_init()
16818 }
16819 }
16820}
16821unsafe extern "C" {
16822 #[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"]
16823 pub fn otThreadGetMaxAllowedChildren(aInstance: *mut otInstance) -> u16;
16824}
16825unsafe extern "C" {
16826 #[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"]
16827 pub fn otThreadSetMaxAllowedChildren(aInstance: *mut otInstance, aMaxChildren: u16) -> otError;
16828}
16829unsafe extern "C" {
16830 #[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."]
16831 pub fn otThreadIsRouterEligible(aInstance: *mut otInstance) -> bool;
16832}
16833unsafe extern "C" {
16834 #[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."]
16835 pub fn otThreadSetRouterEligible(aInstance: *mut otInstance, aEligible: bool) -> otError;
16836}
16837unsafe extern "C" {
16838 #[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)"]
16839 pub fn otThreadSetPreferredRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
16840}
16841#[doc = "< Battery powered."]
16842pub const OT_POWER_SUPPLY_BATTERY: otPowerSupply = 0;
16843#[doc = "< Externally powered (mains-powered)."]
16844pub const OT_POWER_SUPPLY_EXTERNAL: otPowerSupply = 1;
16845#[doc = "< Stable external power with a battery backup or UPS."]
16846pub const OT_POWER_SUPPLY_EXTERNAL_STABLE: otPowerSupply = 2;
16847#[doc = "< Potentially unstable ext power (e.g. light bulb powered via a switch)."]
16848pub const OT_POWER_SUPPLY_EXTERNAL_UNSTABLE: otPowerSupply = 3;
16849#[doc = " Represents the power supply property on a device.\n\n This is used as a property in `otDeviceProperties` to calculate the leader weight."]
16850pub type otPowerSupply = ::std::os::raw::c_uint;
16851#[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."]
16852#[repr(C)]
16853#[derive(Debug, Copy, Clone)]
16854pub struct otDeviceProperties {
16855 #[doc = "< Power supply config."]
16856 pub mPowerSupply: otPowerSupply,
16857 pub _bitfield_align_1: [u8; 0],
16858 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
16859 #[doc = "< Weight adjustment. Should be -16 to +16 (clamped otherwise)."]
16860 pub mLeaderWeightAdjustment: i8,
16861}
16862impl Default for otDeviceProperties {
16863 fn default() -> Self {
16864 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
16865 unsafe {
16866 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
16867 s.assume_init()
16868 }
16869 }
16870}
16871impl otDeviceProperties {
16872 #[inline]
16873 pub fn mIsBorderRouter(&self) -> bool {
16874 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
16875 }
16876 #[inline]
16877 pub fn set_mIsBorderRouter(&mut self, val: bool) {
16878 unsafe {
16879 let val: u8 = ::std::mem::transmute(val);
16880 self._bitfield_1.set(0usize, 1u8, val as u64)
16881 }
16882 }
16883 #[inline]
16884 pub unsafe fn mIsBorderRouter_raw(this: *const Self) -> bool {
16885 unsafe {
16886 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16887 ::std::ptr::addr_of!((*this)._bitfield_1),
16888 0usize,
16889 1u8,
16890 ) as u8)
16891 }
16892 }
16893 #[inline]
16894 pub unsafe fn set_mIsBorderRouter_raw(this: *mut Self, val: bool) {
16895 unsafe {
16896 let val: u8 = ::std::mem::transmute(val);
16897 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16898 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16899 0usize,
16900 1u8,
16901 val as u64,
16902 )
16903 }
16904 }
16905 #[inline]
16906 pub fn mSupportsCcm(&self) -> bool {
16907 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
16908 }
16909 #[inline]
16910 pub fn set_mSupportsCcm(&mut self, val: bool) {
16911 unsafe {
16912 let val: u8 = ::std::mem::transmute(val);
16913 self._bitfield_1.set(1usize, 1u8, val as u64)
16914 }
16915 }
16916 #[inline]
16917 pub unsafe fn mSupportsCcm_raw(this: *const Self) -> bool {
16918 unsafe {
16919 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16920 ::std::ptr::addr_of!((*this)._bitfield_1),
16921 1usize,
16922 1u8,
16923 ) as u8)
16924 }
16925 }
16926 #[inline]
16927 pub unsafe fn set_mSupportsCcm_raw(this: *mut Self, val: bool) {
16928 unsafe {
16929 let val: u8 = ::std::mem::transmute(val);
16930 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16931 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16932 1usize,
16933 1u8,
16934 val as u64,
16935 )
16936 }
16937 }
16938 #[inline]
16939 pub fn mIsUnstable(&self) -> bool {
16940 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
16941 }
16942 #[inline]
16943 pub fn set_mIsUnstable(&mut self, val: bool) {
16944 unsafe {
16945 let val: u8 = ::std::mem::transmute(val);
16946 self._bitfield_1.set(2usize, 1u8, val as u64)
16947 }
16948 }
16949 #[inline]
16950 pub unsafe fn mIsUnstable_raw(this: *const Self) -> bool {
16951 unsafe {
16952 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
16953 ::std::ptr::addr_of!((*this)._bitfield_1),
16954 2usize,
16955 1u8,
16956 ) as u8)
16957 }
16958 }
16959 #[inline]
16960 pub unsafe fn set_mIsUnstable_raw(this: *mut Self, val: bool) {
16961 unsafe {
16962 let val: u8 = ::std::mem::transmute(val);
16963 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
16964 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
16965 2usize,
16966 1u8,
16967 val as u64,
16968 )
16969 }
16970 }
16971 #[inline]
16972 pub fn new_bitfield_1(
16973 mIsBorderRouter: bool,
16974 mSupportsCcm: bool,
16975 mIsUnstable: bool,
16976 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
16977 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
16978 __bindgen_bitfield_unit.set(0usize, 1u8, {
16979 let mIsBorderRouter: u8 = unsafe { ::std::mem::transmute(mIsBorderRouter) };
16980 mIsBorderRouter as u64
16981 });
16982 __bindgen_bitfield_unit.set(1usize, 1u8, {
16983 let mSupportsCcm: u8 = unsafe { ::std::mem::transmute(mSupportsCcm) };
16984 mSupportsCcm as u64
16985 });
16986 __bindgen_bitfield_unit.set(2usize, 1u8, {
16987 let mIsUnstable: u8 = unsafe { ::std::mem::transmute(mIsUnstable) };
16988 mIsUnstable as u64
16989 });
16990 __bindgen_bitfield_unit
16991 }
16992}
16993unsafe extern "C" {
16994 #[doc = " Get the current device properties.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @returns The device properties `otDeviceProperties`."]
16995 pub fn otThreadGetDeviceProperties(aInstance: *mut otInstance) -> *const otDeviceProperties;
16996}
16997unsafe extern "C" {
16998 #[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."]
16999 pub fn otThreadSetDeviceProperties(
17000 aInstance: *mut otInstance,
17001 aDeviceProperties: *const otDeviceProperties,
17002 );
17003}
17004unsafe extern "C" {
17005 #[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"]
17006 pub fn otThreadGetLocalLeaderWeight(aInstance: *mut otInstance) -> u8;
17007}
17008unsafe extern "C" {
17009 #[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"]
17010 pub fn otThreadSetLocalLeaderWeight(aInstance: *mut otInstance, aWeight: u8);
17011}
17012unsafe extern "C" {
17013 #[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."]
17014 pub fn otThreadGetPreferredLeaderPartitionId(aInstance: *mut otInstance) -> u32;
17015}
17016unsafe extern "C" {
17017 #[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."]
17018 pub fn otThreadSetPreferredLeaderPartitionId(aInstance: *mut otInstance, aPartitionId: u32);
17019}
17020unsafe extern "C" {
17021 #[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"]
17022 pub fn otThreadGetJoinerUdpPort(aInstance: *mut otInstance) -> u16;
17023}
17024unsafe extern "C" {
17025 #[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"]
17026 pub fn otThreadSetJoinerUdpPort(aInstance: *mut otInstance, aJoinerUdpPort: u16) -> otError;
17027}
17028unsafe extern "C" {
17029 #[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."]
17030 pub fn otThreadSetSteeringData(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
17031}
17032unsafe extern "C" {
17033 #[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"]
17034 pub fn otThreadGetContextIdReuseDelay(aInstance: *mut otInstance) -> u32;
17035}
17036unsafe extern "C" {
17037 #[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"]
17038 pub fn otThreadSetContextIdReuseDelay(aInstance: *mut otInstance, aDelay: u32);
17039}
17040unsafe extern "C" {
17041 #[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"]
17042 pub fn otThreadGetNetworkIdTimeout(aInstance: *mut otInstance) -> u8;
17043}
17044unsafe extern "C" {
17045 #[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"]
17046 pub fn otThreadSetNetworkIdTimeout(aInstance: *mut otInstance, aTimeout: u8);
17047}
17048unsafe extern "C" {
17049 #[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"]
17050 pub fn otThreadGetRouterUpgradeThreshold(aInstance: *mut otInstance) -> u8;
17051}
17052unsafe extern "C" {
17053 #[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"]
17054 pub fn otThreadSetRouterUpgradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
17055}
17056unsafe extern "C" {
17057 #[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"]
17058 pub fn otThreadGetChildRouterLinks(aInstance: *mut otInstance) -> u8;
17059}
17060unsafe extern "C" {
17061 #[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"]
17062 pub fn otThreadSetChildRouterLinks(
17063 aInstance: *mut otInstance,
17064 aChildRouterLinks: u8,
17065 ) -> otError;
17066}
17067unsafe extern "C" {
17068 #[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."]
17069 pub fn otThreadReleaseRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
17070}
17071unsafe extern "C" {
17072 #[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."]
17073 pub fn otThreadBecomeRouter(aInstance: *mut otInstance) -> otError;
17074}
17075unsafe extern "C" {
17076 #[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."]
17077 pub fn otThreadBecomeLeader(aInstance: *mut otInstance) -> otError;
17078}
17079unsafe extern "C" {
17080 #[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"]
17081 pub fn otThreadGetRouterDowngradeThreshold(aInstance: *mut otInstance) -> u8;
17082}
17083unsafe extern "C" {
17084 #[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"]
17085 pub fn otThreadSetRouterDowngradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
17086}
17087unsafe extern "C" {
17088 #[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"]
17089 pub fn otThreadGetRouterSelectionJitter(aInstance: *mut otInstance) -> u8;
17090}
17091unsafe extern "C" {
17092 #[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"]
17093 pub fn otThreadSetRouterSelectionJitter(aInstance: *mut otInstance, aRouterJitter: u8);
17094}
17095unsafe extern "C" {
17096 #[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."]
17097 pub fn otThreadGetChildInfoById(
17098 aInstance: *mut otInstance,
17099 aChildId: u16,
17100 aChildInfo: *mut otChildInfo,
17101 ) -> otError;
17102}
17103unsafe extern "C" {
17104 #[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"]
17105 pub fn otThreadGetChildInfoByIndex(
17106 aInstance: *mut otInstance,
17107 aChildIndex: u16,
17108 aChildInfo: *mut otChildInfo,
17109 ) -> otError;
17110}
17111unsafe extern "C" {
17112 #[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"]
17113 pub fn otThreadGetChildNextIp6Address(
17114 aInstance: *mut otInstance,
17115 aChildIndex: u16,
17116 aIterator: *mut otChildIp6AddressIterator,
17117 aAddress: *mut otIp6Address,
17118 ) -> otError;
17119}
17120unsafe extern "C" {
17121 #[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."]
17122 pub fn otThreadGetRouterIdSequence(aInstance: *mut otInstance) -> u8;
17123}
17124unsafe extern "C" {
17125 #[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."]
17126 pub fn otThreadGetMaxRouterId(aInstance: *mut otInstance) -> u8;
17127}
17128unsafe extern "C" {
17129 #[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."]
17130 pub fn otThreadGetRouterInfo(
17131 aInstance: *mut otInstance,
17132 aRouterId: u16,
17133 aRouterInfo: *mut otRouterInfo,
17134 ) -> otError;
17135}
17136unsafe extern "C" {
17137 #[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."]
17138 pub fn otThreadGetNextCacheEntry(
17139 aInstance: *mut otInstance,
17140 aEntryInfo: *mut otCacheEntryInfo,
17141 aIterator: *mut otCacheEntryIterator,
17142 ) -> otError;
17143}
17144unsafe extern "C" {
17145 #[doc = " Clears the EID cache.\n\n Intended for testing only.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
17146 pub fn otThreadClearEidCache(aInstance: *mut otInstance);
17147}
17148unsafe extern "C" {
17149 #[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"]
17150 pub fn otThreadGetPskc(aInstance: *mut otInstance, aPskc: *mut otPskc);
17151}
17152unsafe extern "C" {
17153 #[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"]
17154 pub fn otThreadGetPskcRef(aInstance: *mut otInstance) -> otPskcRef;
17155}
17156unsafe extern "C" {
17157 #[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"]
17158 pub fn otThreadSetPskc(aInstance: *mut otInstance, aPskc: *const otPskc) -> otError;
17159}
17160unsafe extern "C" {
17161 #[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"]
17162 pub fn otThreadSetPskcRef(aInstance: *mut otInstance, aKeyRef: otPskcRef) -> otError;
17163}
17164unsafe extern "C" {
17165 #[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"]
17166 pub fn otThreadGetParentPriority(aInstance: *mut otInstance) -> i8;
17167}
17168unsafe extern "C" {
17169 #[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"]
17170 pub fn otThreadSetParentPriority(aInstance: *mut otInstance, aParentPriority: i8) -> otError;
17171}
17172unsafe extern "C" {
17173 #[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"]
17174 pub fn otThreadGetMaxChildIpAddresses(aInstance: *mut otInstance) -> u8;
17175}
17176unsafe extern "C" {
17177 #[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"]
17178 pub fn otThreadSetMaxChildIpAddresses(
17179 aInstance: *mut otInstance,
17180 aMaxIpAddresses: u8,
17181 ) -> otError;
17182}
17183#[doc = "< A child is being added."]
17184pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED: otNeighborTableEvent = 0;
17185#[doc = "< A child is being removed."]
17186pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED: otNeighborTableEvent = 1;
17187#[doc = "< An existing child's mode is changed."]
17188pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED: otNeighborTableEvent = 2;
17189#[doc = "< A router is being added."]
17190pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED: otNeighborTableEvent = 3;
17191#[doc = "< A router is being removed."]
17192pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED: otNeighborTableEvent = 4;
17193#[doc = " Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table."]
17194pub type otNeighborTableEvent = ::std::os::raw::c_uint;
17195#[doc = " Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table\n callback `otNeighborTableCallback`."]
17196#[repr(C)]
17197#[derive(Copy, Clone)]
17198pub struct otNeighborTableEntryInfo {
17199 #[doc = "< The OpenThread instance."]
17200 pub mInstance: *mut otInstance,
17201 pub mInfo: otNeighborTableEntryInfo__bindgen_ty_1,
17202}
17203#[repr(C)]
17204#[derive(Copy, Clone)]
17205pub union otNeighborTableEntryInfo__bindgen_ty_1 {
17206 #[doc = "< The child neighbor info."]
17207 pub mChild: otChildInfo,
17208 #[doc = "< The router neighbor info."]
17209 pub mRouter: otNeighborInfo,
17210}
17211impl Default for otNeighborTableEntryInfo__bindgen_ty_1 {
17212 fn default() -> Self {
17213 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17214 unsafe {
17215 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17216 s.assume_init()
17217 }
17218 }
17219}
17220impl Default for otNeighborTableEntryInfo {
17221 fn default() -> Self {
17222 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17223 unsafe {
17224 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17225 s.assume_init()
17226 }
17227 }
17228}
17229#[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."]
17230pub type otNeighborTableCallback = ::std::option::Option<
17231 unsafe extern "C" fn(aEvent: otNeighborTableEvent, aEntryInfo: *const otNeighborTableEntryInfo),
17232>;
17233unsafe extern "C" {
17234 #[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."]
17235 pub fn otThreadRegisterNeighborTableCallback(
17236 aInstance: *mut otInstance,
17237 aCallback: otNeighborTableCallback,
17238 );
17239}
17240unsafe extern "C" {
17241 #[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."]
17242 pub fn otThreadSetCcmEnabled(aInstance: *mut otInstance, aEnabled: bool);
17243}
17244unsafe extern "C" {
17245 #[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."]
17246 pub fn otThreadSetThreadVersionCheckEnabled(aInstance: *mut otInstance, aEnabled: bool);
17247}
17248unsafe extern "C" {
17249 #[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."]
17250 pub fn otThreadSetTmfOriginFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
17251}
17252unsafe extern "C" {
17253 #[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."]
17254 pub fn otThreadIsTmfOriginFilterEnabled(aInstance: *mut otInstance) -> bool;
17255}
17256unsafe extern "C" {
17257 #[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"]
17258 pub fn otThreadGetRouterIdRange(
17259 aInstance: *mut otInstance,
17260 aMinRouterId: *mut u8,
17261 aMaxRouterId: *mut u8,
17262 );
17263}
17264unsafe extern "C" {
17265 #[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"]
17266 pub fn otThreadSetRouterIdRange(
17267 aInstance: *mut otInstance,
17268 aMinRouterId: u8,
17269 aMaxRouterId: u8,
17270 ) -> otError;
17271}
17272unsafe extern "C" {
17273 #[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."]
17274 pub fn otThreadGetAdvertisementTrickleIntervalMax(aInstance: *mut otInstance) -> u32;
17275}
17276unsafe extern "C" {
17277 #[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."]
17278 pub fn otThreadIsRouterIdAllocated(aInstance: *mut otInstance, aRouterId: u8) -> bool;
17279}
17280unsafe extern "C" {
17281 #[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."]
17282 pub fn otThreadGetNextHopAndPathCost(
17283 aInstance: *mut otInstance,
17284 aDestRloc16: u16,
17285 aNextHopRloc16: *mut u16,
17286 aPathCost: *mut u8,
17287 );
17288}
17289#[doc = " Represents a TREL peer."]
17290#[repr(C)]
17291#[derive(Copy, Clone)]
17292pub struct otTrelPeer {
17293 #[doc = "< The Extended MAC Address of TREL peer."]
17294 pub mExtAddress: otExtAddress,
17295 #[doc = "< The Extended PAN Identifier of TREL peer."]
17296 pub mExtPanId: otExtendedPanId,
17297 #[doc = "< The IPv6 socket address of TREL peer."]
17298 pub mSockAddr: otSockAddr,
17299}
17300impl Default for otTrelPeer {
17301 fn default() -> Self {
17302 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17303 unsafe {
17304 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17305 s.assume_init()
17306 }
17307 }
17308}
17309#[doc = " Represents an iterator for iterating over TREL peer table entries."]
17310pub type otTrelPeerIterator = *const ::std::os::raw::c_void;
17311unsafe extern "C" {
17312 #[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."]
17313 pub fn otTrelSetEnabled(aInstance: *mut otInstance, aEnable: bool);
17314}
17315unsafe extern "C" {
17316 #[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."]
17317 pub fn otTrelIsEnabled(aInstance: *mut otInstance) -> bool;
17318}
17319unsafe extern "C" {
17320 #[doc = " Initializes a peer table iterator.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
17321 pub fn otTrelInitPeerIterator(aInstance: *mut otInstance, aIterator: *mut otTrelPeerIterator);
17322}
17323unsafe extern "C" {
17324 #[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."]
17325 pub fn otTrelGetNextPeer(
17326 aInstance: *mut otInstance,
17327 aIterator: *mut otTrelPeerIterator,
17328 ) -> *const otTrelPeer;
17329}
17330unsafe extern "C" {
17331 #[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."]
17332 pub fn otTrelGetNumberOfPeers(aInstance: *mut otInstance) -> u16;
17333}
17334unsafe extern "C" {
17335 #[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."]
17336 pub fn otTrelSetFilterEnabled(aInstance: *mut otInstance, aEnable: bool);
17337}
17338unsafe extern "C" {
17339 #[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."]
17340 pub fn otTrelIsFilterEnabled(aInstance: *mut otInstance) -> bool;
17341}
17342#[doc = " Represents a group of TREL related counters."]
17343pub type otTrelCounters = otPlatTrelCounters;
17344unsafe extern "C" {
17345 #[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."]
17346 pub fn otTrelGetCounters(aInstance: *mut otInstance) -> *const otTrelCounters;
17347}
17348unsafe extern "C" {
17349 #[doc = " Resets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
17350 pub fn otTrelResetCounters(aInstance: *mut otInstance);
17351}
17352unsafe extern "C" {
17353 #[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."]
17354 pub fn otTrelGetUdpPort(aInstance: *mut otInstance) -> u16;
17355}
17356unsafe extern "C" {
17357 #[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`."]
17358 pub fn otVerhoeffChecksumCalculate(
17359 aDecimalString: *const ::std::os::raw::c_char,
17360 aChecksum: *mut ::std::os::raw::c_char,
17361 ) -> otError;
17362}
17363unsafe extern "C" {
17364 #[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`."]
17365 pub fn otVerhoeffChecksumValidate(aDecimalString: *const ::std::os::raw::c_char) -> otError;
17366}
17367pub type __builtin_va_list = [__va_list_tag; 1usize];
17368#[repr(C)]
17369#[derive(Debug, Copy, Clone)]
17370pub struct __va_list_tag {
17371 pub gp_offset: ::std::os::raw::c_uint,
17372 pub fp_offset: ::std::os::raw::c_uint,
17373 pub overflow_arg_area: *mut ::std::os::raw::c_void,
17374 pub reg_save_area: *mut ::std::os::raw::c_void,
17375}
17376impl Default for __va_list_tag {
17377 fn default() -> Self {
17378 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
17379 unsafe {
17380 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
17381 s.assume_init()
17382 }
17383 }
17384}