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 = 538;
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_IP6_PREFIX_SIZE: u32 = 8;
162pub const OT_IP6_PREFIX_BITSIZE: u32 = 64;
163pub const OT_IP6_IID_SIZE: u32 = 8;
164pub const OT_IP6_ADDRESS_SIZE: u32 = 16;
165pub const OT_IP6_ADDRESS_BITSIZE: u32 = 128;
166pub const OT_IP6_HEADER_SIZE: u32 = 40;
167pub const OT_IP6_HEADER_PROTO_OFFSET: u32 = 6;
168pub const OT_IP6_ADDRESS_STRING_SIZE: u32 = 40;
169pub const OT_IP6_SOCK_ADDR_STRING_SIZE: u32 = 48;
170pub const OT_IP6_PREFIX_STRING_SIZE: u32 = 45;
171pub const OT_IP6_MAX_MLR_ADDRESSES: u32 = 15;
172pub const OT_CRYPTO_SHA256_HASH_SIZE: u32 = 32;
173pub const OT_CRYPTO_ECDSA_MAX_DER_SIZE: u32 = 125;
174pub const OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE: u32 = 64;
175pub const OT_CRYPTO_ECDSA_SIGNATURE_SIZE: u32 = 64;
176pub const OT_CRYPTO_PBDKF2_MAX_SALT_SIZE: u32 = 30;
177pub const OT_PANID_BROADCAST: u32 = 65535;
178pub const OT_EXT_ADDRESS_SIZE: u32 = 8;
179pub const OT_MAC_KEY_SIZE: u32 = 16;
180pub const OT_JOINER_MAX_DISCERNER_LENGTH: u32 = 64;
181pub const OT_COMMISSIONING_PASSPHRASE_MIN_SIZE: u32 = 6;
182pub const OT_COMMISSIONING_PASSPHRASE_MAX_SIZE: u32 = 255;
183pub const OT_PROVISIONING_URL_MAX_SIZE: u32 = 64;
184pub const OT_STEERING_DATA_MAX_LENGTH: u32 = 16;
185pub const OT_JOINER_MAX_PSKD_LENGTH: u32 = 32;
186pub const OT_NETWORK_DATA_ITERATOR_INIT: u32 = 0;
187pub const OT_SERVICE_DATA_MAX_SIZE: u32 = 252;
188pub const OT_SERVER_DATA_MAX_SIZE: u32 = 248;
189pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT: u32 = 0;
190pub const OT_DNS_MAX_NAME_SIZE: u32 = 255;
191pub const OT_DNS_MAX_LABEL_SIZE: u32 = 64;
192pub const OT_DNS_TXT_KEY_MIN_LENGTH: u32 = 1;
193pub const OT_DNS_TXT_KEY_MAX_LENGTH: u32 = 9;
194pub const OT_DNS_TXT_KEY_ITER_MAX_LENGTH: u32 = 64;
195pub const OT_BORDER_AGENT_ID_LENGTH: u32 = 16;
196pub const OT_BORDER_AGENT_MESHCOP_SERVICE_TXT_DATA_MAX_LENGTH: u32 = 256;
197pub const OT_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME_MAX_LENGTH: u32 = 47;
198pub const OT_BORDER_AGENT_MIN_EPHEMERAL_KEY_LENGTH: u32 = 6;
199pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_LENGTH: u32 = 32;
200pub const OT_BORDER_AGENT_DEFAULT_EPHEMERAL_KEY_TIMEOUT: u32 = 120000;
201pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT: u32 = 600000;
202pub const OT_LOG_LEVEL_NONE: u32 = 0;
203pub const OT_LOG_LEVEL_CRIT: u32 = 1;
204pub const OT_LOG_LEVEL_WARN: u32 = 2;
205pub const OT_LOG_LEVEL_NOTE: u32 = 3;
206pub const OT_LOG_LEVEL_INFO: u32 = 4;
207pub const OT_LOG_LEVEL_DEBG: u32 = 5;
208pub const OT_DEFAULT_COAP_PORT: u32 = 5683;
209pub const OT_COAP_DEFAULT_TOKEN_LENGTH: u32 = 2;
210pub const OT_COAP_MAX_TOKEN_LENGTH: u32 = 8;
211pub const OT_COAP_MAX_RETRANSMIT: u32 = 20;
212pub const OT_COAP_MIN_ACK_TIMEOUT: u32 = 1000;
213pub const OT_DEFAULT_COAP_SECURE_PORT: u32 = 5684;
214pub const OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE: u32 = 65535;
215pub const OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL: u32 = 60000000;
216pub const OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE: u32 = 0;
217pub const OT_NETWORK_KEY_SIZE: u32 = 16;
218pub const OT_NETWORK_NAME_MAX_SIZE: u32 = 16;
219pub const OT_EXT_PAN_ID_SIZE: u32 = 8;
220pub const OT_MESH_LOCAL_PREFIX_SIZE: u32 = 8;
221pub const OT_PSKC_MAX_SIZE: u32 = 16;
222pub const OT_CHANNEL_1_MASK: u32 = 2;
223pub const OT_CHANNEL_2_MASK: u32 = 4;
224pub const OT_CHANNEL_3_MASK: u32 = 8;
225pub const OT_CHANNEL_4_MASK: u32 = 16;
226pub const OT_CHANNEL_5_MASK: u32 = 32;
227pub const OT_CHANNEL_6_MASK: u32 = 64;
228pub const OT_CHANNEL_7_MASK: u32 = 128;
229pub const OT_CHANNEL_8_MASK: u32 = 256;
230pub const OT_CHANNEL_9_MASK: u32 = 512;
231pub const OT_CHANNEL_10_MASK: u32 = 1024;
232pub const OT_CHANNEL_11_MASK: u32 = 2048;
233pub const OT_CHANNEL_12_MASK: u32 = 4096;
234pub const OT_CHANNEL_13_MASK: u32 = 8192;
235pub const OT_CHANNEL_14_MASK: u32 = 16384;
236pub const OT_CHANNEL_15_MASK: u32 = 32768;
237pub const OT_CHANNEL_16_MASK: u32 = 65536;
238pub const OT_CHANNEL_17_MASK: u32 = 131072;
239pub const OT_CHANNEL_18_MASK: u32 = 262144;
240pub const OT_CHANNEL_19_MASK: u32 = 524288;
241pub const OT_CHANNEL_20_MASK: u32 = 1048576;
242pub const OT_CHANNEL_21_MASK: u32 = 2097152;
243pub const OT_CHANNEL_22_MASK: u32 = 4194304;
244pub const OT_CHANNEL_23_MASK: u32 = 8388608;
245pub const OT_CHANNEL_24_MASK: u32 = 16777216;
246pub const OT_CHANNEL_25_MASK: u32 = 33554432;
247pub const OT_CHANNEL_26_MASK: u32 = 67108864;
248pub const OT_OPERATIONAL_DATASET_MAX_LENGTH: u32 = 254;
249pub const OT_ICMP6_HEADER_DATA_SIZE: u32 = 4;
250pub const OT_ICMP6_ROUTER_ADVERT_MIN_SIZE: u32 = 16;
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_LOG_HEX_DUMP_LINE_SIZE: u32 = 73;
255pub const OT_IP4_ADDRESS_SIZE: u32 = 4;
256pub const OT_IP4_ADDRESS_STRING_SIZE: u32 = 17;
257pub const OT_IP4_CIDR_STRING_SIZE: u32 = 20;
258pub const OT_THREAD_VERSION_INVALID: u32 = 0;
259pub const OT_THREAD_VERSION_1_1: u32 = 2;
260pub const OT_THREAD_VERSION_1_2: u32 = 3;
261pub const OT_THREAD_VERSION_1_3: u32 = 4;
262pub const OT_THREAD_VERSION_1_3_1: u32 = 5;
263pub const OT_THREAD_VERSION_1_4: u32 = 5;
264pub const OT_NETWORK_BASE_TLV_MAX_LENGTH: u32 = 254;
265pub const OT_NETWORK_MAX_ROUTER_ID: u32 = 62;
266pub const OT_NEIGHBOR_INFO_ITERATOR_INIT: u32 = 0;
267pub const OT_JOINER_ADVDATA_MAX_LENGTH: u32 = 64;
268pub const OT_DURATION_STRING_SIZE: u32 = 21;
269pub const OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS: u32 = 0;
270pub const OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS: u32 = 1;
271pub const OT_NETWORK_DIAGNOSTIC_TLV_MODE: u32 = 2;
272pub const OT_NETWORK_DIAGNOSTIC_TLV_TIMEOUT: u32 = 3;
273pub const OT_NETWORK_DIAGNOSTIC_TLV_CONNECTIVITY: u32 = 4;
274pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTE: u32 = 5;
275pub const OT_NETWORK_DIAGNOSTIC_TLV_LEADER_DATA: u32 = 6;
276pub const OT_NETWORK_DIAGNOSTIC_TLV_NETWORK_DATA: u32 = 7;
277pub const OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST: u32 = 8;
278pub const OT_NETWORK_DIAGNOSTIC_TLV_MAC_COUNTERS: u32 = 9;
279pub const OT_NETWORK_DIAGNOSTIC_TLV_BATTERY_LEVEL: u32 = 14;
280pub const OT_NETWORK_DIAGNOSTIC_TLV_SUPPLY_VOLTAGE: u32 = 15;
281pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE: u32 = 16;
282pub const OT_NETWORK_DIAGNOSTIC_TLV_CHANNEL_PAGES: u32 = 17;
283pub const OT_NETWORK_DIAGNOSTIC_TLV_TYPE_LIST: u32 = 18;
284pub const OT_NETWORK_DIAGNOSTIC_TLV_MAX_CHILD_TIMEOUT: u32 = 19;
285pub const OT_NETWORK_DIAGNOSTIC_TLV_EUI64: u32 = 23;
286pub const OT_NETWORK_DIAGNOSTIC_TLV_VERSION: u32 = 24;
287pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_NAME: u32 = 25;
288pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_MODEL: u32 = 26;
289pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_SW_VERSION: u32 = 27;
290pub const OT_NETWORK_DIAGNOSTIC_TLV_THREAD_STACK_VERSION: u32 = 28;
291pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD: u32 = 29;
292pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_IP6_ADDR_LIST: u32 = 30;
293pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTER_NEIGHBOR: u32 = 31;
294pub const OT_NETWORK_DIAGNOSTIC_TLV_ANSWER: u32 = 32;
295pub const OT_NETWORK_DIAGNOSTIC_TLV_QUERY_ID: u32 = 33;
296pub const OT_NETWORK_DIAGNOSTIC_TLV_MLE_COUNTERS: u32 = 34;
297pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_APP_URL: u32 = 35;
298pub const OT_NETWORK_DIAGNOSTIC_TLV_NON_PREFERRED_CHANNELS: u32 = 36;
299pub const OT_NETWORK_DIAGNOSTIC_TLV_ENHANCED_ROUTE: u32 = 37;
300pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH: u32 = 32;
301pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH: u32 = 32;
302pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH: u32 = 16;
303pub const OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH: u32 = 64;
304pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH: u32 = 96;
305pub const OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT: u32 = 0;
306pub const OT_TIME_SYNC_INVALID_SEQ: u32 = 0;
307pub const OT_PLAT_INFRA_IF_MAX_LINK_LAYER_ADDR_LENGTH: u32 = 16;
308pub const OT_MS_PER_S: u32 = 1000;
309pub const OT_US_PER_MS: u32 = 1000;
310pub const OT_US_PER_S: u32 = 1000000;
311pub const OT_NS_PER_US: u32 = 1000;
312pub const OT_SNTP_DEFAULT_SERVER_IP: &[u8; 19] = b"2001:4860:4806:8::\0";
313pub const OT_SNTP_DEFAULT_SERVER_PORT: u32 = 123;
314pub const OT_TCP_ENDPOINT_TCB_SIZE_BASE: u32 = 392;
315pub const OT_TCP_ENDPOINT_TCB_NUM_PTR: u32 = 36;
316pub const OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS: u32 = 2598;
317pub const OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS: u32 = 4157;
318pub const OT_TCP_LISTENER_TCB_SIZE_BASE: u32 = 16;
319pub const OT_TCP_LISTENER_TCB_NUM_PTR: u32 = 3;
320pub const OT_CHILD_IP6_ADDRESS_ITERATOR_INIT: u32 = 0;
321pub const OT_VERHOEFF_CHECKSUM_MAX_STRING_LENGTH: u32 = 128;
322#[doc = " No error."]
323pub const OT_ERROR_NONE: otError = 0;
324#[doc = " Operational failed."]
325pub const OT_ERROR_FAILED: otError = 1;
326#[doc = " Message was dropped."]
327pub const OT_ERROR_DROP: otError = 2;
328#[doc = " Insufficient buffers."]
329pub const OT_ERROR_NO_BUFS: otError = 3;
330#[doc = " No route available."]
331pub const OT_ERROR_NO_ROUTE: otError = 4;
332#[doc = " Service is busy and could not service the operation."]
333pub const OT_ERROR_BUSY: otError = 5;
334#[doc = " Failed to parse message."]
335pub const OT_ERROR_PARSE: otError = 6;
336#[doc = " Input arguments are invalid."]
337pub const OT_ERROR_INVALID_ARGS: otError = 7;
338#[doc = " Security checks failed."]
339pub const OT_ERROR_SECURITY: otError = 8;
340#[doc = " Address resolution requires an address query operation."]
341pub const OT_ERROR_ADDRESS_QUERY: otError = 9;
342#[doc = " Address is not in the source match table."]
343pub const OT_ERROR_NO_ADDRESS: otError = 10;
344#[doc = " Operation was aborted."]
345pub const OT_ERROR_ABORT: otError = 11;
346#[doc = " Function or method is not implemented."]
347pub const OT_ERROR_NOT_IMPLEMENTED: otError = 12;
348#[doc = " Cannot complete due to invalid state."]
349pub const OT_ERROR_INVALID_STATE: otError = 13;
350#[doc = " No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006)."]
351pub const OT_ERROR_NO_ACK: otError = 14;
352#[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)."]
353pub const OT_ERROR_CHANNEL_ACCESS_FAILURE: otError = 15;
354#[doc = " Not currently attached to a Thread Partition."]
355pub const OT_ERROR_DETACHED: otError = 16;
356#[doc = " FCS check failure while receiving."]
357pub const OT_ERROR_FCS: otError = 17;
358#[doc = " No frame received."]
359pub const OT_ERROR_NO_FRAME_RECEIVED: otError = 18;
360#[doc = " Received a frame from an unknown neighbor."]
361pub const OT_ERROR_UNKNOWN_NEIGHBOR: otError = 19;
362#[doc = " Received a frame from an invalid source address."]
363pub const OT_ERROR_INVALID_SOURCE_ADDRESS: otError = 20;
364#[doc = " Received a frame filtered by the address filter (allowlisted or denylisted)."]
365pub const OT_ERROR_ADDRESS_FILTERED: otError = 21;
366#[doc = " Received a frame filtered by the destination address check."]
367pub const OT_ERROR_DESTINATION_ADDRESS_FILTERED: otError = 22;
368#[doc = " The requested item could not be found."]
369pub const OT_ERROR_NOT_FOUND: otError = 23;
370#[doc = " The operation is already in progress."]
371pub const OT_ERROR_ALREADY: otError = 24;
372#[doc = " The creation of IPv6 address failed."]
373pub const OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: otError = 26;
374#[doc = " Operation prevented by mode flags"]
375pub const OT_ERROR_NOT_CAPABLE: otError = 27;
376#[doc = " Coap response or acknowledgment or DNS, SNTP response not received."]
377pub const OT_ERROR_RESPONSE_TIMEOUT: otError = 28;
378#[doc = " Received a duplicated frame."]
379pub const OT_ERROR_DUPLICATED: otError = 29;
380#[doc = " Message is being dropped from reassembly list due to timeout."]
381pub const OT_ERROR_REASSEMBLY_TIMEOUT: otError = 30;
382#[doc = " Message is not a TMF Message."]
383pub const OT_ERROR_NOT_TMF: otError = 31;
384#[doc = " Received a non-lowpan data frame."]
385pub const OT_ERROR_NOT_LOWPAN_DATA_FRAME: otError = 32;
386#[doc = " The link margin was too low."]
387pub const OT_ERROR_LINK_MARGIN_LOW: otError = 34;
388#[doc = " Input (CLI) command is invalid."]
389pub const OT_ERROR_INVALID_COMMAND: otError = 35;
390#[doc = " Special error code used to indicate success/error status is pending and not yet known."]
391pub const OT_ERROR_PENDING: otError = 36;
392#[doc = " Request rejected."]
393pub const OT_ERROR_REJECTED: otError = 37;
394#[doc = " The number of defined errors."]
395pub const OT_NUM_ERRORS: otError = 38;
396#[doc = " Generic error (should not use)."]
397pub const OT_ERROR_GENERIC: otError = 255;
398#[doc = " Represents error codes used throughout OpenThread."]
399pub type otError = ::std::os::raw::c_uint;
400unsafe extern "C" {
401 #[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."]
402 pub fn otThreadErrorToString(aError: otError) -> *const ::std::os::raw::c_char;
403}
404#[repr(C)]
405#[derive(Debug, Default, Copy, Clone)]
406pub struct otInstance {
407 _unused: [u8; 0],
408}
409unsafe extern "C" {
410 #[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"]
411 pub fn otInstanceInit(
412 aInstanceBuffer: *mut ::std::os::raw::c_void,
413 aInstanceBufferSize: *mut usize,
414 ) -> *mut otInstance;
415}
416unsafe extern "C" {
417 #[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."]
418 pub fn otInstanceInitSingle() -> *mut otInstance;
419}
420unsafe extern "C" {
421 #[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."]
422 pub fn otInstanceGetSingle() -> *mut otInstance;
423}
424unsafe extern "C" {
425 #[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."]
426 pub fn otInstanceInitMultiple(aIdx: u8) -> *mut otInstance;
427}
428unsafe extern "C" {
429 #[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."]
430 pub fn otInstanceGetInstance(aIdx: u8) -> *mut otInstance;
431}
432unsafe extern "C" {
433 #[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."]
434 pub fn otInstanceGetIndex(aInstance: *mut otInstance) -> u8;
435}
436unsafe extern "C" {
437 #[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."]
438 pub fn otInstanceGetId(aInstance: *mut otInstance) -> u32;
439}
440unsafe extern "C" {
441 #[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."]
442 pub fn otInstanceIsInitialized(aInstance: *mut otInstance) -> bool;
443}
444unsafe extern "C" {
445 #[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."]
446 pub fn otInstanceFinalize(aInstance: *mut otInstance);
447}
448unsafe extern "C" {
449 #[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)."]
450 pub fn otInstanceGetUptime(aInstance: *mut otInstance) -> u64;
451}
452unsafe extern "C" {
453 #[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`."]
454 pub fn otInstanceGetUptimeAsString(
455 aInstance: *mut otInstance,
456 aBuffer: *mut ::std::os::raw::c_char,
457 aSize: u16,
458 );
459}
460#[doc = " Represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*`\n definitions."]
461pub type otChangedFlags = u32;
462#[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."]
463pub type otStateChangedCallback = ::std::option::Option<
464 unsafe extern "C" fn(aFlags: otChangedFlags, aContext: *mut ::std::os::raw::c_void),
465>;
466unsafe extern "C" {
467 #[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."]
468 pub fn otSetStateChangedCallback(
469 aInstance: *mut otInstance,
470 aCallback: otStateChangedCallback,
471 aContext: *mut ::std::os::raw::c_void,
472 ) -> otError;
473}
474unsafe extern "C" {
475 #[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."]
476 pub fn otRemoveStateChangeCallback(
477 aInstance: *mut otInstance,
478 aCallback: otStateChangedCallback,
479 aContext: *mut ::std::os::raw::c_void,
480 );
481}
482unsafe extern "C" {
483 #[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."]
484 pub fn otInstanceReset(aInstance: *mut otInstance);
485}
486unsafe extern "C" {
487 #[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."]
488 pub fn otInstanceResetToBootloader(aInstance: *mut otInstance) -> otError;
489}
490unsafe extern "C" {
491 #[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."]
492 pub fn otInstanceFactoryReset(aInstance: *mut otInstance);
493}
494unsafe extern "C" {
495 #[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."]
496 pub fn otInstanceResetRadioStack(aInstance: *mut otInstance);
497}
498unsafe extern "C" {
499 #[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."]
500 pub fn otInstanceErasePersistentInfo(aInstance: *mut otInstance) -> otError;
501}
502unsafe extern "C" {
503 #[doc = " Gets the OpenThread version string.\n\n @returns A pointer to the OpenThread version."]
504 pub fn otGetVersionString() -> *const ::std::os::raw::c_char;
505}
506unsafe extern "C" {
507 #[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."]
508 pub fn otGetRadioVersionString(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
509}
510#[doc = " Represents Backbone Router configuration."]
511#[repr(C)]
512#[derive(Debug, Default, Copy, Clone)]
513pub struct otBackboneRouterConfig {
514 #[doc = "< Only used when get Primary Backbone Router information in the Thread Network"]
515 pub mServer16: u16,
516 #[doc = "< Reregistration Delay (in seconds)"]
517 pub mReregistrationDelay: u16,
518 #[doc = "< Multicast Listener Registration Timeout (in seconds)"]
519 pub mMlrTimeout: u32,
520 #[doc = "< Sequence Number"]
521 pub mSequenceNumber: u8,
522}
523unsafe extern "C" {
524 #[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."]
525 pub fn otBackboneRouterGetPrimary(
526 aInstance: *mut otInstance,
527 aConfig: *mut otBackboneRouterConfig,
528 ) -> otError;
529}
530#[repr(C)]
531#[derive(Debug, Default, Copy, Clone)]
532pub struct otMessage {
533 _unused: [u8; 0],
534}
535#[doc = "< Low priority level."]
536pub const OT_MESSAGE_PRIORITY_LOW: otMessagePriority = 0;
537#[doc = "< Normal priority level."]
538pub const OT_MESSAGE_PRIORITY_NORMAL: otMessagePriority = 1;
539#[doc = "< High priority level."]
540pub const OT_MESSAGE_PRIORITY_HIGH: otMessagePriority = 2;
541#[doc = " Defines the OpenThread message priority levels."]
542pub type otMessagePriority = ::std::os::raw::c_uint;
543#[doc = "< Message from Thread Netif."]
544pub const OT_MESSAGE_ORIGIN_THREAD_NETIF: otMessageOrigin = 0;
545#[doc = "< Message from a trusted source on host."]
546pub const OT_MESSAGE_ORIGIN_HOST_TRUSTED: otMessageOrigin = 1;
547#[doc = "< Message from an untrusted source on host."]
548pub const OT_MESSAGE_ORIGIN_HOST_UNTRUSTED: otMessageOrigin = 2;
549#[doc = " Defines the OpenThread message origins."]
550pub type otMessageOrigin = ::std::os::raw::c_uint;
551#[doc = " Represents a message settings."]
552#[repr(C)]
553#[derive(Debug, Default, Copy, Clone)]
554pub struct otMessageSettings {
555 #[doc = "< TRUE if the message should be secured at Layer 2."]
556 pub mLinkSecurityEnabled: bool,
557 #[doc = "< Priority level (MUST be a `OT_MESSAGE_PRIORITY_*` from `otMessagePriority`)."]
558 pub mPriority: u8,
559}
560#[doc = " Represents link-specific information for messages received from the Thread radio."]
561#[repr(C)]
562#[derive(Debug, Default, Copy, Clone)]
563pub struct otThreadLinkInfo {
564 #[doc = "< Source PAN ID"]
565 pub mPanId: u16,
566 #[doc = "< 802.15.4 Channel"]
567 pub mChannel: u8,
568 #[doc = "< Received Signal Strength in dBm (averaged over fragments)"]
569 pub mRss: i8,
570 #[doc = "< Average Link Quality Indicator (averaged over fragments)"]
571 pub mLqi: u8,
572 pub _bitfield_align_1: [u8; 0],
573 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
574 #[doc = "< The time sync sequence."]
575 pub mTimeSyncSeq: u8,
576 #[doc = "< The time offset to the Thread network time, in microseconds."]
577 pub mNetworkTimeOffset: i64,
578 #[doc = "< Radio link type."]
579 pub mRadioType: u8,
580}
581impl otThreadLinkInfo {
582 #[inline]
583 pub fn mLinkSecurity(&self) -> bool {
584 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
585 }
586 #[inline]
587 pub fn set_mLinkSecurity(&mut self, val: bool) {
588 unsafe {
589 let val: u8 = ::std::mem::transmute(val);
590 self._bitfield_1.set(0usize, 1u8, val as u64)
591 }
592 }
593 #[inline]
594 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
595 unsafe {
596 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
597 ::std::ptr::addr_of!((*this)._bitfield_1),
598 0usize,
599 1u8,
600 ) as u8)
601 }
602 }
603 #[inline]
604 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
605 unsafe {
606 let val: u8 = ::std::mem::transmute(val);
607 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
608 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
609 0usize,
610 1u8,
611 val as u64,
612 )
613 }
614 }
615 #[inline]
616 pub fn mIsDstPanIdBroadcast(&self) -> bool {
617 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
618 }
619 #[inline]
620 pub fn set_mIsDstPanIdBroadcast(&mut self, val: bool) {
621 unsafe {
622 let val: u8 = ::std::mem::transmute(val);
623 self._bitfield_1.set(1usize, 1u8, val as u64)
624 }
625 }
626 #[inline]
627 pub unsafe fn mIsDstPanIdBroadcast_raw(this: *const Self) -> bool {
628 unsafe {
629 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
630 ::std::ptr::addr_of!((*this)._bitfield_1),
631 1usize,
632 1u8,
633 ) as u8)
634 }
635 }
636 #[inline]
637 pub unsafe fn set_mIsDstPanIdBroadcast_raw(this: *mut Self, val: bool) {
638 unsafe {
639 let val: u8 = ::std::mem::transmute(val);
640 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
641 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
642 1usize,
643 1u8,
644 val as u64,
645 )
646 }
647 }
648 #[inline]
649 pub fn new_bitfield_1(
650 mLinkSecurity: bool,
651 mIsDstPanIdBroadcast: bool,
652 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
653 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
654 __bindgen_bitfield_unit.set(0usize, 1u8, {
655 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
656 mLinkSecurity as u64
657 });
658 __bindgen_bitfield_unit.set(1usize, 1u8, {
659 let mIsDstPanIdBroadcast: u8 = unsafe { ::std::mem::transmute(mIsDstPanIdBroadcast) };
660 mIsDstPanIdBroadcast as u64
661 });
662 __bindgen_bitfield_unit
663 }
664}
665unsafe extern "C" {
666 #[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."]
667 pub fn otMessageGetInstance(aMessage: *const otMessage) -> *mut otInstance;
668}
669unsafe extern "C" {
670 #[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"]
671 pub fn otMessageFree(aMessage: *mut otMessage);
672}
673unsafe extern "C" {
674 #[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"]
675 pub fn otMessageGetLength(aMessage: *const otMessage) -> u16;
676}
677unsafe extern "C" {
678 #[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"]
679 pub fn otMessageSetLength(aMessage: *mut otMessage, aLength: u16) -> otError;
680}
681unsafe extern "C" {
682 #[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"]
683 pub fn otMessageGetOffset(aMessage: *const otMessage) -> u16;
684}
685unsafe extern "C" {
686 #[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"]
687 pub fn otMessageSetOffset(aMessage: *mut otMessage, aOffset: u16);
688}
689unsafe extern "C" {
690 #[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."]
691 pub fn otMessageIsLinkSecurityEnabled(aMessage: *const otMessage) -> bool;
692}
693unsafe extern "C" {
694 #[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."]
695 pub fn otMessageIsLoopbackToHostAllowed(aMessage: *const otMessage) -> bool;
696}
697unsafe extern "C" {
698 #[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."]
699 pub fn otMessageSetLoopbackToHostAllowed(aMessage: *mut otMessage, aAllowLoopbackToHost: bool);
700}
701unsafe extern "C" {
702 #[doc = " Indicates whether the given message may be looped back in a case of a multicast destination address.\n\n If @p aMessage is used along with an `otMessageInfo`, the `mMulticastLoop` field from `otMessageInfo` structure\n takes precedence and will be used instead of the the value set on @p aMessage.\n\n This API is mainly intended for use along with `otIp6Send()` which expects an already prepared IPv6 message.\n\n @param[in] aMessage A pointer to the message."]
703 pub fn otMessageIsMulticastLoopEnabled(aMessage: *mut otMessage) -> bool;
704}
705unsafe extern "C" {
706 #[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."]
707 pub fn otMessageSetMulticastLoopEnabled(aMessage: *mut otMessage, aEnabled: bool);
708}
709unsafe extern "C" {
710 #[doc = " Gets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message origin."]
711 pub fn otMessageGetOrigin(aMessage: *const otMessage) -> otMessageOrigin;
712}
713unsafe extern "C" {
714 #[doc = " Sets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOrigin The message origin."]
715 pub fn otMessageSetOrigin(aMessage: *mut otMessage, aOrigin: otMessageOrigin);
716}
717unsafe extern "C" {
718 #[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."]
719 pub fn otMessageSetDirectTransmission(aMessage: *mut otMessage, aEnabled: bool);
720}
721unsafe extern "C" {
722 #[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."]
723 pub fn otMessageGetRss(aMessage: *const otMessage) -> i8;
724}
725unsafe extern "C" {
726 #[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`."]
727 pub fn otMessageGetThreadLinkInfo(
728 aMessage: *const otMessage,
729 aLinkInfo: *mut otThreadLinkInfo,
730 ) -> otError;
731}
732#[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."]
733pub type otMessageTxCallback = ::std::option::Option<
734 unsafe extern "C" fn(
735 aMessage: *const otMessage,
736 aError: otError,
737 aContext: *mut ::std::os::raw::c_void,
738 ),
739>;
740unsafe extern "C" {
741 #[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."]
742 pub fn otMessageRegisterTxCallback(
743 aMessage: *mut otMessage,
744 aCallback: otMessageTxCallback,
745 aContext: *mut ::std::os::raw::c_void,
746 );
747}
748unsafe extern "C" {
749 #[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"]
750 pub fn otMessageAppend(
751 aMessage: *mut otMessage,
752 aBuf: *const ::std::os::raw::c_void,
753 aLength: u16,
754 ) -> otError;
755}
756unsafe extern "C" {
757 #[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"]
758 pub fn otMessageRead(
759 aMessage: *const otMessage,
760 aOffset: u16,
761 aBuf: *mut ::std::os::raw::c_void,
762 aLength: u16,
763 ) -> u16;
764}
765unsafe extern "C" {
766 #[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"]
767 pub fn otMessageWrite(
768 aMessage: *mut otMessage,
769 aOffset: u16,
770 aBuf: *const ::std::os::raw::c_void,
771 aLength: u16,
772 ) -> ::std::os::raw::c_int;
773}
774#[doc = " Represents an OpenThread message queue."]
775#[repr(C)]
776#[derive(Debug, Copy, Clone)]
777pub struct otMessageQueue {
778 #[doc = "< Opaque data used by the implementation."]
779 pub mData: *mut ::std::os::raw::c_void,
780 #[doc = "< Opaque data used by the implementation."]
781 pub mData2: *mut ::std::os::raw::c_void,
782}
783impl Default for otMessageQueue {
784 fn default() -> Self {
785 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
786 unsafe {
787 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
788 s.assume_init()
789 }
790 }
791}
792#[doc = " Represents information about a message queue."]
793#[repr(C)]
794#[derive(Debug, Default, Copy, Clone)]
795pub struct otMessageQueueInfo {
796 #[doc = "< Number of messages in the queue."]
797 pub mNumMessages: u16,
798 #[doc = "< Number of data buffers used by messages in the queue."]
799 pub mNumBuffers: u16,
800 #[doc = "< Total number of bytes used by all messages in the queue."]
801 pub mTotalBytes: u32,
802}
803#[doc = " Represents the message buffer information for different queues used by OpenThread stack."]
804#[repr(C)]
805#[derive(Debug, Default, Copy, Clone)]
806pub struct otBufferInfo {
807 #[doc = "< The total number of buffers in the messages pool (0xffff if unknown)."]
808 pub mTotalBuffers: u16,
809 #[doc = "< The number of free buffers (0xffff if unknown)."]
810 pub mFreeBuffers: u16,
811 #[doc = " The maximum number of used buffers at the same time since OT stack initialization or last call to\n `otMessageResetBufferInfo()`."]
812 pub mMaxUsedBuffers: u16,
813 #[doc = "< Info about 6LoWPAN send queue."]
814 pub m6loSendQueue: otMessageQueueInfo,
815 #[doc = "< Info about 6LoWPAN reassembly queue."]
816 pub m6loReassemblyQueue: otMessageQueueInfo,
817 #[doc = "< Info about IPv6 send queue."]
818 pub mIp6Queue: otMessageQueueInfo,
819 #[doc = "< Info about MPL send queue."]
820 pub mMplQueue: otMessageQueueInfo,
821 #[doc = "< Info about MLE delayed message queue."]
822 pub mMleQueue: otMessageQueueInfo,
823 #[doc = "< Info about CoAP/TMF send queue."]
824 pub mCoapQueue: otMessageQueueInfo,
825 #[doc = "< Info about CoAP secure send queue."]
826 pub mCoapSecureQueue: otMessageQueueInfo,
827 #[doc = "< Info about application CoAP send queue."]
828 pub mApplicationCoapQueue: otMessageQueueInfo,
829}
830unsafe extern "C" {
831 #[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."]
832 pub fn otMessageQueueInit(aQueue: *mut otMessageQueue);
833}
834unsafe extern "C" {
835 #[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."]
836 pub fn otMessageQueueEnqueue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
837}
838unsafe extern "C" {
839 #[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."]
840 pub fn otMessageQueueEnqueueAtHead(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
841}
842unsafe extern "C" {
843 #[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."]
844 pub fn otMessageQueueDequeue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
845}
846unsafe extern "C" {
847 #[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."]
848 pub fn otMessageQueueGetHead(aQueue: *mut otMessageQueue) -> *mut otMessage;
849}
850unsafe extern "C" {
851 #[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`."]
852 pub fn otMessageQueueGetNext(
853 aQueue: *mut otMessageQueue,
854 aMessage: *const otMessage,
855 ) -> *mut otMessage;
856}
857unsafe extern "C" {
858 #[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."]
859 pub fn otMessageGetBufferInfo(aInstance: *mut otInstance, aBufferInfo: *mut otBufferInfo);
860}
861unsafe extern "C" {
862 #[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."]
863 pub fn otMessageResetBufferInfo(aInstance: *mut otInstance);
864}
865#[doc = " @struct otIp6InterfaceIdentifier\n\n Represents the Interface Identifier of an IPv6 address."]
866#[repr(C, packed)]
867#[derive(Copy, Clone)]
868pub struct otIp6InterfaceIdentifier {
869 #[doc = "< The Interface Identifier accessor fields"]
870 pub mFields: otIp6InterfaceIdentifier__bindgen_ty_1,
871}
872#[repr(C, packed)]
873#[derive(Copy, Clone)]
874pub union otIp6InterfaceIdentifier__bindgen_ty_1 {
875 #[doc = "< 8-bit fields"]
876 pub m8: [u8; 8usize],
877 #[doc = "< 16-bit fields"]
878 pub m16: [u16; 4usize],
879 #[doc = "< 32-bit fields"]
880 pub m32: [u32; 2usize],
881}
882impl Default for otIp6InterfaceIdentifier__bindgen_ty_1 {
883 fn default() -> Self {
884 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
885 unsafe {
886 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
887 s.assume_init()
888 }
889 }
890}
891impl Default for otIp6InterfaceIdentifier {
892 fn default() -> Self {
893 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
894 unsafe {
895 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
896 s.assume_init()
897 }
898 }
899}
900#[doc = " @struct otIp6NetworkPrefix\n\n Represents the Network Prefix of an IPv6 address (most significant 64 bits of the address)."]
901#[repr(C, packed)]
902#[derive(Debug, Default, Copy, Clone)]
903pub struct otIp6NetworkPrefix {
904 #[doc = "< The Network Prefix."]
905 pub m8: [u8; 8usize],
906}
907#[doc = " @struct otIp6AddressComponents\n\n Represents the components of an IPv6 address."]
908#[repr(C, packed)]
909#[derive(Copy, Clone)]
910pub struct otIp6AddressComponents {
911 #[doc = "< The Network Prefix (most significant 64 bits of the address)"]
912 pub mNetworkPrefix: otIp6NetworkPrefix,
913 #[doc = "< The Interface Identifier (least significant 64 bits of the address)"]
914 pub mIid: otIp6InterfaceIdentifier,
915}
916impl Default for otIp6AddressComponents {
917 fn default() -> Self {
918 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
919 unsafe {
920 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
921 s.assume_init()
922 }
923 }
924}
925#[doc = " @struct otIp6Address\n\n Represents an IPv6 address."]
926#[repr(C, packed)]
927#[derive(Copy, Clone)]
928pub struct otIp6Address {
929 #[doc = "< IPv6 accessor fields"]
930 pub mFields: otIp6Address__bindgen_ty_1,
931}
932#[repr(C, packed)]
933#[derive(Copy, Clone)]
934pub union otIp6Address__bindgen_ty_1 {
935 #[doc = "< 8-bit fields"]
936 pub m8: [u8; 16usize],
937 #[doc = "< 16-bit fields"]
938 pub m16: [u16; 8usize],
939 #[doc = "< 32-bit fields"]
940 pub m32: [u32; 4usize],
941 #[doc = "< IPv6 address components"]
942 pub mComponents: otIp6AddressComponents,
943}
944impl Default for otIp6Address__bindgen_ty_1 {
945 fn default() -> Self {
946 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
947 unsafe {
948 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
949 s.assume_init()
950 }
951 }
952}
953impl Default for otIp6Address {
954 fn default() -> Self {
955 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
956 unsafe {
957 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
958 s.assume_init()
959 }
960 }
961}
962#[doc = " @struct otIp6Prefix\n\n Represents an IPv6 prefix."]
963#[repr(C, packed)]
964#[derive(Copy, Clone)]
965pub struct otIp6Prefix {
966 #[doc = "< The IPv6 prefix."]
967 pub mPrefix: otIp6Address,
968 #[doc = "< The IPv6 prefix length (in bits)."]
969 pub mLength: u8,
970}
971impl Default for otIp6Prefix {
972 fn default() -> Self {
973 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
974 unsafe {
975 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
976 s.assume_init()
977 }
978 }
979}
980#[doc = "< Thread assigned address (ALOC, RLOC, MLEID, etc)"]
981pub const OT_ADDRESS_ORIGIN_THREAD: _bindgen_ty_1 = 0;
982#[doc = "< SLAAC assigned address"]
983pub const OT_ADDRESS_ORIGIN_SLAAC: _bindgen_ty_1 = 1;
984#[doc = "< DHCPv6 assigned address"]
985pub const OT_ADDRESS_ORIGIN_DHCPV6: _bindgen_ty_1 = 2;
986#[doc = "< Manually assigned address"]
987pub const OT_ADDRESS_ORIGIN_MANUAL: _bindgen_ty_1 = 3;
988#[doc = " IPv6 Address origins"]
989pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
990#[doc = " Represents an IPv6 network interface unicast address."]
991#[repr(C)]
992#[derive(Copy, Clone)]
993pub struct otNetifAddress {
994 #[doc = "< The IPv6 unicast address."]
995 pub mAddress: otIp6Address,
996 #[doc = "< The Prefix length (in bits)."]
997 pub mPrefixLength: u8,
998 #[doc = "< The IPv6 address origin."]
999 pub mAddressOrigin: u8,
1000 pub _bitfield_align_1: [u8; 0],
1001 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
1002 #[doc = "< A pointer to the next network interface address."]
1003 pub mNext: *const otNetifAddress,
1004}
1005impl Default for otNetifAddress {
1006 fn default() -> Self {
1007 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1008 unsafe {
1009 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1010 s.assume_init()
1011 }
1012 }
1013}
1014impl otNetifAddress {
1015 #[inline]
1016 pub fn mPreferred(&self) -> bool {
1017 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1018 }
1019 #[inline]
1020 pub fn set_mPreferred(&mut self, val: bool) {
1021 unsafe {
1022 let val: u8 = ::std::mem::transmute(val);
1023 self._bitfield_1.set(0usize, 1u8, val as u64)
1024 }
1025 }
1026 #[inline]
1027 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
1028 unsafe {
1029 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1030 ::std::ptr::addr_of!((*this)._bitfield_1),
1031 0usize,
1032 1u8,
1033 ) as u8)
1034 }
1035 }
1036 #[inline]
1037 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
1038 unsafe {
1039 let val: u8 = ::std::mem::transmute(val);
1040 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1041 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1042 0usize,
1043 1u8,
1044 val as u64,
1045 )
1046 }
1047 }
1048 #[inline]
1049 pub fn mValid(&self) -> bool {
1050 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1051 }
1052 #[inline]
1053 pub fn set_mValid(&mut self, val: bool) {
1054 unsafe {
1055 let val: u8 = ::std::mem::transmute(val);
1056 self._bitfield_1.set(1usize, 1u8, val as u64)
1057 }
1058 }
1059 #[inline]
1060 pub unsafe fn mValid_raw(this: *const Self) -> bool {
1061 unsafe {
1062 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1063 ::std::ptr::addr_of!((*this)._bitfield_1),
1064 1usize,
1065 1u8,
1066 ) as u8)
1067 }
1068 }
1069 #[inline]
1070 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
1071 unsafe {
1072 let val: u8 = ::std::mem::transmute(val);
1073 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1074 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1075 1usize,
1076 1u8,
1077 val as u64,
1078 )
1079 }
1080 }
1081 #[inline]
1082 pub fn mScopeOverrideValid(&self) -> bool {
1083 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1084 }
1085 #[inline]
1086 pub fn set_mScopeOverrideValid(&mut self, val: bool) {
1087 unsafe {
1088 let val: u8 = ::std::mem::transmute(val);
1089 self._bitfield_1.set(2usize, 1u8, val as u64)
1090 }
1091 }
1092 #[inline]
1093 pub unsafe fn mScopeOverrideValid_raw(this: *const Self) -> bool {
1094 unsafe {
1095 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1096 ::std::ptr::addr_of!((*this)._bitfield_1),
1097 2usize,
1098 1u8,
1099 ) as u8)
1100 }
1101 }
1102 #[inline]
1103 pub unsafe fn set_mScopeOverrideValid_raw(this: *mut Self, val: bool) {
1104 unsafe {
1105 let val: u8 = ::std::mem::transmute(val);
1106 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1107 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1108 2usize,
1109 1u8,
1110 val as u64,
1111 )
1112 }
1113 }
1114 #[inline]
1115 pub fn mScopeOverride(&self) -> ::std::os::raw::c_uint {
1116 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 4u8) as u32) }
1117 }
1118 #[inline]
1119 pub fn set_mScopeOverride(&mut self, val: ::std::os::raw::c_uint) {
1120 unsafe {
1121 let val: u32 = ::std::mem::transmute(val);
1122 self._bitfield_1.set(3usize, 4u8, val as u64)
1123 }
1124 }
1125 #[inline]
1126 pub unsafe fn mScopeOverride_raw(this: *const Self) -> ::std::os::raw::c_uint {
1127 unsafe {
1128 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1129 ::std::ptr::addr_of!((*this)._bitfield_1),
1130 3usize,
1131 4u8,
1132 ) as u32)
1133 }
1134 }
1135 #[inline]
1136 pub unsafe fn set_mScopeOverride_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
1137 unsafe {
1138 let val: u32 = ::std::mem::transmute(val);
1139 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1140 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1141 3usize,
1142 4u8,
1143 val as u64,
1144 )
1145 }
1146 }
1147 #[inline]
1148 pub fn mRloc(&self) -> bool {
1149 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
1150 }
1151 #[inline]
1152 pub fn set_mRloc(&mut self, val: bool) {
1153 unsafe {
1154 let val: u8 = ::std::mem::transmute(val);
1155 self._bitfield_1.set(7usize, 1u8, val as u64)
1156 }
1157 }
1158 #[inline]
1159 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
1160 unsafe {
1161 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1162 ::std::ptr::addr_of!((*this)._bitfield_1),
1163 7usize,
1164 1u8,
1165 ) as u8)
1166 }
1167 }
1168 #[inline]
1169 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
1170 unsafe {
1171 let val: u8 = ::std::mem::transmute(val);
1172 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1173 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1174 7usize,
1175 1u8,
1176 val as u64,
1177 )
1178 }
1179 }
1180 #[inline]
1181 pub fn mMeshLocal(&self) -> bool {
1182 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
1183 }
1184 #[inline]
1185 pub fn set_mMeshLocal(&mut self, val: bool) {
1186 unsafe {
1187 let val: u8 = ::std::mem::transmute(val);
1188 self._bitfield_1.set(8usize, 1u8, val as u64)
1189 }
1190 }
1191 #[inline]
1192 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
1193 unsafe {
1194 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1195 ::std::ptr::addr_of!((*this)._bitfield_1),
1196 8usize,
1197 1u8,
1198 ) as u8)
1199 }
1200 }
1201 #[inline]
1202 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
1203 unsafe {
1204 let val: u8 = ::std::mem::transmute(val);
1205 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1206 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1207 8usize,
1208 1u8,
1209 val as u64,
1210 )
1211 }
1212 }
1213 #[inline]
1214 pub fn mSrpRegistered(&self) -> bool {
1215 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
1216 }
1217 #[inline]
1218 pub fn set_mSrpRegistered(&mut self, val: bool) {
1219 unsafe {
1220 let val: u8 = ::std::mem::transmute(val);
1221 self._bitfield_1.set(9usize, 1u8, val as u64)
1222 }
1223 }
1224 #[inline]
1225 pub unsafe fn mSrpRegistered_raw(this: *const Self) -> bool {
1226 unsafe {
1227 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1228 ::std::ptr::addr_of!((*this)._bitfield_1),
1229 9usize,
1230 1u8,
1231 ) as u8)
1232 }
1233 }
1234 #[inline]
1235 pub unsafe fn set_mSrpRegistered_raw(this: *mut Self, val: bool) {
1236 unsafe {
1237 let val: u8 = ::std::mem::transmute(val);
1238 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1239 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1240 9usize,
1241 1u8,
1242 val as u64,
1243 )
1244 }
1245 }
1246 #[inline]
1247 pub fn new_bitfield_1(
1248 mPreferred: bool,
1249 mValid: bool,
1250 mScopeOverrideValid: bool,
1251 mScopeOverride: ::std::os::raw::c_uint,
1252 mRloc: bool,
1253 mMeshLocal: bool,
1254 mSrpRegistered: bool,
1255 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
1256 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
1257 __bindgen_bitfield_unit.set(0usize, 1u8, {
1258 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
1259 mPreferred as u64
1260 });
1261 __bindgen_bitfield_unit.set(1usize, 1u8, {
1262 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
1263 mValid as u64
1264 });
1265 __bindgen_bitfield_unit.set(2usize, 1u8, {
1266 let mScopeOverrideValid: u8 = unsafe { ::std::mem::transmute(mScopeOverrideValid) };
1267 mScopeOverrideValid as u64
1268 });
1269 __bindgen_bitfield_unit.set(3usize, 4u8, {
1270 let mScopeOverride: u32 = unsafe { ::std::mem::transmute(mScopeOverride) };
1271 mScopeOverride as u64
1272 });
1273 __bindgen_bitfield_unit.set(7usize, 1u8, {
1274 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
1275 mRloc as u64
1276 });
1277 __bindgen_bitfield_unit.set(8usize, 1u8, {
1278 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
1279 mMeshLocal as u64
1280 });
1281 __bindgen_bitfield_unit.set(9usize, 1u8, {
1282 let mSrpRegistered: u8 = unsafe { ::std::mem::transmute(mSrpRegistered) };
1283 mSrpRegistered as u64
1284 });
1285 __bindgen_bitfield_unit
1286 }
1287}
1288#[doc = " Represents an IPv6 network interface multicast address."]
1289#[repr(C)]
1290#[derive(Copy, Clone)]
1291pub struct otNetifMulticastAddress {
1292 #[doc = "< The IPv6 multicast address."]
1293 pub mAddress: otIp6Address,
1294 #[doc = "< A pointer to the next network interface multicast address."]
1295 pub mNext: *const otNetifMulticastAddress,
1296}
1297impl Default for otNetifMulticastAddress {
1298 fn default() -> Self {
1299 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1300 unsafe {
1301 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1302 s.assume_init()
1303 }
1304 }
1305}
1306#[doc = " Represents an IPv6 socket address."]
1307#[repr(C)]
1308#[derive(Copy, Clone)]
1309pub struct otSockAddr {
1310 #[doc = "< An IPv6 address."]
1311 pub mAddress: otIp6Address,
1312 #[doc = "< A transport-layer port."]
1313 pub mPort: u16,
1314}
1315impl Default for otSockAddr {
1316 fn default() -> Self {
1317 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1318 unsafe {
1319 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1320 s.assume_init()
1321 }
1322 }
1323}
1324#[doc = "< Non-ECT"]
1325pub const OT_ECN_NOT_CAPABLE: _bindgen_ty_2 = 0;
1326#[doc = "< ECT(0)"]
1327pub const OT_ECN_CAPABLE_0: _bindgen_ty_2 = 2;
1328#[doc = "< ECT(1)"]
1329pub const OT_ECN_CAPABLE_1: _bindgen_ty_2 = 1;
1330#[doc = "< Congestion encountered (CE)"]
1331pub const OT_ECN_MARKED: _bindgen_ty_2 = 3;
1332#[doc = " ECN statuses, represented as in the IP header."]
1333pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
1334#[doc = " Represents the local and peer IPv6 socket addresses."]
1335#[repr(C)]
1336#[derive(Copy, Clone)]
1337pub struct otMessageInfo {
1338 #[doc = "< The local IPv6 address."]
1339 pub mSockAddr: otIp6Address,
1340 #[doc = "< The peer IPv6 address."]
1341 pub mPeerAddr: otIp6Address,
1342 #[doc = "< The local transport-layer port."]
1343 pub mSockPort: u16,
1344 #[doc = "< The peer transport-layer port."]
1345 pub mPeerPort: u16,
1346 #[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."]
1347 pub mHopLimit: u8,
1348 pub _bitfield_align_1: [u8; 0],
1349 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1350}
1351impl Default for otMessageInfo {
1352 fn default() -> Self {
1353 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1354 unsafe {
1355 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1356 s.assume_init()
1357 }
1358 }
1359}
1360impl otMessageInfo {
1361 #[inline]
1362 pub fn mEcn(&self) -> u8 {
1363 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
1364 }
1365 #[inline]
1366 pub fn set_mEcn(&mut self, val: u8) {
1367 unsafe {
1368 let val: u8 = ::std::mem::transmute(val);
1369 self._bitfield_1.set(0usize, 2u8, val as u64)
1370 }
1371 }
1372 #[inline]
1373 pub unsafe fn mEcn_raw(this: *const Self) -> u8 {
1374 unsafe {
1375 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1376 ::std::ptr::addr_of!((*this)._bitfield_1),
1377 0usize,
1378 2u8,
1379 ) as u8)
1380 }
1381 }
1382 #[inline]
1383 pub unsafe fn set_mEcn_raw(this: *mut Self, val: u8) {
1384 unsafe {
1385 let val: u8 = ::std::mem::transmute(val);
1386 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1387 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1388 0usize,
1389 2u8,
1390 val as u64,
1391 )
1392 }
1393 }
1394 #[inline]
1395 pub fn mIsHostInterface(&self) -> bool {
1396 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1397 }
1398 #[inline]
1399 pub fn set_mIsHostInterface(&mut self, val: bool) {
1400 unsafe {
1401 let val: u8 = ::std::mem::transmute(val);
1402 self._bitfield_1.set(2usize, 1u8, val as u64)
1403 }
1404 }
1405 #[inline]
1406 pub unsafe fn mIsHostInterface_raw(this: *const Self) -> bool {
1407 unsafe {
1408 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1409 ::std::ptr::addr_of!((*this)._bitfield_1),
1410 2usize,
1411 1u8,
1412 ) as u8)
1413 }
1414 }
1415 #[inline]
1416 pub unsafe fn set_mIsHostInterface_raw(this: *mut Self, val: bool) {
1417 unsafe {
1418 let val: u8 = ::std::mem::transmute(val);
1419 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1420 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1421 2usize,
1422 1u8,
1423 val as u64,
1424 )
1425 }
1426 }
1427 #[inline]
1428 pub fn mAllowZeroHopLimit(&self) -> bool {
1429 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1430 }
1431 #[inline]
1432 pub fn set_mAllowZeroHopLimit(&mut self, val: bool) {
1433 unsafe {
1434 let val: u8 = ::std::mem::transmute(val);
1435 self._bitfield_1.set(3usize, 1u8, val as u64)
1436 }
1437 }
1438 #[inline]
1439 pub unsafe fn mAllowZeroHopLimit_raw(this: *const Self) -> bool {
1440 unsafe {
1441 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1442 ::std::ptr::addr_of!((*this)._bitfield_1),
1443 3usize,
1444 1u8,
1445 ) as u8)
1446 }
1447 }
1448 #[inline]
1449 pub unsafe fn set_mAllowZeroHopLimit_raw(this: *mut Self, val: bool) {
1450 unsafe {
1451 let val: u8 = ::std::mem::transmute(val);
1452 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1453 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1454 3usize,
1455 1u8,
1456 val as u64,
1457 )
1458 }
1459 }
1460 #[inline]
1461 pub fn mMulticastLoop(&self) -> bool {
1462 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1463 }
1464 #[inline]
1465 pub fn set_mMulticastLoop(&mut self, val: bool) {
1466 unsafe {
1467 let val: u8 = ::std::mem::transmute(val);
1468 self._bitfield_1.set(4usize, 1u8, val as u64)
1469 }
1470 }
1471 #[inline]
1472 pub unsafe fn mMulticastLoop_raw(this: *const Self) -> bool {
1473 unsafe {
1474 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1475 ::std::ptr::addr_of!((*this)._bitfield_1),
1476 4usize,
1477 1u8,
1478 ) as u8)
1479 }
1480 }
1481 #[inline]
1482 pub unsafe fn set_mMulticastLoop_raw(this: *mut Self, val: bool) {
1483 unsafe {
1484 let val: u8 = ::std::mem::transmute(val);
1485 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1486 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1487 4usize,
1488 1u8,
1489 val as u64,
1490 )
1491 }
1492 }
1493 #[inline]
1494 pub fn new_bitfield_1(
1495 mEcn: u8,
1496 mIsHostInterface: bool,
1497 mAllowZeroHopLimit: bool,
1498 mMulticastLoop: bool,
1499 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1500 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1501 __bindgen_bitfield_unit.set(0usize, 2u8, {
1502 let mEcn: u8 = unsafe { ::std::mem::transmute(mEcn) };
1503 mEcn as u64
1504 });
1505 __bindgen_bitfield_unit.set(2usize, 1u8, {
1506 let mIsHostInterface: u8 = unsafe { ::std::mem::transmute(mIsHostInterface) };
1507 mIsHostInterface as u64
1508 });
1509 __bindgen_bitfield_unit.set(3usize, 1u8, {
1510 let mAllowZeroHopLimit: u8 = unsafe { ::std::mem::transmute(mAllowZeroHopLimit) };
1511 mAllowZeroHopLimit as u64
1512 });
1513 __bindgen_bitfield_unit.set(4usize, 1u8, {
1514 let mMulticastLoop: u8 = unsafe { ::std::mem::transmute(mMulticastLoop) };
1515 mMulticastLoop as u64
1516 });
1517 __bindgen_bitfield_unit
1518 }
1519}
1520#[doc = "< IPv6 Hop-by-Hop Option"]
1521pub const OT_IP6_PROTO_HOP_OPTS: _bindgen_ty_3 = 0;
1522#[doc = "< Transmission Control Protocol"]
1523pub const OT_IP6_PROTO_TCP: _bindgen_ty_3 = 6;
1524#[doc = "< User Datagram"]
1525pub const OT_IP6_PROTO_UDP: _bindgen_ty_3 = 17;
1526#[doc = "< IPv6 encapsulation"]
1527pub const OT_IP6_PROTO_IP6: _bindgen_ty_3 = 41;
1528#[doc = "< Routing Header for IPv6"]
1529pub const OT_IP6_PROTO_ROUTING: _bindgen_ty_3 = 43;
1530#[doc = "< Fragment Header for IPv6"]
1531pub const OT_IP6_PROTO_FRAGMENT: _bindgen_ty_3 = 44;
1532#[doc = "< ICMP for IPv6"]
1533pub const OT_IP6_PROTO_ICMP6: _bindgen_ty_3 = 58;
1534#[doc = "< No Next Header for IPv6"]
1535pub const OT_IP6_PROTO_NONE: _bindgen_ty_3 = 59;
1536#[doc = "< Destination Options for IPv6"]
1537pub const OT_IP6_PROTO_DST_OPTS: _bindgen_ty_3 = 60;
1538#[doc = " Internet Protocol Numbers."]
1539pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
1540unsafe extern "C" {
1541 #[doc = " Brings the IPv6 interface up or down.\n\n Call this to enable or disable IPv6 communication.\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)."]
1542 pub fn otIp6SetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
1543}
1544unsafe extern "C" {
1545 #[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."]
1546 pub fn otIp6IsEnabled(aInstance: *mut otInstance) -> bool;
1547}
1548unsafe extern "C" {
1549 #[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\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."]
1550 pub fn otIp6AddUnicastAddress(
1551 aInstance: *mut otInstance,
1552 aAddress: *const otNetifAddress,
1553 ) -> otError;
1554}
1555unsafe extern "C" {
1556 #[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."]
1557 pub fn otIp6RemoveUnicastAddress(
1558 aInstance: *mut otInstance,
1559 aAddress: *const otIp6Address,
1560 ) -> otError;
1561}
1562unsafe extern "C" {
1563 #[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."]
1564 pub fn otIp6GetUnicastAddresses(aInstance: *mut otInstance) -> *const otNetifAddress;
1565}
1566unsafe extern "C" {
1567 #[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."]
1568 pub fn otIp6HasUnicastAddress(
1569 aInstance: *mut otInstance,
1570 aAddress: *const otIp6Address,
1571 ) -> bool;
1572}
1573unsafe extern "C" {
1574 #[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\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."]
1575 pub fn otIp6SubscribeMulticastAddress(
1576 aInstance: *mut otInstance,
1577 aAddress: *const otIp6Address,
1578 ) -> otError;
1579}
1580unsafe extern "C" {
1581 #[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."]
1582 pub fn otIp6UnsubscribeMulticastAddress(
1583 aInstance: *mut otInstance,
1584 aAddress: *const otIp6Address,
1585 ) -> otError;
1586}
1587unsafe extern "C" {
1588 #[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."]
1589 pub fn otIp6GetMulticastAddresses(aInstance: *mut otInstance)
1590 -> *const otNetifMulticastAddress;
1591}
1592unsafe extern "C" {
1593 #[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"]
1594 pub fn otIp6NewMessage(
1595 aInstance: *mut otInstance,
1596 aSettings: *const otMessageSettings,
1597 ) -> *mut otMessage;
1598}
1599unsafe extern "C" {
1600 #[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"]
1601 pub fn otIp6NewMessageFromBuffer(
1602 aInstance: *mut otInstance,
1603 aData: *const u8,
1604 aDataLength: u16,
1605 aSettings: *const otMessageSettings,
1606 ) -> *mut otMessage;
1607}
1608#[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."]
1609pub type otIp6ReceiveCallback = ::std::option::Option<
1610 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
1611>;
1612unsafe extern "C" {
1613 #[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"]
1614 pub fn otIp6SetReceiveCallback(
1615 aInstance: *mut otInstance,
1616 aCallback: otIp6ReceiveCallback,
1617 aCallbackContext: *mut ::std::os::raw::c_void,
1618 );
1619}
1620#[doc = " Represents IPv6 address information."]
1621#[repr(C)]
1622#[derive(Debug, Copy, Clone)]
1623pub struct otIp6AddressInfo {
1624 #[doc = "< A pointer to the IPv6 address."]
1625 pub mAddress: *const otIp6Address,
1626 #[doc = "< The prefix length of mAddress if it is a unicast address."]
1627 pub mPrefixLength: u8,
1628 pub _bitfield_align_1: [u8; 0],
1629 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1630 pub __bindgen_padding_0: [u16; 3usize],
1631}
1632impl Default for otIp6AddressInfo {
1633 fn default() -> Self {
1634 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1635 unsafe {
1636 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1637 s.assume_init()
1638 }
1639 }
1640}
1641impl otIp6AddressInfo {
1642 #[inline]
1643 pub fn mScope(&self) -> u8 {
1644 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
1645 }
1646 #[inline]
1647 pub fn set_mScope(&mut self, val: u8) {
1648 unsafe {
1649 let val: u8 = ::std::mem::transmute(val);
1650 self._bitfield_1.set(0usize, 4u8, val as u64)
1651 }
1652 }
1653 #[inline]
1654 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
1655 unsafe {
1656 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1657 ::std::ptr::addr_of!((*this)._bitfield_1),
1658 0usize,
1659 4u8,
1660 ) as u8)
1661 }
1662 }
1663 #[inline]
1664 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
1665 unsafe {
1666 let val: u8 = ::std::mem::transmute(val);
1667 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1668 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1669 0usize,
1670 4u8,
1671 val as u64,
1672 )
1673 }
1674 }
1675 #[inline]
1676 pub fn mPreferred(&self) -> bool {
1677 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1678 }
1679 #[inline]
1680 pub fn set_mPreferred(&mut self, val: bool) {
1681 unsafe {
1682 let val: u8 = ::std::mem::transmute(val);
1683 self._bitfield_1.set(4usize, 1u8, val as u64)
1684 }
1685 }
1686 #[inline]
1687 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
1688 unsafe {
1689 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1690 ::std::ptr::addr_of!((*this)._bitfield_1),
1691 4usize,
1692 1u8,
1693 ) as u8)
1694 }
1695 }
1696 #[inline]
1697 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
1698 unsafe {
1699 let val: u8 = ::std::mem::transmute(val);
1700 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1701 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1702 4usize,
1703 1u8,
1704 val as u64,
1705 )
1706 }
1707 }
1708 #[inline]
1709 pub fn mMeshLocal(&self) -> bool {
1710 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
1711 }
1712 #[inline]
1713 pub fn set_mMeshLocal(&mut self, val: bool) {
1714 unsafe {
1715 let val: u8 = ::std::mem::transmute(val);
1716 self._bitfield_1.set(5usize, 1u8, val as u64)
1717 }
1718 }
1719 #[inline]
1720 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
1721 unsafe {
1722 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1723 ::std::ptr::addr_of!((*this)._bitfield_1),
1724 5usize,
1725 1u8,
1726 ) as u8)
1727 }
1728 }
1729 #[inline]
1730 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
1731 unsafe {
1732 let val: u8 = ::std::mem::transmute(val);
1733 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1734 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1735 5usize,
1736 1u8,
1737 val as u64,
1738 )
1739 }
1740 }
1741 #[inline]
1742 pub fn new_bitfield_1(
1743 mScope: u8,
1744 mPreferred: bool,
1745 mMeshLocal: bool,
1746 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1747 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1748 __bindgen_bitfield_unit.set(0usize, 4u8, {
1749 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
1750 mScope as u64
1751 });
1752 __bindgen_bitfield_unit.set(4usize, 1u8, {
1753 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
1754 mPreferred as u64
1755 });
1756 __bindgen_bitfield_unit.set(5usize, 1u8, {
1757 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
1758 mMeshLocal as u64
1759 });
1760 __bindgen_bitfield_unit
1761 }
1762}
1763#[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."]
1764pub type otIp6AddressCallback = ::std::option::Option<
1765 unsafe extern "C" fn(
1766 aAddressInfo: *const otIp6AddressInfo,
1767 aIsAdded: bool,
1768 aContext: *mut ::std::os::raw::c_void,
1769 ),
1770>;
1771unsafe extern "C" {
1772 #[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."]
1773 pub fn otIp6SetAddressCallback(
1774 aInstance: *mut otInstance,
1775 aCallback: otIp6AddressCallback,
1776 aCallbackContext: *mut ::std::os::raw::c_void,
1777 );
1778}
1779unsafe extern "C" {
1780 #[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"]
1781 pub fn otIp6IsReceiveFilterEnabled(aInstance: *mut otInstance) -> bool;
1782}
1783unsafe extern "C" {
1784 #[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"]
1785 pub fn otIp6SetReceiveFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
1786}
1787unsafe extern "C" {
1788 #[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."]
1789 pub fn otIp6Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
1790}
1791unsafe extern "C" {
1792 #[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."]
1793 pub fn otIp6AddUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
1794}
1795unsafe extern "C" {
1796 #[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."]
1797 pub fn otIp6RemoveUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
1798}
1799unsafe extern "C" {
1800 #[doc = " Removes all ports from the allowed unsecure port list.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
1801 pub fn otIp6RemoveAllUnsecurePorts(aInstance: *mut otInstance);
1802}
1803unsafe extern "C" {
1804 #[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."]
1805 pub fn otIp6GetUnsecurePorts(aInstance: *mut otInstance, aNumEntries: *mut u8) -> *const u16;
1806}
1807unsafe extern "C" {
1808 #[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."]
1809 pub fn otIp6IsAddressEqual(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> bool;
1810}
1811unsafe extern "C" {
1812 #[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."]
1813 pub fn otIp6IsLinkLocalUnicast(aAddress: *const otIp6Address) -> bool;
1814}
1815unsafe extern "C" {
1816 #[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."]
1817 pub fn otIp6ArePrefixesEqual(aFirst: *const otIp6Prefix, aSecond: *const otIp6Prefix) -> bool;
1818}
1819unsafe extern "C" {
1820 #[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."]
1821 pub fn otIp6AddressFromString(
1822 aString: *const ::std::os::raw::c_char,
1823 aAddress: *mut otIp6Address,
1824 ) -> otError;
1825}
1826unsafe extern "C" {
1827 #[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."]
1828 pub fn otIp6PrefixFromString(
1829 aString: *const ::std::os::raw::c_char,
1830 aPrefix: *mut otIp6Prefix,
1831 ) -> otError;
1832}
1833unsafe extern "C" {
1834 #[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`."]
1835 pub fn otIp6AddressToString(
1836 aAddress: *const otIp6Address,
1837 aBuffer: *mut ::std::os::raw::c_char,
1838 aSize: u16,
1839 );
1840}
1841unsafe extern "C" {
1842 #[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`."]
1843 pub fn otIp6SockAddrToString(
1844 aSockAddr: *const otSockAddr,
1845 aBuffer: *mut ::std::os::raw::c_char,
1846 aSize: u16,
1847 );
1848}
1849unsafe extern "C" {
1850 #[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`."]
1851 pub fn otIp6PrefixToString(
1852 aPrefix: *const otIp6Prefix,
1853 aBuffer: *mut ::std::os::raw::c_char,
1854 aSize: u16,
1855 );
1856}
1857unsafe extern "C" {
1858 #[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."]
1859 pub fn otIp6PrefixMatch(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> u8;
1860}
1861unsafe extern "C" {
1862 #[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."]
1863 pub fn otIp6GetPrefix(aAddress: *const otIp6Address, aLength: u8, aPrefix: *mut otIp6Prefix);
1864}
1865unsafe extern "C" {
1866 #[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."]
1867 pub fn otIp6IsAddressUnspecified(aAddress: *const otIp6Address) -> bool;
1868}
1869unsafe extern "C" {
1870 #[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."]
1871 pub fn otIp6SelectSourceAddress(
1872 aInstance: *mut otInstance,
1873 aMessageInfo: *mut otMessageInfo,
1874 ) -> otError;
1875}
1876unsafe extern "C" {
1877 #[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."]
1878 pub fn otIp6IsSlaacEnabled(aInstance: *mut otInstance) -> bool;
1879}
1880unsafe extern "C" {
1881 #[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."]
1882 pub fn otIp6SetSlaacEnabled(aInstance: *mut otInstance, aEnabled: bool);
1883}
1884#[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."]
1885pub type otIp6SlaacPrefixFilter = ::std::option::Option<
1886 unsafe extern "C" fn(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix) -> bool,
1887>;
1888unsafe extern "C" {
1889 #[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."]
1890 pub fn otIp6SetSlaacPrefixFilter(aInstance: *mut otInstance, aFilter: otIp6SlaacPrefixFilter);
1891}
1892#[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"]
1893pub type otIp6RegisterMulticastListenersCallback = ::std::option::Option<
1894 unsafe extern "C" fn(
1895 aContext: *mut ::std::os::raw::c_void,
1896 aError: otError,
1897 aMlrStatus: u8,
1898 aFailedAddresses: *const otIp6Address,
1899 aFailedAddressNum: u8,
1900 ),
1901>;
1902unsafe extern "C" {
1903 #[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"]
1904 pub fn otIp6RegisterMulticastListeners(
1905 aInstance: *mut otInstance,
1906 aAddresses: *const otIp6Address,
1907 aAddressNum: u8,
1908 aTimeout: *const u32,
1909 aCallback: otIp6RegisterMulticastListenersCallback,
1910 aContext: *mut ::std::os::raw::c_void,
1911 ) -> otError;
1912}
1913unsafe extern "C" {
1914 #[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."]
1915 pub fn otIp6SetMeshLocalIid(
1916 aInstance: *mut otInstance,
1917 aIid: *const otIp6InterfaceIdentifier,
1918 ) -> otError;
1919}
1920unsafe extern "C" {
1921 #[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."]
1922 pub fn otIp6ProtoToString(aIpProto: u8) -> *const ::std::os::raw::c_char;
1923}
1924#[doc = " Represents the counters for packets and bytes."]
1925#[repr(C)]
1926#[derive(Debug, Default, Copy, Clone)]
1927pub struct otPacketsAndBytes {
1928 #[doc = "< The number of packets."]
1929 pub mPackets: u64,
1930 #[doc = "< The number of bytes."]
1931 pub mBytes: u64,
1932}
1933#[doc = " Represents the counters of packets forwarded via Border Routing."]
1934#[repr(C)]
1935#[derive(Debug, Default, Copy, Clone)]
1936pub struct otBorderRoutingCounters {
1937 #[doc = "< The counters for inbound unicast."]
1938 pub mInboundUnicast: otPacketsAndBytes,
1939 #[doc = "< The counters for inbound multicast."]
1940 pub mInboundMulticast: otPacketsAndBytes,
1941 #[doc = "< The counters for outbound unicast."]
1942 pub mOutboundUnicast: otPacketsAndBytes,
1943 #[doc = "< The counters for outbound multicast."]
1944 pub mOutboundMulticast: otPacketsAndBytes,
1945 #[doc = "< The counters for inbound Internet when DHCPv6 PD enabled."]
1946 pub mInboundInternet: otPacketsAndBytes,
1947 #[doc = "< The counters for outbound Internet when DHCPv6 PD enabled."]
1948 pub mOutboundInternet: otPacketsAndBytes,
1949 #[doc = "< The number of received RA packets."]
1950 pub mRaRx: u32,
1951 #[doc = "< The number of RA packets successfully transmitted."]
1952 pub mRaTxSuccess: u32,
1953 #[doc = "< The number of RA packets failed to transmit."]
1954 pub mRaTxFailure: u32,
1955 #[doc = "< The number of received RS packets."]
1956 pub mRsRx: u32,
1957 #[doc = "< The number of RS packets successfully transmitted."]
1958 pub mRsTxSuccess: u32,
1959 #[doc = "< The number of RS packets failed to transmit."]
1960 pub mRsTxFailure: u32,
1961}
1962unsafe extern "C" {
1963 #[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."]
1964 pub fn otIp6GetBorderRoutingCounters(
1965 aInstance: *mut otInstance,
1966 ) -> *const otBorderRoutingCounters;
1967}
1968unsafe extern "C" {
1969 #[doc = " Resets the Border Routing counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
1970 pub fn otIp6ResetBorderRoutingCounters(aInstance: *mut otInstance);
1971}
1972#[doc = "< Key Type: Raw Data."]
1973pub const OT_CRYPTO_KEY_TYPE_RAW: otCryptoKeyType = 0;
1974#[doc = "< Key Type: AES."]
1975pub const OT_CRYPTO_KEY_TYPE_AES: otCryptoKeyType = 1;
1976#[doc = "< Key Type: HMAC."]
1977pub const OT_CRYPTO_KEY_TYPE_HMAC: otCryptoKeyType = 2;
1978#[doc = "< Key Type: ECDSA."]
1979pub const OT_CRYPTO_KEY_TYPE_ECDSA: otCryptoKeyType = 3;
1980#[doc = " Defines the key types."]
1981pub type otCryptoKeyType = ::std::os::raw::c_uint;
1982#[doc = "< Key Algorithm: Vendor Defined."]
1983pub const OT_CRYPTO_KEY_ALG_VENDOR: otCryptoKeyAlgorithm = 0;
1984#[doc = "< Key Algorithm: AES ECB."]
1985pub const OT_CRYPTO_KEY_ALG_AES_ECB: otCryptoKeyAlgorithm = 1;
1986#[doc = "< Key Algorithm: HMAC SHA-256."]
1987pub const OT_CRYPTO_KEY_ALG_HMAC_SHA_256: otCryptoKeyAlgorithm = 2;
1988#[doc = "< Key Algorithm: ECDSA."]
1989pub const OT_CRYPTO_KEY_ALG_ECDSA: otCryptoKeyAlgorithm = 3;
1990#[doc = " Defines the key algorithms."]
1991pub type otCryptoKeyAlgorithm = ::std::os::raw::c_uint;
1992#[doc = "< Key Usage: Key Usage is empty."]
1993pub const OT_CRYPTO_KEY_USAGE_NONE: _bindgen_ty_4 = 0;
1994#[doc = "< Key Usage: Key can be exported."]
1995pub const OT_CRYPTO_KEY_USAGE_EXPORT: _bindgen_ty_4 = 1;
1996#[doc = "< Key Usage: Encryption (vendor defined)."]
1997pub const OT_CRYPTO_KEY_USAGE_ENCRYPT: _bindgen_ty_4 = 2;
1998#[doc = "< Key Usage: AES ECB."]
1999pub const OT_CRYPTO_KEY_USAGE_DECRYPT: _bindgen_ty_4 = 4;
2000#[doc = "< Key Usage: Sign Hash."]
2001pub const OT_CRYPTO_KEY_USAGE_SIGN_HASH: _bindgen_ty_4 = 8;
2002#[doc = "< Key Usage: Verify Hash."]
2003pub const OT_CRYPTO_KEY_USAGE_VERIFY_HASH: _bindgen_ty_4 = 16;
2004#[doc = " Defines the key usage flags."]
2005pub type _bindgen_ty_4 = ::std::os::raw::c_uint;
2006#[doc = "< Key Persistence: Key is volatile."]
2007pub const OT_CRYPTO_KEY_STORAGE_VOLATILE: otCryptoKeyStorage = 0;
2008#[doc = "< Key Persistence: Key is persistent."]
2009pub const OT_CRYPTO_KEY_STORAGE_PERSISTENT: otCryptoKeyStorage = 1;
2010#[doc = " Defines the key storage types."]
2011pub type otCryptoKeyStorage = ::std::os::raw::c_uint;
2012#[doc = " This datatype represents the key reference."]
2013pub type otCryptoKeyRef = u32;
2014#[doc = " @struct otCryptoKey\n\n Represents the Key Material required for Crypto operations."]
2015#[repr(C)]
2016#[derive(Debug, Copy, Clone)]
2017pub struct otCryptoKey {
2018 #[doc = "< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`."]
2019 pub mKey: *const u8,
2020 #[doc = "< The key length in bytes (applicable when `mKey` is not NULL)."]
2021 pub mKeyLength: u16,
2022 #[doc = "< The PSA key ref (requires `mKey` to be NULL)."]
2023 pub mKeyRef: u32,
2024}
2025impl Default for otCryptoKey {
2026 fn default() -> Self {
2027 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2028 unsafe {
2029 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2030 s.assume_init()
2031 }
2032 }
2033}
2034#[doc = " @struct otCryptoContext\n\n Stores the context object for platform APIs."]
2035#[repr(C)]
2036#[derive(Debug, Copy, Clone)]
2037pub struct otCryptoContext {
2038 #[doc = "< Pointer to the context."]
2039 pub mContext: *mut ::std::os::raw::c_void,
2040 #[doc = "< The length of the context in bytes."]
2041 pub mContextSize: u16,
2042}
2043impl Default for otCryptoContext {
2044 fn default() -> Self {
2045 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2046 unsafe {
2047 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2048 s.assume_init()
2049 }
2050 }
2051}
2052#[doc = " @struct otPlatCryptoSha256Hash\n\n Represents a SHA-256 hash."]
2053#[repr(C, packed)]
2054#[derive(Debug, Default, Copy, Clone)]
2055pub struct otPlatCryptoSha256Hash {
2056 #[doc = "< Hash bytes."]
2057 pub m8: [u8; 32usize],
2058}
2059#[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)."]
2060#[repr(C)]
2061#[derive(Debug, Copy, Clone)]
2062pub struct otPlatCryptoEcdsaKeyPair {
2063 pub mDerBytes: [u8; 125usize],
2064 pub mDerLength: u8,
2065}
2066impl Default for otPlatCryptoEcdsaKeyPair {
2067 fn default() -> Self {
2068 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2069 unsafe {
2070 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2071 s.assume_init()
2072 }
2073 }
2074}
2075#[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)."]
2076#[repr(C, packed)]
2077#[derive(Debug, Copy, Clone)]
2078pub struct otPlatCryptoEcdsaPublicKey {
2079 pub m8: [u8; 64usize],
2080}
2081impl Default for otPlatCryptoEcdsaPublicKey {
2082 fn default() -> Self {
2083 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2084 unsafe {
2085 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2086 s.assume_init()
2087 }
2088 }
2089}
2090#[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)."]
2091#[repr(C, packed)]
2092#[derive(Debug, Copy, Clone)]
2093pub struct otPlatCryptoEcdsaSignature {
2094 pub m8: [u8; 64usize],
2095}
2096impl Default for otPlatCryptoEcdsaSignature {
2097 fn default() -> Self {
2098 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2099 unsafe {
2100 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2101 s.assume_init()
2102 }
2103 }
2104}
2105unsafe extern "C" {
2106 #[doc = " Initialize the Crypto module."]
2107 pub fn otPlatCryptoInit();
2108}
2109unsafe extern "C" {
2110 #[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."]
2111 pub fn otPlatCryptoImportKey(
2112 aKeyRef: *mut otCryptoKeyRef,
2113 aKeyType: otCryptoKeyType,
2114 aKeyAlgorithm: otCryptoKeyAlgorithm,
2115 aKeyUsage: ::std::os::raw::c_int,
2116 aKeyPersistence: otCryptoKeyStorage,
2117 aKey: *const u8,
2118 aKeyLen: usize,
2119 ) -> otError;
2120}
2121unsafe extern "C" {
2122 #[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."]
2123 pub fn otPlatCryptoExportKey(
2124 aKeyRef: otCryptoKeyRef,
2125 aBuffer: *mut u8,
2126 aBufferLen: usize,
2127 aKeyLen: *mut usize,
2128 ) -> otError;
2129}
2130unsafe extern "C" {
2131 #[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."]
2132 pub fn otPlatCryptoDestroyKey(aKeyRef: otCryptoKeyRef) -> otError;
2133}
2134unsafe extern "C" {
2135 #[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."]
2136 pub fn otPlatCryptoHasKey(aKeyRef: otCryptoKeyRef) -> bool;
2137}
2138unsafe extern "C" {
2139 #[doc = " Initialize the HMAC operation.\n\n @param[in] aContext Context for HMAC operation.\n\n @retval OT_ERROR_NONE Successfully initialized HMAC operation.\n @retval OT_ERROR_FAILED Failed to initialize HMAC operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n @note The platform driver shall point the context to the correct object such as psa_mac_operation_t or\n mbedtls_md_context_t."]
2140 pub fn otPlatCryptoHmacSha256Init(aContext: *mut otCryptoContext) -> otError;
2141}
2142unsafe extern "C" {
2143 #[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"]
2144 pub fn otPlatCryptoHmacSha256Deinit(aContext: *mut otCryptoContext) -> otError;
2145}
2146unsafe extern "C" {
2147 #[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"]
2148 pub fn otPlatCryptoHmacSha256Start(
2149 aContext: *mut otCryptoContext,
2150 aKey: *const otCryptoKey,
2151 ) -> otError;
2152}
2153unsafe extern "C" {
2154 #[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"]
2155 pub fn otPlatCryptoHmacSha256Update(
2156 aContext: *mut otCryptoContext,
2157 aBuf: *const ::std::os::raw::c_void,
2158 aBufLength: u16,
2159 ) -> otError;
2160}
2161unsafe extern "C" {
2162 #[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"]
2163 pub fn otPlatCryptoHmacSha256Finish(
2164 aContext: *mut otCryptoContext,
2165 aBuf: *mut u8,
2166 aBufLength: usize,
2167 ) -> otError;
2168}
2169unsafe extern "C" {
2170 #[doc = " Initialise the AES operation.\n\n @param[in] aContext Context for AES operation.\n\n @retval OT_ERROR_NONE Successfully Initialised AES operation.\n @retval OT_ERROR_FAILED Failed to Initialise AES operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n @retval OT_ERROR_NO_BUFS Cannot allocate the context.\n\n @note The platform driver shall point the context to the correct object such as psa_key_id\n or mbedtls_aes_context_t."]
2171 pub fn otPlatCryptoAesInit(aContext: *mut otCryptoContext) -> otError;
2172}
2173unsafe extern "C" {
2174 #[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"]
2175 pub fn otPlatCryptoAesSetKey(
2176 aContext: *mut otCryptoContext,
2177 aKey: *const otCryptoKey,
2178 ) -> otError;
2179}
2180unsafe extern "C" {
2181 #[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"]
2182 pub fn otPlatCryptoAesEncrypt(
2183 aContext: *mut otCryptoContext,
2184 aInput: *const u8,
2185 aOutput: *mut u8,
2186 ) -> otError;
2187}
2188unsafe extern "C" {
2189 #[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"]
2190 pub fn otPlatCryptoAesFree(aContext: *mut otCryptoContext) -> otError;
2191}
2192unsafe extern "C" {
2193 #[doc = " Initialise the HKDF context.\n\n @param[in] aContext Context for HKDF operation.\n\n @retval OT_ERROR_NONE Successfully Initialised AES operation.\n @retval OT_ERROR_FAILED Failed to Initialise AES operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n @note The platform driver shall point the context to the correct object such as psa_key_derivation_operation_t\n or HmacSha256::Hash"]
2194 pub fn otPlatCryptoHkdfInit(aContext: *mut otCryptoContext) -> otError;
2195}
2196unsafe extern "C" {
2197 #[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"]
2198 pub fn otPlatCryptoHkdfExpand(
2199 aContext: *mut otCryptoContext,
2200 aInfo: *const u8,
2201 aInfoLength: u16,
2202 aOutputKey: *mut u8,
2203 aOutputKeyLength: u16,
2204 ) -> otError;
2205}
2206unsafe extern "C" {
2207 #[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."]
2208 pub fn otPlatCryptoHkdfExtract(
2209 aContext: *mut otCryptoContext,
2210 aSalt: *const u8,
2211 aSaltLength: u16,
2212 aInputKey: *const otCryptoKey,
2213 ) -> otError;
2214}
2215unsafe extern "C" {
2216 #[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"]
2217 pub fn otPlatCryptoHkdfDeinit(aContext: *mut otCryptoContext) -> otError;
2218}
2219unsafe extern "C" {
2220 #[doc = " Initialise the SHA-256 operation.\n\n @param[in] aContext Context for SHA-256 operation.\n\n @retval OT_ERROR_NONE Successfully initialised SHA-256 operation.\n @retval OT_ERROR_FAILED Failed to initialise SHA-256 operation.\n @retval OT_ERROR_INVALID_ARGS @p aContext was NULL\n\n\n @note The platform driver shall point the context to the correct object such as psa_hash_operation_t\n or mbedtls_sha256_context."]
2221 pub fn otPlatCryptoSha256Init(aContext: *mut otCryptoContext) -> otError;
2222}
2223unsafe extern "C" {
2224 #[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"]
2225 pub fn otPlatCryptoSha256Deinit(aContext: *mut otCryptoContext) -> otError;
2226}
2227unsafe extern "C" {
2228 #[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"]
2229 pub fn otPlatCryptoSha256Start(aContext: *mut otCryptoContext) -> otError;
2230}
2231unsafe extern "C" {
2232 #[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"]
2233 pub fn otPlatCryptoSha256Update(
2234 aContext: *mut otCryptoContext,
2235 aBuf: *const ::std::os::raw::c_void,
2236 aBufLength: u16,
2237 ) -> otError;
2238}
2239unsafe extern "C" {
2240 #[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"]
2241 pub fn otPlatCryptoSha256Finish(
2242 aContext: *mut otCryptoContext,
2243 aHash: *mut u8,
2244 aHashSize: u16,
2245 ) -> otError;
2246}
2247unsafe extern "C" {
2248 #[doc = " Initialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
2249 pub fn otPlatCryptoRandomInit();
2250}
2251unsafe extern "C" {
2252 #[doc = " Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
2253 pub fn otPlatCryptoRandomDeinit();
2254}
2255unsafe extern "C" {
2256 #[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."]
2257 pub fn otPlatCryptoRandomGet(aBuffer: *mut u8, aSize: u16) -> otError;
2258}
2259unsafe extern "C" {
2260 #[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."]
2261 pub fn otPlatCryptoEcdsaGenerateKey(aKeyPair: *mut otPlatCryptoEcdsaKeyPair) -> otError;
2262}
2263unsafe extern "C" {
2264 #[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."]
2265 pub fn otPlatCryptoEcdsaGetPublicKey(
2266 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
2267 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
2268 ) -> otError;
2269}
2270unsafe extern "C" {
2271 #[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."]
2272 pub fn otPlatCryptoEcdsaSign(
2273 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
2274 aHash: *const otPlatCryptoSha256Hash,
2275 aSignature: *mut otPlatCryptoEcdsaSignature,
2276 ) -> otError;
2277}
2278unsafe extern "C" {
2279 #[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."]
2280 pub fn otPlatCryptoEcdsaVerify(
2281 aPublicKey: *const otPlatCryptoEcdsaPublicKey,
2282 aHash: *const otPlatCryptoSha256Hash,
2283 aSignature: *const otPlatCryptoEcdsaSignature,
2284 ) -> otError;
2285}
2286unsafe extern "C" {
2287 #[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."]
2288 pub fn otPlatCryptoEcdsaSignUsingKeyRef(
2289 aKeyRef: otCryptoKeyRef,
2290 aHash: *const otPlatCryptoSha256Hash,
2291 aSignature: *mut otPlatCryptoEcdsaSignature,
2292 ) -> otError;
2293}
2294unsafe extern "C" {
2295 #[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."]
2296 pub fn otPlatCryptoEcdsaExportPublicKey(
2297 aKeyRef: otCryptoKeyRef,
2298 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
2299 ) -> otError;
2300}
2301unsafe extern "C" {
2302 #[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."]
2303 pub fn otPlatCryptoEcdsaGenerateAndImportKey(aKeyRef: otCryptoKeyRef) -> otError;
2304}
2305unsafe extern "C" {
2306 #[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."]
2307 pub fn otPlatCryptoEcdsaVerifyUsingKeyRef(
2308 aKeyRef: otCryptoKeyRef,
2309 aHash: *const otPlatCryptoSha256Hash,
2310 aSignature: *const otPlatCryptoEcdsaSignature,
2311 ) -> otError;
2312}
2313unsafe extern "C" {
2314 #[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."]
2315 pub fn otPlatCryptoPbkdf2GenerateKey(
2316 aPassword: *const u8,
2317 aPasswordLen: u16,
2318 aSalt: *const u8,
2319 aSaltLen: u16,
2320 aIterationCounter: u32,
2321 aKeyLen: u16,
2322 aKey: *mut u8,
2323 ) -> otError;
2324}
2325#[doc = "< aMaxPHYPacketSize (IEEE 802.15.4-2006)"]
2326pub const OT_RADIO_FRAME_MAX_SIZE: _bindgen_ty_5 = 127;
2327#[doc = "< Minimal size of frame FCS + CONTROL"]
2328pub const OT_RADIO_FRAME_MIN_SIZE: _bindgen_ty_5 = 3;
2329#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2330pub const OT_RADIO_SYMBOLS_PER_OCTET: _bindgen_ty_5 = 2;
2331#[doc = "< 2.4 GHz IEEE 802.15.4 (bits per second)"]
2332pub const OT_RADIO_BIT_RATE: _bindgen_ty_5 = 250000;
2333#[doc = "< Number of bits per octet"]
2334pub const OT_RADIO_BITS_PER_OCTET: _bindgen_ty_5 = 8;
2335#[doc = "< The O-QPSK PHY symbol rate when operating in the 780MHz, 915MHz, 2380MHz, 2450MHz"]
2336pub const OT_RADIO_SYMBOL_RATE: _bindgen_ty_5 = 62500;
2337#[doc = "< Symbol duration time in unit of microseconds"]
2338pub const OT_RADIO_SYMBOL_TIME: _bindgen_ty_5 = 16;
2339#[doc = "< Time for 10 symbols in unit of microseconds"]
2340pub const OT_RADIO_TEN_SYMBOLS_TIME: _bindgen_ty_5 = 160;
2341#[doc = "< LQI measurement not supported"]
2342pub const OT_RADIO_LQI_NONE: _bindgen_ty_5 = 0;
2343#[doc = "< Invalid or unknown RSSI value"]
2344pub const OT_RADIO_RSSI_INVALID: _bindgen_ty_5 = 127;
2345#[doc = "< Invalid or unknown power value"]
2346pub const OT_RADIO_POWER_INVALID: _bindgen_ty_5 = 127;
2347#[doc = "< Invalid short address."]
2348pub const OT_RADIO_INVALID_SHORT_ADDR: _bindgen_ty_5 = 65534;
2349#[doc = "< Broadcast short address."]
2350pub const OT_RADIO_BROADCAST_SHORT_ADDR: _bindgen_ty_5 = 65535;
2351#[doc = " @defgroup radio-types Radio Types\n\n @brief\n This module includes the platform abstraction for a radio frame.\n\n @{"]
2352pub type _bindgen_ty_5 = ::std::os::raw::c_uint;
2353#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2354pub const OT_RADIO_CHANNEL_PAGE_0: _bindgen_ty_6 = 0;
2355#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2356pub const OT_RADIO_CHANNEL_PAGE_0_MASK: _bindgen_ty_6 = 1;
2357#[doc = "< 915 MHz IEEE 802.15.4-2006"]
2358pub const OT_RADIO_CHANNEL_PAGE_2: _bindgen_ty_6 = 2;
2359#[doc = "< 915 MHz IEEE 802.15.4-2006"]
2360pub const OT_RADIO_CHANNEL_PAGE_2_MASK: _bindgen_ty_6 = 4;
2361#[doc = " Defines the channel page."]
2362pub type _bindgen_ty_6 = ::std::os::raw::c_uint;
2363#[doc = "< 915 MHz IEEE 802.15.4-2006"]
2364pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_7 = 1;
2365#[doc = "< 915 MHz IEEE 802.15.4-2006"]
2366pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_7 = 10;
2367#[doc = "< 915 MHz IEEE 802.15.4-2006"]
2368pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_7 = 2046;
2369#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2370pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_7 = 11;
2371#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2372pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_7 = 26;
2373#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
2374pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_7 = 134215680;
2375#[doc = " Defines the frequency band channel range."]
2376pub type _bindgen_ty_7 = ::std::os::raw::c_uint;
2377#[doc = " Represents radio capabilities.\n\n The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions."]
2378pub type otRadioCaps = u16;
2379#[doc = "< Radio supports no capability."]
2380pub const OT_RADIO_CAPS_NONE: _bindgen_ty_8 = 0;
2381#[doc = "< Radio supports AckTime event."]
2382pub const OT_RADIO_CAPS_ACK_TIMEOUT: _bindgen_ty_8 = 1;
2383#[doc = "< Radio supports Energy Scans."]
2384pub const OT_RADIO_CAPS_ENERGY_SCAN: _bindgen_ty_8 = 2;
2385#[doc = "< Radio supports tx retry logic with collision avoidance (CSMA)."]
2386pub const OT_RADIO_CAPS_TRANSMIT_RETRIES: _bindgen_ty_8 = 4;
2387#[doc = "< Radio supports CSMA backoff for frame tx (but no retry)."]
2388pub const OT_RADIO_CAPS_CSMA_BACKOFF: _bindgen_ty_8 = 8;
2389#[doc = "< Radio supports direct transition from sleep to TX with CSMA."]
2390pub const OT_RADIO_CAPS_SLEEP_TO_TX: _bindgen_ty_8 = 16;
2391#[doc = "< Radio supports tx security."]
2392pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_8 = 32;
2393#[doc = "< Radio supports tx at specific time."]
2394pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_8 = 64;
2395#[doc = "< Radio supports rx at specific time."]
2396pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_8 = 128;
2397#[doc = "< Radio supports RxOnWhenIdle handling."]
2398pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_8 = 256;
2399#[doc = "< Radio supports setting per-frame transmit power."]
2400pub const OT_RADIO_CAPS_TRANSMIT_FRAME_POWER: _bindgen_ty_8 = 512;
2401#[doc = "< Radio supports setting alternate short address."]
2402pub const OT_RADIO_CAPS_ALT_SHORT_ADDR: _bindgen_ty_8 = 1024;
2403#[doc = " Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`."]
2404pub type _bindgen_ty_8 = ::std::os::raw::c_uint;
2405#[doc = " Represents the IEEE 802.15.4 PAN ID."]
2406pub type otPanId = u16;
2407#[doc = " Represents the IEEE 802.15.4 Short Address."]
2408pub type otShortAddress = u16;
2409#[doc = "< Size of IE header in bytes."]
2410pub const OT_IE_HEADER_SIZE: _bindgen_ty_9 = 2;
2411#[doc = "< Size of CSL IE content in bytes."]
2412pub const OT_CSL_IE_SIZE: _bindgen_ty_9 = 4;
2413#[doc = "< Max length for header IE in ACK."]
2414pub const OT_ACK_IE_MAX_SIZE: _bindgen_ty_9 = 16;
2415#[doc = "< Max length of Link Metrics data in Vendor-Specific IE."]
2416pub const OT_ENH_PROBING_IE_DATA_MAX_SIZE: _bindgen_ty_9 = 2;
2417#[doc = " Defines constants about size of header IE in ACK."]
2418pub type _bindgen_ty_9 = ::std::os::raw::c_uint;
2419#[doc = " @struct otExtAddress\n\n Represents the IEEE 802.15.4 Extended Address."]
2420#[repr(C, packed)]
2421#[derive(Debug, Default, Copy, Clone)]
2422pub struct otExtAddress {
2423 #[doc = "< IEEE 802.15.4 Extended Address bytes"]
2424 pub m8: [u8; 8usize],
2425}
2426#[doc = " @struct otMacKey\n\n Represents a MAC Key."]
2427#[repr(C, packed)]
2428#[derive(Debug, Default, Copy, Clone)]
2429pub struct otMacKey {
2430 #[doc = "< MAC Key bytes."]
2431 pub m8: [u8; 16usize],
2432}
2433#[doc = " Represents a MAC Key Ref used by PSA."]
2434pub type otMacKeyRef = otCryptoKeyRef;
2435#[doc = " @struct otMacKeyMaterial\n\n Represents a MAC Key."]
2436#[repr(C)]
2437#[derive(Copy, Clone)]
2438pub struct otMacKeyMaterial {
2439 pub mKeyMaterial: otMacKeyMaterial__bindgen_ty_1,
2440}
2441#[repr(C)]
2442#[derive(Copy, Clone)]
2443pub union otMacKeyMaterial__bindgen_ty_1 {
2444 #[doc = "< Reference to the key stored."]
2445 pub mKeyRef: otMacKeyRef,
2446 #[doc = "< Key stored as literal."]
2447 pub mKey: otMacKey,
2448}
2449impl Default for otMacKeyMaterial__bindgen_ty_1 {
2450 fn default() -> Self {
2451 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2452 unsafe {
2453 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2454 s.assume_init()
2455 }
2456 }
2457}
2458impl Default for otMacKeyMaterial {
2459 fn default() -> Self {
2460 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2461 unsafe {
2462 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2463 s.assume_init()
2464 }
2465 }
2466}
2467#[doc = "< Use Literal Keys."]
2468pub const OT_KEY_TYPE_LITERAL_KEY: otRadioKeyType = 0;
2469#[doc = "< Use Reference to Key."]
2470pub const OT_KEY_TYPE_KEY_REF: otRadioKeyType = 1;
2471#[doc = " Defines constants about key types."]
2472pub type otRadioKeyType = ::std::os::raw::c_uint;
2473#[doc = " Represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame."]
2474#[repr(C)]
2475#[derive(Debug, Default, Copy, Clone)]
2476pub struct otRadioIeInfo {
2477 #[doc = "< The time offset to the Thread network time."]
2478 pub mNetworkTimeOffset: i64,
2479 #[doc = "< The Time IE offset from the start of PSDU."]
2480 pub mTimeIeOffset: u8,
2481 #[doc = "< The Time sync sequence."]
2482 pub mTimeSyncSeq: u8,
2483}
2484#[doc = " Represents an IEEE 802.15.4 radio frame."]
2485#[repr(C)]
2486#[derive(Copy, Clone)]
2487pub struct otRadioFrame {
2488 #[doc = "< The PSDU."]
2489 pub mPsdu: *mut u8,
2490 #[doc = "< Length of the PSDU."]
2491 pub mLength: u16,
2492 #[doc = "< Channel used to transmit/receive the frame."]
2493 pub mChannel: u8,
2494 #[doc = "< Radio link type - should be ignored by radio driver."]
2495 pub mRadioType: u8,
2496 pub mInfo: otRadioFrame__bindgen_ty_1,
2497}
2498#[doc = " The union of transmit and receive information for a radio frame."]
2499#[repr(C)]
2500#[derive(Copy, Clone)]
2501pub union otRadioFrame__bindgen_ty_1 {
2502 pub mTxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_1,
2503 pub mRxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_2,
2504}
2505#[doc = " Structure representing radio frame transmit information."]
2506#[repr(C)]
2507#[derive(Debug, Copy, Clone)]
2508pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
2509 #[doc = "< The key material used for AES-CCM frame security."]
2510 pub mAesKey: *const otMacKeyMaterial,
2511 #[doc = "< The pointer to the Header IE(s) related information."]
2512 pub mIeInfo: *mut otRadioIeInfo,
2513 #[doc = " The base time in microseconds for scheduled transmissions\n relative to the local radio clock, see `otPlatRadioGetNow` and\n `mTxDelay`.\n\n If this field is non-zero, `mMaxCsmaBackoffs` should be ignored.\n\n This field does not affect CCA behavior which is controlled by `mCsmaCaEnabled`."]
2514 pub mTxDelayBaseTime: u32,
2515 #[doc = " The delay time in microseconds for this transmission referenced\n to `mTxDelayBaseTime`.\n\n Note: `mTxDelayBaseTime` + `mTxDelay` SHALL point to the point in\n time when the end of the SFD will be present at the local\n antenna, relative to the local radio clock.\n\n If this field is non-zero, `mMaxCsmaBackoffs` should be ignored.\n\n This field does not affect CCA behavior which is controlled by `mCsmaCaEnabled`."]
2516 pub mTxDelay: u32,
2517 #[doc = " Maximum number of CSMA backoff attempts before declaring channel access failure.\n\n This is applicable and MUST be used when radio platform provides the `OT_RADIO_CAPS_CSMA_BACKOFF` and/or\n `OT_RADIO_CAPS_TRANSMIT_RETRIES`.\n\n This field MUST be ignored if `mCsmaCaEnabled` is set to `false` (CCA is disabled) or\n either `mTxDelayBaseTime` or `mTxDelay` is non-zero (frame transmission is expected at a specific time).\n\n It can be set to `0` to skip backoff mechanism (note that CCA MUST still be performed assuming\n `mCsmaCaEnabled` is `true`)."]
2518 pub mMaxCsmaBackoffs: u8,
2519 #[doc = "< Maximum number of retries allowed after a transmission failure."]
2520 pub mMaxFrameRetries: u8,
2521 #[doc = " The RX channel after frame TX is done (after all frame retries - ack received, or timeout, or abort).\n\n Radio platforms can choose to fully ignore this. OT stack will make sure to call `otPlatRadioReceive()`\n with the desired RX channel after a frame TX is done and signaled in `otPlatRadioTxDone()` callback.\n Radio platforms that don't provide `OT_RADIO_CAPS_TRANSMIT_RETRIES` must always ignore this.\n\n This is intended for situations where there may be delay in interactions between OT stack and radio, as\n an example this is used in RCP/host architecture to make sure RCP switches to PAN channel more quickly.\n In particular, this can help with CSL tx to a sleepy child, where the child may use a different channel\n for CSL than the PAN channel. After frame tx, we want the radio/RCP to go back to the PAN channel\n quickly to ensure that parent does not miss tx from child afterwards, e.g., child responding to the\n earlier CSL transmitted frame from parent using PAN channel while radio still staying on CSL channel.\n\n The switch to the RX channel MUST happen after the frame TX is fully done, i.e., after all retries and\n when ack is received (when \"Ack Request\" flag is set on the TX frame) or ack timeout. Note that ack is\n expected on the same channel that frame is sent on."]
2522 pub mRxChannelAfterTxDone: u8,
2523 #[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()."]
2524 pub mTxPower: i8,
2525 pub _bitfield_align_1: [u8; 0],
2526 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2527 #[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."]
2528 pub mTimestamp: u64,
2529}
2530impl Default for otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
2531 fn default() -> Self {
2532 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2533 unsafe {
2534 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2535 s.assume_init()
2536 }
2537 }
2538}
2539impl otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
2540 #[inline]
2541 pub fn mIsHeaderUpdated(&self) -> bool {
2542 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2543 }
2544 #[inline]
2545 pub fn set_mIsHeaderUpdated(&mut self, val: bool) {
2546 unsafe {
2547 let val: u8 = ::std::mem::transmute(val);
2548 self._bitfield_1.set(0usize, 1u8, val as u64)
2549 }
2550 }
2551 #[inline]
2552 pub unsafe fn mIsHeaderUpdated_raw(this: *const Self) -> bool {
2553 unsafe {
2554 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2555 ::std::ptr::addr_of!((*this)._bitfield_1),
2556 0usize,
2557 1u8,
2558 ) as u8)
2559 }
2560 }
2561 #[inline]
2562 pub unsafe fn set_mIsHeaderUpdated_raw(this: *mut Self, val: bool) {
2563 unsafe {
2564 let val: u8 = ::std::mem::transmute(val);
2565 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2566 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2567 0usize,
2568 1u8,
2569 val as u64,
2570 )
2571 }
2572 }
2573 #[inline]
2574 pub fn mIsARetx(&self) -> bool {
2575 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2576 }
2577 #[inline]
2578 pub fn set_mIsARetx(&mut self, val: bool) {
2579 unsafe {
2580 let val: u8 = ::std::mem::transmute(val);
2581 self._bitfield_1.set(1usize, 1u8, val as u64)
2582 }
2583 }
2584 #[inline]
2585 pub unsafe fn mIsARetx_raw(this: *const Self) -> bool {
2586 unsafe {
2587 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2588 ::std::ptr::addr_of!((*this)._bitfield_1),
2589 1usize,
2590 1u8,
2591 ) as u8)
2592 }
2593 }
2594 #[inline]
2595 pub unsafe fn set_mIsARetx_raw(this: *mut Self, val: bool) {
2596 unsafe {
2597 let val: u8 = ::std::mem::transmute(val);
2598 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2599 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2600 1usize,
2601 1u8,
2602 val as u64,
2603 )
2604 }
2605 }
2606 #[inline]
2607 pub fn mCsmaCaEnabled(&self) -> bool {
2608 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2609 }
2610 #[inline]
2611 pub fn set_mCsmaCaEnabled(&mut self, val: bool) {
2612 unsafe {
2613 let val: u8 = ::std::mem::transmute(val);
2614 self._bitfield_1.set(2usize, 1u8, val as u64)
2615 }
2616 }
2617 #[inline]
2618 pub unsafe fn mCsmaCaEnabled_raw(this: *const Self) -> bool {
2619 unsafe {
2620 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2621 ::std::ptr::addr_of!((*this)._bitfield_1),
2622 2usize,
2623 1u8,
2624 ) as u8)
2625 }
2626 }
2627 #[inline]
2628 pub unsafe fn set_mCsmaCaEnabled_raw(this: *mut Self, val: bool) {
2629 unsafe {
2630 let val: u8 = ::std::mem::transmute(val);
2631 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2632 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2633 2usize,
2634 1u8,
2635 val as u64,
2636 )
2637 }
2638 }
2639 #[inline]
2640 pub fn mCslPresent(&self) -> bool {
2641 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
2642 }
2643 #[inline]
2644 pub fn set_mCslPresent(&mut self, val: bool) {
2645 unsafe {
2646 let val: u8 = ::std::mem::transmute(val);
2647 self._bitfield_1.set(3usize, 1u8, val as u64)
2648 }
2649 }
2650 #[inline]
2651 pub unsafe fn mCslPresent_raw(this: *const Self) -> bool {
2652 unsafe {
2653 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2654 ::std::ptr::addr_of!((*this)._bitfield_1),
2655 3usize,
2656 1u8,
2657 ) as u8)
2658 }
2659 }
2660 #[inline]
2661 pub unsafe fn set_mCslPresent_raw(this: *mut Self, val: bool) {
2662 unsafe {
2663 let val: u8 = ::std::mem::transmute(val);
2664 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2665 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2666 3usize,
2667 1u8,
2668 val as u64,
2669 )
2670 }
2671 }
2672 #[inline]
2673 pub fn mIsSecurityProcessed(&self) -> bool {
2674 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
2675 }
2676 #[inline]
2677 pub fn set_mIsSecurityProcessed(&mut self, val: bool) {
2678 unsafe {
2679 let val: u8 = ::std::mem::transmute(val);
2680 self._bitfield_1.set(4usize, 1u8, val as u64)
2681 }
2682 }
2683 #[inline]
2684 pub unsafe fn mIsSecurityProcessed_raw(this: *const Self) -> bool {
2685 unsafe {
2686 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2687 ::std::ptr::addr_of!((*this)._bitfield_1),
2688 4usize,
2689 1u8,
2690 ) as u8)
2691 }
2692 }
2693 #[inline]
2694 pub unsafe fn set_mIsSecurityProcessed_raw(this: *mut Self, val: bool) {
2695 unsafe {
2696 let val: u8 = ::std::mem::transmute(val);
2697 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2698 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2699 4usize,
2700 1u8,
2701 val as u64,
2702 )
2703 }
2704 }
2705 #[inline]
2706 pub fn new_bitfield_1(
2707 mIsHeaderUpdated: bool,
2708 mIsARetx: bool,
2709 mCsmaCaEnabled: bool,
2710 mCslPresent: bool,
2711 mIsSecurityProcessed: bool,
2712 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2713 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2714 __bindgen_bitfield_unit.set(0usize, 1u8, {
2715 let mIsHeaderUpdated: u8 = unsafe { ::std::mem::transmute(mIsHeaderUpdated) };
2716 mIsHeaderUpdated as u64
2717 });
2718 __bindgen_bitfield_unit.set(1usize, 1u8, {
2719 let mIsARetx: u8 = unsafe { ::std::mem::transmute(mIsARetx) };
2720 mIsARetx as u64
2721 });
2722 __bindgen_bitfield_unit.set(2usize, 1u8, {
2723 let mCsmaCaEnabled: u8 = unsafe { ::std::mem::transmute(mCsmaCaEnabled) };
2724 mCsmaCaEnabled as u64
2725 });
2726 __bindgen_bitfield_unit.set(3usize, 1u8, {
2727 let mCslPresent: u8 = unsafe { ::std::mem::transmute(mCslPresent) };
2728 mCslPresent as u64
2729 });
2730 __bindgen_bitfield_unit.set(4usize, 1u8, {
2731 let mIsSecurityProcessed: u8 = unsafe { ::std::mem::transmute(mIsSecurityProcessed) };
2732 mIsSecurityProcessed as u64
2733 });
2734 __bindgen_bitfield_unit
2735 }
2736}
2737#[doc = " Structure representing radio frame receive information."]
2738#[repr(C)]
2739#[derive(Debug, Default, Copy, Clone)]
2740pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
2741 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna."]
2742 pub mTimestamp: u64,
2743 #[doc = "< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set)."]
2744 pub mAckFrameCounter: u32,
2745 #[doc = "< ACK security key index (applicable when `mAckedWithSecEnhAck` is set)."]
2746 pub mAckKeyId: u8,
2747 #[doc = "< Received signal strength indicator in dBm for received frames."]
2748 pub mRssi: i8,
2749 #[doc = "< Link Quality Indicator for received frames."]
2750 pub mLqi: u8,
2751 pub _bitfield_align_1: [u8; 0],
2752 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2753}
2754impl otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
2755 #[inline]
2756 pub fn mAckedWithFramePending(&self) -> bool {
2757 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2758 }
2759 #[inline]
2760 pub fn set_mAckedWithFramePending(&mut self, val: bool) {
2761 unsafe {
2762 let val: u8 = ::std::mem::transmute(val);
2763 self._bitfield_1.set(0usize, 1u8, val as u64)
2764 }
2765 }
2766 #[inline]
2767 pub unsafe fn mAckedWithFramePending_raw(this: *const Self) -> bool {
2768 unsafe {
2769 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2770 ::std::ptr::addr_of!((*this)._bitfield_1),
2771 0usize,
2772 1u8,
2773 ) as u8)
2774 }
2775 }
2776 #[inline]
2777 pub unsafe fn set_mAckedWithFramePending_raw(this: *mut Self, val: bool) {
2778 unsafe {
2779 let val: u8 = ::std::mem::transmute(val);
2780 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2781 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2782 0usize,
2783 1u8,
2784 val as u64,
2785 )
2786 }
2787 }
2788 #[inline]
2789 pub fn mAckedWithSecEnhAck(&self) -> bool {
2790 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2791 }
2792 #[inline]
2793 pub fn set_mAckedWithSecEnhAck(&mut self, val: bool) {
2794 unsafe {
2795 let val: u8 = ::std::mem::transmute(val);
2796 self._bitfield_1.set(1usize, 1u8, val as u64)
2797 }
2798 }
2799 #[inline]
2800 pub unsafe fn mAckedWithSecEnhAck_raw(this: *const Self) -> bool {
2801 unsafe {
2802 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2803 ::std::ptr::addr_of!((*this)._bitfield_1),
2804 1usize,
2805 1u8,
2806 ) as u8)
2807 }
2808 }
2809 #[inline]
2810 pub unsafe fn set_mAckedWithSecEnhAck_raw(this: *mut Self, val: bool) {
2811 unsafe {
2812 let val: u8 = ::std::mem::transmute(val);
2813 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2814 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2815 1usize,
2816 1u8,
2817 val as u64,
2818 )
2819 }
2820 }
2821 #[inline]
2822 pub fn new_bitfield_1(
2823 mAckedWithFramePending: bool,
2824 mAckedWithSecEnhAck: bool,
2825 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2826 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2827 __bindgen_bitfield_unit.set(0usize, 1u8, {
2828 let mAckedWithFramePending: u8 =
2829 unsafe { ::std::mem::transmute(mAckedWithFramePending) };
2830 mAckedWithFramePending as u64
2831 });
2832 __bindgen_bitfield_unit.set(1usize, 1u8, {
2833 let mAckedWithSecEnhAck: u8 = unsafe { ::std::mem::transmute(mAckedWithSecEnhAck) };
2834 mAckedWithSecEnhAck as u64
2835 });
2836 __bindgen_bitfield_unit
2837 }
2838}
2839impl Default for otRadioFrame__bindgen_ty_1 {
2840 fn default() -> Self {
2841 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2842 unsafe {
2843 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2844 s.assume_init()
2845 }
2846 }
2847}
2848impl Default for otRadioFrame {
2849 fn default() -> Self {
2850 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2851 unsafe {
2852 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2853 s.assume_init()
2854 }
2855 }
2856}
2857pub const OT_RADIO_STATE_DISABLED: otRadioState = 0;
2858pub const OT_RADIO_STATE_SLEEP: otRadioState = 1;
2859pub const OT_RADIO_STATE_RECEIVE: otRadioState = 2;
2860pub const OT_RADIO_STATE_TRANSMIT: otRadioState = 3;
2861pub const OT_RADIO_STATE_INVALID: otRadioState = 255;
2862#[doc = " Represents the state of a radio.\n Initially, a radio is in the Disabled state."]
2863pub type otRadioState = ::std::os::raw::c_uint;
2864#[doc = " Represents radio coexistence metrics."]
2865#[repr(C)]
2866#[derive(Debug, Default, Copy, Clone)]
2867pub struct otRadioCoexMetrics {
2868 #[doc = "< Number of grant glitches."]
2869 pub mNumGrantGlitch: u32,
2870 #[doc = "< Number of tx requests."]
2871 pub mNumTxRequest: u32,
2872 #[doc = "< Number of tx requests while grant was active."]
2873 pub mNumTxGrantImmediate: u32,
2874 #[doc = "< Number of tx requests while grant was inactive."]
2875 pub mNumTxGrantWait: u32,
2876 #[doc = "< Number of tx requests while grant was inactive that were ultimately granted."]
2877 pub mNumTxGrantWaitActivated: u32,
2878 #[doc = "< Number of tx requests while grant was inactive that timed out."]
2879 pub mNumTxGrantWaitTimeout: u32,
2880 #[doc = "< Number of tx that were in progress when grant was deactivated."]
2881 pub mNumTxGrantDeactivatedDuringRequest: u32,
2882 #[doc = "< Number of tx requests that were not granted within 50us."]
2883 pub mNumTxDelayedGrant: u32,
2884 #[doc = "< Average time in usec from tx request to grant."]
2885 pub mAvgTxRequestToGrantTime: u32,
2886 #[doc = "< Number of rx requests."]
2887 pub mNumRxRequest: u32,
2888 #[doc = "< Number of rx requests while grant was active."]
2889 pub mNumRxGrantImmediate: u32,
2890 #[doc = "< Number of rx requests while grant was inactive."]
2891 pub mNumRxGrantWait: u32,
2892 #[doc = "< Number of rx requests while grant was inactive that were ultimately granted."]
2893 pub mNumRxGrantWaitActivated: u32,
2894 #[doc = "< Number of rx requests while grant was inactive that timed out."]
2895 pub mNumRxGrantWaitTimeout: u32,
2896 #[doc = "< Number of rx that were in progress when grant was deactivated."]
2897 pub mNumRxGrantDeactivatedDuringRequest: u32,
2898 #[doc = "< Number of rx requests that were not granted within 50us."]
2899 pub mNumRxDelayedGrant: u32,
2900 #[doc = "< Average time in usec from rx request to grant."]
2901 pub mAvgRxRequestToGrantTime: u32,
2902 #[doc = "< Number of rx requests that completed without receiving grant."]
2903 pub mNumRxGrantNone: u32,
2904 #[doc = "< Stats collection stopped due to saturation."]
2905 pub mStopped: bool,
2906}
2907#[doc = " Represents what metrics are specified to query."]
2908#[repr(C)]
2909#[derive(Debug, Default, Copy, Clone)]
2910pub struct otLinkMetrics {
2911 pub _bitfield_align_1: [u8; 0],
2912 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2913}
2914impl otLinkMetrics {
2915 #[inline]
2916 pub fn mPduCount(&self) -> bool {
2917 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2918 }
2919 #[inline]
2920 pub fn set_mPduCount(&mut self, val: bool) {
2921 unsafe {
2922 let val: u8 = ::std::mem::transmute(val);
2923 self._bitfield_1.set(0usize, 1u8, val as u64)
2924 }
2925 }
2926 #[inline]
2927 pub unsafe fn mPduCount_raw(this: *const Self) -> bool {
2928 unsafe {
2929 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2930 ::std::ptr::addr_of!((*this)._bitfield_1),
2931 0usize,
2932 1u8,
2933 ) as u8)
2934 }
2935 }
2936 #[inline]
2937 pub unsafe fn set_mPduCount_raw(this: *mut Self, val: bool) {
2938 unsafe {
2939 let val: u8 = ::std::mem::transmute(val);
2940 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2941 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2942 0usize,
2943 1u8,
2944 val as u64,
2945 )
2946 }
2947 }
2948 #[inline]
2949 pub fn mLqi(&self) -> bool {
2950 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2951 }
2952 #[inline]
2953 pub fn set_mLqi(&mut self, val: bool) {
2954 unsafe {
2955 let val: u8 = ::std::mem::transmute(val);
2956 self._bitfield_1.set(1usize, 1u8, val as u64)
2957 }
2958 }
2959 #[inline]
2960 pub unsafe fn mLqi_raw(this: *const Self) -> bool {
2961 unsafe {
2962 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2963 ::std::ptr::addr_of!((*this)._bitfield_1),
2964 1usize,
2965 1u8,
2966 ) as u8)
2967 }
2968 }
2969 #[inline]
2970 pub unsafe fn set_mLqi_raw(this: *mut Self, val: bool) {
2971 unsafe {
2972 let val: u8 = ::std::mem::transmute(val);
2973 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2974 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2975 1usize,
2976 1u8,
2977 val as u64,
2978 )
2979 }
2980 }
2981 #[inline]
2982 pub fn mLinkMargin(&self) -> bool {
2983 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2984 }
2985 #[inline]
2986 pub fn set_mLinkMargin(&mut self, val: bool) {
2987 unsafe {
2988 let val: u8 = ::std::mem::transmute(val);
2989 self._bitfield_1.set(2usize, 1u8, val as u64)
2990 }
2991 }
2992 #[inline]
2993 pub unsafe fn mLinkMargin_raw(this: *const Self) -> bool {
2994 unsafe {
2995 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2996 ::std::ptr::addr_of!((*this)._bitfield_1),
2997 2usize,
2998 1u8,
2999 ) as u8)
3000 }
3001 }
3002 #[inline]
3003 pub unsafe fn set_mLinkMargin_raw(this: *mut Self, val: bool) {
3004 unsafe {
3005 let val: u8 = ::std::mem::transmute(val);
3006 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3007 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3008 2usize,
3009 1u8,
3010 val as u64,
3011 )
3012 }
3013 }
3014 #[inline]
3015 pub fn mRssi(&self) -> bool {
3016 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3017 }
3018 #[inline]
3019 pub fn set_mRssi(&mut self, val: bool) {
3020 unsafe {
3021 let val: u8 = ::std::mem::transmute(val);
3022 self._bitfield_1.set(3usize, 1u8, val as u64)
3023 }
3024 }
3025 #[inline]
3026 pub unsafe fn mRssi_raw(this: *const Self) -> bool {
3027 unsafe {
3028 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3029 ::std::ptr::addr_of!((*this)._bitfield_1),
3030 3usize,
3031 1u8,
3032 ) as u8)
3033 }
3034 }
3035 #[inline]
3036 pub unsafe fn set_mRssi_raw(this: *mut Self, val: bool) {
3037 unsafe {
3038 let val: u8 = ::std::mem::transmute(val);
3039 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3040 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3041 3usize,
3042 1u8,
3043 val as u64,
3044 )
3045 }
3046 }
3047 #[inline]
3048 pub fn mReserved(&self) -> bool {
3049 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3050 }
3051 #[inline]
3052 pub fn set_mReserved(&mut self, val: bool) {
3053 unsafe {
3054 let val: u8 = ::std::mem::transmute(val);
3055 self._bitfield_1.set(4usize, 1u8, val as u64)
3056 }
3057 }
3058 #[inline]
3059 pub unsafe fn mReserved_raw(this: *const Self) -> bool {
3060 unsafe {
3061 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3062 ::std::ptr::addr_of!((*this)._bitfield_1),
3063 4usize,
3064 1u8,
3065 ) as u8)
3066 }
3067 }
3068 #[inline]
3069 pub unsafe fn set_mReserved_raw(this: *mut Self, val: bool) {
3070 unsafe {
3071 let val: u8 = ::std::mem::transmute(val);
3072 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3073 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3074 4usize,
3075 1u8,
3076 val as u64,
3077 )
3078 }
3079 }
3080 #[inline]
3081 pub fn new_bitfield_1(
3082 mPduCount: bool,
3083 mLqi: bool,
3084 mLinkMargin: bool,
3085 mRssi: bool,
3086 mReserved: bool,
3087 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3088 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3089 __bindgen_bitfield_unit.set(0usize, 1u8, {
3090 let mPduCount: u8 = unsafe { ::std::mem::transmute(mPduCount) };
3091 mPduCount as u64
3092 });
3093 __bindgen_bitfield_unit.set(1usize, 1u8, {
3094 let mLqi: u8 = unsafe { ::std::mem::transmute(mLqi) };
3095 mLqi as u64
3096 });
3097 __bindgen_bitfield_unit.set(2usize, 1u8, {
3098 let mLinkMargin: u8 = unsafe { ::std::mem::transmute(mLinkMargin) };
3099 mLinkMargin as u64
3100 });
3101 __bindgen_bitfield_unit.set(3usize, 1u8, {
3102 let mRssi: u8 = unsafe { ::std::mem::transmute(mRssi) };
3103 mRssi as u64
3104 });
3105 __bindgen_bitfield_unit.set(4usize, 1u8, {
3106 let mReserved: u8 = unsafe { ::std::mem::transmute(mReserved) };
3107 mReserved as u64
3108 });
3109 __bindgen_bitfield_unit
3110 }
3111}
3112unsafe extern "C" {
3113 #[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)."]
3114 pub fn otPlatRadioGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
3115}
3116unsafe extern "C" {
3117 #[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."]
3118 pub fn otPlatRadioGetVersionString(aInstance: *mut otInstance)
3119 -> *const ::std::os::raw::c_char;
3120}
3121unsafe extern "C" {
3122 #[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."]
3123 pub fn otPlatRadioGetReceiveSensitivity(aInstance: *mut otInstance) -> i8;
3124}
3125unsafe extern "C" {
3126 #[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."]
3127 pub fn otPlatRadioGetIeeeEui64(aInstance: *mut otInstance, aIeeeEui64: *mut u8);
3128}
3129unsafe extern "C" {
3130 #[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."]
3131 pub fn otPlatRadioSetPanId(aInstance: *mut otInstance, aPanId: otPanId);
3132}
3133unsafe extern "C" {
3134 #[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."]
3135 pub fn otPlatRadioSetExtendedAddress(
3136 aInstance: *mut otInstance,
3137 aExtAddress: *const otExtAddress,
3138 );
3139}
3140unsafe extern "C" {
3141 #[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."]
3142 pub fn otPlatRadioSetShortAddress(aInstance: *mut otInstance, aShortAddress: otShortAddress);
3143}
3144unsafe extern "C" {
3145 #[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."]
3146 pub fn otPlatRadioSetAlternateShortAddress(
3147 aInstance: *mut otInstance,
3148 aShortAddress: otShortAddress,
3149 );
3150}
3151unsafe extern "C" {
3152 #[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."]
3153 pub fn otPlatRadioGetTransmitPower(aInstance: *mut otInstance, aPower: *mut i8) -> otError;
3154}
3155unsafe extern "C" {
3156 #[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."]
3157 pub fn otPlatRadioSetTransmitPower(aInstance: *mut otInstance, aPower: i8) -> otError;
3158}
3159unsafe extern "C" {
3160 #[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."]
3161 pub fn otPlatRadioGetCcaEnergyDetectThreshold(
3162 aInstance: *mut otInstance,
3163 aThreshold: *mut i8,
3164 ) -> otError;
3165}
3166unsafe extern "C" {
3167 #[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."]
3168 pub fn otPlatRadioSetCcaEnergyDetectThreshold(
3169 aInstance: *mut otInstance,
3170 aThreshold: i8,
3171 ) -> otError;
3172}
3173unsafe extern "C" {
3174 #[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."]
3175 pub fn otPlatRadioGetFemLnaGain(aInstance: *mut otInstance, aGain: *mut i8) -> otError;
3176}
3177unsafe extern "C" {
3178 #[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."]
3179 pub fn otPlatRadioSetFemLnaGain(aInstance: *mut otInstance, aGain: i8) -> otError;
3180}
3181unsafe extern "C" {
3182 #[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."]
3183 pub fn otPlatRadioGetPromiscuous(aInstance: *mut otInstance) -> bool;
3184}
3185unsafe extern "C" {
3186 #[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."]
3187 pub fn otPlatRadioSetPromiscuous(aInstance: *mut otInstance, aEnable: bool);
3188}
3189unsafe extern "C" {
3190 #[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."]
3191 pub fn otPlatRadioSetRxOnWhenIdle(aInstance: *mut otInstance, aEnable: bool);
3192}
3193unsafe extern "C" {
3194 #[doc = " Update MAC keys and key index\n\n Is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability.\n\n The radio platform should reset the current security MAC frame counter tracked by the radio on this call. While this\n is highly recommended, the OpenThread stack, as a safeguard, will also reset the frame counter using the\n `otPlatRadioSetMacFrameCounter()` before calling this API.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyIdMode The key ID mode.\n @param[in] aKeyId Current MAC key index.\n @param[in] aPrevKey A pointer to the previous MAC key.\n @param[in] aCurrKey A pointer to the current MAC key.\n @param[in] aNextKey A pointer to the next MAC key.\n @param[in] aKeyType Key Type used."]
3195 pub fn otPlatRadioSetMacKey(
3196 aInstance: *mut otInstance,
3197 aKeyIdMode: u8,
3198 aKeyId: u8,
3199 aPrevKey: *const otMacKeyMaterial,
3200 aCurrKey: *const otMacKeyMaterial,
3201 aNextKey: *const otMacKeyMaterial,
3202 aKeyType: otRadioKeyType,
3203 );
3204}
3205unsafe extern "C" {
3206 #[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."]
3207 pub fn otPlatRadioSetMacFrameCounter(aInstance: *mut otInstance, aMacFrameCounter: u32);
3208}
3209unsafe extern "C" {
3210 #[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."]
3211 pub fn otPlatRadioSetMacFrameCounterIfLarger(aInstance: *mut otInstance, aMacFrameCounter: u32);
3212}
3213unsafe extern "C" {
3214 #[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."]
3215 pub fn otPlatRadioGetNow(aInstance: *mut otInstance) -> u64;
3216}
3217unsafe extern "C" {
3218 #[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."]
3219 pub fn otPlatRadioGetBusSpeed(aInstance: *mut otInstance) -> u32;
3220}
3221unsafe extern "C" {
3222 #[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."]
3223 pub fn otPlatRadioGetBusLatency(aInstance: *mut otInstance) -> u32;
3224}
3225unsafe extern "C" {
3226 #[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."]
3227 pub fn otPlatRadioGetState(aInstance: *mut otInstance) -> otRadioState;
3228}
3229unsafe extern "C" {
3230 #[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."]
3231 pub fn otPlatRadioEnable(aInstance: *mut otInstance) -> otError;
3232}
3233unsafe extern "C" {
3234 #[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."]
3235 pub fn otPlatRadioDisable(aInstance: *mut otInstance) -> otError;
3236}
3237unsafe extern "C" {
3238 #[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."]
3239 pub fn otPlatRadioIsEnabled(aInstance: *mut otInstance) -> bool;
3240}
3241unsafe extern "C" {
3242 #[doc = " Transition the radio from Receive to Sleep (turn off the radio).\n\n @param[in] aInstance The OpenThread instance structure.\n\n @retval OT_ERROR_NONE Successfully transitioned to Sleep.\n @retval OT_ERROR_BUSY The radio was transmitting.\n @retval OT_ERROR_INVALID_STATE The radio was disabled."]
3243 pub fn otPlatRadioSleep(aInstance: *mut otInstance) -> otError;
3244}
3245unsafe extern "C" {
3246 #[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."]
3247 pub fn otPlatRadioReceive(aInstance: *mut otInstance, aChannel: u8) -> otError;
3248}
3249unsafe extern "C" {
3250 #[doc = " Schedule a radio reception window at a specific time and duration.\n\n After a radio reception is successfully scheduled for a future time and duration, a subsequent call to this\n function MUST be handled as follows:\n\n - If the start time of the previously scheduled reception window has not yet been reached, the new call to\n `otPlatRadioReceiveAt()` MUST cancel the previous schedule, effectively replacing it.\n\n - If the start of the previous window has already passed, the previous receive schedule is already being executed\n by the radio and MUST NOT be replaced or impacted. The new call to `otPlatRadioReceiveAt()` would then schedule\n a new future receive window. In particular, if the new `otPlatRadioReceiveAt()` call occurs after the start\n but while still within the previous reception window, the ongoing reception window MUST NOT be impacted.\n\n @param[in] aChannel The radio channel on which to receive.\n @param[in] aStart The receive window start time relative to the local\n radio clock, see `otPlatRadioGetNow`. The radio\n receiver SHALL be on and ready to receive the first\n symbol of a frame's SHR at the window start time.\n @param[in] aDuration The receive window duration, in microseconds, as\n measured by the local radio clock. The radio SHOULD be\n turned off (or switched to TX mode if an ACK frame\n needs to be sent) after that duration unless it is\n still actively receiving a frame. In the latter case\n the radio SHALL be kept in reception mode until frame\n reception has either succeeded or failed.\n\n @retval OT_ERROR_NONE Successfully scheduled receive window.\n @retval OT_ERROR_FAILED The receive window could not be scheduled. For example, if @p aStart is in the past."]
3251 pub fn otPlatRadioReceiveAt(
3252 aInstance: *mut otInstance,
3253 aChannel: u8,
3254 aStart: u32,
3255 aDuration: u32,
3256 ) -> otError;
3257}
3258unsafe extern "C" {
3259 #[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."]
3260 pub fn otPlatRadioReceiveDone(
3261 aInstance: *mut otInstance,
3262 aFrame: *mut otRadioFrame,
3263 aError: otError,
3264 );
3265}
3266unsafe extern "C" {
3267 #[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."]
3268 pub fn otPlatDiagRadioReceiveDone(
3269 aInstance: *mut otInstance,
3270 aFrame: *mut otRadioFrame,
3271 aError: otError,
3272 );
3273}
3274unsafe extern "C" {
3275 #[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."]
3276 pub fn otPlatRadioGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
3277}
3278unsafe extern "C" {
3279 #[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."]
3280 pub fn otPlatRadioTransmit(aInstance: *mut otInstance, aFrame: *mut otRadioFrame) -> otError;
3281}
3282unsafe extern "C" {
3283 #[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."]
3284 pub fn otPlatRadioTxStarted(aInstance: *mut otInstance, aFrame: *mut otRadioFrame);
3285}
3286unsafe extern "C" {
3287 #[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."]
3288 pub fn otPlatRadioTxDone(
3289 aInstance: *mut otInstance,
3290 aFrame: *mut otRadioFrame,
3291 aAckFrame: *mut otRadioFrame,
3292 aError: otError,
3293 );
3294}
3295unsafe extern "C" {
3296 #[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."]
3297 pub fn otPlatDiagRadioTransmitDone(
3298 aInstance: *mut otInstance,
3299 aFrame: *mut otRadioFrame,
3300 aError: otError,
3301 );
3302}
3303unsafe extern "C" {
3304 #[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."]
3305 pub fn otPlatRadioGetRssi(aInstance: *mut otInstance) -> i8;
3306}
3307unsafe extern "C" {
3308 #[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."]
3309 pub fn otPlatRadioEnergyScan(
3310 aInstance: *mut otInstance,
3311 aScanChannel: u8,
3312 aScanDuration: u16,
3313 ) -> otError;
3314}
3315unsafe extern "C" {
3316 #[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."]
3317 pub fn otPlatRadioEnergyScanDone(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8);
3318}
3319unsafe extern "C" {
3320 #[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."]
3321 pub fn otPlatRadioBusLatencyChanged(aInstance: *mut otInstance);
3322}
3323unsafe extern "C" {
3324 #[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."]
3325 pub fn otPlatRadioEnableSrcMatch(aInstance: *mut otInstance, aEnable: bool);
3326}
3327unsafe extern "C" {
3328 #[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."]
3329 pub fn otPlatRadioAddSrcMatchShortEntry(
3330 aInstance: *mut otInstance,
3331 aShortAddress: otShortAddress,
3332 ) -> otError;
3333}
3334unsafe extern "C" {
3335 #[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."]
3336 pub fn otPlatRadioAddSrcMatchExtEntry(
3337 aInstance: *mut otInstance,
3338 aExtAddress: *const otExtAddress,
3339 ) -> otError;
3340}
3341unsafe extern "C" {
3342 #[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."]
3343 pub fn otPlatRadioClearSrcMatchShortEntry(
3344 aInstance: *mut otInstance,
3345 aShortAddress: otShortAddress,
3346 ) -> otError;
3347}
3348unsafe extern "C" {
3349 #[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."]
3350 pub fn otPlatRadioClearSrcMatchExtEntry(
3351 aInstance: *mut otInstance,
3352 aExtAddress: *const otExtAddress,
3353 ) -> otError;
3354}
3355unsafe extern "C" {
3356 #[doc = " Clear all short addresses from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
3357 pub fn otPlatRadioClearSrcMatchShortEntries(aInstance: *mut otInstance);
3358}
3359unsafe extern "C" {
3360 #[doc = " Clear all the extended/long addresses from source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
3361 pub fn otPlatRadioClearSrcMatchExtEntries(aInstance: *mut otInstance);
3362}
3363unsafe extern "C" {
3364 #[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."]
3365 pub fn otPlatRadioGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
3366}
3367unsafe extern "C" {
3368 #[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."]
3369 pub fn otPlatRadioGetPreferredChannelMask(aInstance: *mut otInstance) -> u32;
3370}
3371unsafe extern "C" {
3372 #[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."]
3373 pub fn otPlatRadioSetCoexEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3374}
3375unsafe extern "C" {
3376 #[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."]
3377 pub fn otPlatRadioIsCoexEnabled(aInstance: *mut otInstance) -> bool;
3378}
3379unsafe extern "C" {
3380 #[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."]
3381 pub fn otPlatRadioGetCoexMetrics(
3382 aInstance: *mut otInstance,
3383 aCoexMetrics: *mut otRadioCoexMetrics,
3384 ) -> otError;
3385}
3386unsafe extern "C" {
3387 #[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."]
3388 pub fn otPlatRadioEnableCsl(
3389 aInstance: *mut otInstance,
3390 aCslPeriod: u32,
3391 aShortAddr: otShortAddress,
3392 aExtAddr: *const otExtAddress,
3393 ) -> otError;
3394}
3395unsafe extern "C" {
3396 #[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."]
3397 pub fn otPlatRadioResetCsl(aInstance: *mut otInstance) -> otError;
3398}
3399unsafe extern "C" {
3400 #[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."]
3401 pub fn otPlatRadioUpdateCslSampleTime(aInstance: *mut otInstance, aCslSampleTime: u32);
3402}
3403unsafe extern "C" {
3404 #[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."]
3405 pub fn otPlatRadioGetCslAccuracy(aInstance: *mut otInstance) -> u8;
3406}
3407unsafe extern "C" {
3408 #[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."]
3409 pub fn otPlatRadioGetCslUncertainty(aInstance: *mut otInstance) -> u8;
3410}
3411unsafe extern "C" {
3412 #[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."]
3413 pub fn otPlatRadioSetChannelMaxTransmitPower(
3414 aInstance: *mut otInstance,
3415 aChannel: u8,
3416 aMaxPower: i8,
3417 ) -> otError;
3418}
3419unsafe extern "C" {
3420 #[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."]
3421 pub fn otPlatRadioSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
3422}
3423unsafe extern "C" {
3424 #[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."]
3425 pub fn otPlatRadioGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
3426}
3427unsafe extern "C" {
3428 #[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."]
3429 pub fn otPlatRadioConfigureEnhAckProbing(
3430 aInstance: *mut otInstance,
3431 aLinkMetrics: otLinkMetrics,
3432 aShortAddress: otShortAddress,
3433 aExtAddress: *const otExtAddress,
3434 ) -> otError;
3435}
3436unsafe extern "C" {
3437 #[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."]
3438 pub fn otPlatRadioAddCalibratedPower(
3439 aInstance: *mut otInstance,
3440 aChannel: u8,
3441 aActualPower: i16,
3442 aRawPowerSetting: *const u8,
3443 aRawPowerSettingLength: u16,
3444 ) -> otError;
3445}
3446unsafe extern "C" {
3447 #[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."]
3448 pub fn otPlatRadioClearCalibratedPowers(aInstance: *mut otInstance) -> otError;
3449}
3450unsafe extern "C" {
3451 #[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."]
3452 pub fn otPlatRadioSetChannelTargetPower(
3453 aInstance: *mut otInstance,
3454 aChannel: u8,
3455 aTargetPower: i16,
3456 ) -> otError;
3457}
3458unsafe extern "C" {
3459 #[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."]
3460 pub fn otPlatRadioGetRawPowerSetting(
3461 aInstance: *mut otInstance,
3462 aChannel: u8,
3463 aRawPowerSetting: *mut u8,
3464 aRawPowerSettingLength: *mut u16,
3465 ) -> otError;
3466}
3467pub const OT_JOINER_STATE_IDLE: otJoinerState = 0;
3468pub const OT_JOINER_STATE_DISCOVER: otJoinerState = 1;
3469pub const OT_JOINER_STATE_CONNECT: otJoinerState = 2;
3470pub const OT_JOINER_STATE_CONNECTED: otJoinerState = 3;
3471pub const OT_JOINER_STATE_ENTRUST: otJoinerState = 4;
3472pub const OT_JOINER_STATE_JOINED: otJoinerState = 5;
3473#[doc = " Defines the Joiner State."]
3474pub type otJoinerState = ::std::os::raw::c_uint;
3475#[doc = " Represents a Joiner Discerner."]
3476#[repr(C)]
3477#[derive(Debug, Default, Copy, Clone)]
3478pub struct otJoinerDiscerner {
3479 #[doc = "< Discerner value (the lowest `mLength` bits specify the discerner)."]
3480 pub mValue: u64,
3481 #[doc = "< Length (number of bits) - must be non-zero and at most `OT_JOINER_MAX_DISCERNER_LENGTH`."]
3482 pub mLength: u8,
3483}
3484#[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."]
3485pub type otJoinerCallback = ::std::option::Option<
3486 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
3487>;
3488unsafe extern "C" {
3489 #[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."]
3490 pub fn otJoinerStart(
3491 aInstance: *mut otInstance,
3492 aPskd: *const ::std::os::raw::c_char,
3493 aProvisioningUrl: *const ::std::os::raw::c_char,
3494 aVendorName: *const ::std::os::raw::c_char,
3495 aVendorModel: *const ::std::os::raw::c_char,
3496 aVendorSwVersion: *const ::std::os::raw::c_char,
3497 aVendorData: *const ::std::os::raw::c_char,
3498 aCallback: otJoinerCallback,
3499 aContext: *mut ::std::os::raw::c_void,
3500 ) -> otError;
3501}
3502unsafe extern "C" {
3503 #[doc = " Disables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3504 pub fn otJoinerStop(aInstance: *mut otInstance);
3505}
3506unsafe extern "C" {
3507 #[doc = " Gets the Joiner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The joiner state."]
3508 pub fn otJoinerGetState(aInstance: *mut otInstance) -> otJoinerState;
3509}
3510unsafe extern "C" {
3511 #[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."]
3512 pub fn otJoinerGetId(aInstance: *mut otInstance) -> *const otExtAddress;
3513}
3514unsafe extern "C" {
3515 #[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."]
3516 pub fn otJoinerSetDiscerner(
3517 aInstance: *mut otInstance,
3518 aDiscerner: *mut otJoinerDiscerner,
3519 ) -> otError;
3520}
3521unsafe extern "C" {
3522 #[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."]
3523 pub fn otJoinerGetDiscerner(aInstance: *mut otInstance) -> *const otJoinerDiscerner;
3524}
3525unsafe extern "C" {
3526 #[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."]
3527 pub fn otJoinerStateToString(aState: otJoinerState) -> *const ::std::os::raw::c_char;
3528}
3529#[doc = "< Commissioner role is disabled."]
3530pub const OT_COMMISSIONER_STATE_DISABLED: otCommissionerState = 0;
3531#[doc = "< Currently petitioning to become a Commissioner."]
3532pub const OT_COMMISSIONER_STATE_PETITION: otCommissionerState = 1;
3533#[doc = "< Commissioner role is active."]
3534pub const OT_COMMISSIONER_STATE_ACTIVE: otCommissionerState = 2;
3535#[doc = " Defines the Commissioner State."]
3536pub type otCommissionerState = ::std::os::raw::c_uint;
3537pub const OT_COMMISSIONER_JOINER_START: otCommissionerJoinerEvent = 0;
3538pub const OT_COMMISSIONER_JOINER_CONNECTED: otCommissionerJoinerEvent = 1;
3539pub const OT_COMMISSIONER_JOINER_FINALIZE: otCommissionerJoinerEvent = 2;
3540pub const OT_COMMISSIONER_JOINER_END: otCommissionerJoinerEvent = 3;
3541pub const OT_COMMISSIONER_JOINER_REMOVED: otCommissionerJoinerEvent = 4;
3542#[doc = " Defines a Joiner Event on the Commissioner."]
3543pub type otCommissionerJoinerEvent = ::std::os::raw::c_uint;
3544#[doc = " Represents the steering data."]
3545#[repr(C)]
3546#[derive(Debug, Default, Copy, Clone)]
3547pub struct otSteeringData {
3548 #[doc = "< Length of steering data (bytes)"]
3549 pub mLength: u8,
3550 #[doc = "< Byte values"]
3551 pub m8: [u8; 16usize],
3552}
3553#[doc = " Represents a Commissioning Dataset."]
3554#[repr(C)]
3555#[derive(Debug, Default, Copy, Clone)]
3556pub struct otCommissioningDataset {
3557 #[doc = "< Border Router RLOC16"]
3558 pub mLocator: u16,
3559 #[doc = "< Commissioner Session Id"]
3560 pub mSessionId: u16,
3561 #[doc = "< Steering Data"]
3562 pub mSteeringData: otSteeringData,
3563 #[doc = "< Joiner UDP Port"]
3564 pub mJoinerUdpPort: u16,
3565 pub _bitfield_align_1: [u8; 0],
3566 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3567 pub __bindgen_padding_0: u8,
3568}
3569impl otCommissioningDataset {
3570 #[inline]
3571 pub fn mIsLocatorSet(&self) -> bool {
3572 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
3573 }
3574 #[inline]
3575 pub fn set_mIsLocatorSet(&mut self, val: bool) {
3576 unsafe {
3577 let val: u8 = ::std::mem::transmute(val);
3578 self._bitfield_1.set(0usize, 1u8, val as u64)
3579 }
3580 }
3581 #[inline]
3582 pub unsafe fn mIsLocatorSet_raw(this: *const Self) -> bool {
3583 unsafe {
3584 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3585 ::std::ptr::addr_of!((*this)._bitfield_1),
3586 0usize,
3587 1u8,
3588 ) as u8)
3589 }
3590 }
3591 #[inline]
3592 pub unsafe fn set_mIsLocatorSet_raw(this: *mut Self, val: bool) {
3593 unsafe {
3594 let val: u8 = ::std::mem::transmute(val);
3595 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3596 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3597 0usize,
3598 1u8,
3599 val as u64,
3600 )
3601 }
3602 }
3603 #[inline]
3604 pub fn mIsSessionIdSet(&self) -> bool {
3605 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
3606 }
3607 #[inline]
3608 pub fn set_mIsSessionIdSet(&mut self, val: bool) {
3609 unsafe {
3610 let val: u8 = ::std::mem::transmute(val);
3611 self._bitfield_1.set(1usize, 1u8, val as u64)
3612 }
3613 }
3614 #[inline]
3615 pub unsafe fn mIsSessionIdSet_raw(this: *const Self) -> bool {
3616 unsafe {
3617 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3618 ::std::ptr::addr_of!((*this)._bitfield_1),
3619 1usize,
3620 1u8,
3621 ) as u8)
3622 }
3623 }
3624 #[inline]
3625 pub unsafe fn set_mIsSessionIdSet_raw(this: *mut Self, val: bool) {
3626 unsafe {
3627 let val: u8 = ::std::mem::transmute(val);
3628 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3629 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3630 1usize,
3631 1u8,
3632 val as u64,
3633 )
3634 }
3635 }
3636 #[inline]
3637 pub fn mIsSteeringDataSet(&self) -> bool {
3638 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
3639 }
3640 #[inline]
3641 pub fn set_mIsSteeringDataSet(&mut self, val: bool) {
3642 unsafe {
3643 let val: u8 = ::std::mem::transmute(val);
3644 self._bitfield_1.set(2usize, 1u8, val as u64)
3645 }
3646 }
3647 #[inline]
3648 pub unsafe fn mIsSteeringDataSet_raw(this: *const Self) -> bool {
3649 unsafe {
3650 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3651 ::std::ptr::addr_of!((*this)._bitfield_1),
3652 2usize,
3653 1u8,
3654 ) as u8)
3655 }
3656 }
3657 #[inline]
3658 pub unsafe fn set_mIsSteeringDataSet_raw(this: *mut Self, val: bool) {
3659 unsafe {
3660 let val: u8 = ::std::mem::transmute(val);
3661 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3662 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3663 2usize,
3664 1u8,
3665 val as u64,
3666 )
3667 }
3668 }
3669 #[inline]
3670 pub fn mIsJoinerUdpPortSet(&self) -> bool {
3671 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3672 }
3673 #[inline]
3674 pub fn set_mIsJoinerUdpPortSet(&mut self, val: bool) {
3675 unsafe {
3676 let val: u8 = ::std::mem::transmute(val);
3677 self._bitfield_1.set(3usize, 1u8, val as u64)
3678 }
3679 }
3680 #[inline]
3681 pub unsafe fn mIsJoinerUdpPortSet_raw(this: *const Self) -> bool {
3682 unsafe {
3683 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3684 ::std::ptr::addr_of!((*this)._bitfield_1),
3685 3usize,
3686 1u8,
3687 ) as u8)
3688 }
3689 }
3690 #[inline]
3691 pub unsafe fn set_mIsJoinerUdpPortSet_raw(this: *mut Self, val: bool) {
3692 unsafe {
3693 let val: u8 = ::std::mem::transmute(val);
3694 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3695 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3696 3usize,
3697 1u8,
3698 val as u64,
3699 )
3700 }
3701 }
3702 #[inline]
3703 pub fn mHasExtraTlv(&self) -> bool {
3704 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3705 }
3706 #[inline]
3707 pub fn set_mHasExtraTlv(&mut self, val: bool) {
3708 unsafe {
3709 let val: u8 = ::std::mem::transmute(val);
3710 self._bitfield_1.set(4usize, 1u8, val as u64)
3711 }
3712 }
3713 #[inline]
3714 pub unsafe fn mHasExtraTlv_raw(this: *const Self) -> bool {
3715 unsafe {
3716 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3717 ::std::ptr::addr_of!((*this)._bitfield_1),
3718 4usize,
3719 1u8,
3720 ) as u8)
3721 }
3722 }
3723 #[inline]
3724 pub unsafe fn set_mHasExtraTlv_raw(this: *mut Self, val: bool) {
3725 unsafe {
3726 let val: u8 = ::std::mem::transmute(val);
3727 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3728 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3729 4usize,
3730 1u8,
3731 val as u64,
3732 )
3733 }
3734 }
3735 #[inline]
3736 pub fn new_bitfield_1(
3737 mIsLocatorSet: bool,
3738 mIsSessionIdSet: bool,
3739 mIsSteeringDataSet: bool,
3740 mIsJoinerUdpPortSet: bool,
3741 mHasExtraTlv: bool,
3742 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3743 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3744 __bindgen_bitfield_unit.set(0usize, 1u8, {
3745 let mIsLocatorSet: u8 = unsafe { ::std::mem::transmute(mIsLocatorSet) };
3746 mIsLocatorSet as u64
3747 });
3748 __bindgen_bitfield_unit.set(1usize, 1u8, {
3749 let mIsSessionIdSet: u8 = unsafe { ::std::mem::transmute(mIsSessionIdSet) };
3750 mIsSessionIdSet as u64
3751 });
3752 __bindgen_bitfield_unit.set(2usize, 1u8, {
3753 let mIsSteeringDataSet: u8 = unsafe { ::std::mem::transmute(mIsSteeringDataSet) };
3754 mIsSteeringDataSet as u64
3755 });
3756 __bindgen_bitfield_unit.set(3usize, 1u8, {
3757 let mIsJoinerUdpPortSet: u8 = unsafe { ::std::mem::transmute(mIsJoinerUdpPortSet) };
3758 mIsJoinerUdpPortSet as u64
3759 });
3760 __bindgen_bitfield_unit.set(4usize, 1u8, {
3761 let mHasExtraTlv: u8 = unsafe { ::std::mem::transmute(mHasExtraTlv) };
3762 mHasExtraTlv as u64
3763 });
3764 __bindgen_bitfield_unit
3765 }
3766}
3767#[doc = " Represents a Joiner PSKd."]
3768#[repr(C)]
3769#[derive(Debug, Copy, Clone)]
3770pub struct otJoinerPskd {
3771 #[doc = "< Char string array (must be null terminated - +1 is for null char)."]
3772 pub m8: [::std::os::raw::c_char; 33usize],
3773}
3774impl Default for otJoinerPskd {
3775 fn default() -> Self {
3776 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3777 unsafe {
3778 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3779 s.assume_init()
3780 }
3781 }
3782}
3783#[doc = "< Accept any Joiner (no EUI64 or Discerner is specified)."]
3784pub const OT_JOINER_INFO_TYPE_ANY: otJoinerInfoType = 0;
3785#[doc = "< Joiner EUI-64 is specified (`mSharedId.mEui64` in `otJoinerInfo`)."]
3786pub const OT_JOINER_INFO_TYPE_EUI64: otJoinerInfoType = 1;
3787#[doc = "< Joiner Discerner is specified (`mSharedId.mDiscerner` in `otJoinerInfo`)."]
3788pub const OT_JOINER_INFO_TYPE_DISCERNER: otJoinerInfoType = 2;
3789#[doc = " Defines a Joiner Info Type."]
3790pub type otJoinerInfoType = ::std::os::raw::c_uint;
3791#[doc = " Represents a Joiner Info."]
3792#[repr(C)]
3793#[derive(Copy, Clone)]
3794pub struct otJoinerInfo {
3795 #[doc = "< Joiner type."]
3796 pub mType: otJoinerInfoType,
3797 #[doc = "< Shared fields"]
3798 pub mSharedId: otJoinerInfo__bindgen_ty_1,
3799 #[doc = "< Joiner PSKd"]
3800 pub mPskd: otJoinerPskd,
3801 #[doc = "< Joiner expiration time in msec"]
3802 pub mExpirationTime: u32,
3803}
3804#[repr(C)]
3805#[derive(Copy, Clone)]
3806pub union otJoinerInfo__bindgen_ty_1 {
3807 #[doc = "< Joiner EUI64 (when `mType` is `OT_JOINER_INFO_TYPE_EUI64`)"]
3808 pub mEui64: otExtAddress,
3809 #[doc = "< Joiner Discerner (when `mType` is `OT_JOINER_INFO_TYPE_DISCERNER`)"]
3810 pub mDiscerner: otJoinerDiscerner,
3811}
3812impl Default for otJoinerInfo__bindgen_ty_1 {
3813 fn default() -> Self {
3814 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3815 unsafe {
3816 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3817 s.assume_init()
3818 }
3819 }
3820}
3821impl Default for otJoinerInfo {
3822 fn default() -> Self {
3823 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3824 unsafe {
3825 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3826 s.assume_init()
3827 }
3828 }
3829}
3830#[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."]
3831pub type otCommissionerStateCallback = ::std::option::Option<
3832 unsafe extern "C" fn(aState: otCommissionerState, aContext: *mut ::std::os::raw::c_void),
3833>;
3834#[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."]
3835pub type otCommissionerJoinerCallback = ::std::option::Option<
3836 unsafe extern "C" fn(
3837 aEvent: otCommissionerJoinerEvent,
3838 aJoinerInfo: *const otJoinerInfo,
3839 aJoinerId: *const otExtAddress,
3840 aContext: *mut ::std::os::raw::c_void,
3841 ),
3842>;
3843unsafe extern "C" {
3844 #[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."]
3845 pub fn otCommissionerStart(
3846 aInstance: *mut otInstance,
3847 aStateCallback: otCommissionerStateCallback,
3848 aJoinerCallback: otCommissionerJoinerCallback,
3849 aCallbackContext: *mut ::std::os::raw::c_void,
3850 ) -> otError;
3851}
3852unsafe extern "C" {
3853 #[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."]
3854 pub fn otCommissionerStop(aInstance: *mut otInstance) -> otError;
3855}
3856unsafe extern "C" {
3857 #[doc = " Returns the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Commissioner Id."]
3858 pub fn otCommissionerGetId(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
3859}
3860unsafe extern "C" {
3861 #[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."]
3862 pub fn otCommissionerSetId(
3863 aInstance: *mut otInstance,
3864 aId: *const ::std::os::raw::c_char,
3865 ) -> otError;
3866}
3867unsafe extern "C" {
3868 #[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()."]
3869 pub fn otCommissionerAddJoiner(
3870 aInstance: *mut otInstance,
3871 aEui64: *const otExtAddress,
3872 aPskd: *const ::std::os::raw::c_char,
3873 aTimeout: u32,
3874 ) -> otError;
3875}
3876unsafe extern "C" {
3877 #[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()."]
3878 pub fn otCommissionerAddJoinerWithDiscerner(
3879 aInstance: *mut otInstance,
3880 aDiscerner: *const otJoinerDiscerner,
3881 aPskd: *const ::std::os::raw::c_char,
3882 aTimeout: u32,
3883 ) -> otError;
3884}
3885unsafe extern "C" {
3886 #[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."]
3887 pub fn otCommissionerGetNextJoinerInfo(
3888 aInstance: *mut otInstance,
3889 aIterator: *mut u16,
3890 aJoiner: *mut otJoinerInfo,
3891 ) -> otError;
3892}
3893unsafe extern "C" {
3894 #[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()."]
3895 pub fn otCommissionerRemoveJoiner(
3896 aInstance: *mut otInstance,
3897 aEui64: *const otExtAddress,
3898 ) -> otError;
3899}
3900unsafe extern "C" {
3901 #[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()."]
3902 pub fn otCommissionerRemoveJoinerWithDiscerner(
3903 aInstance: *mut otInstance,
3904 aDiscerner: *const otJoinerDiscerner,
3905 ) -> otError;
3906}
3907unsafe extern "C" {
3908 #[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."]
3909 pub fn otCommissionerGetProvisioningUrl(
3910 aInstance: *mut otInstance,
3911 ) -> *const ::std::os::raw::c_char;
3912}
3913unsafe extern "C" {
3914 #[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)."]
3915 pub fn otCommissionerSetProvisioningUrl(
3916 aInstance: *mut otInstance,
3917 aProvisioningUrl: *const ::std::os::raw::c_char,
3918 ) -> otError;
3919}
3920unsafe extern "C" {
3921 #[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()."]
3922 pub fn otCommissionerAnnounceBegin(
3923 aInstance: *mut otInstance,
3924 aChannelMask: u32,
3925 aCount: u8,
3926 aPeriod: u16,
3927 aAddress: *const otIp6Address,
3928 ) -> otError;
3929}
3930#[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."]
3931pub type otCommissionerEnergyReportCallback = ::std::option::Option<
3932 unsafe extern "C" fn(
3933 aChannelMask: u32,
3934 aEnergyList: *const u8,
3935 aEnergyListLength: u8,
3936 aContext: *mut ::std::os::raw::c_void,
3937 ),
3938>;
3939unsafe extern "C" {
3940 #[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()."]
3941 pub fn otCommissionerEnergyScan(
3942 aInstance: *mut otInstance,
3943 aChannelMask: u32,
3944 aCount: u8,
3945 aPeriod: u16,
3946 aScanDuration: u16,
3947 aAddress: *const otIp6Address,
3948 aCallback: otCommissionerEnergyReportCallback,
3949 aContext: *mut ::std::os::raw::c_void,
3950 ) -> otError;
3951}
3952#[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."]
3953pub type otCommissionerPanIdConflictCallback = ::std::option::Option<
3954 unsafe extern "C" fn(aPanId: u16, aChannelMask: u32, aContext: *mut ::std::os::raw::c_void),
3955>;
3956unsafe extern "C" {
3957 #[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()."]
3958 pub fn otCommissionerPanIdQuery(
3959 aInstance: *mut otInstance,
3960 aPanId: u16,
3961 aChannelMask: u32,
3962 aAddress: *const otIp6Address,
3963 aCallback: otCommissionerPanIdConflictCallback,
3964 aContext: *mut ::std::os::raw::c_void,
3965 ) -> otError;
3966}
3967unsafe extern "C" {
3968 #[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."]
3969 pub fn otCommissionerSendMgmtGet(
3970 aInstance: *mut otInstance,
3971 aTlvs: *const u8,
3972 aLength: u8,
3973 ) -> otError;
3974}
3975unsafe extern "C" {
3976 #[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."]
3977 pub fn otCommissionerSendMgmtSet(
3978 aInstance: *mut otInstance,
3979 aDataset: *const otCommissioningDataset,
3980 aTlvs: *const u8,
3981 aLength: u8,
3982 ) -> otError;
3983}
3984unsafe extern "C" {
3985 #[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."]
3986 pub fn otCommissionerGetSessionId(aInstance: *mut otInstance) -> u16;
3987}
3988unsafe extern "C" {
3989 #[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."]
3990 pub fn otCommissionerGetState(aInstance: *mut otInstance) -> otCommissionerState;
3991}
3992pub type otNetworkDataIterator = u32;
3993#[doc = " Represents a Border Router configuration."]
3994#[repr(C)]
3995#[repr(align(4))]
3996#[derive(Copy, Clone)]
3997pub struct otBorderRouterConfig {
3998 #[doc = "< The IPv6 prefix."]
3999 pub mPrefix: otIp6Prefix,
4000 pub _bitfield_align_1: [u8; 0],
4001 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
4002 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4003 pub mRloc16: u16,
4004}
4005impl Default for otBorderRouterConfig {
4006 fn default() -> Self {
4007 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4008 unsafe {
4009 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4010 s.assume_init()
4011 }
4012 }
4013}
4014impl otBorderRouterConfig {
4015 #[inline]
4016 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4017 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4018 }
4019 #[inline]
4020 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4021 unsafe {
4022 let val: u32 = ::std::mem::transmute(val);
4023 self._bitfield_1.set(0usize, 2u8, val as u64)
4024 }
4025 }
4026 #[inline]
4027 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4028 unsafe {
4029 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4030 ::std::ptr::addr_of!((*this)._bitfield_1),
4031 0usize,
4032 2u8,
4033 ) as u32)
4034 }
4035 }
4036 #[inline]
4037 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4038 unsafe {
4039 let val: u32 = ::std::mem::transmute(val);
4040 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4041 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4042 0usize,
4043 2u8,
4044 val as u64,
4045 )
4046 }
4047 }
4048 #[inline]
4049 pub fn mPreferred(&self) -> bool {
4050 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4051 }
4052 #[inline]
4053 pub fn set_mPreferred(&mut self, val: bool) {
4054 unsafe {
4055 let val: u8 = ::std::mem::transmute(val);
4056 self._bitfield_1.set(2usize, 1u8, val as u64)
4057 }
4058 }
4059 #[inline]
4060 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
4061 unsafe {
4062 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4063 ::std::ptr::addr_of!((*this)._bitfield_1),
4064 2usize,
4065 1u8,
4066 ) as u8)
4067 }
4068 }
4069 #[inline]
4070 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
4071 unsafe {
4072 let val: u8 = ::std::mem::transmute(val);
4073 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4074 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4075 2usize,
4076 1u8,
4077 val as u64,
4078 )
4079 }
4080 }
4081 #[inline]
4082 pub fn mSlaac(&self) -> bool {
4083 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4084 }
4085 #[inline]
4086 pub fn set_mSlaac(&mut self, val: bool) {
4087 unsafe {
4088 let val: u8 = ::std::mem::transmute(val);
4089 self._bitfield_1.set(3usize, 1u8, val as u64)
4090 }
4091 }
4092 #[inline]
4093 pub unsafe fn mSlaac_raw(this: *const Self) -> bool {
4094 unsafe {
4095 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4096 ::std::ptr::addr_of!((*this)._bitfield_1),
4097 3usize,
4098 1u8,
4099 ) as u8)
4100 }
4101 }
4102 #[inline]
4103 pub unsafe fn set_mSlaac_raw(this: *mut Self, val: bool) {
4104 unsafe {
4105 let val: u8 = ::std::mem::transmute(val);
4106 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4107 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4108 3usize,
4109 1u8,
4110 val as u64,
4111 )
4112 }
4113 }
4114 #[inline]
4115 pub fn mDhcp(&self) -> bool {
4116 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4117 }
4118 #[inline]
4119 pub fn set_mDhcp(&mut self, val: bool) {
4120 unsafe {
4121 let val: u8 = ::std::mem::transmute(val);
4122 self._bitfield_1.set(4usize, 1u8, val as u64)
4123 }
4124 }
4125 #[inline]
4126 pub unsafe fn mDhcp_raw(this: *const Self) -> bool {
4127 unsafe {
4128 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4129 ::std::ptr::addr_of!((*this)._bitfield_1),
4130 4usize,
4131 1u8,
4132 ) as u8)
4133 }
4134 }
4135 #[inline]
4136 pub unsafe fn set_mDhcp_raw(this: *mut Self, val: bool) {
4137 unsafe {
4138 let val: u8 = ::std::mem::transmute(val);
4139 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4140 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4141 4usize,
4142 1u8,
4143 val as u64,
4144 )
4145 }
4146 }
4147 #[inline]
4148 pub fn mConfigure(&self) -> bool {
4149 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4150 }
4151 #[inline]
4152 pub fn set_mConfigure(&mut self, val: bool) {
4153 unsafe {
4154 let val: u8 = ::std::mem::transmute(val);
4155 self._bitfield_1.set(5usize, 1u8, val as u64)
4156 }
4157 }
4158 #[inline]
4159 pub unsafe fn mConfigure_raw(this: *const Self) -> bool {
4160 unsafe {
4161 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4162 ::std::ptr::addr_of!((*this)._bitfield_1),
4163 5usize,
4164 1u8,
4165 ) as u8)
4166 }
4167 }
4168 #[inline]
4169 pub unsafe fn set_mConfigure_raw(this: *mut Self, val: bool) {
4170 unsafe {
4171 let val: u8 = ::std::mem::transmute(val);
4172 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4173 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4174 5usize,
4175 1u8,
4176 val as u64,
4177 )
4178 }
4179 }
4180 #[inline]
4181 pub fn mDefaultRoute(&self) -> bool {
4182 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
4183 }
4184 #[inline]
4185 pub fn set_mDefaultRoute(&mut self, val: bool) {
4186 unsafe {
4187 let val: u8 = ::std::mem::transmute(val);
4188 self._bitfield_1.set(6usize, 1u8, val as u64)
4189 }
4190 }
4191 #[inline]
4192 pub unsafe fn mDefaultRoute_raw(this: *const Self) -> bool {
4193 unsafe {
4194 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4195 ::std::ptr::addr_of!((*this)._bitfield_1),
4196 6usize,
4197 1u8,
4198 ) as u8)
4199 }
4200 }
4201 #[inline]
4202 pub unsafe fn set_mDefaultRoute_raw(this: *mut Self, val: bool) {
4203 unsafe {
4204 let val: u8 = ::std::mem::transmute(val);
4205 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4206 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4207 6usize,
4208 1u8,
4209 val as u64,
4210 )
4211 }
4212 }
4213 #[inline]
4214 pub fn mOnMesh(&self) -> bool {
4215 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
4216 }
4217 #[inline]
4218 pub fn set_mOnMesh(&mut self, val: bool) {
4219 unsafe {
4220 let val: u8 = ::std::mem::transmute(val);
4221 self._bitfield_1.set(7usize, 1u8, val as u64)
4222 }
4223 }
4224 #[inline]
4225 pub unsafe fn mOnMesh_raw(this: *const Self) -> bool {
4226 unsafe {
4227 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4228 ::std::ptr::addr_of!((*this)._bitfield_1),
4229 7usize,
4230 1u8,
4231 ) as u8)
4232 }
4233 }
4234 #[inline]
4235 pub unsafe fn set_mOnMesh_raw(this: *mut Self, val: bool) {
4236 unsafe {
4237 let val: u8 = ::std::mem::transmute(val);
4238 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4239 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4240 7usize,
4241 1u8,
4242 val as u64,
4243 )
4244 }
4245 }
4246 #[inline]
4247 pub fn mStable(&self) -> bool {
4248 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
4249 }
4250 #[inline]
4251 pub fn set_mStable(&mut self, val: bool) {
4252 unsafe {
4253 let val: u8 = ::std::mem::transmute(val);
4254 self._bitfield_1.set(8usize, 1u8, val as u64)
4255 }
4256 }
4257 #[inline]
4258 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4259 unsafe {
4260 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4261 ::std::ptr::addr_of!((*this)._bitfield_1),
4262 8usize,
4263 1u8,
4264 ) as u8)
4265 }
4266 }
4267 #[inline]
4268 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4269 unsafe {
4270 let val: u8 = ::std::mem::transmute(val);
4271 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4272 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4273 8usize,
4274 1u8,
4275 val as u64,
4276 )
4277 }
4278 }
4279 #[inline]
4280 pub fn mNdDns(&self) -> bool {
4281 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
4282 }
4283 #[inline]
4284 pub fn set_mNdDns(&mut self, val: bool) {
4285 unsafe {
4286 let val: u8 = ::std::mem::transmute(val);
4287 self._bitfield_1.set(9usize, 1u8, val as u64)
4288 }
4289 }
4290 #[inline]
4291 pub unsafe fn mNdDns_raw(this: *const Self) -> bool {
4292 unsafe {
4293 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4294 ::std::ptr::addr_of!((*this)._bitfield_1),
4295 9usize,
4296 1u8,
4297 ) as u8)
4298 }
4299 }
4300 #[inline]
4301 pub unsafe fn set_mNdDns_raw(this: *mut Self, val: bool) {
4302 unsafe {
4303 let val: u8 = ::std::mem::transmute(val);
4304 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4305 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4306 9usize,
4307 1u8,
4308 val as u64,
4309 )
4310 }
4311 }
4312 #[inline]
4313 pub fn mDp(&self) -> bool {
4314 unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
4315 }
4316 #[inline]
4317 pub fn set_mDp(&mut self, val: bool) {
4318 unsafe {
4319 let val: u8 = ::std::mem::transmute(val);
4320 self._bitfield_1.set(10usize, 1u8, val as u64)
4321 }
4322 }
4323 #[inline]
4324 pub unsafe fn mDp_raw(this: *const Self) -> bool {
4325 unsafe {
4326 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4327 ::std::ptr::addr_of!((*this)._bitfield_1),
4328 10usize,
4329 1u8,
4330 ) as u8)
4331 }
4332 }
4333 #[inline]
4334 pub unsafe fn set_mDp_raw(this: *mut Self, val: bool) {
4335 unsafe {
4336 let val: u8 = ::std::mem::transmute(val);
4337 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4338 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4339 10usize,
4340 1u8,
4341 val as u64,
4342 )
4343 }
4344 }
4345 #[inline]
4346 pub fn new_bitfield_1(
4347 mPreference: ::std::os::raw::c_int,
4348 mPreferred: bool,
4349 mSlaac: bool,
4350 mDhcp: bool,
4351 mConfigure: bool,
4352 mDefaultRoute: bool,
4353 mOnMesh: bool,
4354 mStable: bool,
4355 mNdDns: bool,
4356 mDp: bool,
4357 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
4358 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
4359 __bindgen_bitfield_unit.set(0usize, 2u8, {
4360 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
4361 mPreference as u64
4362 });
4363 __bindgen_bitfield_unit.set(2usize, 1u8, {
4364 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
4365 mPreferred as u64
4366 });
4367 __bindgen_bitfield_unit.set(3usize, 1u8, {
4368 let mSlaac: u8 = unsafe { ::std::mem::transmute(mSlaac) };
4369 mSlaac as u64
4370 });
4371 __bindgen_bitfield_unit.set(4usize, 1u8, {
4372 let mDhcp: u8 = unsafe { ::std::mem::transmute(mDhcp) };
4373 mDhcp as u64
4374 });
4375 __bindgen_bitfield_unit.set(5usize, 1u8, {
4376 let mConfigure: u8 = unsafe { ::std::mem::transmute(mConfigure) };
4377 mConfigure as u64
4378 });
4379 __bindgen_bitfield_unit.set(6usize, 1u8, {
4380 let mDefaultRoute: u8 = unsafe { ::std::mem::transmute(mDefaultRoute) };
4381 mDefaultRoute as u64
4382 });
4383 __bindgen_bitfield_unit.set(7usize, 1u8, {
4384 let mOnMesh: u8 = unsafe { ::std::mem::transmute(mOnMesh) };
4385 mOnMesh as u64
4386 });
4387 __bindgen_bitfield_unit.set(8usize, 1u8, {
4388 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4389 mStable as u64
4390 });
4391 __bindgen_bitfield_unit.set(9usize, 1u8, {
4392 let mNdDns: u8 = unsafe { ::std::mem::transmute(mNdDns) };
4393 mNdDns as u64
4394 });
4395 __bindgen_bitfield_unit.set(10usize, 1u8, {
4396 let mDp: u8 = unsafe { ::std::mem::transmute(mDp) };
4397 mDp as u64
4398 });
4399 __bindgen_bitfield_unit
4400 }
4401}
4402#[doc = " Represents 6LoWPAN Context ID information associated with a prefix in Network Data."]
4403#[repr(C)]
4404#[derive(Copy, Clone)]
4405pub struct otLowpanContextInfo {
4406 #[doc = "< The 6LoWPAN Context ID."]
4407 pub mContextId: u8,
4408 pub _bitfield_align_1: [u8; 0],
4409 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4410 #[doc = "< The associated IPv6 prefix."]
4411 pub mPrefix: otIp6Prefix,
4412}
4413impl Default for otLowpanContextInfo {
4414 fn default() -> Self {
4415 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4416 unsafe {
4417 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4418 s.assume_init()
4419 }
4420 }
4421}
4422impl otLowpanContextInfo {
4423 #[inline]
4424 pub fn mCompressFlag(&self) -> bool {
4425 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4426 }
4427 #[inline]
4428 pub fn set_mCompressFlag(&mut self, val: bool) {
4429 unsafe {
4430 let val: u8 = ::std::mem::transmute(val);
4431 self._bitfield_1.set(0usize, 1u8, val as u64)
4432 }
4433 }
4434 #[inline]
4435 pub unsafe fn mCompressFlag_raw(this: *const Self) -> bool {
4436 unsafe {
4437 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4438 ::std::ptr::addr_of!((*this)._bitfield_1),
4439 0usize,
4440 1u8,
4441 ) as u8)
4442 }
4443 }
4444 #[inline]
4445 pub unsafe fn set_mCompressFlag_raw(this: *mut Self, val: bool) {
4446 unsafe {
4447 let val: u8 = ::std::mem::transmute(val);
4448 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4449 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4450 0usize,
4451 1u8,
4452 val as u64,
4453 )
4454 }
4455 }
4456 #[inline]
4457 pub fn mStable(&self) -> bool {
4458 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
4459 }
4460 #[inline]
4461 pub fn set_mStable(&mut self, val: bool) {
4462 unsafe {
4463 let val: u8 = ::std::mem::transmute(val);
4464 self._bitfield_1.set(1usize, 1u8, val as u64)
4465 }
4466 }
4467 #[inline]
4468 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4469 unsafe {
4470 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4471 ::std::ptr::addr_of!((*this)._bitfield_1),
4472 1usize,
4473 1u8,
4474 ) as u8)
4475 }
4476 }
4477 #[inline]
4478 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4479 unsafe {
4480 let val: u8 = ::std::mem::transmute(val);
4481 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4482 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4483 1usize,
4484 1u8,
4485 val as u64,
4486 )
4487 }
4488 }
4489 #[inline]
4490 pub fn new_bitfield_1(
4491 mCompressFlag: bool,
4492 mStable: bool,
4493 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4494 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4495 __bindgen_bitfield_unit.set(0usize, 1u8, {
4496 let mCompressFlag: u8 = unsafe { ::std::mem::transmute(mCompressFlag) };
4497 mCompressFlag as u64
4498 });
4499 __bindgen_bitfield_unit.set(1usize, 1u8, {
4500 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4501 mStable as u64
4502 });
4503 __bindgen_bitfield_unit
4504 }
4505}
4506#[doc = " Represents an External Route configuration."]
4507#[repr(C)]
4508#[repr(align(4))]
4509#[derive(Copy, Clone)]
4510pub struct otExternalRouteConfig {
4511 #[doc = "< The IPv6 prefix."]
4512 pub mPrefix: otIp6Prefix,
4513 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4514 pub mRloc16: u16,
4515 pub _bitfield_align_1: [u8; 0],
4516 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4517 pub __bindgen_padding_0: [u8; 3usize],
4518}
4519impl Default for otExternalRouteConfig {
4520 fn default() -> Self {
4521 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4522 unsafe {
4523 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4524 s.assume_init()
4525 }
4526 }
4527}
4528impl otExternalRouteConfig {
4529 #[inline]
4530 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4531 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4532 }
4533 #[inline]
4534 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4535 unsafe {
4536 let val: u32 = ::std::mem::transmute(val);
4537 self._bitfield_1.set(0usize, 2u8, val as u64)
4538 }
4539 }
4540 #[inline]
4541 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4542 unsafe {
4543 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4544 ::std::ptr::addr_of!((*this)._bitfield_1),
4545 0usize,
4546 2u8,
4547 ) as u32)
4548 }
4549 }
4550 #[inline]
4551 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4552 unsafe {
4553 let val: u32 = ::std::mem::transmute(val);
4554 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4555 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4556 0usize,
4557 2u8,
4558 val as u64,
4559 )
4560 }
4561 }
4562 #[inline]
4563 pub fn mNat64(&self) -> bool {
4564 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4565 }
4566 #[inline]
4567 pub fn set_mNat64(&mut self, val: bool) {
4568 unsafe {
4569 let val: u8 = ::std::mem::transmute(val);
4570 self._bitfield_1.set(2usize, 1u8, val as u64)
4571 }
4572 }
4573 #[inline]
4574 pub unsafe fn mNat64_raw(this: *const Self) -> bool {
4575 unsafe {
4576 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4577 ::std::ptr::addr_of!((*this)._bitfield_1),
4578 2usize,
4579 1u8,
4580 ) as u8)
4581 }
4582 }
4583 #[inline]
4584 pub unsafe fn set_mNat64_raw(this: *mut Self, val: bool) {
4585 unsafe {
4586 let val: u8 = ::std::mem::transmute(val);
4587 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4588 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4589 2usize,
4590 1u8,
4591 val as u64,
4592 )
4593 }
4594 }
4595 #[inline]
4596 pub fn mStable(&self) -> bool {
4597 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4598 }
4599 #[inline]
4600 pub fn set_mStable(&mut self, val: bool) {
4601 unsafe {
4602 let val: u8 = ::std::mem::transmute(val);
4603 self._bitfield_1.set(3usize, 1u8, val as u64)
4604 }
4605 }
4606 #[inline]
4607 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4608 unsafe {
4609 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4610 ::std::ptr::addr_of!((*this)._bitfield_1),
4611 3usize,
4612 1u8,
4613 ) as u8)
4614 }
4615 }
4616 #[inline]
4617 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4618 unsafe {
4619 let val: u8 = ::std::mem::transmute(val);
4620 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4621 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4622 3usize,
4623 1u8,
4624 val as u64,
4625 )
4626 }
4627 }
4628 #[inline]
4629 pub fn mNextHopIsThisDevice(&self) -> bool {
4630 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4631 }
4632 #[inline]
4633 pub fn set_mNextHopIsThisDevice(&mut self, val: bool) {
4634 unsafe {
4635 let val: u8 = ::std::mem::transmute(val);
4636 self._bitfield_1.set(4usize, 1u8, val as u64)
4637 }
4638 }
4639 #[inline]
4640 pub unsafe fn mNextHopIsThisDevice_raw(this: *const Self) -> bool {
4641 unsafe {
4642 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4643 ::std::ptr::addr_of!((*this)._bitfield_1),
4644 4usize,
4645 1u8,
4646 ) as u8)
4647 }
4648 }
4649 #[inline]
4650 pub unsafe fn set_mNextHopIsThisDevice_raw(this: *mut Self, val: bool) {
4651 unsafe {
4652 let val: u8 = ::std::mem::transmute(val);
4653 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4654 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4655 4usize,
4656 1u8,
4657 val as u64,
4658 )
4659 }
4660 }
4661 #[inline]
4662 pub fn mAdvPio(&self) -> bool {
4663 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4664 }
4665 #[inline]
4666 pub fn set_mAdvPio(&mut self, val: bool) {
4667 unsafe {
4668 let val: u8 = ::std::mem::transmute(val);
4669 self._bitfield_1.set(5usize, 1u8, val as u64)
4670 }
4671 }
4672 #[inline]
4673 pub unsafe fn mAdvPio_raw(this: *const Self) -> bool {
4674 unsafe {
4675 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4676 ::std::ptr::addr_of!((*this)._bitfield_1),
4677 5usize,
4678 1u8,
4679 ) as u8)
4680 }
4681 }
4682 #[inline]
4683 pub unsafe fn set_mAdvPio_raw(this: *mut Self, val: bool) {
4684 unsafe {
4685 let val: u8 = ::std::mem::transmute(val);
4686 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4687 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4688 5usize,
4689 1u8,
4690 val as u64,
4691 )
4692 }
4693 }
4694 #[inline]
4695 pub fn new_bitfield_1(
4696 mPreference: ::std::os::raw::c_int,
4697 mNat64: bool,
4698 mStable: bool,
4699 mNextHopIsThisDevice: bool,
4700 mAdvPio: bool,
4701 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4702 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4703 __bindgen_bitfield_unit.set(0usize, 2u8, {
4704 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
4705 mPreference as u64
4706 });
4707 __bindgen_bitfield_unit.set(2usize, 1u8, {
4708 let mNat64: u8 = unsafe { ::std::mem::transmute(mNat64) };
4709 mNat64 as u64
4710 });
4711 __bindgen_bitfield_unit.set(3usize, 1u8, {
4712 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4713 mStable as u64
4714 });
4715 __bindgen_bitfield_unit.set(4usize, 1u8, {
4716 let mNextHopIsThisDevice: u8 = unsafe { ::std::mem::transmute(mNextHopIsThisDevice) };
4717 mNextHopIsThisDevice as u64
4718 });
4719 __bindgen_bitfield_unit.set(5usize, 1u8, {
4720 let mAdvPio: u8 = unsafe { ::std::mem::transmute(mAdvPio) };
4721 mAdvPio as u64
4722 });
4723 __bindgen_bitfield_unit
4724 }
4725}
4726#[doc = "< Low route preference."]
4727pub const OT_ROUTE_PREFERENCE_LOW: otRoutePreference = -1;
4728#[doc = "< Medium route preference."]
4729pub const OT_ROUTE_PREFERENCE_MED: otRoutePreference = 0;
4730#[doc = "< High route preference."]
4731pub const OT_ROUTE_PREFERENCE_HIGH: otRoutePreference = 1;
4732#[doc = " Defines valid values for `mPreference` in `otExternalRouteConfig` and `otBorderRouterConfig`."]
4733pub type otRoutePreference = ::std::os::raw::c_int;
4734#[doc = " Represents a Server configuration."]
4735#[repr(C)]
4736#[derive(Debug, Copy, Clone)]
4737pub struct otServerConfig {
4738 pub _bitfield_align_1: [u8; 0],
4739 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4740 #[doc = "< Length of server data."]
4741 pub mServerDataLength: u8,
4742 #[doc = "< Server data bytes."]
4743 pub mServerData: [u8; 248usize],
4744 #[doc = "< The Server RLOC16."]
4745 pub mRloc16: u16,
4746}
4747impl Default for otServerConfig {
4748 fn default() -> Self {
4749 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4750 unsafe {
4751 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4752 s.assume_init()
4753 }
4754 }
4755}
4756impl otServerConfig {
4757 #[inline]
4758 pub fn mStable(&self) -> bool {
4759 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4760 }
4761 #[inline]
4762 pub fn set_mStable(&mut self, val: bool) {
4763 unsafe {
4764 let val: u8 = ::std::mem::transmute(val);
4765 self._bitfield_1.set(0usize, 1u8, val as u64)
4766 }
4767 }
4768 #[inline]
4769 pub unsafe fn mStable_raw(this: *const Self) -> bool {
4770 unsafe {
4771 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4772 ::std::ptr::addr_of!((*this)._bitfield_1),
4773 0usize,
4774 1u8,
4775 ) as u8)
4776 }
4777 }
4778 #[inline]
4779 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
4780 unsafe {
4781 let val: u8 = ::std::mem::transmute(val);
4782 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4783 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4784 0usize,
4785 1u8,
4786 val as u64,
4787 )
4788 }
4789 }
4790 #[inline]
4791 pub fn new_bitfield_1(mStable: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4792 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4793 __bindgen_bitfield_unit.set(0usize, 1u8, {
4794 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
4795 mStable as u64
4796 });
4797 __bindgen_bitfield_unit
4798 }
4799}
4800#[doc = " Represents a Service configuration."]
4801#[repr(C)]
4802#[derive(Debug, Copy, Clone)]
4803pub struct otServiceConfig {
4804 #[doc = "< Service ID (when iterating over the Network Data)."]
4805 pub mServiceId: u8,
4806 #[doc = "< IANA Enterprise Number."]
4807 pub mEnterpriseNumber: u32,
4808 #[doc = "< Length of service data."]
4809 pub mServiceDataLength: u8,
4810 #[doc = "< Service data bytes."]
4811 pub mServiceData: [u8; 252usize],
4812 #[doc = "< The Server configuration."]
4813 pub mServerConfig: otServerConfig,
4814}
4815impl Default for otServiceConfig {
4816 fn default() -> Self {
4817 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4818 unsafe {
4819 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4820 s.assume_init()
4821 }
4822 }
4823}
4824unsafe extern "C" {
4825 #[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."]
4826 pub fn otNetDataGet(
4827 aInstance: *mut otInstance,
4828 aStable: bool,
4829 aData: *mut u8,
4830 aDataLength: *mut u8,
4831 ) -> otError;
4832}
4833unsafe extern "C" {
4834 #[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."]
4835 pub fn otNetDataGetLength(aInstance: *mut otInstance) -> u8;
4836}
4837unsafe extern "C" {
4838 #[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)."]
4839 pub fn otNetDataGetMaxLength(aInstance: *mut otInstance) -> u8;
4840}
4841unsafe extern "C" {
4842 #[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"]
4843 pub fn otNetDataResetMaxLength(aInstance: *mut otInstance);
4844}
4845unsafe extern "C" {
4846 #[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."]
4847 pub fn otNetDataGetNextOnMeshPrefix(
4848 aInstance: *mut otInstance,
4849 aIterator: *mut otNetworkDataIterator,
4850 aConfig: *mut otBorderRouterConfig,
4851 ) -> otError;
4852}
4853unsafe extern "C" {
4854 #[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."]
4855 pub fn otNetDataGetNextRoute(
4856 aInstance: *mut otInstance,
4857 aIterator: *mut otNetworkDataIterator,
4858 aConfig: *mut otExternalRouteConfig,
4859 ) -> otError;
4860}
4861unsafe extern "C" {
4862 #[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."]
4863 pub fn otNetDataGetNextService(
4864 aInstance: *mut otInstance,
4865 aIterator: *mut otNetworkDataIterator,
4866 aConfig: *mut otServiceConfig,
4867 ) -> otError;
4868}
4869unsafe extern "C" {
4870 #[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."]
4871 pub fn otNetDataGetNextLowpanContextInfo(
4872 aInstance: *mut otInstance,
4873 aIterator: *mut otNetworkDataIterator,
4874 aContextInfo: *mut otLowpanContextInfo,
4875 ) -> otError;
4876}
4877unsafe extern "C" {
4878 #[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."]
4879 pub fn otNetDataGetCommissioningDataset(
4880 aInstance: *mut otInstance,
4881 aDataset: *mut otCommissioningDataset,
4882 );
4883}
4884unsafe extern "C" {
4885 #[doc = " Get the Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Network Data Version."]
4886 pub fn otNetDataGetVersion(aInstance: *mut otInstance) -> u8;
4887}
4888unsafe extern "C" {
4889 #[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."]
4890 pub fn otNetDataGetStableVersion(aInstance: *mut otInstance) -> u8;
4891}
4892unsafe extern "C" {
4893 #[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."]
4894 pub fn otNetDataSteeringDataCheckJoiner(
4895 aInstance: *mut otInstance,
4896 aEui64: *const otExtAddress,
4897 ) -> otError;
4898}
4899unsafe extern "C" {
4900 #[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."]
4901 pub fn otNetDataSteeringDataCheckJoinerWithDiscerner(
4902 aInstance: *mut otInstance,
4903 aDiscerner: *const otJoinerDiscerner,
4904 ) -> otError;
4905}
4906unsafe extern "C" {
4907 #[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."]
4908 pub fn otNetDataContainsOmrPrefix(
4909 aInstance: *mut otInstance,
4910 aPrefix: *const otIp6Prefix,
4911 ) -> bool;
4912}
4913#[doc = "< Backbone function is disabled."]
4914pub const OT_BACKBONE_ROUTER_STATE_DISABLED: otBackboneRouterState = 0;
4915#[doc = "< Secondary Backbone Router."]
4916pub const OT_BACKBONE_ROUTER_STATE_SECONDARY: otBackboneRouterState = 1;
4917#[doc = "< The Primary Backbone Router."]
4918pub const OT_BACKBONE_ROUTER_STATE_PRIMARY: otBackboneRouterState = 2;
4919#[doc = " Represents the Backbone Router Status."]
4920pub type otBackboneRouterState = ::std::os::raw::c_uint;
4921unsafe extern "C" {
4922 #[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"]
4923 pub fn otBackboneRouterSetEnabled(aInstance: *mut otInstance, aEnable: bool);
4924}
4925unsafe extern "C" {
4926 #[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"]
4927 pub fn otBackboneRouterGetState(aInstance: *mut otInstance) -> otBackboneRouterState;
4928}
4929unsafe extern "C" {
4930 #[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"]
4931 pub fn otBackboneRouterGetConfig(
4932 aInstance: *mut otInstance,
4933 aConfig: *mut otBackboneRouterConfig,
4934 );
4935}
4936unsafe extern "C" {
4937 #[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"]
4938 pub fn otBackboneRouterSetConfig(
4939 aInstance: *mut otInstance,
4940 aConfig: *const otBackboneRouterConfig,
4941 ) -> otError;
4942}
4943unsafe extern "C" {
4944 #[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"]
4945 pub fn otBackboneRouterRegister(aInstance: *mut otInstance) -> otError;
4946}
4947unsafe extern "C" {
4948 #[doc = " Returns the Backbone Router registration jitter value.\n\n @returns The Backbone Router registration jitter value.\n\n @sa otBackboneRouterSetRegistrationJitter"]
4949 pub fn otBackboneRouterGetRegistrationJitter(aInstance: *mut otInstance) -> u8;
4950}
4951unsafe extern "C" {
4952 #[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"]
4953 pub fn otBackboneRouterSetRegistrationJitter(aInstance: *mut otInstance, aJitter: u8);
4954}
4955unsafe extern "C" {
4956 #[doc = " Gets the local Domain Prefix configuration.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aConfig A pointer to the Domain Prefix configuration.\n\n @retval OT_ERROR_NONE Successfully got the Domain Prefix configuration.\n @retval OT_ERROR_NOT_FOUND No Domain Prefix was configured."]
4957 pub fn otBackboneRouterGetDomainPrefix(
4958 aInstance: *mut otInstance,
4959 aConfig: *mut otBorderRouterConfig,
4960 ) -> otError;
4961}
4962unsafe extern "C" {
4963 #[doc = " Configures response status for next DUA registration.\n\n Note: available only when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n Only used for test and certification.\n\n TODO: (DUA) support coap error code and corresponding process for certification purpose.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMlIid A pointer to the Mesh Local IID. If NULL, respond with @p aStatus for any\n coming DUA.req, otherwise only respond the one with matching @p aMlIid.\n @param[in] aStatus The status to respond."]
4964 pub fn otBackboneRouterConfigNextDuaRegistrationResponse(
4965 aInstance: *mut otInstance,
4966 aMlIid: *const otIp6InterfaceIdentifier,
4967 aStatus: u8,
4968 );
4969}
4970unsafe extern "C" {
4971 #[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."]
4972 pub fn otBackboneRouterConfigNextMulticastListenerRegistrationResponse(
4973 aInstance: *mut otInstance,
4974 aStatus: u8,
4975 );
4976}
4977#[doc = "< Multicast Listener was added."]
4978pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ADDED: otBackboneRouterMulticastListenerEvent = 0;
4979#[doc = "< Multicast Listener was removed or expired."]
4980pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_REMOVED: otBackboneRouterMulticastListenerEvent = 1;
4981#[doc = " Represents the Multicast Listener events."]
4982pub type otBackboneRouterMulticastListenerEvent = ::std::os::raw::c_uint;
4983#[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."]
4984pub type otBackboneRouterMulticastListenerCallback = ::std::option::Option<
4985 unsafe extern "C" fn(
4986 aContext: *mut ::std::os::raw::c_void,
4987 aEvent: otBackboneRouterMulticastListenerEvent,
4988 aAddress: *const otIp6Address,
4989 ),
4990>;
4991unsafe extern "C" {
4992 #[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."]
4993 pub fn otBackboneRouterSetMulticastListenerCallback(
4994 aInstance: *mut otInstance,
4995 aCallback: otBackboneRouterMulticastListenerCallback,
4996 aContext: *mut ::std::os::raw::c_void,
4997 );
4998}
4999unsafe extern "C" {
5000 #[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"]
5001 pub fn otBackboneRouterMulticastListenerClear(aInstance: *mut otInstance);
5002}
5003unsafe extern "C" {
5004 #[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"]
5005 pub fn otBackboneRouterMulticastListenerAdd(
5006 aInstance: *mut otInstance,
5007 aAddress: *const otIp6Address,
5008 aTimeout: u32,
5009 ) -> otError;
5010}
5011pub type otBackboneRouterMulticastListenerIterator = u16;
5012#[doc = " Represents a Backbone Router Multicast Listener info."]
5013#[repr(C)]
5014#[derive(Copy, Clone)]
5015pub struct otBackboneRouterMulticastListenerInfo {
5016 pub mAddress: otIp6Address,
5017 pub mTimeout: u32,
5018}
5019impl Default for otBackboneRouterMulticastListenerInfo {
5020 fn default() -> Self {
5021 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5022 unsafe {
5023 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5024 s.assume_init()
5025 }
5026 }
5027}
5028unsafe extern "C" {
5029 #[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"]
5030 pub fn otBackboneRouterMulticastListenerGetNext(
5031 aInstance: *mut otInstance,
5032 aIterator: *mut otBackboneRouterMulticastListenerIterator,
5033 aListenerInfo: *mut otBackboneRouterMulticastListenerInfo,
5034 ) -> otError;
5035}
5036#[doc = "< ND Proxy was added."]
5037pub const OT_BACKBONE_ROUTER_NDPROXY_ADDED: otBackboneRouterNdProxyEvent = 0;
5038#[doc = "< ND Proxy was removed."]
5039pub const OT_BACKBONE_ROUTER_NDPROXY_REMOVED: otBackboneRouterNdProxyEvent = 1;
5040#[doc = "< ND Proxy was renewed."]
5041pub const OT_BACKBONE_ROUTER_NDPROXY_RENEWED: otBackboneRouterNdProxyEvent = 2;
5042#[doc = "< All ND Proxies were cleared."]
5043pub const OT_BACKBONE_ROUTER_NDPROXY_CLEARED: otBackboneRouterNdProxyEvent = 3;
5044#[doc = " Represents the ND Proxy events."]
5045pub type otBackboneRouterNdProxyEvent = ::std::os::raw::c_uint;
5046#[doc = " Pointer is called whenever the Nd Proxy changed.\n\n @param[in] aContext The user context pointer.\n @param[in] aEvent The ND Proxy event.\n @param[in] aDua The Domain Unicast Address of the ND Proxy, or NULL if @p aEvent is\n `OT_BACKBONE_ROUTER_NDPROXY_CLEARED`."]
5047pub type otBackboneRouterNdProxyCallback = ::std::option::Option<
5048 unsafe extern "C" fn(
5049 aContext: *mut ::std::os::raw::c_void,
5050 aEvent: otBackboneRouterNdProxyEvent,
5051 aDua: *const otIp6Address,
5052 ),
5053>;
5054unsafe extern "C" {
5055 #[doc = " Sets the Backbone Router ND Proxy callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to the ND Proxy callback.\n @param[in] aContext A user context pointer."]
5056 pub fn otBackboneRouterSetNdProxyCallback(
5057 aInstance: *mut otInstance,
5058 aCallback: otBackboneRouterNdProxyCallback,
5059 aContext: *mut ::std::os::raw::c_void,
5060 );
5061}
5062#[doc = " Represents the Backbone Router ND Proxy info."]
5063#[repr(C)]
5064#[derive(Debug, Copy, Clone)]
5065pub struct otBackboneRouterNdProxyInfo {
5066 #[doc = "< Mesh-local IID"]
5067 pub mMeshLocalIid: *mut otIp6InterfaceIdentifier,
5068 #[doc = "< Time since last transaction (Seconds)"]
5069 pub mTimeSinceLastTransaction: u32,
5070 #[doc = "< RLOC16"]
5071 pub mRloc16: u16,
5072}
5073impl Default for otBackboneRouterNdProxyInfo {
5074 fn default() -> Self {
5075 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5076 unsafe {
5077 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5078 s.assume_init()
5079 }
5080 }
5081}
5082unsafe extern "C" {
5083 #[doc = " Gets the Backbone Router ND Proxy info.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aDua The Domain Unicast Address.\n @param[out] aNdProxyInfo A pointer to the ND Proxy info.\n\n @retval OT_ERROR_NONE Successfully got the ND Proxy info.\n @retval OT_ERROR_NOT_FOUND Failed to find the Domain Unicast Address in the ND Proxy table."]
5084 pub fn otBackboneRouterGetNdProxyInfo(
5085 aInstance: *mut otInstance,
5086 aDua: *const otIp6Address,
5087 aNdProxyInfo: *mut otBackboneRouterNdProxyInfo,
5088 ) -> otError;
5089}
5090#[doc = "< Domain Prefix was added."]
5091pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED: otBackboneRouterDomainPrefixEvent = 0;
5092#[doc = "< Domain Prefix was removed."]
5093pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED: otBackboneRouterDomainPrefixEvent = 1;
5094#[doc = "< Domain Prefix was changed."]
5095pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED: otBackboneRouterDomainPrefixEvent = 2;
5096#[doc = " Represents the Domain Prefix events."]
5097pub type otBackboneRouterDomainPrefixEvent = ::std::os::raw::c_uint;
5098#[doc = " Pointer is called whenever the Domain Prefix changed.\n\n @param[in] aContext The user context pointer.\n @param[in] aEvent The Domain Prefix event.\n @param[in] aDomainPrefix The new Domain Prefix if added or changed, NULL otherwise."]
5099pub type otBackboneRouterDomainPrefixCallback = ::std::option::Option<
5100 unsafe extern "C" fn(
5101 aContext: *mut ::std::os::raw::c_void,
5102 aEvent: otBackboneRouterDomainPrefixEvent,
5103 aDomainPrefix: *const otIp6Prefix,
5104 ),
5105>;
5106unsafe extern "C" {
5107 #[doc = " Sets the Backbone Router Domain Prefix callback.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aCallback A pointer to the Domain Prefix callback.\n @param[in] aContext A user context pointer."]
5108 pub fn otBackboneRouterSetDomainPrefixCallback(
5109 aInstance: *mut otInstance,
5110 aCallback: otBackboneRouterDomainPrefixCallback,
5111 aContext: *mut ::std::os::raw::c_void,
5112 );
5113}
5114#[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)."]
5115#[repr(C)]
5116#[derive(Debug, Copy, Clone)]
5117pub struct otDnsTxtEntry {
5118 #[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."]
5119 pub mKey: *const ::std::os::raw::c_char,
5120 #[doc = "< The TXT record value or already encoded TXT-DATA (depending on `mKey`)."]
5121 pub mValue: *const u8,
5122 #[doc = "< Number of bytes in `mValue` buffer."]
5123 pub mValueLength: u16,
5124}
5125impl Default for otDnsTxtEntry {
5126 fn default() -> Self {
5127 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5128 unsafe {
5129 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5130 s.assume_init()
5131 }
5132 }
5133}
5134#[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."]
5135#[repr(C)]
5136#[derive(Debug, Copy, Clone)]
5137pub struct otDnsTxtEntryIterator {
5138 pub mPtr: *const ::std::os::raw::c_void,
5139 pub mData: [u16; 2usize],
5140 pub mChar: [::std::os::raw::c_char; 65usize],
5141}
5142impl Default for otDnsTxtEntryIterator {
5143 fn default() -> Self {
5144 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5145 unsafe {
5146 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5147 s.assume_init()
5148 }
5149 }
5150}
5151unsafe extern "C" {
5152 #[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."]
5153 pub fn otDnsInitTxtEntryIterator(
5154 aIterator: *mut otDnsTxtEntryIterator,
5155 aTxtData: *const u8,
5156 aTxtDataLength: u16,
5157 );
5158}
5159unsafe extern "C" {
5160 #[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."]
5161 pub fn otDnsGetNextTxtEntry(
5162 aIterator: *mut otDnsTxtEntryIterator,
5163 aEntry: *mut otDnsTxtEntry,
5164 ) -> otError;
5165}
5166unsafe extern "C" {
5167 #[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."]
5168 pub fn otDnsEncodeTxtData(
5169 aTxtEntries: *const otDnsTxtEntry,
5170 aNumTxtEntries: u16,
5171 aTxtData: *mut u8,
5172 aTxtDataLength: *mut u16,
5173 ) -> otError;
5174}
5175unsafe extern "C" {
5176 #[doc = " Enables/disables the \"DNS name compression\" mode.\n\n By default DNS name compression is enabled. When disabled, DNS names are appended as full and never compressed. This\n is applicable to OpenThread's DNS and SRP client/server modules.\n\n This is intended for testing only and available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` config is enabled.\n\n Note that in the case `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` is used, this mode applies to all OpenThread\n instances (i.e., calling this function enables/disables the compression mode on all OpenThread instances).\n\n @param[in] aEnabled TRUE to enable the \"DNS name compression\" mode, FALSE to disable."]
5177 pub fn otDnsSetNameCompressionEnabled(aEnabled: bool);
5178}
5179unsafe extern "C" {
5180 #[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."]
5181 pub fn otDnsIsNameCompressionEnabled() -> bool;
5182}
5183#[doc = " Represents a Border Agent Identifier."]
5184#[repr(C)]
5185#[derive(Debug, Default, Copy, Clone)]
5186pub struct otBorderAgentId {
5187 #[doc = "< Border Agent ID bytes."]
5188 pub mId: [u8; 16usize],
5189}
5190#[doc = " Defines Border Agent counters.\n\n The `mEpskc` related counters require `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`."]
5191#[repr(C)]
5192#[derive(Debug, Default, Copy, Clone)]
5193pub struct otBorderAgentCounters {
5194 #[doc = "< The number of ePSKc activations"]
5195 pub mEpskcActivations: u32,
5196 #[doc = "< The number of ePSKc deactivations via API"]
5197 pub mEpskcDeactivationClears: u32,
5198 #[doc = "< The number of ePSKc deactivations due to timeout"]
5199 pub mEpskcDeactivationTimeouts: u32,
5200 #[doc = "< The number of ePSKc deactivations due to reached max attempts"]
5201 pub mEpskcDeactivationMaxAttempts: u32,
5202 #[doc = "< The number of ePSKc deactivations due to commissioner disconnected"]
5203 pub mEpskcDeactivationDisconnects: u32,
5204 #[doc = "< The number of invalid border agent state errors at ePSKc activation"]
5205 pub mEpskcInvalidBaStateErrors: u32,
5206 #[doc = "< The number of invalid args errors at ePSKc activation"]
5207 pub mEpskcInvalidArgsErrors: u32,
5208 #[doc = "< The number of start secure session errors at ePSKc activation"]
5209 pub mEpskcStartSecureSessionErrors: u32,
5210 #[doc = "< The number of established secure sessions with ePSKc"]
5211 pub mEpskcSecureSessionSuccesses: u32,
5212 #[doc = "< The number of failed secure sessions with ePSKc"]
5213 pub mEpskcSecureSessionFailures: u32,
5214 #[doc = "< The number of successful commissioner petitions with ePSKc"]
5215 pub mEpskcCommissionerPetitions: u32,
5216 #[doc = "< The number of established secure sessions with PSKc"]
5217 pub mPskcSecureSessionSuccesses: u32,
5218 #[doc = "< The number of failed secure sessions with PSKc"]
5219 pub mPskcSecureSessionFailures: u32,
5220 #[doc = "< The number of successful commissioner petitions with PSKc"]
5221 pub mPskcCommissionerPetitions: u32,
5222 #[doc = "< The number of MGMT_ACTIVE_GET.req sent over secure sessions"]
5223 pub mMgmtActiveGets: u32,
5224 #[doc = "< The number of MGMT_PENDING_GET.req sent over secure sessions"]
5225 pub mMgmtPendingGets: u32,
5226}
5227#[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."]
5228#[repr(C)]
5229#[derive(Copy, Clone)]
5230pub struct otBorderAgentSessionInfo {
5231 #[doc = "< Socket address (IPv6 address and port number) of session peer."]
5232 pub mPeerSockAddr: otSockAddr,
5233 #[doc = "< Indicates whether the session is connected."]
5234 pub mIsConnected: bool,
5235 #[doc = "< Indicates whether the session is accepted as full commissioner."]
5236 pub mIsCommissioner: bool,
5237 #[doc = "< Milliseconds since the session was first established."]
5238 pub mLifetime: u64,
5239}
5240impl Default for otBorderAgentSessionInfo {
5241 fn default() -> Self {
5242 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5243 unsafe {
5244 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5245 s.assume_init()
5246 }
5247 }
5248}
5249#[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."]
5250#[repr(C)]
5251#[derive(Debug, Copy, Clone)]
5252pub struct otBorderAgentSessionIterator {
5253 pub mPtr: *mut ::std::os::raw::c_void,
5254 pub mData: u64,
5255}
5256impl Default for otBorderAgentSessionIterator {
5257 fn default() -> Self {
5258 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5259 unsafe {
5260 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5261 s.assume_init()
5262 }
5263 }
5264}
5265#[doc = " Represents the Border Agent MeshCoP Service TXT data."]
5266#[repr(C)]
5267#[derive(Debug, Copy, Clone)]
5268pub struct otBorderAgentMeshCoPServiceTxtData {
5269 pub mData: [u8; 256usize],
5270 pub mLength: u16,
5271}
5272impl Default for otBorderAgentMeshCoPServiceTxtData {
5273 fn default() -> Self {
5274 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5275 unsafe {
5276 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5277 s.assume_init()
5278 }
5279 }
5280}
5281unsafe extern "C" {
5282 #[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)."]
5283 pub fn otBorderAgentSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
5284}
5285unsafe extern "C" {
5286 #[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."]
5287 pub fn otBorderAgentIsEnabled(aInstance: *mut otInstance) -> bool;
5288}
5289unsafe extern "C" {
5290 #[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."]
5291 pub fn otBorderAgentIsActive(aInstance: *mut otInstance) -> bool;
5292}
5293unsafe extern "C" {
5294 #[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."]
5295 pub fn otBorderAgentGetUdpPort(aInstance: *mut otInstance) -> u16;
5296}
5297#[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."]
5298pub type otBorderAgentMeshCoPServiceChangedCallback =
5299 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5300unsafe extern "C" {
5301 #[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."]
5302 pub fn otBorderAgentSetMeshCoPServiceChangedCallback(
5303 aInstance: *mut otInstance,
5304 aCallback: otBorderAgentMeshCoPServiceChangedCallback,
5305 aContext: *mut ::std::os::raw::c_void,
5306 );
5307}
5308unsafe extern "C" {
5309 #[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."]
5310 pub fn otBorderAgentGetMeshCoPServiceTxtData(
5311 aInstance: *mut otInstance,
5312 aTxtData: *mut otBorderAgentMeshCoPServiceTxtData,
5313 ) -> otError;
5314}
5315unsafe extern "C" {
5316 #[doc = " Sets the base name to construct the service instance name used when advertising the mDNS `_meshcop._udp` service by\n the Border Agent.\n\n Requires the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_ENABLE` feature.\n\n The name can also be configured using the `OPENTHREAD_CONFIG_BORDER_AGENT_MESHCOP_SERVICE_BASE_NAME` configuration\n option (which is the recommended way to specify this name). This API is provided for projects where the name needs\n to be set after device initialization and at run-time.\n\n Per the Thread specification, the service instance should be a user-friendly name identifying the device model or\n product. A recommended format is \"VendorName ProductName\".\n\n To construct the full name and ensure name uniqueness, the OpenThread Border Agent module will append the Extended\n Address of the device (as 16-character hex digits) to the given base name.\n\n Note that the same name will be used for the ephemeral key service `_meshcop-e._udp` when the ephemeral key feature\n is enabled and used.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aBaseName The base name to use (MUST not be NULL).\n\n @retval OT_ERROR_NONE The name was set successfully.\n @retval OT_ERROR_INVALID_ARGS The name is too long or invalid."]
5317 pub fn otBorderAgentSetMeshCoPServiceBaseName(
5318 aInstance: *mut otInstance,
5319 aBaseName: *const ::std::os::raw::c_char,
5320 ) -> otError;
5321}
5322unsafe extern "C" {
5323 #[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."]
5324 pub fn otBorderAgentSetVendorTxtData(
5325 aInstance: *mut otInstance,
5326 aVendorData: *const u8,
5327 aVendorDataLength: u16,
5328 );
5329}
5330unsafe extern "C" {
5331 #[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"]
5332 pub fn otBorderAgentGetId(aInstance: *mut otInstance, aId: *mut otBorderAgentId) -> otError;
5333}
5334unsafe extern "C" {
5335 #[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[out] 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"]
5336 pub fn otBorderAgentSetId(aInstance: *mut otInstance, aId: *const otBorderAgentId) -> otError;
5337}
5338unsafe extern "C" {
5339 #[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."]
5340 pub fn otBorderAgentInitSessionIterator(
5341 aInstance: *mut otInstance,
5342 aIterator: *mut otBorderAgentSessionIterator,
5343 );
5344}
5345unsafe extern "C" {
5346 #[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."]
5347 pub fn otBorderAgentGetNextSessionInfo(
5348 aIterator: *mut otBorderAgentSessionIterator,
5349 aSessionInfo: *mut otBorderAgentSessionInfo,
5350 ) -> otError;
5351}
5352unsafe extern "C" {
5353 #[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."]
5354 pub fn otBorderAgentGetCounters(aInstance: *mut otInstance) -> *const otBorderAgentCounters;
5355}
5356#[doc = "< Ephemeral Key Manager is disabled."]
5357pub const OT_BORDER_AGENT_STATE_DISABLED: otBorderAgentEphemeralKeyState = 0;
5358#[doc = "< Enabled, but no ephemeral key is in use (not set or started)."]
5359pub const OT_BORDER_AGENT_STATE_STOPPED: otBorderAgentEphemeralKeyState = 1;
5360#[doc = "< Ephemeral key is set. Listening to accept secure connections."]
5361pub const OT_BORDER_AGENT_STATE_STARTED: otBorderAgentEphemeralKeyState = 2;
5362#[doc = "< Session is established with an external commissioner candidate."]
5363pub const OT_BORDER_AGENT_STATE_CONNECTED: otBorderAgentEphemeralKeyState = 3;
5364#[doc = "< Session is established and candidate is accepted as full commissioner."]
5365pub const OT_BORDER_AGENT_STATE_ACCEPTED: otBorderAgentEphemeralKeyState = 4;
5366#[doc = " Represents Border Agent's Ephemeral Key Manager state."]
5367pub type otBorderAgentEphemeralKeyState = ::std::os::raw::c_uint;
5368unsafe extern "C" {
5369 #[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."]
5370 pub fn otBorderAgentEphemeralKeyGetState(
5371 aInstance: *mut otInstance,
5372 ) -> otBorderAgentEphemeralKeyState;
5373}
5374unsafe extern "C" {
5375 #[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."]
5376 pub fn otBorderAgentEphemeralKeySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
5377}
5378unsafe extern "C" {
5379 #[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)."]
5380 pub fn otBorderAgentEphemeralKeyStart(
5381 aInstance: *mut otInstance,
5382 aKeyString: *const ::std::os::raw::c_char,
5383 aTimeout: u32,
5384 aUdpPort: u16,
5385 ) -> otError;
5386}
5387unsafe extern "C" {
5388 #[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."]
5389 pub fn otBorderAgentEphemeralKeyStop(aInstance: *mut otInstance);
5390}
5391unsafe extern "C" {
5392 #[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)."]
5393 pub fn otBorderAgentEphemeralKeyGetUdpPort(aInstance: *mut otInstance) -> u16;
5394}
5395#[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)."]
5396pub type otBorderAgentEphemeralKeyCallback =
5397 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5398unsafe extern "C" {
5399 #[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."]
5400 pub fn otBorderAgentEphemeralKeySetCallback(
5401 aInstance: *mut otInstance,
5402 aCallback: otBorderAgentEphemeralKeyCallback,
5403 aContext: *mut ::std::os::raw::c_void,
5404 );
5405}
5406unsafe extern "C" {
5407 #[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."]
5408 pub fn otBorderAgentEphemeralKeyStateToString(
5409 aState: otBorderAgentEphemeralKeyState,
5410 ) -> *const ::std::os::raw::c_char;
5411}
5412unsafe extern "C" {
5413 #[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."]
5414 pub fn otBorderRouterGetNetData(
5415 aInstance: *mut otInstance,
5416 aStable: bool,
5417 aData: *mut u8,
5418 aDataLength: *mut u8,
5419 ) -> otError;
5420}
5421unsafe extern "C" {
5422 #[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"]
5423 pub fn otBorderRouterAddOnMeshPrefix(
5424 aInstance: *mut otInstance,
5425 aConfig: *const otBorderRouterConfig,
5426 ) -> otError;
5427}
5428unsafe extern "C" {
5429 #[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"]
5430 pub fn otBorderRouterRemoveOnMeshPrefix(
5431 aInstance: *mut otInstance,
5432 aPrefix: *const otIp6Prefix,
5433 ) -> otError;
5434}
5435unsafe extern "C" {
5436 #[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."]
5437 pub fn otBorderRouterGetNextOnMeshPrefix(
5438 aInstance: *mut otInstance,
5439 aIterator: *mut otNetworkDataIterator,
5440 aConfig: *mut otBorderRouterConfig,
5441 ) -> otError;
5442}
5443unsafe extern "C" {
5444 #[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"]
5445 pub fn otBorderRouterAddRoute(
5446 aInstance: *mut otInstance,
5447 aConfig: *const otExternalRouteConfig,
5448 ) -> otError;
5449}
5450unsafe extern "C" {
5451 #[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"]
5452 pub fn otBorderRouterRemoveRoute(
5453 aInstance: *mut otInstance,
5454 aPrefix: *const otIp6Prefix,
5455 ) -> otError;
5456}
5457unsafe extern "C" {
5458 #[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."]
5459 pub fn otBorderRouterGetNextRoute(
5460 aInstance: *mut otInstance,
5461 aIterator: *mut otNetworkDataIterator,
5462 aConfig: *mut otExternalRouteConfig,
5463 ) -> otError;
5464}
5465unsafe extern "C" {
5466 #[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"]
5467 pub fn otBorderRouterRegister(aInstance: *mut otInstance) -> otError;
5468}
5469#[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."]
5470pub type otBorderRouterNetDataFullCallback =
5471 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5472unsafe extern "C" {
5473 #[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."]
5474 pub fn otBorderRouterSetNetDataFullCallback(
5475 aInstance: *mut otInstance,
5476 aCallback: otBorderRouterNetDataFullCallback,
5477 aContext: *mut ::std::os::raw::c_void,
5478 );
5479}
5480unsafe extern "C" {
5481 #[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."]
5482 pub fn otChannelManagerRequestChannelChange(aInstance: *mut otInstance, aChannel: u8);
5483}
5484unsafe extern "C" {
5485 #[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."]
5486 pub fn otChannelManagerGetRequestedChannel(aInstance: *mut otInstance) -> u8;
5487}
5488unsafe extern "C" {
5489 #[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."]
5490 pub fn otChannelManagerGetDelay(aInstance: *mut otInstance) -> u16;
5491}
5492unsafe extern "C" {
5493 #[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."]
5494 pub fn otChannelManagerSetDelay(aInstance: *mut otInstance, aDelay: u16) -> otError;
5495}
5496unsafe extern "C" {
5497 #[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."]
5498 pub fn otChannelManagerRequestChannelSelect(
5499 aInstance: *mut otInstance,
5500 aSkipQualityCheck: bool,
5501 ) -> otError;
5502}
5503unsafe extern "C" {
5504 #[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."]
5505 pub fn otChannelManagerRequestCslChannelSelect(
5506 aInstance: *mut otInstance,
5507 aSkipQualityCheck: bool,
5508 ) -> otError;
5509}
5510unsafe extern "C" {
5511 #[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."]
5512 pub fn otChannelManagerSetAutoChannelSelectionEnabled(
5513 aInstance: *mut otInstance,
5514 aEnabled: bool,
5515 );
5516}
5517unsafe extern "C" {
5518 #[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."]
5519 pub fn otChannelManagerGetAutoChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5520}
5521unsafe extern "C" {
5522 #[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."]
5523 pub fn otChannelManagerSetAutoCslChannelSelectionEnabled(
5524 aInstance: *mut otInstance,
5525 aEnabled: bool,
5526 );
5527}
5528unsafe extern "C" {
5529 #[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."]
5530 pub fn otChannelManagerGetAutoCslChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
5531}
5532unsafe extern "C" {
5533 #[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)."]
5534 pub fn otChannelManagerSetAutoChannelSelectionInterval(
5535 aInstance: *mut otInstance,
5536 aInterval: u32,
5537 ) -> otError;
5538}
5539unsafe extern "C" {
5540 #[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."]
5541 pub fn otChannelManagerGetAutoChannelSelectionInterval(aInstance: *mut otInstance) -> u32;
5542}
5543unsafe extern "C" {
5544 #[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."]
5545 pub fn otChannelManagerGetSupportedChannels(aInstance: *mut otInstance) -> u32;
5546}
5547unsafe extern "C" {
5548 #[doc = " Sets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5549 pub fn otChannelManagerSetSupportedChannels(aInstance: *mut otInstance, aChannelMask: u32);
5550}
5551unsafe extern "C" {
5552 #[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."]
5553 pub fn otChannelManagerGetFavoredChannels(aInstance: *mut otInstance) -> u32;
5554}
5555unsafe extern "C" {
5556 #[doc = " Sets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
5557 pub fn otChannelManagerSetFavoredChannels(aInstance: *mut otInstance, aChannelMask: u32);
5558}
5559unsafe extern "C" {
5560 #[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%."]
5561 pub fn otChannelManagerGetCcaFailureRateThreshold(aInstance: *mut otInstance) -> u16;
5562}
5563unsafe extern "C" {
5564 #[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%."]
5565 pub fn otChannelManagerSetCcaFailureRateThreshold(aInstance: *mut otInstance, aThreshold: u16);
5566}
5567unsafe extern "C" {
5568 #[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."]
5569 pub fn otChannelMonitorSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
5570}
5571unsafe extern "C" {
5572 #[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."]
5573 pub fn otChannelMonitorIsEnabled(aInstance: *mut otInstance) -> bool;
5574}
5575unsafe extern "C" {
5576 #[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."]
5577 pub fn otChannelMonitorGetSampleInterval(aInstance: *mut otInstance) -> u32;
5578}
5579unsafe extern "C" {
5580 #[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."]
5581 pub fn otChannelMonitorGetRssiThreshold(aInstance: *mut otInstance) -> i8;
5582}
5583unsafe extern "C" {
5584 #[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."]
5585 pub fn otChannelMonitorGetSampleWindow(aInstance: *mut otInstance) -> u32;
5586}
5587unsafe extern "C" {
5588 #[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."]
5589 pub fn otChannelMonitorGetSampleCount(aInstance: *mut otInstance) -> u32;
5590}
5591unsafe extern "C" {
5592 #[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."]
5593 pub fn otChannelMonitorGetChannelOccupancy(aInstance: *mut otInstance, aChannel: u8) -> u16;
5594}
5595unsafe extern "C" {
5596 #[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."]
5597 pub fn otChildSupervisionGetInterval(aInstance: *mut otInstance) -> u16;
5598}
5599unsafe extern "C" {
5600 #[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."]
5601 pub fn otChildSupervisionSetInterval(aInstance: *mut otInstance, aInterval: u16);
5602}
5603unsafe extern "C" {
5604 #[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."]
5605 pub fn otChildSupervisionGetCheckTimeout(aInstance: *mut otInstance) -> u16;
5606}
5607unsafe extern "C" {
5608 #[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."]
5609 pub fn otChildSupervisionSetCheckTimeout(aInstance: *mut otInstance, aTimeout: u16);
5610}
5611unsafe extern "C" {
5612 #[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."]
5613 pub fn otChildSupervisionGetCheckFailureCounter(aInstance: *mut otInstance) -> u16;
5614}
5615unsafe extern "C" {
5616 #[doc = " Reset the supervision check timeout failure counter to zero."]
5617 pub fn otChildSupervisionResetCheckFailureCounter(aInstance: *mut otInstance);
5618}
5619pub type va_list = __builtin_va_list;
5620#[doc = " Represents the log level."]
5621pub type otLogLevel = ::std::os::raw::c_int;
5622#[doc = "< OpenThread API"]
5623pub const OT_LOG_REGION_API: otLogRegion = 1;
5624#[doc = "< MLE"]
5625pub const OT_LOG_REGION_MLE: otLogRegion = 2;
5626#[doc = "< EID-to-RLOC mapping."]
5627pub const OT_LOG_REGION_ARP: otLogRegion = 3;
5628#[doc = "< Network Data"]
5629pub const OT_LOG_REGION_NET_DATA: otLogRegion = 4;
5630#[doc = "< ICMPv6"]
5631pub const OT_LOG_REGION_ICMP: otLogRegion = 5;
5632#[doc = "< IPv6"]
5633pub const OT_LOG_REGION_IP6: otLogRegion = 6;
5634#[doc = "< TCP"]
5635pub const OT_LOG_REGION_TCP: otLogRegion = 7;
5636#[doc = "< IEEE 802.15.4 MAC"]
5637pub const OT_LOG_REGION_MAC: otLogRegion = 8;
5638#[doc = "< Memory"]
5639pub const OT_LOG_REGION_MEM: otLogRegion = 9;
5640#[doc = "< NCP"]
5641pub const OT_LOG_REGION_NCP: otLogRegion = 10;
5642#[doc = "< Mesh Commissioning Protocol"]
5643pub const OT_LOG_REGION_MESH_COP: otLogRegion = 11;
5644#[doc = "< Network Diagnostic"]
5645pub const OT_LOG_REGION_NET_DIAG: otLogRegion = 12;
5646#[doc = "< Platform"]
5647pub const OT_LOG_REGION_PLATFORM: otLogRegion = 13;
5648#[doc = "< CoAP"]
5649pub const OT_LOG_REGION_COAP: otLogRegion = 14;
5650#[doc = "< CLI"]
5651pub const OT_LOG_REGION_CLI: otLogRegion = 15;
5652#[doc = "< OpenThread Core"]
5653pub const OT_LOG_REGION_CORE: otLogRegion = 16;
5654#[doc = "< Utility module"]
5655pub const OT_LOG_REGION_UTIL: otLogRegion = 17;
5656#[doc = "< Backbone Router (available since Thread 1.2)"]
5657pub const OT_LOG_REGION_BBR: otLogRegion = 18;
5658#[doc = "< Multicast Listener Registration (available since Thread 1.2)"]
5659pub const OT_LOG_REGION_MLR: otLogRegion = 19;
5660#[doc = "< Domain Unicast Address (available since Thread 1.2)"]
5661pub const OT_LOG_REGION_DUA: otLogRegion = 20;
5662#[doc = "< Border Router"]
5663pub const OT_LOG_REGION_BR: otLogRegion = 21;
5664#[doc = "< Service Registration Protocol (SRP)"]
5665pub const OT_LOG_REGION_SRP: otLogRegion = 22;
5666#[doc = "< DNS"]
5667pub const OT_LOG_REGION_DNS: otLogRegion = 23;
5668#[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`."]
5669pub type otLogRegion = ::std::os::raw::c_uint;
5670unsafe extern "C" {
5671 #[doc = " Outputs logs.\n\n Note that the support for log region is removed. The OT core will always emit all logs with `OT_LOG_REGION_CORE`\n as @p aLogRegion.\n\n @param[in] aLogLevel The log level.\n @param[in] aLogRegion The log region.\n @param[in] aFormat A pointer to the format string.\n @param[in] ... Arguments for the format specification."]
5672 pub fn otPlatLog(
5673 aLogLevel: otLogLevel,
5674 aLogRegion: otLogRegion,
5675 aFormat: *const ::std::os::raw::c_char,
5676 ...
5677 );
5678}
5679unsafe extern "C" {
5680 #[doc = " This function handles OpenThread log level changes.\n\n This platform function is called whenever the OpenThread log level changes.\n This platform function is optional since an empty weak implementation has been provided.\n\n @note Only applicable when `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n @param[in] aLogLevel The new OpenThread log level."]
5681 pub fn otPlatLogHandleLevelChanged(aLogLevel: otLogLevel);
5682}
5683#[doc = " Represents a CLI command."]
5684#[repr(C)]
5685#[derive(Debug, Copy, Clone)]
5686pub struct otCliCommand {
5687 #[doc = "< A pointer to the command string."]
5688 pub mName: *const ::std::os::raw::c_char,
5689 pub mCommand: ::std::option::Option<
5690 unsafe extern "C" fn(
5691 aContext: *mut ::std::os::raw::c_void,
5692 aArgsLength: u8,
5693 aArgs: *mut *mut ::std::os::raw::c_char,
5694 ) -> otError,
5695 >,
5696}
5697impl Default for otCliCommand {
5698 fn default() -> Self {
5699 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5700 unsafe {
5701 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5702 s.assume_init()
5703 }
5704 }
5705}
5706#[doc = " Pointer is called to notify about Console output.\n\n @param[out] aContext A user context pointer.\n @param[in] aFormat The format string.\n @param[in] aArguments The format string arguments.\n\n @returns Number of bytes written by the callback."]
5707pub type otCliOutputCallback = ::std::option::Option<
5708 unsafe extern "C" fn(
5709 aContext: *mut ::std::os::raw::c_void,
5710 aFormat: *const ::std::os::raw::c_char,
5711 aArguments: *mut __va_list_tag,
5712 ) -> ::std::os::raw::c_int,
5713>;
5714unsafe extern "C" {
5715 #[doc = " Initialize the CLI module.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aCallback A callback method called to process CLI output.\n @param[in] aContext A user context pointer."]
5716 pub fn otCliInit(
5717 aInstance: *mut otInstance,
5718 aCallback: otCliOutputCallback,
5719 aContext: *mut ::std::os::raw::c_void,
5720 );
5721}
5722unsafe extern "C" {
5723 #[doc = " Is called to feed in a console input line.\n\n @param[in] aBuf A pointer to a null-terminated string."]
5724 pub fn otCliInputLine(aBuf: *mut ::std::os::raw::c_char);
5725}
5726unsafe extern "C" {
5727 #[doc = " Set a user command table.\n\n @param[in] aUserCommands A pointer to an array with user commands.\n @param[in] aLength @p aUserCommands length.\n @param[in] aContext @p The context passed to the handler.\n\n @retval OT_ERROR_NONE Successfully updated command table with commands from @p aUserCommands.\n @retval OT_ERROR_FAILED Maximum number of command entries have already been set."]
5728 pub fn otCliSetUserCommands(
5729 aUserCommands: *const otCliCommand,
5730 aLength: u8,
5731 aContext: *mut ::std::os::raw::c_void,
5732 ) -> otError;
5733}
5734unsafe extern "C" {
5735 #[doc = " Write a number of bytes to the CLI console as a hex string.\n\n @param[in] aBytes A pointer to data which should be printed.\n @param[in] aLength @p aBytes length."]
5736 pub fn otCliOutputBytes(aBytes: *const u8, aLength: u8);
5737}
5738unsafe extern "C" {
5739 #[doc = " Write formatted string to the CLI console\n\n @param[in] aFmt A pointer to the format string.\n @param[in] ... A matching list of arguments."]
5740 pub fn otCliOutputFormat(aFmt: *const ::std::os::raw::c_char, ...);
5741}
5742unsafe extern "C" {
5743 #[doc = " Write error code to the CLI console\n\n If the @p aError is `OT_ERROR_PENDING` nothing will be outputted.\n\n @param[in] aError Error code value."]
5744 pub fn otCliAppendResult(aError: otError);
5745}
5746unsafe extern "C" {
5747 #[doc = " Callback to write the OpenThread Log to the CLI console\n\n @param[in] aLogLevel The log level.\n @param[in] aLogRegion The log region.\n @param[in] aFormat A pointer to the format string.\n @param[in] aArgs va_list matching aFormat."]
5748 pub fn otCliPlatLogv(
5749 aLogLevel: otLogLevel,
5750 aLogRegion: otLogRegion,
5751 aFormat: *const ::std::os::raw::c_char,
5752 aArgs: *mut __va_list_tag,
5753 );
5754}
5755unsafe extern "C" {
5756 #[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."]
5757 pub fn otCliVendorSetUserCommands();
5758}
5759#[doc = "< Confirmable"]
5760pub const OT_COAP_TYPE_CONFIRMABLE: otCoapType = 0;
5761#[doc = "< Non-confirmable"]
5762pub const OT_COAP_TYPE_NON_CONFIRMABLE: otCoapType = 1;
5763#[doc = "< Acknowledgment"]
5764pub const OT_COAP_TYPE_ACKNOWLEDGMENT: otCoapType = 2;
5765#[doc = "< Reset"]
5766pub const OT_COAP_TYPE_RESET: otCoapType = 3;
5767#[doc = " CoAP Type values (2 bit unsigned integer)."]
5768pub type otCoapType = ::std::os::raw::c_uint;
5769#[doc = "< Empty message code"]
5770pub const OT_COAP_CODE_EMPTY: otCoapCode = 0;
5771#[doc = "< Get"]
5772pub const OT_COAP_CODE_GET: otCoapCode = 1;
5773#[doc = "< Post"]
5774pub const OT_COAP_CODE_POST: otCoapCode = 2;
5775#[doc = "< Put"]
5776pub const OT_COAP_CODE_PUT: otCoapCode = 3;
5777#[doc = "< Delete"]
5778pub const OT_COAP_CODE_DELETE: otCoapCode = 4;
5779#[doc = "< 2.00"]
5780pub const OT_COAP_CODE_RESPONSE_MIN: otCoapCode = 64;
5781#[doc = "< Created"]
5782pub const OT_COAP_CODE_CREATED: otCoapCode = 65;
5783#[doc = "< Deleted"]
5784pub const OT_COAP_CODE_DELETED: otCoapCode = 66;
5785#[doc = "< Valid"]
5786pub const OT_COAP_CODE_VALID: otCoapCode = 67;
5787#[doc = "< Changed"]
5788pub const OT_COAP_CODE_CHANGED: otCoapCode = 68;
5789#[doc = "< Content"]
5790pub const OT_COAP_CODE_CONTENT: otCoapCode = 69;
5791#[doc = "< RFC7959 Continue"]
5792pub const OT_COAP_CODE_CONTINUE: otCoapCode = 95;
5793#[doc = "< Bad Request"]
5794pub const OT_COAP_CODE_BAD_REQUEST: otCoapCode = 128;
5795#[doc = "< Unauthorized"]
5796pub const OT_COAP_CODE_UNAUTHORIZED: otCoapCode = 129;
5797#[doc = "< Bad Option"]
5798pub const OT_COAP_CODE_BAD_OPTION: otCoapCode = 130;
5799#[doc = "< Forbidden"]
5800pub const OT_COAP_CODE_FORBIDDEN: otCoapCode = 131;
5801#[doc = "< Not Found"]
5802pub const OT_COAP_CODE_NOT_FOUND: otCoapCode = 132;
5803#[doc = "< Method Not Allowed"]
5804pub const OT_COAP_CODE_METHOD_NOT_ALLOWED: otCoapCode = 133;
5805#[doc = "< Not Acceptable"]
5806pub const OT_COAP_CODE_NOT_ACCEPTABLE: otCoapCode = 134;
5807#[doc = "< RFC7959 Request Entity Incomplete"]
5808pub const OT_COAP_CODE_REQUEST_INCOMPLETE: otCoapCode = 136;
5809#[doc = "< Precondition Failed"]
5810pub const OT_COAP_CODE_PRECONDITION_FAILED: otCoapCode = 140;
5811#[doc = "< Request Entity Too Large"]
5812pub const OT_COAP_CODE_REQUEST_TOO_LARGE: otCoapCode = 141;
5813#[doc = "< Unsupported Content-Format"]
5814pub const OT_COAP_CODE_UNSUPPORTED_FORMAT: otCoapCode = 143;
5815#[doc = "< Internal Server Error"]
5816pub const OT_COAP_CODE_INTERNAL_ERROR: otCoapCode = 160;
5817#[doc = "< Not Implemented"]
5818pub const OT_COAP_CODE_NOT_IMPLEMENTED: otCoapCode = 161;
5819#[doc = "< Bad Gateway"]
5820pub const OT_COAP_CODE_BAD_GATEWAY: otCoapCode = 162;
5821#[doc = "< Service Unavailable"]
5822pub const OT_COAP_CODE_SERVICE_UNAVAILABLE: otCoapCode = 163;
5823#[doc = "< Gateway Timeout"]
5824pub const OT_COAP_CODE_GATEWAY_TIMEOUT: otCoapCode = 164;
5825#[doc = "< Proxying Not Supported"]
5826pub const OT_COAP_CODE_PROXY_NOT_SUPPORTED: otCoapCode = 165;
5827#[doc = " CoAP Code values."]
5828pub type otCoapCode = ::std::os::raw::c_uint;
5829#[doc = "< If-Match"]
5830pub const OT_COAP_OPTION_IF_MATCH: otCoapOptionType = 1;
5831#[doc = "< Uri-Host"]
5832pub const OT_COAP_OPTION_URI_HOST: otCoapOptionType = 3;
5833#[doc = "< ETag"]
5834pub const OT_COAP_OPTION_E_TAG: otCoapOptionType = 4;
5835#[doc = "< If-None-Match"]
5836pub const OT_COAP_OPTION_IF_NONE_MATCH: otCoapOptionType = 5;
5837#[doc = "< Observe [RFC7641]"]
5838pub const OT_COAP_OPTION_OBSERVE: otCoapOptionType = 6;
5839#[doc = "< Uri-Port"]
5840pub const OT_COAP_OPTION_URI_PORT: otCoapOptionType = 7;
5841#[doc = "< Location-Path"]
5842pub const OT_COAP_OPTION_LOCATION_PATH: otCoapOptionType = 8;
5843#[doc = "< Uri-Path"]
5844pub const OT_COAP_OPTION_URI_PATH: otCoapOptionType = 11;
5845#[doc = "< Content-Format"]
5846pub const OT_COAP_OPTION_CONTENT_FORMAT: otCoapOptionType = 12;
5847#[doc = "< Max-Age"]
5848pub const OT_COAP_OPTION_MAX_AGE: otCoapOptionType = 14;
5849#[doc = "< Uri-Query"]
5850pub const OT_COAP_OPTION_URI_QUERY: otCoapOptionType = 15;
5851#[doc = "< Accept"]
5852pub const OT_COAP_OPTION_ACCEPT: otCoapOptionType = 17;
5853#[doc = "< Location-Query"]
5854pub const OT_COAP_OPTION_LOCATION_QUERY: otCoapOptionType = 20;
5855#[doc = "< Block2 (RFC7959)"]
5856pub const OT_COAP_OPTION_BLOCK2: otCoapOptionType = 23;
5857#[doc = "< Block1 (RFC7959)"]
5858pub const OT_COAP_OPTION_BLOCK1: otCoapOptionType = 27;
5859#[doc = "< Size2 (RFC7959)"]
5860pub const OT_COAP_OPTION_SIZE2: otCoapOptionType = 28;
5861#[doc = "< Proxy-Uri"]
5862pub const OT_COAP_OPTION_PROXY_URI: otCoapOptionType = 35;
5863#[doc = "< Proxy-Scheme"]
5864pub const OT_COAP_OPTION_PROXY_SCHEME: otCoapOptionType = 39;
5865#[doc = "< Size1"]
5866pub const OT_COAP_OPTION_SIZE1: otCoapOptionType = 60;
5867#[doc = " CoAP Option Numbers"]
5868pub type otCoapOptionType = ::std::os::raw::c_uint;
5869#[doc = " Represents a CoAP option."]
5870#[repr(C)]
5871#[derive(Debug, Default, Copy, Clone)]
5872pub struct otCoapOption {
5873 #[doc = "< Option Number"]
5874 pub mNumber: u16,
5875 #[doc = "< Option Length"]
5876 pub mLength: u16,
5877}
5878#[doc = " Acts as an iterator for CoAP options"]
5879#[repr(C)]
5880#[derive(Debug, Copy, Clone)]
5881pub struct otCoapOptionIterator {
5882 #[doc = "< CoAP message"]
5883 pub mMessage: *const otMessage,
5884 #[doc = "< CoAP message option"]
5885 pub mOption: otCoapOption,
5886 #[doc = "< Byte offset of next option"]
5887 pub mNextOptionOffset: u16,
5888}
5889impl Default for otCoapOptionIterator {
5890 fn default() -> Self {
5891 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5892 unsafe {
5893 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5894 s.assume_init()
5895 }
5896 }
5897}
5898#[doc = " text/plain; charset=utf-8: [RFC2046][RFC3676][RFC5147]"]
5899pub const OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN: otCoapOptionContentFormat = 0;
5900#[doc = " application/cose; cose-type=\"cose-encrypt0\": [RFC8152]"]
5901pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0: otCoapOptionContentFormat = 16;
5902#[doc = " application/cose; cose-type=\"cose-mac0\": [RFC8152]"]
5903pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0: otCoapOptionContentFormat = 17;
5904#[doc = " application/cose; cose-type=\"cose-sign1\": [RFC8152]"]
5905pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1: otCoapOptionContentFormat = 18;
5906#[doc = " application/link-format: [RFC6690]"]
5907pub const OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT: otCoapOptionContentFormat = 40;
5908#[doc = " application/xml: [RFC3023]"]
5909pub const OT_COAP_OPTION_CONTENT_FORMAT_XML: otCoapOptionContentFormat = 41;
5910#[doc = " application/octet-stream: [RFC2045][RFC2046]"]
5911pub const OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM: otCoapOptionContentFormat = 42;
5912#[doc = " application/exi:\n [\"Efficient XML Interchange (EXI) Format 1.0 (Second Edition)\", February 2014]"]
5913pub const OT_COAP_OPTION_CONTENT_FORMAT_EXI: otCoapOptionContentFormat = 47;
5914#[doc = " application/json: [RFC7159]"]
5915pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON: otCoapOptionContentFormat = 50;
5916#[doc = " application/json-patch+json: [RFC6902]"]
5917pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON: otCoapOptionContentFormat = 51;
5918#[doc = " application/merge-patch+json: [RFC7396]"]
5919pub const OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON: otCoapOptionContentFormat = 52;
5920#[doc = " application/cbor: [RFC7049]"]
5921pub const OT_COAP_OPTION_CONTENT_FORMAT_CBOR: otCoapOptionContentFormat = 60;
5922#[doc = " application/cwt: [RFC8392]"]
5923pub const OT_COAP_OPTION_CONTENT_FORMAT_CWT: otCoapOptionContentFormat = 61;
5924#[doc = " application/cose; cose-type=\"cose-encrypt\": [RFC8152]"]
5925pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT: otCoapOptionContentFormat = 96;
5926#[doc = " application/cose; cose-type=\"cose-mac\": [RFC8152]"]
5927pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC: otCoapOptionContentFormat = 97;
5928#[doc = " application/cose; cose-type=\"cose-sign\": [RFC8152]"]
5929pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN: otCoapOptionContentFormat = 98;
5930#[doc = " application/cose-key: [RFC8152]"]
5931pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY: otCoapOptionContentFormat = 101;
5932#[doc = " application/cose-key-set: [RFC8152]"]
5933pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET: otCoapOptionContentFormat = 102;
5934#[doc = " application/senml+json: [RFC8428]"]
5935pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON: otCoapOptionContentFormat = 110;
5936#[doc = " application/sensml+json: [RFC8428]"]
5937pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON: otCoapOptionContentFormat = 111;
5938#[doc = " application/senml+cbor: [RFC8428]"]
5939pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR: otCoapOptionContentFormat = 112;
5940#[doc = " application/sensml+cbor: [RFC8428]"]
5941pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR: otCoapOptionContentFormat = 113;
5942#[doc = " application/senml-exi: [RFC8428]"]
5943pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI: otCoapOptionContentFormat = 114;
5944#[doc = " application/sensml-exi: [RFC8428]"]
5945pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI: otCoapOptionContentFormat = 115;
5946#[doc = " application/coap-group+json: [RFC7390]"]
5947pub const OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON: otCoapOptionContentFormat = 256;
5948#[doc = " application/senml+xml: [RFC8428]"]
5949pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML: otCoapOptionContentFormat = 310;
5950#[doc = " application/sensml+xml: [RFC8428]"]
5951pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML: otCoapOptionContentFormat = 311;
5952#[doc = " CoAP Content Format codes. The full list is documented at\n https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats"]
5953pub type otCoapOptionContentFormat = ::std::os::raw::c_uint;
5954pub const OT_COAP_OPTION_BLOCK_SZX_16: otCoapBlockSzx = 0;
5955pub const OT_COAP_OPTION_BLOCK_SZX_32: otCoapBlockSzx = 1;
5956pub const OT_COAP_OPTION_BLOCK_SZX_64: otCoapBlockSzx = 2;
5957pub const OT_COAP_OPTION_BLOCK_SZX_128: otCoapBlockSzx = 3;
5958pub const OT_COAP_OPTION_BLOCK_SZX_256: otCoapBlockSzx = 4;
5959pub const OT_COAP_OPTION_BLOCK_SZX_512: otCoapBlockSzx = 5;
5960pub const OT_COAP_OPTION_BLOCK_SZX_1024: otCoapBlockSzx = 6;
5961#[doc = " CoAP Block Size Exponents"]
5962pub type otCoapBlockSzx = ::std::os::raw::c_uint;
5963#[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."]
5964pub type otCoapResponseHandler = ::std::option::Option<
5965 unsafe extern "C" fn(
5966 aContext: *mut ::std::os::raw::c_void,
5967 aMessage: *mut otMessage,
5968 aMessageInfo: *const otMessageInfo,
5969 aResult: otError,
5970 ),
5971>;
5972#[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."]
5973pub type otCoapRequestHandler = ::std::option::Option<
5974 unsafe extern "C" fn(
5975 aContext: *mut ::std::os::raw::c_void,
5976 aMessage: *mut otMessage,
5977 aMessageInfo: *const otMessageInfo,
5978 ),
5979>;
5980#[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."]
5981pub type otCoapResponseFallback = ::std::option::Option<
5982 unsafe extern "C" fn(
5983 aContext: *mut ::std::os::raw::c_void,
5984 aMessage: *mut otMessage,
5985 aMessageInfo: *const otMessageInfo,
5986 ) -> bool,
5987>;
5988#[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."]
5989pub type otCoapBlockwiseReceiveHook = ::std::option::Option<
5990 unsafe extern "C" fn(
5991 aContext: *mut ::std::os::raw::c_void,
5992 aBlock: *const u8,
5993 aPosition: u32,
5994 aBlockLength: u16,
5995 aMore: bool,
5996 aTotalLength: u32,
5997 ) -> otError,
5998>;
5999#[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."]
6000pub type otCoapBlockwiseTransmitHook = ::std::option::Option<
6001 unsafe extern "C" fn(
6002 aContext: *mut ::std::os::raw::c_void,
6003 aBlock: *mut u8,
6004 aPosition: u32,
6005 aBlockLength: *mut u16,
6006 aMore: *mut bool,
6007 ) -> otError,
6008>;
6009#[doc = " Represents a CoAP resource."]
6010#[repr(C)]
6011#[derive(Debug, Copy, Clone)]
6012pub struct otCoapResource {
6013 #[doc = "< The URI Path string"]
6014 pub mUriPath: *const ::std::os::raw::c_char,
6015 #[doc = "< The callback for handling a received request"]
6016 pub mHandler: otCoapRequestHandler,
6017 #[doc = "< Application-specific context"]
6018 pub mContext: *mut ::std::os::raw::c_void,
6019 #[doc = "< The next CoAP resource in the list"]
6020 pub mNext: *mut otCoapResource,
6021}
6022impl Default for otCoapResource {
6023 fn default() -> Self {
6024 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6025 unsafe {
6026 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6027 s.assume_init()
6028 }
6029 }
6030}
6031#[doc = " Represents a CoAP resource with block-wise transfer."]
6032#[repr(C)]
6033#[derive(Debug, Copy, Clone)]
6034pub struct otCoapBlockwiseResource {
6035 #[doc = "< The URI Path string"]
6036 pub mUriPath: *const ::std::os::raw::c_char,
6037 #[doc = "< The callback for handling a received request"]
6038 pub mHandler: otCoapRequestHandler,
6039 #[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."]
6040 pub mReceiveHook: otCoapBlockwiseReceiveHook,
6041 #[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."]
6042 pub mTransmitHook: otCoapBlockwiseTransmitHook,
6043 #[doc = "< Application-specific context"]
6044 pub mContext: *mut ::std::os::raw::c_void,
6045 #[doc = "< The next CoAP resource in the list"]
6046 pub mNext: *mut otCoapBlockwiseResource,
6047}
6048impl Default for otCoapBlockwiseResource {
6049 fn default() -> Self {
6050 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6051 unsafe {
6052 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6053 s.assume_init()
6054 }
6055 }
6056}
6057#[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."]
6058#[repr(C)]
6059#[derive(Debug, Default, Copy, Clone)]
6060pub struct otCoapTxParameters {
6061 #[doc = " Minimum spacing before first retransmission when ACK is not received, in milliseconds (RFC7252 default value is\n 2000ms)."]
6062 pub mAckTimeout: u32,
6063 #[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)."]
6064 pub mAckRandomFactorNumerator: u8,
6065 #[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)."]
6066 pub mAckRandomFactorDenominator: u8,
6067 #[doc = " Maximum number of retransmissions for CoAP Confirmable messages (RFC7252 default value is 4)."]
6068 pub mMaxRetransmit: u8,
6069}
6070unsafe extern "C" {
6071 #[doc = " Initializes the CoAP header.\n\n @param[in,out] aMessage A pointer to the CoAP message to initialize.\n @param[in] aType CoAP message type.\n @param[in] aCode CoAP message code."]
6072 pub fn otCoapMessageInit(aMessage: *mut otMessage, aType: otCoapType, aCode: otCoapCode);
6073}
6074unsafe extern "C" {
6075 #[doc = " Initializes a response message.\n\n @note Both message ID and token are set according to @p aRequest.\n\n @param[in,out] aResponse A pointer to the CoAP response message.\n @param[in] aRequest A pointer to the CoAP request message.\n @param[in] aType CoAP message type.\n @param[in] aCode CoAP message code.\n\n @retval OT_ERROR_NONE Successfully initialized the response message.\n @retval OT_ERROR_NO_BUFS Insufficient message buffers available to initialize the response message."]
6076 pub fn otCoapMessageInitResponse(
6077 aResponse: *mut otMessage,
6078 aRequest: *const otMessage,
6079 aType: otCoapType,
6080 aCode: otCoapCode,
6081 ) -> otError;
6082}
6083unsafe extern "C" {
6084 #[doc = " Sets the Token value and length in a header.\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."]
6085 pub fn otCoapMessageSetToken(
6086 aMessage: *mut otMessage,
6087 aToken: *const u8,
6088 aTokenLength: u8,
6089 ) -> otError;
6090}
6091unsafe extern "C" {
6092 #[doc = " Sets the Token length and randomizes its value.\n\n @param[in,out] aMessage A pointer to the CoAP message.\n @param[in] aTokenLength The Length of a Token to set."]
6093 pub fn otCoapMessageGenerateToken(aMessage: *mut otMessage, aTokenLength: u8);
6094}
6095unsafe extern "C" {
6096 #[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."]
6097 pub fn otCoapMessageAppendContentFormatOption(
6098 aMessage: *mut otMessage,
6099 aContentFormat: otCoapOptionContentFormat,
6100 ) -> otError;
6101}
6102unsafe extern "C" {
6103 #[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."]
6104 pub fn otCoapMessageAppendOption(
6105 aMessage: *mut otMessage,
6106 aNumber: u16,
6107 aLength: u16,
6108 aValue: *const ::std::os::raw::c_void,
6109 ) -> otError;
6110}
6111unsafe extern "C" {
6112 #[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"]
6113 pub fn otCoapMessageAppendUintOption(
6114 aMessage: *mut otMessage,
6115 aNumber: u16,
6116 aValue: u32,
6117 ) -> otError;
6118}
6119unsafe extern "C" {
6120 #[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."]
6121 pub fn otCoapMessageAppendObserveOption(aMessage: *mut otMessage, aObserve: u32) -> otError;
6122}
6123unsafe extern "C" {
6124 #[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."]
6125 pub fn otCoapMessageAppendUriPathOptions(
6126 aMessage: *mut otMessage,
6127 aUriPath: *const ::std::os::raw::c_char,
6128 ) -> otError;
6129}
6130unsafe extern "C" {
6131 #[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."]
6132 pub fn otCoapMessageAppendUriQueryOptions(
6133 aMessage: *mut otMessage,
6134 aUriQuery: *const ::std::os::raw::c_char,
6135 ) -> otError;
6136}
6137unsafe extern "C" {
6138 #[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."]
6139 pub fn otCoapBlockSizeFromExponent(aSize: otCoapBlockSzx) -> u16;
6140}
6141unsafe extern "C" {
6142 #[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."]
6143 pub fn otCoapMessageAppendBlock2Option(
6144 aMessage: *mut otMessage,
6145 aNum: u32,
6146 aMore: bool,
6147 aSize: otCoapBlockSzx,
6148 ) -> otError;
6149}
6150unsafe extern "C" {
6151 #[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."]
6152 pub fn otCoapMessageAppendBlock1Option(
6153 aMessage: *mut otMessage,
6154 aNum: u32,
6155 aMore: bool,
6156 aSize: otCoapBlockSzx,
6157 ) -> otError;
6158}
6159unsafe extern "C" {
6160 #[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."]
6161 pub fn otCoapMessageAppendProxyUriOption(
6162 aMessage: *mut otMessage,
6163 aUriPath: *const ::std::os::raw::c_char,
6164 ) -> otError;
6165}
6166unsafe extern "C" {
6167 #[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."]
6168 pub fn otCoapMessageAppendMaxAgeOption(aMessage: *mut otMessage, aMaxAge: u32) -> otError;
6169}
6170unsafe extern "C" {
6171 #[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."]
6172 pub fn otCoapMessageAppendUriQueryOption(
6173 aMessage: *mut otMessage,
6174 aUriQuery: *const ::std::os::raw::c_char,
6175 ) -> otError;
6176}
6177unsafe extern "C" {
6178 #[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."]
6179 pub fn otCoapMessageSetPayloadMarker(aMessage: *mut otMessage) -> otError;
6180}
6181unsafe extern "C" {
6182 #[doc = " Returns the Type value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Type value."]
6183 pub fn otCoapMessageGetType(aMessage: *const otMessage) -> otCoapType;
6184}
6185unsafe extern "C" {
6186 #[doc = " Returns the Code value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Code value."]
6187 pub fn otCoapMessageGetCode(aMessage: *const otMessage) -> otCoapCode;
6188}
6189unsafe extern "C" {
6190 #[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."]
6191 pub fn otCoapMessageSetCode(aMessage: *mut otMessage, aCode: otCoapCode);
6192}
6193unsafe extern "C" {
6194 #[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."]
6195 pub fn otCoapMessageCodeToString(aMessage: *const otMessage) -> *const ::std::os::raw::c_char;
6196}
6197unsafe extern "C" {
6198 #[doc = " Returns the Message ID value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Message ID value."]
6199 pub fn otCoapMessageGetMessageId(aMessage: *const otMessage) -> u16;
6200}
6201unsafe extern "C" {
6202 #[doc = " Returns the Token length.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Token length."]
6203 pub fn otCoapMessageGetTokenLength(aMessage: *const otMessage) -> u8;
6204}
6205unsafe extern "C" {
6206 #[doc = " Returns a pointer to the Token value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns A pointer to the Token value."]
6207 pub fn otCoapMessageGetToken(aMessage: *const otMessage) -> *const u8;
6208}
6209unsafe extern "C" {
6210 #[doc = " Initialises 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 initialised.\n @retval OT_ERROR_PARSE Message state is inconsistent."]
6211 pub fn otCoapOptionIteratorInit(
6212 aIterator: *mut otCoapOptionIterator,
6213 aMessage: *const otMessage,
6214 ) -> otError;
6215}
6216unsafe extern "C" {
6217 #[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."]
6218 pub fn otCoapOptionIteratorGetFirstOptionMatching(
6219 aIterator: *mut otCoapOptionIterator,
6220 aOption: u16,
6221 ) -> *const otCoapOption;
6222}
6223unsafe extern "C" {
6224 #[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."]
6225 pub fn otCoapOptionIteratorGetFirstOption(
6226 aIterator: *mut otCoapOptionIterator,
6227 ) -> *const otCoapOption;
6228}
6229unsafe extern "C" {
6230 #[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."]
6231 pub fn otCoapOptionIteratorGetNextOptionMatching(
6232 aIterator: *mut otCoapOptionIterator,
6233 aOption: u16,
6234 ) -> *const otCoapOption;
6235}
6236unsafe extern "C" {
6237 #[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."]
6238 pub fn otCoapOptionIteratorGetNextOption(
6239 aIterator: *mut otCoapOptionIterator,
6240 ) -> *const otCoapOption;
6241}
6242unsafe extern "C" {
6243 #[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"]
6244 pub fn otCoapOptionIteratorGetOptionUintValue(
6245 aIterator: *mut otCoapOptionIterator,
6246 aValue: *mut u64,
6247 ) -> otError;
6248}
6249unsafe extern "C" {
6250 #[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."]
6251 pub fn otCoapOptionIteratorGetOptionValue(
6252 aIterator: *mut otCoapOptionIterator,
6253 aValue: *mut ::std::os::raw::c_void,
6254 ) -> otError;
6255}
6256unsafe extern "C" {
6257 #[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."]
6258 pub fn otCoapNewMessage(
6259 aInstance: *mut otInstance,
6260 aSettings: *const otMessageSettings,
6261 ) -> *mut otMessage;
6262}
6263unsafe extern "C" {
6264 #[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."]
6265 pub fn otCoapSendRequestWithParameters(
6266 aInstance: *mut otInstance,
6267 aMessage: *mut otMessage,
6268 aMessageInfo: *const otMessageInfo,
6269 aHandler: otCoapResponseHandler,
6270 aContext: *mut ::std::os::raw::c_void,
6271 aTxParameters: *const otCoapTxParameters,
6272 ) -> otError;
6273}
6274unsafe extern "C" {
6275 #[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."]
6276 pub fn otCoapSendRequestBlockWiseWithParameters(
6277 aInstance: *mut otInstance,
6278 aMessage: *mut otMessage,
6279 aMessageInfo: *const otMessageInfo,
6280 aHandler: otCoapResponseHandler,
6281 aContext: *mut ::std::os::raw::c_void,
6282 aTxParameters: *const otCoapTxParameters,
6283 aTransmitHook: otCoapBlockwiseTransmitHook,
6284 aReceiveHook: otCoapBlockwiseReceiveHook,
6285 ) -> otError;
6286}
6287unsafe extern "C" {
6288 #[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."]
6289 pub fn otCoapStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6290}
6291unsafe extern "C" {
6292 #[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."]
6293 pub fn otCoapStop(aInstance: *mut otInstance) -> otError;
6294}
6295unsafe extern "C" {
6296 #[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."]
6297 pub fn otCoapAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6298}
6299unsafe extern "C" {
6300 #[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."]
6301 pub fn otCoapRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6302}
6303unsafe extern "C" {
6304 #[doc = " Adds a block-wise 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."]
6305 pub fn otCoapAddBlockWiseResource(
6306 aInstance: *mut otInstance,
6307 aResource: *mut otCoapBlockwiseResource,
6308 );
6309}
6310unsafe extern "C" {
6311 #[doc = " Removes a block-wise 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."]
6312 pub fn otCoapRemoveBlockWiseResource(
6313 aInstance: *mut otInstance,
6314 aResource: *mut otCoapBlockwiseResource,
6315 );
6316}
6317unsafe extern "C" {
6318 #[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."]
6319 pub fn otCoapSetDefaultHandler(
6320 aInstance: *mut otInstance,
6321 aHandler: otCoapRequestHandler,
6322 aContext: *mut ::std::os::raw::c_void,
6323 );
6324}
6325unsafe extern "C" {
6326 #[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."]
6327 pub fn otCoapSetResponseFallback(
6328 aInstance: *mut otInstance,
6329 aHandler: otCoapResponseFallback,
6330 aContext: *mut ::std::os::raw::c_void,
6331 );
6332}
6333unsafe extern "C" {
6334 #[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."]
6335 pub fn otCoapSendResponseWithParameters(
6336 aInstance: *mut otInstance,
6337 aMessage: *mut otMessage,
6338 aMessageInfo: *const otMessageInfo,
6339 aTxParameters: *const otCoapTxParameters,
6340 ) -> otError;
6341}
6342unsafe extern "C" {
6343 #[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."]
6344 pub fn otCoapSendResponseBlockWiseWithParameters(
6345 aInstance: *mut otInstance,
6346 aMessage: *mut otMessage,
6347 aMessageInfo: *const otMessageInfo,
6348 aTxParameters: *const otCoapTxParameters,
6349 aContext: *mut ::std::os::raw::c_void,
6350 aTransmitHook: otCoapBlockwiseTransmitHook,
6351 ) -> otError;
6352}
6353#[doc = "< Connection established"]
6354pub const OT_COAP_SECURE_CONNECTED: otCoapSecureConnectEvent = 0;
6355#[doc = "< Disconnected by peer"]
6356pub const OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED: otCoapSecureConnectEvent = 1;
6357#[doc = "< Disconnected locally"]
6358pub const OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED: otCoapSecureConnectEvent = 2;
6359#[doc = "< Disconnected due to reaching the max connection attempts"]
6360pub const OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS: otCoapSecureConnectEvent = 3;
6361#[doc = "< Disconnected due to an error"]
6362pub const OT_COAP_SECURE_DISCONNECTED_ERROR: otCoapSecureConnectEvent = 4;
6363#[doc = "< Disconnected locally due to session timeout"]
6364pub const OT_COAP_SECURE_DISCONNECTED_TIMEOUT: otCoapSecureConnectEvent = 5;
6365#[doc = " CoAP secure connection event types."]
6366pub type otCoapSecureConnectEvent = ::std::os::raw::c_uint;
6367#[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."]
6368pub type otHandleCoapSecureClientConnect = ::std::option::Option<
6369 unsafe extern "C" fn(aEvent: otCoapSecureConnectEvent, aContext: *mut ::std::os::raw::c_void),
6370>;
6371#[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."]
6372pub type otCoapSecureAutoStopCallback =
6373 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
6374unsafe extern "C" {
6375 #[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."]
6376 pub fn otCoapSecureStart(aInstance: *mut otInstance, aPort: u16) -> otError;
6377}
6378unsafe extern "C" {
6379 #[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."]
6380 pub fn otCoapSecureStartWithMaxConnAttempts(
6381 aInstance: *mut otInstance,
6382 aPort: u16,
6383 aMaxAttempts: u16,
6384 aCallback: otCoapSecureAutoStopCallback,
6385 aContext: *mut ::std::os::raw::c_void,
6386 ) -> otError;
6387}
6388unsafe extern "C" {
6389 #[doc = " Stops the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6390 pub fn otCoapSecureStop(aInstance: *mut otInstance);
6391}
6392unsafe extern "C" {
6393 #[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."]
6394 pub fn otCoapSecureSetPsk(
6395 aInstance: *mut otInstance,
6396 aPsk: *const u8,
6397 aPskLength: u16,
6398 aPskIdentity: *const u8,
6399 aPskIdLength: u16,
6400 );
6401}
6402unsafe extern "C" {
6403 #[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."]
6404 pub fn otCoapSecureGetPeerCertificateBase64(
6405 aInstance: *mut otInstance,
6406 aPeerCert: *mut ::std::os::raw::c_uchar,
6407 aCertLength: *mut usize,
6408 aCertBufferSize: usize,
6409 ) -> otError;
6410}
6411unsafe extern "C" {
6412 #[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."]
6413 pub fn otCoapSecureSetSslAuthMode(aInstance: *mut otInstance, aVerifyPeerCertificate: bool);
6414}
6415unsafe extern "C" {
6416 #[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."]
6417 pub fn otCoapSecureSetCertificate(
6418 aInstance: *mut otInstance,
6419 aX509Cert: *const u8,
6420 aX509Length: u32,
6421 aPrivateKey: *const u8,
6422 aPrivateKeyLength: u32,
6423 );
6424}
6425unsafe extern "C" {
6426 #[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."]
6427 pub fn otCoapSecureSetCaCertificateChain(
6428 aInstance: *mut otInstance,
6429 aX509CaCertificateChain: *const u8,
6430 aX509CaCertChainLength: u32,
6431 );
6432}
6433unsafe extern "C" {
6434 #[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."]
6435 pub fn otCoapSecureConnect(
6436 aInstance: *mut otInstance,
6437 aSockAddr: *const otSockAddr,
6438 aHandler: otHandleCoapSecureClientConnect,
6439 aContext: *mut ::std::os::raw::c_void,
6440 ) -> otError;
6441}
6442unsafe extern "C" {
6443 #[doc = " Stops the DTLS connection.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
6444 pub fn otCoapSecureDisconnect(aInstance: *mut otInstance);
6445}
6446unsafe extern "C" {
6447 #[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."]
6448 pub fn otCoapSecureIsConnected(aInstance: *mut otInstance) -> bool;
6449}
6450unsafe extern "C" {
6451 #[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."]
6452 pub fn otCoapSecureIsConnectionActive(aInstance: *mut otInstance) -> bool;
6453}
6454unsafe extern "C" {
6455 #[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."]
6456 pub fn otCoapSecureIsClosed(aInstance: *mut otInstance) -> bool;
6457}
6458unsafe extern "C" {
6459 #[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."]
6460 pub fn otCoapSecureSendRequestBlockWise(
6461 aInstance: *mut otInstance,
6462 aMessage: *mut otMessage,
6463 aHandler: otCoapResponseHandler,
6464 aContext: *mut ::std::os::raw::c_void,
6465 aTransmitHook: otCoapBlockwiseTransmitHook,
6466 aReceiveHook: otCoapBlockwiseReceiveHook,
6467 ) -> otError;
6468}
6469unsafe extern "C" {
6470 #[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."]
6471 pub fn otCoapSecureSendRequest(
6472 aInstance: *mut otInstance,
6473 aMessage: *mut otMessage,
6474 aHandler: otCoapResponseHandler,
6475 aContext: *mut ::std::os::raw::c_void,
6476 ) -> otError;
6477}
6478unsafe extern "C" {
6479 #[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."]
6480 pub fn otCoapSecureAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6481}
6482unsafe extern "C" {
6483 #[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."]
6484 pub fn otCoapSecureRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
6485}
6486unsafe extern "C" {
6487 #[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."]
6488 pub fn otCoapSecureAddBlockWiseResource(
6489 aInstance: *mut otInstance,
6490 aResource: *mut otCoapBlockwiseResource,
6491 );
6492}
6493unsafe extern "C" {
6494 #[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."]
6495 pub fn otCoapSecureRemoveBlockWiseResource(
6496 aInstance: *mut otInstance,
6497 aResource: *mut otCoapBlockwiseResource,
6498 );
6499}
6500unsafe extern "C" {
6501 #[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."]
6502 pub fn otCoapSecureSetDefaultHandler(
6503 aInstance: *mut otInstance,
6504 aHandler: otCoapRequestHandler,
6505 aContext: *mut ::std::os::raw::c_void,
6506 );
6507}
6508unsafe extern "C" {
6509 #[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."]
6510 pub fn otCoapSecureSetClientConnectEventCallback(
6511 aInstance: *mut otInstance,
6512 aHandler: otHandleCoapSecureClientConnect,
6513 aContext: *mut ::std::os::raw::c_void,
6514 );
6515}
6516unsafe extern "C" {
6517 #[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."]
6518 pub fn otCoapSecureSendResponseBlockWise(
6519 aInstance: *mut otInstance,
6520 aMessage: *mut otMessage,
6521 aMessageInfo: *const otMessageInfo,
6522 aContext: *mut ::std::os::raw::c_void,
6523 aTransmitHook: otCoapBlockwiseTransmitHook,
6524 ) -> otError;
6525}
6526unsafe extern "C" {
6527 #[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."]
6528 pub fn otCoapSecureSendResponse(
6529 aInstance: *mut otInstance,
6530 aMessage: *mut otMessage,
6531 aMessageInfo: *const otMessageInfo,
6532 ) -> otError;
6533}
6534#[doc = " @struct otNetworkKey\n\n Represents a Thread Network Key."]
6535#[repr(C, packed)]
6536#[derive(Debug, Default, Copy, Clone)]
6537pub struct otNetworkKey {
6538 #[doc = "< Byte values"]
6539 pub m8: [u8; 16usize],
6540}
6541#[doc = " This datatype represents KeyRef to NetworkKey."]
6542pub type otNetworkKeyRef = otCryptoKeyRef;
6543#[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`)."]
6544#[repr(C)]
6545#[derive(Debug, Default, Copy, Clone)]
6546pub struct otNetworkName {
6547 #[doc = "< Byte values. The `+ 1` is for null char."]
6548 pub m8: [::std::os::raw::c_char; 17usize],
6549}
6550#[doc = " Represents an Extended PAN ID."]
6551#[repr(C, packed)]
6552#[derive(Debug, Default, Copy, Clone)]
6553pub struct otExtendedPanId {
6554 #[doc = "< Byte values"]
6555 pub m8: [u8; 8usize],
6556}
6557#[doc = " Represents a Mesh Local Prefix."]
6558pub type otMeshLocalPrefix = otIp6NetworkPrefix;
6559#[doc = " Represents PSKc."]
6560#[repr(C, packed)]
6561#[derive(Debug, Default, Copy, Clone)]
6562pub struct otPskc {
6563 #[doc = "< Byte values"]
6564 pub m8: [u8; 16usize],
6565}
6566#[doc = " This datatype represents KeyRef to PSKc."]
6567pub type otPskcRef = otCryptoKeyRef;
6568#[doc = " Represent Security Policy."]
6569#[repr(C)]
6570#[derive(Debug, Default, Copy, Clone)]
6571pub struct otSecurityPolicy {
6572 #[doc = "< The value for thrKeyRotation in units of hours."]
6573 pub mRotationTime: u16,
6574 pub _bitfield_align_1: [u8; 0],
6575 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
6576}
6577impl otSecurityPolicy {
6578 #[inline]
6579 pub fn mObtainNetworkKeyEnabled(&self) -> bool {
6580 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
6581 }
6582 #[inline]
6583 pub fn set_mObtainNetworkKeyEnabled(&mut self, val: bool) {
6584 unsafe {
6585 let val: u8 = ::std::mem::transmute(val);
6586 self._bitfield_1.set(0usize, 1u8, val as u64)
6587 }
6588 }
6589 #[inline]
6590 pub unsafe fn mObtainNetworkKeyEnabled_raw(this: *const Self) -> bool {
6591 unsafe {
6592 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6593 ::std::ptr::addr_of!((*this)._bitfield_1),
6594 0usize,
6595 1u8,
6596 ) as u8)
6597 }
6598 }
6599 #[inline]
6600 pub unsafe fn set_mObtainNetworkKeyEnabled_raw(this: *mut Self, val: bool) {
6601 unsafe {
6602 let val: u8 = ::std::mem::transmute(val);
6603 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6604 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6605 0usize,
6606 1u8,
6607 val as u64,
6608 )
6609 }
6610 }
6611 #[inline]
6612 pub fn mNativeCommissioningEnabled(&self) -> bool {
6613 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
6614 }
6615 #[inline]
6616 pub fn set_mNativeCommissioningEnabled(&mut self, val: bool) {
6617 unsafe {
6618 let val: u8 = ::std::mem::transmute(val);
6619 self._bitfield_1.set(1usize, 1u8, val as u64)
6620 }
6621 }
6622 #[inline]
6623 pub unsafe fn mNativeCommissioningEnabled_raw(this: *const Self) -> bool {
6624 unsafe {
6625 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6626 ::std::ptr::addr_of!((*this)._bitfield_1),
6627 1usize,
6628 1u8,
6629 ) as u8)
6630 }
6631 }
6632 #[inline]
6633 pub unsafe fn set_mNativeCommissioningEnabled_raw(this: *mut Self, val: bool) {
6634 unsafe {
6635 let val: u8 = ::std::mem::transmute(val);
6636 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6637 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6638 1usize,
6639 1u8,
6640 val as u64,
6641 )
6642 }
6643 }
6644 #[inline]
6645 pub fn mRoutersEnabled(&self) -> bool {
6646 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
6647 }
6648 #[inline]
6649 pub fn set_mRoutersEnabled(&mut self, val: bool) {
6650 unsafe {
6651 let val: u8 = ::std::mem::transmute(val);
6652 self._bitfield_1.set(2usize, 1u8, val as u64)
6653 }
6654 }
6655 #[inline]
6656 pub unsafe fn mRoutersEnabled_raw(this: *const Self) -> bool {
6657 unsafe {
6658 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6659 ::std::ptr::addr_of!((*this)._bitfield_1),
6660 2usize,
6661 1u8,
6662 ) as u8)
6663 }
6664 }
6665 #[inline]
6666 pub unsafe fn set_mRoutersEnabled_raw(this: *mut Self, val: bool) {
6667 unsafe {
6668 let val: u8 = ::std::mem::transmute(val);
6669 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6670 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6671 2usize,
6672 1u8,
6673 val as u64,
6674 )
6675 }
6676 }
6677 #[inline]
6678 pub fn mExternalCommissioningEnabled(&self) -> bool {
6679 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
6680 }
6681 #[inline]
6682 pub fn set_mExternalCommissioningEnabled(&mut self, val: bool) {
6683 unsafe {
6684 let val: u8 = ::std::mem::transmute(val);
6685 self._bitfield_1.set(3usize, 1u8, val as u64)
6686 }
6687 }
6688 #[inline]
6689 pub unsafe fn mExternalCommissioningEnabled_raw(this: *const Self) -> bool {
6690 unsafe {
6691 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6692 ::std::ptr::addr_of!((*this)._bitfield_1),
6693 3usize,
6694 1u8,
6695 ) as u8)
6696 }
6697 }
6698 #[inline]
6699 pub unsafe fn set_mExternalCommissioningEnabled_raw(this: *mut Self, val: bool) {
6700 unsafe {
6701 let val: u8 = ::std::mem::transmute(val);
6702 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6703 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6704 3usize,
6705 1u8,
6706 val as u64,
6707 )
6708 }
6709 }
6710 #[inline]
6711 pub fn mCommercialCommissioningEnabled(&self) -> bool {
6712 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
6713 }
6714 #[inline]
6715 pub fn set_mCommercialCommissioningEnabled(&mut self, val: bool) {
6716 unsafe {
6717 let val: u8 = ::std::mem::transmute(val);
6718 self._bitfield_1.set(4usize, 1u8, val as u64)
6719 }
6720 }
6721 #[inline]
6722 pub unsafe fn mCommercialCommissioningEnabled_raw(this: *const Self) -> bool {
6723 unsafe {
6724 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6725 ::std::ptr::addr_of!((*this)._bitfield_1),
6726 4usize,
6727 1u8,
6728 ) as u8)
6729 }
6730 }
6731 #[inline]
6732 pub unsafe fn set_mCommercialCommissioningEnabled_raw(this: *mut Self, val: bool) {
6733 unsafe {
6734 let val: u8 = ::std::mem::transmute(val);
6735 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6736 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6737 4usize,
6738 1u8,
6739 val as u64,
6740 )
6741 }
6742 }
6743 #[inline]
6744 pub fn mAutonomousEnrollmentEnabled(&self) -> bool {
6745 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
6746 }
6747 #[inline]
6748 pub fn set_mAutonomousEnrollmentEnabled(&mut self, val: bool) {
6749 unsafe {
6750 let val: u8 = ::std::mem::transmute(val);
6751 self._bitfield_1.set(5usize, 1u8, val as u64)
6752 }
6753 }
6754 #[inline]
6755 pub unsafe fn mAutonomousEnrollmentEnabled_raw(this: *const Self) -> bool {
6756 unsafe {
6757 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6758 ::std::ptr::addr_of!((*this)._bitfield_1),
6759 5usize,
6760 1u8,
6761 ) as u8)
6762 }
6763 }
6764 #[inline]
6765 pub unsafe fn set_mAutonomousEnrollmentEnabled_raw(this: *mut Self, val: bool) {
6766 unsafe {
6767 let val: u8 = ::std::mem::transmute(val);
6768 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6769 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6770 5usize,
6771 1u8,
6772 val as u64,
6773 )
6774 }
6775 }
6776 #[inline]
6777 pub fn mNetworkKeyProvisioningEnabled(&self) -> bool {
6778 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
6779 }
6780 #[inline]
6781 pub fn set_mNetworkKeyProvisioningEnabled(&mut self, val: bool) {
6782 unsafe {
6783 let val: u8 = ::std::mem::transmute(val);
6784 self._bitfield_1.set(6usize, 1u8, val as u64)
6785 }
6786 }
6787 #[inline]
6788 pub unsafe fn mNetworkKeyProvisioningEnabled_raw(this: *const Self) -> bool {
6789 unsafe {
6790 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6791 ::std::ptr::addr_of!((*this)._bitfield_1),
6792 6usize,
6793 1u8,
6794 ) as u8)
6795 }
6796 }
6797 #[inline]
6798 pub unsafe fn set_mNetworkKeyProvisioningEnabled_raw(this: *mut Self, val: bool) {
6799 unsafe {
6800 let val: u8 = ::std::mem::transmute(val);
6801 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6802 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6803 6usize,
6804 1u8,
6805 val as u64,
6806 )
6807 }
6808 }
6809 #[inline]
6810 pub fn mTobleLinkEnabled(&self) -> bool {
6811 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
6812 }
6813 #[inline]
6814 pub fn set_mTobleLinkEnabled(&mut self, val: bool) {
6815 unsafe {
6816 let val: u8 = ::std::mem::transmute(val);
6817 self._bitfield_1.set(7usize, 1u8, val as u64)
6818 }
6819 }
6820 #[inline]
6821 pub unsafe fn mTobleLinkEnabled_raw(this: *const Self) -> bool {
6822 unsafe {
6823 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6824 ::std::ptr::addr_of!((*this)._bitfield_1),
6825 7usize,
6826 1u8,
6827 ) as u8)
6828 }
6829 }
6830 #[inline]
6831 pub unsafe fn set_mTobleLinkEnabled_raw(this: *mut Self, val: bool) {
6832 unsafe {
6833 let val: u8 = ::std::mem::transmute(val);
6834 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6835 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6836 7usize,
6837 1u8,
6838 val as u64,
6839 )
6840 }
6841 }
6842 #[inline]
6843 pub fn mNonCcmRoutersEnabled(&self) -> bool {
6844 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
6845 }
6846 #[inline]
6847 pub fn set_mNonCcmRoutersEnabled(&mut self, val: bool) {
6848 unsafe {
6849 let val: u8 = ::std::mem::transmute(val);
6850 self._bitfield_1.set(8usize, 1u8, val as u64)
6851 }
6852 }
6853 #[inline]
6854 pub unsafe fn mNonCcmRoutersEnabled_raw(this: *const Self) -> bool {
6855 unsafe {
6856 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6857 ::std::ptr::addr_of!((*this)._bitfield_1),
6858 8usize,
6859 1u8,
6860 ) as u8)
6861 }
6862 }
6863 #[inline]
6864 pub unsafe fn set_mNonCcmRoutersEnabled_raw(this: *mut Self, val: bool) {
6865 unsafe {
6866 let val: u8 = ::std::mem::transmute(val);
6867 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6868 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6869 8usize,
6870 1u8,
6871 val as u64,
6872 )
6873 }
6874 }
6875 #[inline]
6876 pub fn mVersionThresholdForRouting(&self) -> u8 {
6877 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 3u8) as u8) }
6878 }
6879 #[inline]
6880 pub fn set_mVersionThresholdForRouting(&mut self, val: u8) {
6881 unsafe {
6882 let val: u8 = ::std::mem::transmute(val);
6883 self._bitfield_1.set(9usize, 3u8, val as u64)
6884 }
6885 }
6886 #[inline]
6887 pub unsafe fn mVersionThresholdForRouting_raw(this: *const Self) -> u8 {
6888 unsafe {
6889 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
6890 ::std::ptr::addr_of!((*this)._bitfield_1),
6891 9usize,
6892 3u8,
6893 ) as u8)
6894 }
6895 }
6896 #[inline]
6897 pub unsafe fn set_mVersionThresholdForRouting_raw(this: *mut Self, val: u8) {
6898 unsafe {
6899 let val: u8 = ::std::mem::transmute(val);
6900 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
6901 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6902 9usize,
6903 3u8,
6904 val as u64,
6905 )
6906 }
6907 }
6908 #[inline]
6909 pub fn new_bitfield_1(
6910 mObtainNetworkKeyEnabled: bool,
6911 mNativeCommissioningEnabled: bool,
6912 mRoutersEnabled: bool,
6913 mExternalCommissioningEnabled: bool,
6914 mCommercialCommissioningEnabled: bool,
6915 mAutonomousEnrollmentEnabled: bool,
6916 mNetworkKeyProvisioningEnabled: bool,
6917 mTobleLinkEnabled: bool,
6918 mNonCcmRoutersEnabled: bool,
6919 mVersionThresholdForRouting: u8,
6920 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
6921 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
6922 __bindgen_bitfield_unit.set(0usize, 1u8, {
6923 let mObtainNetworkKeyEnabled: u8 =
6924 unsafe { ::std::mem::transmute(mObtainNetworkKeyEnabled) };
6925 mObtainNetworkKeyEnabled as u64
6926 });
6927 __bindgen_bitfield_unit.set(1usize, 1u8, {
6928 let mNativeCommissioningEnabled: u8 =
6929 unsafe { ::std::mem::transmute(mNativeCommissioningEnabled) };
6930 mNativeCommissioningEnabled as u64
6931 });
6932 __bindgen_bitfield_unit.set(2usize, 1u8, {
6933 let mRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mRoutersEnabled) };
6934 mRoutersEnabled as u64
6935 });
6936 __bindgen_bitfield_unit.set(3usize, 1u8, {
6937 let mExternalCommissioningEnabled: u8 =
6938 unsafe { ::std::mem::transmute(mExternalCommissioningEnabled) };
6939 mExternalCommissioningEnabled as u64
6940 });
6941 __bindgen_bitfield_unit.set(4usize, 1u8, {
6942 let mCommercialCommissioningEnabled: u8 =
6943 unsafe { ::std::mem::transmute(mCommercialCommissioningEnabled) };
6944 mCommercialCommissioningEnabled as u64
6945 });
6946 __bindgen_bitfield_unit.set(5usize, 1u8, {
6947 let mAutonomousEnrollmentEnabled: u8 =
6948 unsafe { ::std::mem::transmute(mAutonomousEnrollmentEnabled) };
6949 mAutonomousEnrollmentEnabled as u64
6950 });
6951 __bindgen_bitfield_unit.set(6usize, 1u8, {
6952 let mNetworkKeyProvisioningEnabled: u8 =
6953 unsafe { ::std::mem::transmute(mNetworkKeyProvisioningEnabled) };
6954 mNetworkKeyProvisioningEnabled as u64
6955 });
6956 __bindgen_bitfield_unit.set(7usize, 1u8, {
6957 let mTobleLinkEnabled: u8 = unsafe { ::std::mem::transmute(mTobleLinkEnabled) };
6958 mTobleLinkEnabled as u64
6959 });
6960 __bindgen_bitfield_unit.set(8usize, 1u8, {
6961 let mNonCcmRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mNonCcmRoutersEnabled) };
6962 mNonCcmRoutersEnabled as u64
6963 });
6964 __bindgen_bitfield_unit.set(9usize, 3u8, {
6965 let mVersionThresholdForRouting: u8 =
6966 unsafe { ::std::mem::transmute(mVersionThresholdForRouting) };
6967 mVersionThresholdForRouting as u64
6968 });
6969 __bindgen_bitfield_unit
6970 }
6971}
6972#[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.\n"]
6973pub type otChannelMask = u32;
6974#[doc = " Represents presence of different components in Active or Pending Operational Dataset."]
6975#[repr(C)]
6976#[derive(Debug, Default, Copy, Clone)]
6977pub struct otOperationalDatasetComponents {
6978 #[doc = "< TRUE if Active Timestamp is present, FALSE otherwise."]
6979 pub mIsActiveTimestampPresent: bool,
6980 #[doc = "< TRUE if Pending Timestamp is present, FALSE otherwise."]
6981 pub mIsPendingTimestampPresent: bool,
6982 #[doc = "< TRUE if Network Key is present, FALSE otherwise."]
6983 pub mIsNetworkKeyPresent: bool,
6984 #[doc = "< TRUE if Network Name is present, FALSE otherwise."]
6985 pub mIsNetworkNamePresent: bool,
6986 #[doc = "< TRUE if Extended PAN ID is present, FALSE otherwise."]
6987 pub mIsExtendedPanIdPresent: bool,
6988 #[doc = "< TRUE if Mesh Local Prefix is present, FALSE otherwise."]
6989 pub mIsMeshLocalPrefixPresent: bool,
6990 #[doc = "< TRUE if Delay Timer is present, FALSE otherwise."]
6991 pub mIsDelayPresent: bool,
6992 #[doc = "< TRUE if PAN ID is present, FALSE otherwise."]
6993 pub mIsPanIdPresent: bool,
6994 #[doc = "< TRUE if Channel is present, FALSE otherwise."]
6995 pub mIsChannelPresent: bool,
6996 #[doc = "< TRUE if PSKc is present, FALSE otherwise."]
6997 pub mIsPskcPresent: bool,
6998 #[doc = "< TRUE if Security Policy is present, FALSE otherwise."]
6999 pub mIsSecurityPolicyPresent: bool,
7000 #[doc = "< TRUE if Channel Mask is present, FALSE otherwise."]
7001 pub mIsChannelMaskPresent: bool,
7002 #[doc = "< TRUE if Wake-up Channel is present, FALSE otherwise."]
7003 pub mIsWakeupChannelPresent: bool,
7004}
7005#[doc = " Represents a Thread Dataset timestamp component."]
7006#[repr(C)]
7007#[derive(Debug, Default, Copy, Clone)]
7008pub struct otTimestamp {
7009 pub mSeconds: u64,
7010 pub mTicks: u16,
7011 pub mAuthoritative: bool,
7012}
7013#[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."]
7014#[repr(C)]
7015#[derive(Debug, Default, Copy, Clone)]
7016pub struct otOperationalDataset {
7017 #[doc = "< Active Timestamp"]
7018 pub mActiveTimestamp: otTimestamp,
7019 #[doc = "< Pending Timestamp"]
7020 pub mPendingTimestamp: otTimestamp,
7021 #[doc = "< Network Key"]
7022 pub mNetworkKey: otNetworkKey,
7023 #[doc = "< Network Name"]
7024 pub mNetworkName: otNetworkName,
7025 #[doc = "< Extended PAN ID"]
7026 pub mExtendedPanId: otExtendedPanId,
7027 #[doc = "< Mesh Local Prefix"]
7028 pub mMeshLocalPrefix: otMeshLocalPrefix,
7029 #[doc = "< Delay Timer"]
7030 pub mDelay: u32,
7031 #[doc = "< PAN ID"]
7032 pub mPanId: otPanId,
7033 #[doc = "< Channel"]
7034 pub mChannel: u16,
7035 #[doc = "< Wake-up Channel"]
7036 pub mWakeupChannel: u16,
7037 #[doc = "< PSKc"]
7038 pub mPskc: otPskc,
7039 #[doc = "< Security Policy"]
7040 pub mSecurityPolicy: otSecurityPolicy,
7041 #[doc = "< Channel Mask"]
7042 pub mChannelMask: otChannelMask,
7043 #[doc = "< Specifies which components are set in the Dataset."]
7044 pub mComponents: otOperationalDatasetComponents,
7045}
7046#[doc = " Represents an Active or Pending Operational Dataset.\n\n The Operational Dataset is TLV encoded as specified by Thread."]
7047#[repr(C)]
7048#[derive(Debug, Copy, Clone)]
7049pub struct otOperationalDatasetTlvs {
7050 #[doc = "< Operational Dataset TLVs."]
7051 pub mTlvs: [u8; 254usize],
7052 #[doc = "< Size of Operational Dataset in bytes."]
7053 pub mLength: u8,
7054}
7055impl Default for otOperationalDatasetTlvs {
7056 fn default() -> Self {
7057 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7058 unsafe {
7059 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7060 s.assume_init()
7061 }
7062 }
7063}
7064#[doc = "< meshcop Channel TLV"]
7065pub const OT_MESHCOP_TLV_CHANNEL: otMeshcopTlvType = 0;
7066#[doc = "< meshcop Pan Id TLV"]
7067pub const OT_MESHCOP_TLV_PANID: otMeshcopTlvType = 1;
7068#[doc = "< meshcop Extended Pan Id TLV"]
7069pub const OT_MESHCOP_TLV_EXTPANID: otMeshcopTlvType = 2;
7070#[doc = "< meshcop Network Name TLV"]
7071pub const OT_MESHCOP_TLV_NETWORKNAME: otMeshcopTlvType = 3;
7072#[doc = "< meshcop PSKc TLV"]
7073pub const OT_MESHCOP_TLV_PSKC: otMeshcopTlvType = 4;
7074#[doc = "< meshcop Network Key TLV"]
7075pub const OT_MESHCOP_TLV_NETWORKKEY: otMeshcopTlvType = 5;
7076#[doc = "< meshcop Network Key Sequence TLV"]
7077pub const OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE: otMeshcopTlvType = 6;
7078#[doc = "< meshcop Mesh Local Prefix TLV"]
7079pub const OT_MESHCOP_TLV_MESHLOCALPREFIX: otMeshcopTlvType = 7;
7080#[doc = "< meshcop Steering Data TLV"]
7081pub const OT_MESHCOP_TLV_STEERING_DATA: otMeshcopTlvType = 8;
7082#[doc = "< meshcop Border Agent Locator TLV"]
7083pub const OT_MESHCOP_TLV_BORDER_AGENT_RLOC: otMeshcopTlvType = 9;
7084#[doc = "< meshcop Commissioner ID TLV"]
7085pub const OT_MESHCOP_TLV_COMMISSIONER_ID: otMeshcopTlvType = 10;
7086#[doc = "< meshcop Commissioner Session ID TLV"]
7087pub const OT_MESHCOP_TLV_COMM_SESSION_ID: otMeshcopTlvType = 11;
7088#[doc = "< meshcop Security Policy TLV"]
7089pub const OT_MESHCOP_TLV_SECURITYPOLICY: otMeshcopTlvType = 12;
7090#[doc = "< meshcop Get TLV"]
7091pub const OT_MESHCOP_TLV_GET: otMeshcopTlvType = 13;
7092#[doc = "< meshcop Active Timestamp TLV"]
7093pub const OT_MESHCOP_TLV_ACTIVETIMESTAMP: otMeshcopTlvType = 14;
7094#[doc = "< meshcop Commissioner UDP Port TLV"]
7095pub const OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT: otMeshcopTlvType = 15;
7096#[doc = "< meshcop State TLV"]
7097pub const OT_MESHCOP_TLV_STATE: otMeshcopTlvType = 16;
7098#[doc = "< meshcop Joiner DTLS Encapsulation TLV"]
7099pub const OT_MESHCOP_TLV_JOINER_DTLS: otMeshcopTlvType = 17;
7100#[doc = "< meshcop Joiner UDP Port TLV"]
7101pub const OT_MESHCOP_TLV_JOINER_UDP_PORT: otMeshcopTlvType = 18;
7102#[doc = "< meshcop Joiner IID TLV"]
7103pub const OT_MESHCOP_TLV_JOINER_IID: otMeshcopTlvType = 19;
7104#[doc = "< meshcop Joiner Router Locator TLV"]
7105pub const OT_MESHCOP_TLV_JOINER_RLOC: otMeshcopTlvType = 20;
7106#[doc = "< meshcop Joiner Router KEK TLV"]
7107pub const OT_MESHCOP_TLV_JOINER_ROUTER_KEK: otMeshcopTlvType = 21;
7108#[doc = "< meshcop Provisioning URL TLV"]
7109pub const OT_MESHCOP_TLV_PROVISIONING_URL: otMeshcopTlvType = 32;
7110#[doc = "< meshcop Vendor Name TLV"]
7111pub const OT_MESHCOP_TLV_VENDOR_NAME_TLV: otMeshcopTlvType = 33;
7112#[doc = "< meshcop Vendor Model TLV"]
7113pub const OT_MESHCOP_TLV_VENDOR_MODEL_TLV: otMeshcopTlvType = 34;
7114#[doc = "< meshcop Vendor SW Version TLV"]
7115pub const OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV: otMeshcopTlvType = 35;
7116#[doc = "< meshcop Vendor Data TLV"]
7117pub const OT_MESHCOP_TLV_VENDOR_DATA_TLV: otMeshcopTlvType = 36;
7118#[doc = "< meshcop Vendor Stack Version TLV"]
7119pub const OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV: otMeshcopTlvType = 37;
7120#[doc = "< meshcop UDP encapsulation TLV"]
7121pub const OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV: otMeshcopTlvType = 48;
7122#[doc = "< meshcop IPv6 address TLV"]
7123pub const OT_MESHCOP_TLV_IPV6_ADDRESS_TLV: otMeshcopTlvType = 49;
7124#[doc = "< meshcop Pending Timestamp TLV"]
7125pub const OT_MESHCOP_TLV_PENDINGTIMESTAMP: otMeshcopTlvType = 51;
7126#[doc = "< meshcop Delay Timer TLV"]
7127pub const OT_MESHCOP_TLV_DELAYTIMER: otMeshcopTlvType = 52;
7128#[doc = "< meshcop Channel Mask TLV"]
7129pub const OT_MESHCOP_TLV_CHANNELMASK: otMeshcopTlvType = 53;
7130#[doc = "< meshcop Count TLV"]
7131pub const OT_MESHCOP_TLV_COUNT: otMeshcopTlvType = 54;
7132#[doc = "< meshcop Period TLV"]
7133pub const OT_MESHCOP_TLV_PERIOD: otMeshcopTlvType = 55;
7134#[doc = "< meshcop Scan Duration TLV"]
7135pub const OT_MESHCOP_TLV_SCAN_DURATION: otMeshcopTlvType = 56;
7136#[doc = "< meshcop Energy List TLV"]
7137pub const OT_MESHCOP_TLV_ENERGY_LIST: otMeshcopTlvType = 57;
7138#[doc = "< meshcop Thread Domain Name TLV"]
7139pub const OT_MESHCOP_TLV_THREAD_DOMAIN_NAME: otMeshcopTlvType = 59;
7140#[doc = "< meshcop Wake-up Channel TLV"]
7141pub const OT_MESHCOP_TLV_WAKEUP_CHANNEL: otMeshcopTlvType = 74;
7142#[doc = "< meshcop Discovery Request TLV"]
7143pub const OT_MESHCOP_TLV_DISCOVERYREQUEST: otMeshcopTlvType = 128;
7144#[doc = "< meshcop Discovery Response TLV"]
7145pub const OT_MESHCOP_TLV_DISCOVERYRESPONSE: otMeshcopTlvType = 129;
7146#[doc = "< meshcop Joiner Advertisement TLV"]
7147pub const OT_MESHCOP_TLV_JOINERADVERTISEMENT: otMeshcopTlvType = 241;
7148#[doc = " Represents meshcop TLV types."]
7149pub type otMeshcopTlvType = ::std::os::raw::c_uint;
7150#[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."]
7151pub type otDatasetMgmtSetCallback = ::std::option::Option<
7152 unsafe extern "C" fn(aResult: otError, aContext: *mut ::std::os::raw::c_void),
7153>;
7154unsafe extern "C" {
7155 #[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."]
7156 pub fn otDatasetIsCommissioned(aInstance: *mut otInstance) -> bool;
7157}
7158unsafe extern "C" {
7159 #[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."]
7160 pub fn otDatasetGetActive(
7161 aInstance: *mut otInstance,
7162 aDataset: *mut otOperationalDataset,
7163 ) -> otError;
7164}
7165unsafe extern "C" {
7166 #[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."]
7167 pub fn otDatasetGetActiveTlvs(
7168 aInstance: *mut otInstance,
7169 aDataset: *mut otOperationalDatasetTlvs,
7170 ) -> otError;
7171}
7172unsafe extern "C" {
7173 #[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."]
7174 pub fn otDatasetSetActive(
7175 aInstance: *mut otInstance,
7176 aDataset: *const otOperationalDataset,
7177 ) -> otError;
7178}
7179unsafe extern "C" {
7180 #[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."]
7181 pub fn otDatasetSetActiveTlvs(
7182 aInstance: *mut otInstance,
7183 aDataset: *const otOperationalDatasetTlvs,
7184 ) -> otError;
7185}
7186unsafe extern "C" {
7187 #[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."]
7188 pub fn otDatasetGetPending(
7189 aInstance: *mut otInstance,
7190 aDataset: *mut otOperationalDataset,
7191 ) -> otError;
7192}
7193unsafe extern "C" {
7194 #[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."]
7195 pub fn otDatasetGetPendingTlvs(
7196 aInstance: *mut otInstance,
7197 aDataset: *mut otOperationalDatasetTlvs,
7198 ) -> otError;
7199}
7200unsafe extern "C" {
7201 #[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."]
7202 pub fn otDatasetSetPending(
7203 aInstance: *mut otInstance,
7204 aDataset: *const otOperationalDataset,
7205 ) -> otError;
7206}
7207unsafe extern "C" {
7208 #[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."]
7209 pub fn otDatasetSetPendingTlvs(
7210 aInstance: *mut otInstance,
7211 aDataset: *const otOperationalDatasetTlvs,
7212 ) -> otError;
7213}
7214unsafe extern "C" {
7215 #[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."]
7216 pub fn otDatasetSendMgmtActiveGet(
7217 aInstance: *mut otInstance,
7218 aDatasetComponents: *const otOperationalDatasetComponents,
7219 aTlvTypes: *const u8,
7220 aLength: u8,
7221 aAddress: *const otIp6Address,
7222 ) -> otError;
7223}
7224unsafe extern "C" {
7225 #[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."]
7226 pub fn otDatasetSendMgmtActiveSet(
7227 aInstance: *mut otInstance,
7228 aDataset: *const otOperationalDataset,
7229 aTlvs: *const u8,
7230 aLength: u8,
7231 aCallback: otDatasetMgmtSetCallback,
7232 aContext: *mut ::std::os::raw::c_void,
7233 ) -> otError;
7234}
7235unsafe extern "C" {
7236 #[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."]
7237 pub fn otDatasetSendMgmtPendingGet(
7238 aInstance: *mut otInstance,
7239 aDatasetComponents: *const otOperationalDatasetComponents,
7240 aTlvTypes: *const u8,
7241 aLength: u8,
7242 aAddress: *const otIp6Address,
7243 ) -> otError;
7244}
7245unsafe extern "C" {
7246 #[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."]
7247 pub fn otDatasetSendMgmtPendingSet(
7248 aInstance: *mut otInstance,
7249 aDataset: *const otOperationalDataset,
7250 aTlvs: *const u8,
7251 aLength: u8,
7252 aCallback: otDatasetMgmtSetCallback,
7253 aContext: *mut ::std::os::raw::c_void,
7254 ) -> otError;
7255}
7256unsafe extern "C" {
7257 #[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."]
7258 pub fn otDatasetGeneratePskc(
7259 aPassPhrase: *const ::std::os::raw::c_char,
7260 aNetworkName: *const otNetworkName,
7261 aExtPanId: *const otExtendedPanId,
7262 aPskc: *mut otPskc,
7263 ) -> otError;
7264}
7265unsafe extern "C" {
7266 #[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)."]
7267 pub fn otNetworkNameFromString(
7268 aNetworkName: *mut otNetworkName,
7269 aNameString: *const ::std::os::raw::c_char,
7270 ) -> otError;
7271}
7272unsafe extern "C" {
7273 #[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`."]
7274 pub fn otDatasetParseTlvs(
7275 aDatasetTlvs: *const otOperationalDatasetTlvs,
7276 aDataset: *mut otOperationalDataset,
7277 ) -> otError;
7278}
7279unsafe extern "C" {
7280 #[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."]
7281 pub fn otDatasetConvertToTlvs(
7282 aDataset: *const otOperationalDataset,
7283 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7284 );
7285}
7286unsafe extern "C" {
7287 #[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."]
7288 pub fn otDatasetUpdateTlvs(
7289 aDataset: *const otOperationalDataset,
7290 aDatasetTlvs: *mut otOperationalDatasetTlvs,
7291 ) -> otError;
7292}
7293unsafe extern "C" {
7294 #[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."]
7295 pub fn otDatasetCreateNewNetwork(
7296 aInstance: *mut otInstance,
7297 aDataset: *mut otOperationalDataset,
7298 ) -> otError;
7299}
7300unsafe extern "C" {
7301 #[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)."]
7302 pub fn otDatasetGetDelayTimerMinimal(aInstance: *mut otInstance) -> u32;
7303}
7304unsafe extern "C" {
7305 #[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."]
7306 pub fn otDatasetSetDelayTimerMinimal(
7307 aInstance: *mut otInstance,
7308 aDelayTimerMinimal: u32,
7309 ) -> otError;
7310}
7311#[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()`)."]
7312pub type otDatasetUpdaterCallback = ::std::option::Option<
7313 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
7314>;
7315unsafe extern "C" {
7316 #[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."]
7317 pub fn otDatasetUpdaterRequestUpdate(
7318 aInstance: *mut otInstance,
7319 aDataset: *const otOperationalDataset,
7320 aCallback: otDatasetUpdaterCallback,
7321 aContext: *mut ::std::os::raw::c_void,
7322 ) -> otError;
7323}
7324unsafe extern "C" {
7325 #[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."]
7326 pub fn otDatasetUpdaterCancelUpdate(aInstance: *mut otInstance);
7327}
7328unsafe extern "C" {
7329 #[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."]
7330 pub fn otDatasetUpdaterIsUpdateOngoing(aInstance: *mut otInstance) -> bool;
7331}
7332#[doc = "< Input mode without pull resistor."]
7333pub const OT_GPIO_MODE_INPUT: otGpioMode = 0;
7334#[doc = "< Output mode."]
7335pub const OT_GPIO_MODE_OUTPUT: otGpioMode = 1;
7336#[doc = " Defines the gpio modes."]
7337pub type otGpioMode = ::std::os::raw::c_uint;
7338#[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."]
7339pub type otPlatDiagOutputCallback = ::std::option::Option<
7340 unsafe extern "C" fn(
7341 aFormat: *const ::std::os::raw::c_char,
7342 aArguments: *mut __va_list_tag,
7343 aContext: *mut ::std::os::raw::c_void,
7344 ),
7345>;
7346unsafe extern "C" {
7347 #[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."]
7348 pub fn otPlatDiagSetOutputCallback(
7349 aInstance: *mut otInstance,
7350 aCallback: otPlatDiagOutputCallback,
7351 aContext: *mut ::std::os::raw::c_void,
7352 );
7353}
7354unsafe extern "C" {
7355 #[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."]
7356 pub fn otPlatDiagProcess(
7357 aInstance: *mut otInstance,
7358 aArgsLength: u8,
7359 aArgs: *mut *mut ::std::os::raw::c_char,
7360 ) -> otError;
7361}
7362unsafe extern "C" {
7363 #[doc = " Enables/disables the factory diagnostics mode.\n\n @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise."]
7364 pub fn otPlatDiagModeSet(aMode: bool);
7365}
7366unsafe extern "C" {
7367 #[doc = " Indicates whether or not factory diagnostics mode is enabled.\n\n @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise."]
7368 pub fn otPlatDiagModeGet() -> bool;
7369}
7370unsafe extern "C" {
7371 #[doc = " Sets the channel to use for factory diagnostics.\n\n @param[in] aChannel The channel value."]
7372 pub fn otPlatDiagChannelSet(aChannel: u8);
7373}
7374unsafe extern "C" {
7375 #[doc = " Sets the transmit power to use for factory diagnostics.\n\n @param[in] aTxPower The transmit power value."]
7376 pub fn otPlatDiagTxPowerSet(aTxPower: i8);
7377}
7378unsafe extern "C" {
7379 #[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."]
7380 pub fn otPlatDiagRadioReceived(
7381 aInstance: *mut otInstance,
7382 aFrame: *mut otRadioFrame,
7383 aError: otError,
7384 );
7385}
7386unsafe extern "C" {
7387 #[doc = " Processes the alarm event.\n\n @param[in] aInstance The OpenThread instance for current request."]
7388 pub fn otPlatDiagAlarmCallback(aInstance: *mut otInstance);
7389}
7390unsafe extern "C" {
7391 #[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."]
7392 pub fn otPlatDiagGpioSet(aGpio: u32, aValue: bool) -> otError;
7393}
7394unsafe extern "C" {
7395 #[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."]
7396 pub fn otPlatDiagGpioGet(aGpio: u32, aValue: *mut bool) -> otError;
7397}
7398unsafe extern "C" {
7399 #[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."]
7400 pub fn otPlatDiagGpioSetMode(aGpio: u32, aMode: otGpioMode) -> otError;
7401}
7402unsafe extern "C" {
7403 #[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."]
7404 pub fn otPlatDiagGpioGetMode(aGpio: u32, aMode: *mut otGpioMode) -> otError;
7405}
7406unsafe extern "C" {
7407 #[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."]
7408 pub fn otPlatDiagRadioSetRawPowerSetting(
7409 aInstance: *mut otInstance,
7410 aRawPowerSetting: *const u8,
7411 aRawPowerSettingLength: u16,
7412 ) -> otError;
7413}
7414unsafe extern "C" {
7415 #[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."]
7416 pub fn otPlatDiagRadioGetRawPowerSetting(
7417 aInstance: *mut otInstance,
7418 aRawPowerSetting: *mut u8,
7419 aRawPowerSettingLength: *mut u16,
7420 ) -> otError;
7421}
7422unsafe extern "C" {
7423 #[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."]
7424 pub fn otPlatDiagRadioRawPowerSettingEnable(
7425 aInstance: *mut otInstance,
7426 aEnable: bool,
7427 ) -> otError;
7428}
7429unsafe extern "C" {
7430 #[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."]
7431 pub fn otPlatDiagRadioTransmitCarrier(aInstance: *mut otInstance, aEnable: bool) -> otError;
7432}
7433unsafe extern "C" {
7434 #[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."]
7435 pub fn otPlatDiagRadioTransmitStream(aInstance: *mut otInstance, aEnable: bool) -> otError;
7436}
7437unsafe extern "C" {
7438 #[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."]
7439 pub fn otPlatDiagRadioGetPowerSettings(
7440 aInstance: *mut otInstance,
7441 aChannel: u8,
7442 aTargetPower: *mut i16,
7443 aActualPower: *mut i16,
7444 aRawPowerSetting: *mut u8,
7445 aRawPowerSettingLength: *mut u16,
7446 ) -> otError;
7447}
7448#[doc = " @addtogroup api-factory-diagnostics\n\n @brief\n This module includes functions that control the Thread stack's execution.\n\n @{"]
7449pub type otDiagOutputCallback = otPlatDiagOutputCallback;
7450unsafe extern "C" {
7451 #[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."]
7452 pub fn otDiagSetOutputCallback(
7453 aInstance: *mut otInstance,
7454 aCallback: otDiagOutputCallback,
7455 aContext: *mut ::std::os::raw::c_void,
7456 );
7457}
7458unsafe extern "C" {
7459 #[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."]
7460 pub fn otDiagProcessCmd(
7461 aInstance: *mut otInstance,
7462 aArgsLength: u8,
7463 aArgs: *mut *mut ::std::os::raw::c_char,
7464 ) -> otError;
7465}
7466unsafe extern "C" {
7467 #[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."]
7468 pub fn otDiagProcessCmdLine(
7469 aInstance: *mut otInstance,
7470 aString: *const ::std::os::raw::c_char,
7471 ) -> otError;
7472}
7473unsafe extern "C" {
7474 #[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."]
7475 pub fn otDiagIsEnabled(aInstance: *mut otInstance) -> bool;
7476}
7477#[doc = "< Indicates the flag is not specified."]
7478pub const OT_DNS_FLAG_UNSPECIFIED: otDnsRecursionFlag = 0;
7479#[doc = "< Indicates DNS name server can resolve the query recursively."]
7480pub const OT_DNS_FLAG_RECURSION_DESIRED: otDnsRecursionFlag = 1;
7481#[doc = "< Indicates DNS name server can not resolve the query recursively."]
7482pub const OT_DNS_FLAG_NO_RECURSION: otDnsRecursionFlag = 2;
7483#[doc = " Type represents the \"Recursion Desired\" (RD) flag in an `otDnsQueryConfig`."]
7484pub type otDnsRecursionFlag = ::std::os::raw::c_uint;
7485#[doc = "< NAT64 mode is not specified. Use default NAT64 mode."]
7486pub const OT_DNS_NAT64_UNSPECIFIED: otDnsNat64Mode = 0;
7487#[doc = "< Allow NAT64 address translation during DNS client address resolution."]
7488pub const OT_DNS_NAT64_ALLOW: otDnsNat64Mode = 1;
7489#[doc = "< Do not allow NAT64 address translation during DNS client address resolution."]
7490pub const OT_DNS_NAT64_DISALLOW: otDnsNat64Mode = 2;
7491#[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."]
7492pub type otDnsNat64Mode = ::std::os::raw::c_uint;
7493#[doc = "< Mode is not specified. Use default service mode."]
7494pub const OT_DNS_SERVICE_MODE_UNSPECIFIED: otDnsServiceMode = 0;
7495#[doc = "< Query for SRV record only."]
7496pub const OT_DNS_SERVICE_MODE_SRV: otDnsServiceMode = 1;
7497#[doc = "< Query for TXT record only."]
7498pub const OT_DNS_SERVICE_MODE_TXT: otDnsServiceMode = 2;
7499#[doc = "< Query for both SRV and TXT records in same message."]
7500pub const OT_DNS_SERVICE_MODE_SRV_TXT: otDnsServiceMode = 3;
7501#[doc = "< Query in parallel for SRV and TXT using separate messages."]
7502pub const OT_DNS_SERVICE_MODE_SRV_TXT_SEPARATE: otDnsServiceMode = 4;
7503#[doc = "< Query for TXT/SRV together first, if fails then query separately."]
7504pub const OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE: otDnsServiceMode = 5;
7505#[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."]
7506pub type otDnsServiceMode = ::std::os::raw::c_uint;
7507pub const OT_DNS_TRANSPORT_UNSPECIFIED: otDnsTransportProto = 0;
7508#[doc = " DNS transport is unspecified."]
7509pub const OT_DNS_TRANSPORT_UDP: otDnsTransportProto = 1;
7510#[doc = " DNS query should be sent via UDP."]
7511pub const OT_DNS_TRANSPORT_TCP: otDnsTransportProto = 2;
7512#[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."]
7513pub type otDnsTransportProto = ::std::os::raw::c_uint;
7514#[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`."]
7515#[repr(C)]
7516#[derive(Copy, Clone)]
7517pub struct otDnsQueryConfig {
7518 #[doc = "< Server address (IPv6 addr/port). All zero or zero port for unspecified."]
7519 pub mServerSockAddr: otSockAddr,
7520 #[doc = "< Wait time (in msec) to rx response. Zero indicates unspecified value."]
7521 pub mResponseTimeout: u32,
7522 #[doc = "< Maximum tx attempts before reporting failure. Zero for unspecified value."]
7523 pub mMaxTxAttempts: u8,
7524 #[doc = "< Indicates whether the server can resolve the query recursively or not."]
7525 pub mRecursionFlag: otDnsRecursionFlag,
7526 #[doc = "< Allow/Disallow NAT64 address translation during address resolution."]
7527 pub mNat64Mode: otDnsNat64Mode,
7528 #[doc = "< Determines which records to query during service resolution."]
7529 pub mServiceMode: otDnsServiceMode,
7530 #[doc = "< Select default transport protocol."]
7531 pub mTransportProto: otDnsTransportProto,
7532}
7533impl Default for otDnsQueryConfig {
7534 fn default() -> Self {
7535 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7536 unsafe {
7537 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7538 s.assume_init()
7539 }
7540 }
7541}
7542unsafe extern "C" {
7543 #[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."]
7544 pub fn otDnsClientGetDefaultConfig(aInstance: *mut otInstance) -> *const otDnsQueryConfig;
7545}
7546unsafe extern "C" {
7547 #[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."]
7548 pub fn otDnsClientSetDefaultConfig(
7549 aInstance: *mut otInstance,
7550 aConfig: *const otDnsQueryConfig,
7551 );
7552}
7553#[repr(C)]
7554#[derive(Debug, Copy, Clone)]
7555pub struct otDnsAddressResponse {
7556 _unused: [u8; 0],
7557}
7558#[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"]
7559pub type otDnsAddressCallback = ::std::option::Option<
7560 unsafe extern "C" fn(
7561 aError: otError,
7562 aResponse: *const otDnsAddressResponse,
7563 aContext: *mut ::std::os::raw::c_void,
7564 ),
7565>;
7566unsafe extern "C" {
7567 #[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."]
7568 pub fn otDnsClientResolveAddress(
7569 aInstance: *mut otInstance,
7570 aHostName: *const ::std::os::raw::c_char,
7571 aCallback: otDnsAddressCallback,
7572 aContext: *mut ::std::os::raw::c_void,
7573 aConfig: *const otDnsQueryConfig,
7574 ) -> otError;
7575}
7576unsafe extern "C" {
7577 #[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."]
7578 pub fn otDnsClientResolveIp4Address(
7579 aInstance: *mut otInstance,
7580 aHostName: *const ::std::os::raw::c_char,
7581 aCallback: otDnsAddressCallback,
7582 aContext: *mut ::std::os::raw::c_void,
7583 aConfig: *const otDnsQueryConfig,
7584 ) -> otError;
7585}
7586unsafe extern "C" {
7587 #[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."]
7588 pub fn otDnsAddressResponseGetHostName(
7589 aResponse: *const otDnsAddressResponse,
7590 aNameBuffer: *mut ::std::os::raw::c_char,
7591 aNameBufferSize: u16,
7592 ) -> otError;
7593}
7594unsafe extern "C" {
7595 #[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)."]
7596 pub fn otDnsAddressResponseGetAddress(
7597 aResponse: *const otDnsAddressResponse,
7598 aIndex: u16,
7599 aAddress: *mut otIp6Address,
7600 aTtl: *mut u32,
7601 ) -> otError;
7602}
7603#[repr(C)]
7604#[derive(Debug, Copy, Clone)]
7605pub struct otDnsBrowseResponse {
7606 _unused: [u8; 0],
7607}
7608#[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()`."]
7609pub type otDnsBrowseCallback = ::std::option::Option<
7610 unsafe extern "C" fn(
7611 aError: otError,
7612 aResponse: *const otDnsBrowseResponse,
7613 aContext: *mut ::std::os::raw::c_void,
7614 ),
7615>;
7616#[doc = " Provides info for a DNS service instance."]
7617#[repr(C)]
7618#[derive(Copy, Clone)]
7619pub struct otDnsServiceInfo {
7620 #[doc = "< Service record TTL (in seconds)."]
7621 pub mTtl: u32,
7622 #[doc = "< Service port number."]
7623 pub mPort: u16,
7624 #[doc = "< Service priority."]
7625 pub mPriority: u16,
7626 #[doc = "< Service weight."]
7627 pub mWeight: u16,
7628 #[doc = "< Buffer to output the service host name (can be NULL if not needed)."]
7629 pub mHostNameBuffer: *mut ::std::os::raw::c_char,
7630 #[doc = "< Size of `mHostNameBuffer`."]
7631 pub mHostNameBufferSize: u16,
7632 #[doc = "< The host IPv6 address. Set to all zero if not available."]
7633 pub mHostAddress: otIp6Address,
7634 #[doc = "< The host address TTL."]
7635 pub mHostAddressTtl: u32,
7636 #[doc = "< Buffer to output TXT data (can be NULL if not needed)."]
7637 pub mTxtData: *mut u8,
7638 #[doc = "< On input, size of `mTxtData` buffer. On output number bytes written."]
7639 pub mTxtDataSize: u16,
7640 #[doc = "< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated."]
7641 pub mTxtDataTruncated: bool,
7642 #[doc = "< The TXT data TTL."]
7643 pub mTxtDataTtl: u32,
7644}
7645impl Default for otDnsServiceInfo {
7646 fn default() -> Self {
7647 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7648 unsafe {
7649 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7650 s.assume_init()
7651 }
7652 }
7653}
7654unsafe extern "C" {
7655 #[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."]
7656 pub fn otDnsClientBrowse(
7657 aInstance: *mut otInstance,
7658 aServiceName: *const ::std::os::raw::c_char,
7659 aCallback: otDnsBrowseCallback,
7660 aContext: *mut ::std::os::raw::c_void,
7661 aConfig: *const otDnsQueryConfig,
7662 ) -> otError;
7663}
7664unsafe extern "C" {
7665 #[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."]
7666 pub fn otDnsBrowseResponseGetServiceName(
7667 aResponse: *const otDnsBrowseResponse,
7668 aNameBuffer: *mut ::std::os::raw::c_char,
7669 aNameBufferSize: u16,
7670 ) -> otError;
7671}
7672unsafe extern "C" {
7673 #[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."]
7674 pub fn otDnsBrowseResponseGetServiceInstance(
7675 aResponse: *const otDnsBrowseResponse,
7676 aIndex: u16,
7677 aLabelBuffer: *mut ::std::os::raw::c_char,
7678 aLabelBufferSize: u8,
7679 ) -> otError;
7680}
7681unsafe extern "C" {
7682 #[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."]
7683 pub fn otDnsBrowseResponseGetServiceInfo(
7684 aResponse: *const otDnsBrowseResponse,
7685 aInstanceLabel: *const ::std::os::raw::c_char,
7686 aServiceInfo: *mut otDnsServiceInfo,
7687 ) -> otError;
7688}
7689unsafe extern "C" {
7690 #[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."]
7691 pub fn otDnsBrowseResponseGetHostAddress(
7692 aResponse: *const otDnsBrowseResponse,
7693 aHostName: *const ::std::os::raw::c_char,
7694 aIndex: u16,
7695 aAddress: *mut otIp6Address,
7696 aTtl: *mut u32,
7697 ) -> otError;
7698}
7699#[repr(C)]
7700#[derive(Debug, Copy, Clone)]
7701pub struct otDnsServiceResponse {
7702 _unused: [u8; 0],
7703}
7704#[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()`."]
7705pub type otDnsServiceCallback = ::std::option::Option<
7706 unsafe extern "C" fn(
7707 aError: otError,
7708 aResponse: *const otDnsServiceResponse,
7709 aContext: *mut ::std::os::raw::c_void,
7710 ),
7711>;
7712unsafe extern "C" {
7713 #[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."]
7714 pub fn otDnsClientResolveService(
7715 aInstance: *mut otInstance,
7716 aInstanceLabel: *const ::std::os::raw::c_char,
7717 aServiceName: *const ::std::os::raw::c_char,
7718 aCallback: otDnsServiceCallback,
7719 aContext: *mut ::std::os::raw::c_void,
7720 aConfig: *const otDnsQueryConfig,
7721 ) -> otError;
7722}
7723unsafe extern "C" {
7724 #[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."]
7725 pub fn otDnsClientResolveServiceAndHostAddress(
7726 aInstance: *mut otInstance,
7727 aInstanceLabel: *const ::std::os::raw::c_char,
7728 aServiceName: *const ::std::os::raw::c_char,
7729 aCallback: otDnsServiceCallback,
7730 aContext: *mut ::std::os::raw::c_void,
7731 aConfig: *const otDnsQueryConfig,
7732 ) -> otError;
7733}
7734unsafe extern "C" {
7735 #[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."]
7736 pub fn otDnsServiceResponseGetServiceName(
7737 aResponse: *const otDnsServiceResponse,
7738 aLabelBuffer: *mut ::std::os::raw::c_char,
7739 aLabelBufferSize: u8,
7740 aNameBuffer: *mut ::std::os::raw::c_char,
7741 aNameBufferSize: u16,
7742 ) -> otError;
7743}
7744unsafe extern "C" {
7745 #[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."]
7746 pub fn otDnsServiceResponseGetServiceInfo(
7747 aResponse: *const otDnsServiceResponse,
7748 aServiceInfo: *mut otDnsServiceInfo,
7749 ) -> otError;
7750}
7751unsafe extern "C" {
7752 #[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."]
7753 pub fn otDnsServiceResponseGetHostAddress(
7754 aResponse: *const otDnsServiceResponse,
7755 aHostName: *const ::std::os::raw::c_char,
7756 aIndex: u16,
7757 aAddress: *mut otIp6Address,
7758 aTtl: *mut u32,
7759 ) -> otError;
7760}
7761#[repr(C)]
7762#[derive(Debug, Copy, Clone)]
7763pub struct otDnsRecordResponse {
7764 _unused: [u8; 0],
7765}
7766#[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.\n"]
7767pub type otDnsRecordCallback = ::std::option::Option<
7768 unsafe extern "C" fn(
7769 aError: otError,
7770 aResponse: *const otDnsRecordResponse,
7771 aContext: *mut ::std::os::raw::c_void,
7772 ),
7773>;
7774#[doc = "< Answer section."]
7775pub const OT_DNS_SECTION_ANSWER: otDnsRecordSection = 0;
7776#[doc = "< Authority section."]
7777pub const OT_DNS_SECTION_AUTHORITY: otDnsRecordSection = 1;
7778#[doc = "< Additional section."]
7779pub const OT_DNS_SECTION_ADDITIONAL: otDnsRecordSection = 2;
7780#[doc = " Represents a section in a DNS query/response message."]
7781pub type otDnsRecordSection = ::std::os::raw::c_uint;
7782#[doc = " Represents info for a record in an `otDnsRecordResponse`.\n\n This struct is used as input to `otDnsRecordResponseGetRecordInfo()`."]
7783#[repr(C)]
7784#[derive(Debug, Copy, Clone)]
7785pub struct otDnsRecordInfo {
7786 #[doc = "< Buffer to output the name (MUST NOT be NULL)."]
7787 pub mNameBuffer: *mut ::std::os::raw::c_char,
7788 #[doc = "< Size of `mNameBuffer`."]
7789 pub mNameBufferSize: u16,
7790 #[doc = "< The record type."]
7791 pub mRecordType: u16,
7792 #[doc = "< The record data length (in bytes)."]
7793 pub mRecordLength: u16,
7794 #[doc = "< Record TTL (in seconds)."]
7795 pub mTtl: u32,
7796 #[doc = "< Buffer to output the data (Can be NULL if data not needed)."]
7797 pub mDataBuffer: *mut u8,
7798 #[doc = "< On input, size of `mDataBuffer`. On output number of bytes written."]
7799 pub mDataBufferSize: u16,
7800 #[doc = "< Indicates the section of the record."]
7801 pub mSection: otDnsRecordSection,
7802}
7803impl Default for otDnsRecordInfo {
7804 fn default() -> Self {
7805 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7806 unsafe {
7807 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7808 s.assume_init()
7809 }
7810 }
7811}
7812unsafe extern "C" {
7813 #[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."]
7814 pub fn otDnsClientQueryRecord(
7815 aInstance: *mut otInstance,
7816 aRecordType: u16,
7817 aFirstLabel: *const ::std::os::raw::c_char,
7818 aNextLabels: *const ::std::os::raw::c_char,
7819 aCallback: otDnsRecordCallback,
7820 aContext: *mut ::std::os::raw::c_void,
7821 aConfig: *const otDnsQueryConfig,
7822 ) -> otError;
7823}
7824unsafe extern "C" {
7825 #[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."]
7826 pub fn otDnsRecordResponseGetQueryName(
7827 aResponse: *const otDnsRecordResponse,
7828 aNameBuffer: *mut ::std::os::raw::c_char,
7829 aNameBufferSize: u16,
7830 ) -> otError;
7831}
7832unsafe extern "C" {
7833 #[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."]
7834 pub fn otDnsRecordResponseGetRecordInfo(
7835 aResponse: *const otDnsRecordResponse,
7836 aIndex: u16,
7837 aRecordInfo: *mut otDnsRecordInfo,
7838 ) -> otError;
7839}
7840#[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"]
7841pub type otDnssdQuerySubscribeCallback = ::std::option::Option<
7842 unsafe extern "C" fn(
7843 aContext: *mut ::std::os::raw::c_void,
7844 aFullName: *const ::std::os::raw::c_char,
7845 ),
7846>;
7847#[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.\")."]
7848pub type otDnssdQueryUnsubscribeCallback = ::std::option::Option<
7849 unsafe extern "C" fn(
7850 aContext: *mut ::std::os::raw::c_void,
7851 aFullName: *const ::std::os::raw::c_char,
7852 ),
7853>;
7854#[doc = " This opaque type represents a DNS-SD query."]
7855pub type otDnssdQuery = ::std::os::raw::c_void;
7856#[doc = " Represents information of a discovered service instance for a DNS-SD query."]
7857#[repr(C)]
7858#[derive(Debug, Copy, Clone)]
7859pub struct otDnssdServiceInstanceInfo {
7860 #[doc = "< Full instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
7861 pub mFullName: *const ::std::os::raw::c_char,
7862 #[doc = "< Host name (e.g. \"ot-host.default.service.arpa.\")."]
7863 pub mHostName: *const ::std::os::raw::c_char,
7864 #[doc = "< Number of host IPv6 addresses."]
7865 pub mAddressNum: u8,
7866 #[doc = "< Host IPv6 addresses."]
7867 pub mAddresses: *const otIp6Address,
7868 #[doc = "< Service port."]
7869 pub mPort: u16,
7870 #[doc = "< Service priority."]
7871 pub mPriority: u16,
7872 #[doc = "< Service weight."]
7873 pub mWeight: u16,
7874 #[doc = "< Service TXT RDATA length."]
7875 pub mTxtLength: u16,
7876 #[doc = "< Service TXT RDATA."]
7877 pub mTxtData: *const u8,
7878 #[doc = "< Service TTL (in seconds)."]
7879 pub mTtl: u32,
7880}
7881impl Default for otDnssdServiceInstanceInfo {
7882 fn default() -> Self {
7883 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7884 unsafe {
7885 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7886 s.assume_init()
7887 }
7888 }
7889}
7890#[doc = " Represents information of a discovered host for a DNS-SD query."]
7891#[repr(C)]
7892#[derive(Debug, Copy, Clone)]
7893pub struct otDnssdHostInfo {
7894 #[doc = "< Number of host IPv6 addresses."]
7895 pub mAddressNum: u8,
7896 #[doc = "< Host IPv6 addresses."]
7897 pub mAddresses: *const otIp6Address,
7898 #[doc = "< Service TTL (in seconds)."]
7899 pub mTtl: u32,
7900}
7901impl Default for otDnssdHostInfo {
7902 fn default() -> Self {
7903 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7904 unsafe {
7905 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7906 s.assume_init()
7907 }
7908 }
7909}
7910#[doc = "< Service type unspecified."]
7911pub const OT_DNSSD_QUERY_TYPE_NONE: otDnssdQueryType = 0;
7912#[doc = "< Service type browse service."]
7913pub const OT_DNSSD_QUERY_TYPE_BROWSE: otDnssdQueryType = 1;
7914#[doc = "< Service type resolve service instance."]
7915pub const OT_DNSSD_QUERY_TYPE_RESOLVE: otDnssdQueryType = 2;
7916#[doc = "< Service type resolve hostname."]
7917pub const OT_DNSSD_QUERY_TYPE_RESOLVE_HOST: otDnssdQueryType = 3;
7918#[doc = " Specifies a DNS-SD query type."]
7919pub type otDnssdQueryType = ::std::os::raw::c_uint;
7920#[doc = " Represents the count of queries, responses, failures handled by upstream DNS server.\n\n Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`."]
7921#[repr(C)]
7922#[derive(Debug, Default, Copy, Clone)]
7923pub struct otUpstreamDnsCounters {
7924 #[doc = "< The number of queries forwarded."]
7925 pub mQueries: u32,
7926 #[doc = "< The number of responses forwarded."]
7927 pub mResponses: u32,
7928 #[doc = "< The number of upstream DNS failures."]
7929 pub mFailures: u32,
7930}
7931#[doc = " Contains the counters of DNS-SD server."]
7932#[repr(C)]
7933#[derive(Debug, Default, Copy, Clone)]
7934pub struct otDnssdCounters {
7935 #[doc = "< The number of successful responses."]
7936 pub mSuccessResponse: u32,
7937 #[doc = "< The number of server failure responses."]
7938 pub mServerFailureResponse: u32,
7939 #[doc = "< The number of format error responses."]
7940 pub mFormatErrorResponse: u32,
7941 #[doc = "< The number of name error responses."]
7942 pub mNameErrorResponse: u32,
7943 #[doc = "< The number of 'not implemented' responses."]
7944 pub mNotImplementedResponse: u32,
7945 #[doc = "< The number of other responses."]
7946 pub mOtherResponse: u32,
7947 #[doc = "< The number of queries resolved by the local SRP server."]
7948 pub mResolvedBySrp: u32,
7949 #[doc = "< The number of queries, responses,\n< failures handled by upstream DNS server."]
7950 pub mUpstreamDnsCounters: otUpstreamDnsCounters,
7951}
7952unsafe extern "C" {
7953 #[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."]
7954 pub fn otDnssdQuerySetCallbacks(
7955 aInstance: *mut otInstance,
7956 aSubscribe: otDnssdQuerySubscribeCallback,
7957 aUnsubscribe: otDnssdQueryUnsubscribeCallback,
7958 aContext: *mut ::std::os::raw::c_void,
7959 );
7960}
7961unsafe extern "C" {
7962 #[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."]
7963 pub fn otDnssdQueryHandleDiscoveredServiceInstance(
7964 aInstance: *mut otInstance,
7965 aServiceFullName: *const ::std::os::raw::c_char,
7966 aInstanceInfo: *mut otDnssdServiceInstanceInfo,
7967 );
7968}
7969unsafe extern "C" {
7970 #[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."]
7971 pub fn otDnssdQueryHandleDiscoveredHost(
7972 aInstance: *mut otInstance,
7973 aHostFullName: *const ::std::os::raw::c_char,
7974 aHostInfo: *mut otDnssdHostInfo,
7975 );
7976}
7977unsafe extern "C" {
7978 #[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."]
7979 pub fn otDnssdGetNextQuery(
7980 aInstance: *mut otInstance,
7981 aQuery: *const otDnssdQuery,
7982 ) -> *const otDnssdQuery;
7983}
7984unsafe extern "C" {
7985 #[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."]
7986 pub fn otDnssdGetQueryTypeAndName(
7987 aQuery: *const otDnssdQuery,
7988 aNameOutput: *mut [::std::os::raw::c_char; 255usize],
7989 ) -> otDnssdQueryType;
7990}
7991unsafe extern "C" {
7992 #[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."]
7993 pub fn otDnssdGetCounters(aInstance: *mut otInstance) -> *const otDnssdCounters;
7994}
7995unsafe extern "C" {
7996 #[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"]
7997 pub fn otDnssdUpstreamQuerySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
7998}
7999unsafe extern "C" {
8000 #[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"]
8001 pub fn otDnssdUpstreamQueryIsEnabled(aInstance: *mut otInstance) -> bool;
8002}
8003unsafe extern "C" {
8004 #[doc = " @note This API is deprecated and use of it is discouraged."]
8005 pub fn otHeapCAlloc(aCount: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
8006}
8007unsafe extern "C" {
8008 #[doc = " @note This API is deprecated and use of it is discouraged."]
8009 pub fn otHeapFree(aPointer: *mut ::std::os::raw::c_void);
8010}
8011#[doc = "< Destination Unreachable"]
8012pub const OT_ICMP6_TYPE_DST_UNREACH: otIcmp6Type = 1;
8013#[doc = "< Packet To Big"]
8014pub const OT_ICMP6_TYPE_PACKET_TO_BIG: otIcmp6Type = 2;
8015#[doc = "< Time Exceeded"]
8016pub const OT_ICMP6_TYPE_TIME_EXCEEDED: otIcmp6Type = 3;
8017#[doc = "< Parameter Problem"]
8018pub const OT_ICMP6_TYPE_PARAMETER_PROBLEM: otIcmp6Type = 4;
8019#[doc = "< Echo Request"]
8020pub const OT_ICMP6_TYPE_ECHO_REQUEST: otIcmp6Type = 128;
8021#[doc = "< Echo Reply"]
8022pub const OT_ICMP6_TYPE_ECHO_REPLY: otIcmp6Type = 129;
8023#[doc = "< Router Solicitation"]
8024pub const OT_ICMP6_TYPE_ROUTER_SOLICIT: otIcmp6Type = 133;
8025#[doc = "< Router Advertisement"]
8026pub const OT_ICMP6_TYPE_ROUTER_ADVERT: otIcmp6Type = 134;
8027#[doc = "< Neighbor Solicitation"]
8028pub const OT_ICMP6_TYPE_NEIGHBOR_SOLICIT: otIcmp6Type = 135;
8029#[doc = "< Neighbor Advertisement"]
8030pub const OT_ICMP6_TYPE_NEIGHBOR_ADVERT: otIcmp6Type = 136;
8031#[doc = " ICMPv6 Message Types"]
8032pub type otIcmp6Type = ::std::os::raw::c_uint;
8033#[doc = "< Destination Unreachable (Type 1) - No Route"]
8034pub const OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE: otIcmp6Code = 0;
8035#[doc = "< Destination Unreachable (Type 1) - Administratively Prohibited"]
8036pub const OT_ICMP6_CODE_DST_UNREACH_PROHIBITED: otIcmp6Code = 1;
8037#[doc = "< Time Exceeded (Type 3) - Fragment Reassembly"]
8038pub const OT_ICMP6_CODE_FRAGM_REAS_TIME_EX: otIcmp6Code = 1;
8039#[doc = " ICMPv6 Message Codes"]
8040pub type otIcmp6Code = ::std::os::raw::c_uint;
8041#[doc = " @struct otIcmp6Header\n\n Represents an ICMPv6 header."]
8042#[repr(C, packed)]
8043#[derive(Copy, Clone)]
8044pub struct otIcmp6Header {
8045 #[doc = "< Type"]
8046 pub mType: u8,
8047 #[doc = "< Code"]
8048 pub mCode: u8,
8049 #[doc = "< Checksum"]
8050 pub mChecksum: u16,
8051 #[doc = "< Message-specific data"]
8052 pub mData: otIcmp6Header__bindgen_ty_1,
8053}
8054#[repr(C, packed)]
8055#[derive(Copy, Clone)]
8056pub union otIcmp6Header__bindgen_ty_1 {
8057 pub m8: [u8; 4usize],
8058 pub m16: [u16; 2usize],
8059 pub m32: [u32; 1usize],
8060}
8061impl Default for otIcmp6Header__bindgen_ty_1 {
8062 fn default() -> Self {
8063 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8064 unsafe {
8065 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8066 s.assume_init()
8067 }
8068 }
8069}
8070impl Default for otIcmp6Header {
8071 fn default() -> Self {
8072 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8073 unsafe {
8074 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8075 s.assume_init()
8076 }
8077 }
8078}
8079#[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."]
8080pub type otIcmp6ReceiveCallback = ::std::option::Option<
8081 unsafe extern "C" fn(
8082 aContext: *mut ::std::os::raw::c_void,
8083 aMessage: *mut otMessage,
8084 aMessageInfo: *const otMessageInfo,
8085 aIcmpHeader: *const otIcmp6Header,
8086 ),
8087>;
8088#[doc = " Implements ICMPv6 message handler."]
8089#[repr(C)]
8090#[derive(Debug, Copy, Clone)]
8091pub struct otIcmp6Handler {
8092 #[doc = "< The ICMPv6 received callback"]
8093 pub mReceiveCallback: otIcmp6ReceiveCallback,
8094 #[doc = "< A pointer to arbitrary context information."]
8095 pub mContext: *mut ::std::os::raw::c_void,
8096 #[doc = "< A pointer to the next handler in the list."]
8097 pub mNext: *mut otIcmp6Handler,
8098}
8099impl Default for otIcmp6Handler {
8100 fn default() -> Self {
8101 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8102 unsafe {
8103 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8104 s.assume_init()
8105 }
8106 }
8107}
8108#[doc = "< ICMPv6 Echo processing disabled"]
8109pub const OT_ICMP6_ECHO_HANDLER_DISABLED: otIcmp6EchoMode = 0;
8110#[doc = "< ICMPv6 Echo processing enabled only for unicast requests only"]
8111pub const OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: otIcmp6EchoMode = 1;
8112#[doc = "< ICMPv6 Echo processing enabled only for multicast requests only"]
8113pub const OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: otIcmp6EchoMode = 2;
8114#[doc = "< ICMPv6 Echo processing enabled for unicast and multicast requests"]
8115pub const OT_ICMP6_ECHO_HANDLER_ALL: otIcmp6EchoMode = 3;
8116#[doc = "< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only"]
8117pub const OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: otIcmp6EchoMode = 4;
8118#[doc = " ICMPv6 Echo Reply Modes"]
8119pub type otIcmp6EchoMode = ::std::os::raw::c_uint;
8120unsafe extern "C" {
8121 #[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"]
8122 pub fn otIcmp6GetEchoMode(aInstance: *mut otInstance) -> otIcmp6EchoMode;
8123}
8124unsafe extern "C" {
8125 #[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."]
8126 pub fn otIcmp6SetEchoMode(aInstance: *mut otInstance, aMode: otIcmp6EchoMode);
8127}
8128unsafe extern "C" {
8129 #[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."]
8130 pub fn otIcmp6RegisterHandler(
8131 aInstance: *mut otInstance,
8132 aHandler: *mut otIcmp6Handler,
8133 ) -> otError;
8134}
8135unsafe extern "C" {
8136 #[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."]
8137 pub fn otIcmp6SendEchoRequest(
8138 aInstance: *mut otInstance,
8139 aMessage: *mut otMessage,
8140 aMessageInfo: *const otMessageInfo,
8141 aIdentifier: u16,
8142 ) -> otError;
8143}
8144#[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."]
8145pub type otJamDetectionCallback = ::std::option::Option<
8146 unsafe extern "C" fn(aJamState: bool, aContext: *mut ::std::os::raw::c_void),
8147>;
8148unsafe extern "C" {
8149 #[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."]
8150 pub fn otJamDetectionSetRssiThreshold(
8151 aInstance: *mut otInstance,
8152 aRssiThreshold: i8,
8153 ) -> otError;
8154}
8155unsafe extern "C" {
8156 #[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."]
8157 pub fn otJamDetectionGetRssiThreshold(aInstance: *mut otInstance) -> i8;
8158}
8159unsafe extern "C" {
8160 #[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)"]
8161 pub fn otJamDetectionSetWindow(aInstance: *mut otInstance, aWindow: u8) -> otError;
8162}
8163unsafe extern "C" {
8164 #[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."]
8165 pub fn otJamDetectionGetWindow(aInstance: *mut otInstance) -> u8;
8166}
8167unsafe extern "C" {
8168 #[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."]
8169 pub fn otJamDetectionSetBusyPeriod(aInstance: *mut otInstance, aBusyPeriod: u8) -> otError;
8170}
8171unsafe extern "C" {
8172 #[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."]
8173 pub fn otJamDetectionGetBusyPeriod(aInstance: *mut otInstance) -> u8;
8174}
8175unsafe extern "C" {
8176 #[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."]
8177 pub fn otJamDetectionStart(
8178 aInstance: *mut otInstance,
8179 aCallback: otJamDetectionCallback,
8180 aContext: *mut ::std::os::raw::c_void,
8181 ) -> otError;
8182}
8183unsafe extern "C" {
8184 #[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."]
8185 pub fn otJamDetectionStop(aInstance: *mut otInstance) -> otError;
8186}
8187unsafe extern "C" {
8188 #[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)."]
8189 pub fn otJamDetectionIsEnabled(aInstance: *mut otInstance) -> bool;
8190}
8191unsafe extern "C" {
8192 #[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)."]
8193 pub fn otJamDetectionGetState(aInstance: *mut otInstance) -> bool;
8194}
8195unsafe extern "C" {
8196 #[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."]
8197 pub fn otJamDetectionGetHistoryBitmap(aInstance: *mut otInstance) -> u64;
8198}
8199pub type otMacFilterIterator = u8;
8200#[doc = "< Address filter is disabled."]
8201pub const OT_MAC_FILTER_ADDRESS_MODE_DISABLED: otMacFilterAddressMode = 0;
8202#[doc = "< Allowlist address filter mode is enabled."]
8203pub const OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST: otMacFilterAddressMode = 1;
8204#[doc = "< Denylist address filter mode is enabled."]
8205pub const OT_MAC_FILTER_ADDRESS_MODE_DENYLIST: otMacFilterAddressMode = 2;
8206#[doc = " Defines address mode of the mac filter."]
8207pub type otMacFilterAddressMode = ::std::os::raw::c_uint;
8208#[doc = " Represents a Mac Filter entry."]
8209#[repr(C)]
8210#[derive(Debug, Default, Copy, Clone)]
8211pub struct otMacFilterEntry {
8212 #[doc = "< IEEE 802.15.4 Extended Address"]
8213 pub mExtAddress: otExtAddress,
8214 #[doc = "< Received signal strength"]
8215 pub mRssIn: i8,
8216}
8217#[doc = " Represents the MAC layer counters."]
8218#[repr(C)]
8219#[derive(Debug, Default, Copy, Clone)]
8220pub struct otMacCounters {
8221 #[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"]
8222 pub mTxTotal: u32,
8223 #[doc = " The total number of unique unicast MAC frame transmission requests."]
8224 pub mTxUnicast: u32,
8225 #[doc = " The total number of unique broadcast MAC frame transmission requests."]
8226 pub mTxBroadcast: u32,
8227 #[doc = " The total number of unique MAC frame transmission requests with requested acknowledgment."]
8228 pub mTxAckRequested: u32,
8229 #[doc = " The total number of unique MAC frame transmission requests that were acked."]
8230 pub mTxAcked: u32,
8231 #[doc = " The total number of unique MAC frame transmission requests without requested acknowledgment."]
8232 pub mTxNoAckRequested: u32,
8233 #[doc = " The total number of unique MAC Data frame transmission requests."]
8234 pub mTxData: u32,
8235 #[doc = " The total number of unique MAC Data Poll frame transmission requests."]
8236 pub mTxDataPoll: u32,
8237 #[doc = " The total number of unique MAC Beacon frame transmission requests."]
8238 pub mTxBeacon: u32,
8239 #[doc = " The total number of unique MAC Beacon Request frame transmission requests."]
8240 pub mTxBeaconRequest: u32,
8241 #[doc = " The total number of unique other MAC frame transmission requests.\n\n This counter is currently used for counting out-of-band frames."]
8242 pub mTxOther: u32,
8243 #[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."]
8244 pub mTxRetry: u32,
8245 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for direct packets."]
8246 pub mTxDirectMaxRetryExpiry: u32,
8247 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets."]
8248 pub mTxIndirectMaxRetryExpiry: u32,
8249 #[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)."]
8250 pub mTxErrCca: u32,
8251 #[doc = " The total number of unique MAC transmission request failures cause by an abort error."]
8252 pub mTxErrAbort: u32,
8253 #[doc = " The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail)."]
8254 pub mTxErrBusyChannel: u32,
8255 #[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."]
8256 pub mRxTotal: u32,
8257 #[doc = " The total number of unicast frames received."]
8258 pub mRxUnicast: u32,
8259 #[doc = " The total number of broadcast frames received."]
8260 pub mRxBroadcast: u32,
8261 #[doc = " The total number of MAC Data frames received."]
8262 pub mRxData: u32,
8263 #[doc = " The total number of MAC Data Poll frames received."]
8264 pub mRxDataPoll: u32,
8265 #[doc = " The total number of MAC Beacon frames received."]
8266 pub mRxBeacon: u32,
8267 #[doc = " The total number of MAC Beacon Request frames received."]
8268 pub mRxBeaconRequest: u32,
8269 #[doc = " The total number of other types of frames received."]
8270 pub mRxOther: u32,
8271 #[doc = " The total number of frames dropped by MAC Filter module, for example received from denylisted node."]
8272 pub mRxAddressFiltered: u32,
8273 #[doc = " The total number of frames dropped by destination address check, for example received frame for other node."]
8274 pub mRxDestAddrFiltered: u32,
8275 #[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."]
8276 pub mRxDuplicated: u32,
8277 #[doc = " The total number of frames dropped because of missing or malformed content."]
8278 pub mRxErrNoFrame: u32,
8279 #[doc = " The total number of frames dropped due to unknown neighbor."]
8280 pub mRxErrUnknownNeighbor: u32,
8281 #[doc = " The total number of frames dropped due to invalid source address."]
8282 pub mRxErrInvalidSrcAddr: u32,
8283 #[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."]
8284 pub mRxErrSec: u32,
8285 #[doc = " The total number of frames dropped due to invalid FCS."]
8286 pub mRxErrFcs: u32,
8287 #[doc = " The total number of frames dropped due to other error."]
8288 pub mRxErrOther: u32,
8289}
8290#[doc = " Represents a received IEEE 802.15.4 Beacon."]
8291#[repr(C)]
8292#[repr(align(4))]
8293#[derive(Debug, Default, Copy, Clone)]
8294pub struct otActiveScanResult {
8295 #[doc = "< IEEE 802.15.4 Extended Address"]
8296 pub mExtAddress: otExtAddress,
8297 #[doc = "< Thread Network Name"]
8298 pub mNetworkName: otNetworkName,
8299 #[doc = "< Thread Extended PAN ID"]
8300 pub mExtendedPanId: otExtendedPanId,
8301 #[doc = "< Steering Data"]
8302 pub mSteeringData: otSteeringData,
8303 #[doc = "< IEEE 802.15.4 PAN ID"]
8304 pub mPanId: u16,
8305 #[doc = "< Joiner UDP Port"]
8306 pub mJoinerUdpPort: u16,
8307 #[doc = "< IEEE 802.15.4 Channel"]
8308 pub mChannel: u8,
8309 #[doc = "< RSSI (dBm)"]
8310 pub mRssi: i8,
8311 #[doc = "< LQI"]
8312 pub mLqi: u8,
8313 pub _bitfield_align_1: [u8; 0],
8314 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8315 pub __bindgen_padding_0: u16,
8316}
8317impl otActiveScanResult {
8318 #[inline]
8319 pub fn mVersion(&self) -> ::std::os::raw::c_uint {
8320 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) }
8321 }
8322 #[inline]
8323 pub fn set_mVersion(&mut self, val: ::std::os::raw::c_uint) {
8324 unsafe {
8325 let val: u32 = ::std::mem::transmute(val);
8326 self._bitfield_1.set(0usize, 4u8, val as u64)
8327 }
8328 }
8329 #[inline]
8330 pub unsafe fn mVersion_raw(this: *const Self) -> ::std::os::raw::c_uint {
8331 unsafe {
8332 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8333 ::std::ptr::addr_of!((*this)._bitfield_1),
8334 0usize,
8335 4u8,
8336 ) as u32)
8337 }
8338 }
8339 #[inline]
8340 pub unsafe fn set_mVersion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
8341 unsafe {
8342 let val: u32 = ::std::mem::transmute(val);
8343 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8344 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8345 0usize,
8346 4u8,
8347 val as u64,
8348 )
8349 }
8350 }
8351 #[inline]
8352 pub fn mIsNative(&self) -> bool {
8353 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
8354 }
8355 #[inline]
8356 pub fn set_mIsNative(&mut self, val: bool) {
8357 unsafe {
8358 let val: u8 = ::std::mem::transmute(val);
8359 self._bitfield_1.set(4usize, 1u8, val as u64)
8360 }
8361 }
8362 #[inline]
8363 pub unsafe fn mIsNative_raw(this: *const Self) -> bool {
8364 unsafe {
8365 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8366 ::std::ptr::addr_of!((*this)._bitfield_1),
8367 4usize,
8368 1u8,
8369 ) as u8)
8370 }
8371 }
8372 #[inline]
8373 pub unsafe fn set_mIsNative_raw(this: *mut Self, val: bool) {
8374 unsafe {
8375 let val: u8 = ::std::mem::transmute(val);
8376 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8377 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8378 4usize,
8379 1u8,
8380 val as u64,
8381 )
8382 }
8383 }
8384 #[inline]
8385 pub fn mDiscover(&self) -> bool {
8386 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
8387 }
8388 #[inline]
8389 pub fn set_mDiscover(&mut self, val: bool) {
8390 unsafe {
8391 let val: u8 = ::std::mem::transmute(val);
8392 self._bitfield_1.set(5usize, 1u8, val as u64)
8393 }
8394 }
8395 #[inline]
8396 pub unsafe fn mDiscover_raw(this: *const Self) -> bool {
8397 unsafe {
8398 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8399 ::std::ptr::addr_of!((*this)._bitfield_1),
8400 5usize,
8401 1u8,
8402 ) as u8)
8403 }
8404 }
8405 #[inline]
8406 pub unsafe fn set_mDiscover_raw(this: *mut Self, val: bool) {
8407 unsafe {
8408 let val: u8 = ::std::mem::transmute(val);
8409 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8410 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8411 5usize,
8412 1u8,
8413 val as u64,
8414 )
8415 }
8416 }
8417 #[inline]
8418 pub fn mIsJoinable(&self) -> bool {
8419 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
8420 }
8421 #[inline]
8422 pub fn set_mIsJoinable(&mut self, val: bool) {
8423 unsafe {
8424 let val: u8 = ::std::mem::transmute(val);
8425 self._bitfield_1.set(6usize, 1u8, val as u64)
8426 }
8427 }
8428 #[inline]
8429 pub unsafe fn mIsJoinable_raw(this: *const Self) -> bool {
8430 unsafe {
8431 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8432 ::std::ptr::addr_of!((*this)._bitfield_1),
8433 6usize,
8434 1u8,
8435 ) as u8)
8436 }
8437 }
8438 #[inline]
8439 pub unsafe fn set_mIsJoinable_raw(this: *mut Self, val: bool) {
8440 unsafe {
8441 let val: u8 = ::std::mem::transmute(val);
8442 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8443 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8444 6usize,
8445 1u8,
8446 val as u64,
8447 )
8448 }
8449 }
8450 #[inline]
8451 pub fn new_bitfield_1(
8452 mVersion: ::std::os::raw::c_uint,
8453 mIsNative: bool,
8454 mDiscover: bool,
8455 mIsJoinable: bool,
8456 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8457 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8458 __bindgen_bitfield_unit.set(0usize, 4u8, {
8459 let mVersion: u32 = unsafe { ::std::mem::transmute(mVersion) };
8460 mVersion as u64
8461 });
8462 __bindgen_bitfield_unit.set(4usize, 1u8, {
8463 let mIsNative: u8 = unsafe { ::std::mem::transmute(mIsNative) };
8464 mIsNative as u64
8465 });
8466 __bindgen_bitfield_unit.set(5usize, 1u8, {
8467 let mDiscover: u8 = unsafe { ::std::mem::transmute(mDiscover) };
8468 mDiscover as u64
8469 });
8470 __bindgen_bitfield_unit.set(6usize, 1u8, {
8471 let mIsJoinable: u8 = unsafe { ::std::mem::transmute(mIsJoinable) };
8472 mIsJoinable as u64
8473 });
8474 __bindgen_bitfield_unit
8475 }
8476}
8477#[doc = " Represents an energy scan result."]
8478#[repr(C)]
8479#[derive(Debug, Default, Copy, Clone)]
8480pub struct otEnergyScanResult {
8481 #[doc = "< IEEE 802.15.4 Channel"]
8482 pub mChannel: u8,
8483 #[doc = "< The max RSSI (dBm)"]
8484 pub mMaxRssi: i8,
8485}
8486#[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."]
8487pub type otHandleActiveScanResult = ::std::option::Option<
8488 unsafe extern "C" fn(aResult: *mut otActiveScanResult, aContext: *mut ::std::os::raw::c_void),
8489>;
8490unsafe extern "C" {
8491 #[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."]
8492 pub fn otLinkActiveScan(
8493 aInstance: *mut otInstance,
8494 aScanChannels: u32,
8495 aScanDuration: u16,
8496 aCallback: otHandleActiveScanResult,
8497 aCallbackContext: *mut ::std::os::raw::c_void,
8498 ) -> otError;
8499}
8500unsafe extern "C" {
8501 #[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."]
8502 pub fn otLinkIsActiveScanInProgress(aInstance: *mut otInstance) -> bool;
8503}
8504#[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."]
8505pub type otHandleEnergyScanResult = ::std::option::Option<
8506 unsafe extern "C" fn(aResult: *mut otEnergyScanResult, aContext: *mut ::std::os::raw::c_void),
8507>;
8508unsafe extern "C" {
8509 #[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."]
8510 pub fn otLinkEnergyScan(
8511 aInstance: *mut otInstance,
8512 aScanChannels: u32,
8513 aScanDuration: u16,
8514 aCallback: otHandleEnergyScanResult,
8515 aCallbackContext: *mut ::std::os::raw::c_void,
8516 ) -> otError;
8517}
8518unsafe extern "C" {
8519 #[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."]
8520 pub fn otLinkIsEnergyScanInProgress(aInstance: *mut otInstance) -> bool;
8521}
8522unsafe extern "C" {
8523 #[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."]
8524 pub fn otLinkSendDataRequest(aInstance: *mut otInstance) -> otError;
8525}
8526unsafe extern "C" {
8527 #[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."]
8528 pub fn otLinkIsInTransmitState(aInstance: *mut otInstance) -> bool;
8529}
8530unsafe extern "C" {
8531 #[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"]
8532 pub fn otLinkGetChannel(aInstance: *mut otInstance) -> u8;
8533}
8534unsafe extern "C" {
8535 #[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"]
8536 pub fn otLinkSetChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
8537}
8538unsafe extern "C" {
8539 #[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."]
8540 pub fn otLinkGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
8541}
8542unsafe extern "C" {
8543 #[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."]
8544 pub fn otLinkSetSupportedChannelMask(aInstance: *mut otInstance, aChannelMask: u32) -> otError;
8545}
8546unsafe extern "C" {
8547 #[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."]
8548 pub fn otLinkGetExtendedAddress(aInstance: *mut otInstance) -> *const otExtAddress;
8549}
8550unsafe extern "C" {
8551 #[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."]
8552 pub fn otLinkSetExtendedAddress(
8553 aInstance: *mut otInstance,
8554 aExtAddress: *const otExtAddress,
8555 ) -> otError;
8556}
8557unsafe extern "C" {
8558 #[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."]
8559 pub fn otLinkGetFactoryAssignedIeeeEui64(aInstance: *mut otInstance, aEui64: *mut otExtAddress);
8560}
8561unsafe extern "C" {
8562 #[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"]
8563 pub fn otLinkGetPanId(aInstance: *mut otInstance) -> otPanId;
8564}
8565unsafe extern "C" {
8566 #[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"]
8567 pub fn otLinkSetPanId(aInstance: *mut otInstance, aPanId: otPanId) -> otError;
8568}
8569unsafe extern "C" {
8570 #[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"]
8571 pub fn otLinkGetPollPeriod(aInstance: *mut otInstance) -> u32;
8572}
8573unsafe extern "C" {
8574 #[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"]
8575 pub fn otLinkSetPollPeriod(aInstance: *mut otInstance, aPollPeriod: u32) -> otError;
8576}
8577unsafe extern "C" {
8578 #[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."]
8579 pub fn otLinkGetShortAddress(aInstance: *mut otInstance) -> otShortAddress;
8580}
8581unsafe extern "C" {
8582 #[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."]
8583 pub fn otLinkGetAlternateShortAddress(aInstance: *mut otInstance) -> otShortAddress;
8584}
8585unsafe extern "C" {
8586 #[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."]
8587 pub fn otLinkGetMaxFrameRetriesDirect(aInstance: *mut otInstance) -> u8;
8588}
8589unsafe extern "C" {
8590 #[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."]
8591 pub fn otLinkSetMaxFrameRetriesDirect(aInstance: *mut otInstance, aMaxFrameRetriesDirect: u8);
8592}
8593unsafe extern "C" {
8594 #[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."]
8595 pub fn otLinkGetMaxFrameRetriesIndirect(aInstance: *mut otInstance) -> u8;
8596}
8597unsafe extern "C" {
8598 #[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."]
8599 pub fn otLinkSetMaxFrameRetriesIndirect(
8600 aInstance: *mut otInstance,
8601 aMaxFrameRetriesIndirect: u8,
8602 );
8603}
8604unsafe extern "C" {
8605 #[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."]
8606 pub fn otLinkGetFrameCounter(aInstance: *mut otInstance) -> u32;
8607}
8608unsafe extern "C" {
8609 #[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."]
8610 pub fn otLinkFilterGetAddressMode(aInstance: *mut otInstance) -> otMacFilterAddressMode;
8611}
8612unsafe extern "C" {
8613 #[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."]
8614 pub fn otLinkFilterSetAddressMode(aInstance: *mut otInstance, aMode: otMacFilterAddressMode);
8615}
8616unsafe extern "C" {
8617 #[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."]
8618 pub fn otLinkFilterAddAddress(
8619 aInstance: *mut otInstance,
8620 aExtAddress: *const otExtAddress,
8621 ) -> otError;
8622}
8623unsafe extern "C" {
8624 #[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)."]
8625 pub fn otLinkFilterRemoveAddress(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
8626}
8627unsafe extern "C" {
8628 #[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."]
8629 pub fn otLinkFilterClearAddresses(aInstance: *mut otInstance);
8630}
8631unsafe extern "C" {
8632 #[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."]
8633 pub fn otLinkFilterGetNextAddress(
8634 aInstance: *mut otInstance,
8635 aIterator: *mut otMacFilterIterator,
8636 aEntry: *mut otMacFilterEntry,
8637 ) -> otError;
8638}
8639unsafe extern "C" {
8640 #[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."]
8641 pub fn otLinkFilterAddRssIn(
8642 aInstance: *mut otInstance,
8643 aExtAddress: *const otExtAddress,
8644 aRss: i8,
8645 ) -> otError;
8646}
8647unsafe extern "C" {
8648 #[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."]
8649 pub fn otLinkFilterRemoveRssIn(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
8650}
8651unsafe extern "C" {
8652 #[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."]
8653 pub fn otLinkFilterSetDefaultRssIn(aInstance: *mut otInstance, aRss: i8);
8654}
8655unsafe extern "C" {
8656 #[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."]
8657 pub fn otLinkFilterClearDefaultRssIn(aInstance: *mut otInstance);
8658}
8659unsafe extern "C" {
8660 #[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."]
8661 pub fn otLinkFilterClearAllRssIn(aInstance: *mut otInstance);
8662}
8663unsafe extern "C" {
8664 #[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."]
8665 pub fn otLinkFilterGetNextRssIn(
8666 aInstance: *mut otInstance,
8667 aIterator: *mut otMacFilterIterator,
8668 aEntry: *mut otMacFilterEntry,
8669 ) -> otError;
8670}
8671unsafe extern "C" {
8672 #[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"]
8673 pub fn otLinkSetRadioFilterEnabled(aInstance: *mut otInstance, aFilterEnabled: bool);
8674}
8675unsafe extern "C" {
8676 #[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."]
8677 pub fn otLinkIsRadioFilterEnabled(aInstance: *mut otInstance) -> bool;
8678}
8679unsafe extern "C" {
8680 #[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."]
8681 pub fn otLinkConvertRssToLinkQuality(aInstance: *mut otInstance, aRss: i8) -> u8;
8682}
8683unsafe extern "C" {
8684 #[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."]
8685 pub fn otLinkConvertLinkQualityToRss(aInstance: *mut otInstance, aLinkQuality: u8) -> i8;
8686}
8687unsafe extern "C" {
8688 #[doc = " Gets histogram of retries for a single direct packet until success.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumberOfEntries A pointer to where the size of returned histogram array is placed.\n\n @returns A pointer to the histogram of retries (in a form of an array).\n The n-th element indicates that the packet has been sent with n-th retry."]
8689 pub fn otLinkGetTxDirectRetrySuccessHistogram(
8690 aInstance: *mut otInstance,
8691 aNumberOfEntries: *mut u8,
8692 ) -> *const u32;
8693}
8694unsafe extern "C" {
8695 #[doc = " Gets histogram of retries for a single indirect packet until success.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aNumberOfEntries A pointer to where the size of returned histogram array is placed.\n\n @returns A pointer to the histogram of retries (in a form of an array).\n The n-th element indicates that the packet has been sent with n-th retry."]
8696 pub fn otLinkGetTxIndirectRetrySuccessHistogram(
8697 aInstance: *mut otInstance,
8698 aNumberOfEntries: *mut u8,
8699 ) -> *const u32;
8700}
8701unsafe extern "C" {
8702 #[doc = " Clears histogram statistics for direct and indirect transmissions.\n\n Is valid when OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE configuration is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
8703 pub fn otLinkResetTxRetrySuccessHistogram(aInstance: *mut otInstance);
8704}
8705unsafe extern "C" {
8706 #[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."]
8707 pub fn otLinkGetCounters(aInstance: *mut otInstance) -> *const otMacCounters;
8708}
8709unsafe extern "C" {
8710 #[doc = " Resets the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
8711 pub fn otLinkResetCounters(aInstance: *mut otInstance);
8712}
8713#[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."]
8714pub type otLinkPcapCallback = ::std::option::Option<
8715 unsafe extern "C" fn(
8716 aFrame: *const otRadioFrame,
8717 aIsTx: bool,
8718 aContext: *mut ::std::os::raw::c_void,
8719 ),
8720>;
8721unsafe extern "C" {
8722 #[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."]
8723 pub fn otLinkSetPcapCallback(
8724 aInstance: *mut otInstance,
8725 aPcapCallback: otLinkPcapCallback,
8726 aCallbackContext: *mut ::std::os::raw::c_void,
8727 );
8728}
8729unsafe extern "C" {
8730 #[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."]
8731 pub fn otLinkIsPromiscuous(aInstance: *mut otInstance) -> bool;
8732}
8733unsafe extern "C" {
8734 #[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."]
8735 pub fn otLinkSetPromiscuous(aInstance: *mut otInstance, aPromiscuous: bool) -> otError;
8736}
8737unsafe extern "C" {
8738 #[doc = " Gets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL channel."]
8739 pub fn otLinkGetCslChannel(aInstance: *mut otInstance) -> u8;
8740}
8741unsafe extern "C" {
8742 #[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."]
8743 pub fn otLinkSetCslChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
8744}
8745unsafe extern "C" {
8746 #[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."]
8747 pub fn otLinkGetCslPeriod(aInstance: *mut otInstance) -> u32;
8748}
8749unsafe extern "C" {
8750 #[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"]
8751 pub fn otLinkSetCslPeriod(aInstance: *mut otInstance, aPeriod: u32) -> otError;
8752}
8753unsafe extern "C" {
8754 #[doc = " Gets the CSL timeout.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL timeout in seconds."]
8755 pub fn otLinkGetCslTimeout(aInstance: *mut otInstance) -> u32;
8756}
8757unsafe extern "C" {
8758 #[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."]
8759 pub fn otLinkSetCslTimeout(aInstance: *mut otInstance, aTimeout: u32) -> otError;
8760}
8761unsafe extern "C" {
8762 #[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."]
8763 pub fn otLinkGetCcaFailureRate(aInstance: *mut otInstance) -> u16;
8764}
8765unsafe extern "C" {
8766 #[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."]
8767 pub fn otLinkSetEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
8768}
8769unsafe extern "C" {
8770 #[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."]
8771 pub fn otLinkIsEnabled(aInstance: *mut otInstance) -> bool;
8772}
8773unsafe extern "C" {
8774 #[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."]
8775 pub fn otLinkIsCslEnabled(aInstance: *mut otInstance) -> bool;
8776}
8777unsafe extern "C" {
8778 #[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."]
8779 pub fn otLinkIsCslSupported(aInstance: *mut otInstance) -> bool;
8780}
8781unsafe extern "C" {
8782 #[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."]
8783 pub fn otLinkSendEmptyData(aInstance: *mut otInstance) -> otError;
8784}
8785unsafe extern "C" {
8786 #[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."]
8787 pub fn otLinkSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
8788}
8789unsafe extern "C" {
8790 #[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."]
8791 pub fn otLinkGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
8792}
8793unsafe extern "C" {
8794 #[doc = " Gets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Wake-up channel."]
8795 pub fn otLinkGetWakeupChannel(aInstance: *mut otInstance) -> u8;
8796}
8797unsafe extern "C" {
8798 #[doc = " Sets the Wake-up channel.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannel The Wake-up sample channel. Channel value should be `0` (Set Wake-up Channel unspecified,\n which means the device will use the PAN channel) or within the range [1, 10] (if 915-MHz\n supported) and [11, 26] (if 2.4 GHz supported).\n\n @retval OT_ERROR_NONE Successfully set the Wake-up channel.\n @retval OT_ERROR_INVALID_ARGS Invalid @p aChannel."]
8799 pub fn otLinkSetWakeupChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
8800}
8801unsafe extern "C" {
8802 #[doc = " Enables or disables listening for wake-up frames.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable true to enable listening for wake-up frames, or false otherwise.\n\n @retval OT_ERROR_NONE Successfully enabled / disabled the listening for wake-up frames.\n @retval OT_ERROR_INVALID_ARGS The listen duration is greater than the listen interval.\n @retval OT_ERROR_INVALID_STATE Could not enable listening for wake-up frames due to bad configuration."]
8803 pub fn otLinkSetWakeUpListenEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
8804}
8805unsafe extern "C" {
8806 #[doc = " Returns whether listening for wake-up frames is enabled.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If listening for wake-up frames is enabled.\n @retval FALSE If listening for wake-up frames is not enabled."]
8807 pub fn otLinkIsWakeupListenEnabled(aInstance: *mut otInstance) -> bool;
8808}
8809unsafe extern "C" {
8810 #[doc = " Get the wake-up listen parameters.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[out] aInterval A pointer to return the wake-up listen interval in microseconds.\n @param[out] aDuration A pointer to return the wake-up listen duration in microseconds."]
8811 pub fn otLinkGetWakeupListenParameters(
8812 aInstance: *mut otInstance,
8813 aInterval: *mut u32,
8814 aDuration: *mut u32,
8815 );
8816}
8817unsafe extern "C" {
8818 #[doc = " Set the wake-up listen parameters.\n\n The listen interval must be greater than the listen duration.\n The listen duration must be greater or equal than the minimum supported.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aInterval The wake-up listen interval in microseconds.\n @param[in] aDuration The wake-up listen duration in microseconds.\n\n @retval OT_ERROR_NONE Successfully set the wake-up listen parameters.\n @retval OT_ERROR_INVALID_ARGS Invalid wake-up listen parameters."]
8819 pub fn otLinkSetWakeupListenParameters(
8820 aInstance: *mut otInstance,
8821 aInterval: u32,
8822 aDuration: u32,
8823 ) -> otError;
8824}
8825unsafe extern "C" {
8826 #[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."]
8827 pub fn otLinkSetRxOnWhenIdle(aInstance: *mut otInstance, aRxOnWhenIdle: bool) -> otError;
8828}
8829#[doc = " Represents the result (value) for a Link Metrics query."]
8830#[repr(C)]
8831#[derive(Debug, Default, Copy, Clone)]
8832pub struct otLinkMetricsValues {
8833 #[doc = "< Specifies which metrics values are present/included."]
8834 pub mMetrics: otLinkMetrics,
8835 #[doc = "< The value of Pdu Count."]
8836 pub mPduCountValue: u32,
8837 #[doc = "< The value LQI."]
8838 pub mLqiValue: u8,
8839 #[doc = "< The value of Link Margin."]
8840 pub mLinkMarginValue: u8,
8841 #[doc = "< The value of Rssi."]
8842 pub mRssiValue: i8,
8843}
8844#[doc = " Represents which frames are accounted in a Forward Tracking Series."]
8845#[repr(C)]
8846#[derive(Debug, Default, Copy, Clone)]
8847pub struct otLinkMetricsSeriesFlags {
8848 pub _bitfield_align_1: [u8; 0],
8849 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8850}
8851impl otLinkMetricsSeriesFlags {
8852 #[inline]
8853 pub fn mLinkProbe(&self) -> bool {
8854 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
8855 }
8856 #[inline]
8857 pub fn set_mLinkProbe(&mut self, val: bool) {
8858 unsafe {
8859 let val: u8 = ::std::mem::transmute(val);
8860 self._bitfield_1.set(0usize, 1u8, val as u64)
8861 }
8862 }
8863 #[inline]
8864 pub unsafe fn mLinkProbe_raw(this: *const Self) -> bool {
8865 unsafe {
8866 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8867 ::std::ptr::addr_of!((*this)._bitfield_1),
8868 0usize,
8869 1u8,
8870 ) as u8)
8871 }
8872 }
8873 #[inline]
8874 pub unsafe fn set_mLinkProbe_raw(this: *mut Self, val: bool) {
8875 unsafe {
8876 let val: u8 = ::std::mem::transmute(val);
8877 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8878 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8879 0usize,
8880 1u8,
8881 val as u64,
8882 )
8883 }
8884 }
8885 #[inline]
8886 pub fn mMacData(&self) -> bool {
8887 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
8888 }
8889 #[inline]
8890 pub fn set_mMacData(&mut self, val: bool) {
8891 unsafe {
8892 let val: u8 = ::std::mem::transmute(val);
8893 self._bitfield_1.set(1usize, 1u8, val as u64)
8894 }
8895 }
8896 #[inline]
8897 pub unsafe fn mMacData_raw(this: *const Self) -> bool {
8898 unsafe {
8899 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8900 ::std::ptr::addr_of!((*this)._bitfield_1),
8901 1usize,
8902 1u8,
8903 ) as u8)
8904 }
8905 }
8906 #[inline]
8907 pub unsafe fn set_mMacData_raw(this: *mut Self, val: bool) {
8908 unsafe {
8909 let val: u8 = ::std::mem::transmute(val);
8910 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8911 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8912 1usize,
8913 1u8,
8914 val as u64,
8915 )
8916 }
8917 }
8918 #[inline]
8919 pub fn mMacDataRequest(&self) -> bool {
8920 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
8921 }
8922 #[inline]
8923 pub fn set_mMacDataRequest(&mut self, val: bool) {
8924 unsafe {
8925 let val: u8 = ::std::mem::transmute(val);
8926 self._bitfield_1.set(2usize, 1u8, val as u64)
8927 }
8928 }
8929 #[inline]
8930 pub unsafe fn mMacDataRequest_raw(this: *const Self) -> bool {
8931 unsafe {
8932 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8933 ::std::ptr::addr_of!((*this)._bitfield_1),
8934 2usize,
8935 1u8,
8936 ) as u8)
8937 }
8938 }
8939 #[inline]
8940 pub unsafe fn set_mMacDataRequest_raw(this: *mut Self, val: bool) {
8941 unsafe {
8942 let val: u8 = ::std::mem::transmute(val);
8943 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8944 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8945 2usize,
8946 1u8,
8947 val as u64,
8948 )
8949 }
8950 }
8951 #[inline]
8952 pub fn mMacAck(&self) -> bool {
8953 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
8954 }
8955 #[inline]
8956 pub fn set_mMacAck(&mut self, val: bool) {
8957 unsafe {
8958 let val: u8 = ::std::mem::transmute(val);
8959 self._bitfield_1.set(3usize, 1u8, val as u64)
8960 }
8961 }
8962 #[inline]
8963 pub unsafe fn mMacAck_raw(this: *const Self) -> bool {
8964 unsafe {
8965 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8966 ::std::ptr::addr_of!((*this)._bitfield_1),
8967 3usize,
8968 1u8,
8969 ) as u8)
8970 }
8971 }
8972 #[inline]
8973 pub unsafe fn set_mMacAck_raw(this: *mut Self, val: bool) {
8974 unsafe {
8975 let val: u8 = ::std::mem::transmute(val);
8976 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8977 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8978 3usize,
8979 1u8,
8980 val as u64,
8981 )
8982 }
8983 }
8984 #[inline]
8985 pub fn new_bitfield_1(
8986 mLinkProbe: bool,
8987 mMacData: bool,
8988 mMacDataRequest: bool,
8989 mMacAck: bool,
8990 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8991 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8992 __bindgen_bitfield_unit.set(0usize, 1u8, {
8993 let mLinkProbe: u8 = unsafe { ::std::mem::transmute(mLinkProbe) };
8994 mLinkProbe as u64
8995 });
8996 __bindgen_bitfield_unit.set(1usize, 1u8, {
8997 let mMacData: u8 = unsafe { ::std::mem::transmute(mMacData) };
8998 mMacData as u64
8999 });
9000 __bindgen_bitfield_unit.set(2usize, 1u8, {
9001 let mMacDataRequest: u8 = unsafe { ::std::mem::transmute(mMacDataRequest) };
9002 mMacDataRequest as u64
9003 });
9004 __bindgen_bitfield_unit.set(3usize, 1u8, {
9005 let mMacAck: u8 = unsafe { ::std::mem::transmute(mMacAck) };
9006 mMacAck as u64
9007 });
9008 __bindgen_bitfield_unit
9009 }
9010}
9011#[doc = "< Clear."]
9012pub const OT_LINK_METRICS_ENH_ACK_CLEAR: otLinkMetricsEnhAckFlags = 0;
9013#[doc = "< Register."]
9014pub const OT_LINK_METRICS_ENH_ACK_REGISTER: otLinkMetricsEnhAckFlags = 1;
9015#[doc = " Enhanced-ACK Flags.\n\n These are used in Enhanced-ACK Based Probing to indicate whether to register or clear the probing."]
9016pub type otLinkMetricsEnhAckFlags = ::std::os::raw::c_uint;
9017pub const OT_LINK_METRICS_STATUS_SUCCESS: otLinkMetricsStatus = 0;
9018pub const OT_LINK_METRICS_STATUS_CANNOT_SUPPORT_NEW_SERIES: otLinkMetricsStatus = 1;
9019pub const OT_LINK_METRICS_STATUS_SERIESID_ALREADY_REGISTERED: otLinkMetricsStatus = 2;
9020pub const OT_LINK_METRICS_STATUS_SERIESID_NOT_RECOGNIZED: otLinkMetricsStatus = 3;
9021pub const OT_LINK_METRICS_STATUS_NO_MATCHING_FRAMES_RECEIVED: otLinkMetricsStatus = 4;
9022pub const OT_LINK_METRICS_STATUS_OTHER_ERROR: otLinkMetricsStatus = 254;
9023#[doc = " Link Metrics Status values."]
9024pub type otLinkMetricsStatus = ::std::os::raw::c_uint;
9025#[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."]
9026pub type otLinkMetricsReportCallback = ::std::option::Option<
9027 unsafe extern "C" fn(
9028 aSource: *const otIp6Address,
9029 aMetricsValues: *const otLinkMetricsValues,
9030 aStatus: otLinkMetricsStatus,
9031 aContext: *mut ::std::os::raw::c_void,
9032 ),
9033>;
9034#[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."]
9035pub type otLinkMetricsMgmtResponseCallback = ::std::option::Option<
9036 unsafe extern "C" fn(
9037 aSource: *const otIp6Address,
9038 aStatus: otLinkMetricsStatus,
9039 aContext: *mut ::std::os::raw::c_void,
9040 ),
9041>;
9042#[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."]
9043pub type otLinkMetricsEnhAckProbingIeReportCallback = ::std::option::Option<
9044 unsafe extern "C" fn(
9045 aShortAddress: otShortAddress,
9046 aExtAddress: *const otExtAddress,
9047 aMetricsValues: *const otLinkMetricsValues,
9048 aContext: *mut ::std::os::raw::c_void,
9049 ),
9050>;
9051unsafe extern "C" {
9052 #[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."]
9053 pub fn otLinkMetricsQuery(
9054 aInstance: *mut otInstance,
9055 aDestination: *const otIp6Address,
9056 aSeriesId: u8,
9057 aLinkMetricsFlags: *const otLinkMetrics,
9058 aCallback: otLinkMetricsReportCallback,
9059 aCallbackContext: *mut ::std::os::raw::c_void,
9060 ) -> otError;
9061}
9062unsafe extern "C" {
9063 #[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."]
9064 pub fn otLinkMetricsConfigForwardTrackingSeries(
9065 aInstance: *mut otInstance,
9066 aDestination: *const otIp6Address,
9067 aSeriesId: u8,
9068 aSeriesFlags: otLinkMetricsSeriesFlags,
9069 aLinkMetricsFlags: *const otLinkMetrics,
9070 aCallback: otLinkMetricsMgmtResponseCallback,
9071 aCallbackContext: *mut ::std::os::raw::c_void,
9072 ) -> otError;
9073}
9074unsafe extern "C" {
9075 #[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."]
9076 pub fn otLinkMetricsConfigEnhAckProbing(
9077 aInstance: *mut otInstance,
9078 aDestination: *const otIp6Address,
9079 aEnhAckFlags: otLinkMetricsEnhAckFlags,
9080 aLinkMetricsFlags: *const otLinkMetrics,
9081 aCallback: otLinkMetricsMgmtResponseCallback,
9082 aCallbackContext: *mut ::std::os::raw::c_void,
9083 aEnhAckCallback: otLinkMetricsEnhAckProbingIeReportCallback,
9084 aEnhAckCallbackContext: *mut ::std::os::raw::c_void,
9085 ) -> otError;
9086}
9087unsafe extern "C" {
9088 #[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."]
9089 pub fn otLinkMetricsSendLinkProbe(
9090 aInstance: *mut otInstance,
9091 aDestination: *const otIp6Address,
9092 aSeriesId: u8,
9093 aLength: u8,
9094 ) -> otError;
9095}
9096unsafe extern "C" {
9097 #[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."]
9098 pub fn otLinkMetricsManagerIsEnabled(aInstance: *mut otInstance) -> bool;
9099}
9100unsafe extern "C" {
9101 #[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."]
9102 pub fn otLinkMetricsManagerSetEnabled(aInstance: *mut otInstance, aEnable: bool);
9103}
9104unsafe extern "C" {
9105 #[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."]
9106 pub fn otLinkMetricsManagerGetMetricsValueByExtAddr(
9107 aInstance: *mut otInstance,
9108 aExtAddress: *const otExtAddress,
9109 aLinkMetricsValues: *mut otLinkMetricsValues,
9110 ) -> otError;
9111}
9112#[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."]
9113pub type otLinkRawReceiveDone = ::std::option::Option<
9114 unsafe extern "C" fn(aInstance: *mut otInstance, aFrame: *mut otRadioFrame, aError: otError),
9115>;
9116unsafe extern "C" {
9117 #[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."]
9118 pub fn otLinkRawSetReceiveDone(
9119 aInstance: *mut otInstance,
9120 aCallback: otLinkRawReceiveDone,
9121 ) -> otError;
9122}
9123unsafe extern "C" {
9124 #[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."]
9125 pub fn otLinkRawIsEnabled(aInstance: *mut otInstance) -> bool;
9126}
9127unsafe extern "C" {
9128 #[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."]
9129 pub fn otLinkRawGetPromiscuous(aInstance: *mut otInstance) -> bool;
9130}
9131unsafe extern "C" {
9132 #[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."]
9133 pub fn otLinkRawSetPromiscuous(aInstance: *mut otInstance, aEnable: bool) -> otError;
9134}
9135unsafe extern "C" {
9136 #[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."]
9137 pub fn otLinkRawSetShortAddress(aInstance: *mut otInstance, aShortAddress: u16) -> otError;
9138}
9139unsafe extern "C" {
9140 #[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."]
9141 pub fn otLinkRawSetAlternateShortAddress(
9142 aInstance: *mut otInstance,
9143 aShortAddress: otShortAddress,
9144 ) -> otError;
9145}
9146unsafe extern "C" {
9147 #[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"]
9148 pub fn otLinkRawSleep(aInstance: *mut otInstance) -> otError;
9149}
9150unsafe extern "C" {
9151 #[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."]
9152 pub fn otLinkRawReceive(aInstance: *mut otInstance) -> otError;
9153}
9154unsafe extern "C" {
9155 #[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."]
9156 pub fn otLinkRawGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
9157}
9158#[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."]
9159pub type otLinkRawTransmitDone = ::std::option::Option<
9160 unsafe extern "C" fn(
9161 aInstance: *mut otInstance,
9162 aFrame: *mut otRadioFrame,
9163 aAckFrame: *mut otRadioFrame,
9164 aError: otError,
9165 ),
9166>;
9167unsafe extern "C" {
9168 #[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."]
9169 pub fn otLinkRawTransmit(
9170 aInstance: *mut otInstance,
9171 aCallback: otLinkRawTransmitDone,
9172 ) -> otError;
9173}
9174unsafe extern "C" {
9175 #[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."]
9176 pub fn otLinkRawGetRssi(aInstance: *mut otInstance) -> i8;
9177}
9178unsafe extern "C" {
9179 #[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."]
9180 pub fn otLinkRawGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
9181}
9182#[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."]
9183pub type otLinkRawEnergyScanDone =
9184 ::std::option::Option<unsafe extern "C" fn(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8)>;
9185unsafe extern "C" {
9186 #[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."]
9187 pub fn otLinkRawEnergyScan(
9188 aInstance: *mut otInstance,
9189 aScanChannel: u8,
9190 aScanDuration: u16,
9191 aCallback: otLinkRawEnergyScanDone,
9192 ) -> otError;
9193}
9194unsafe extern "C" {
9195 #[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."]
9196 pub fn otLinkRawSrcMatchEnable(aInstance: *mut otInstance, aEnable: bool) -> otError;
9197}
9198unsafe extern "C" {
9199 #[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."]
9200 pub fn otLinkRawSrcMatchAddShortEntry(
9201 aInstance: *mut otInstance,
9202 aShortAddress: u16,
9203 ) -> otError;
9204}
9205unsafe extern "C" {
9206 #[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."]
9207 pub fn otLinkRawSrcMatchAddExtEntry(
9208 aInstance: *mut otInstance,
9209 aExtAddress: *const otExtAddress,
9210 ) -> otError;
9211}
9212unsafe extern "C" {
9213 #[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."]
9214 pub fn otLinkRawSrcMatchClearShortEntry(
9215 aInstance: *mut otInstance,
9216 aShortAddress: u16,
9217 ) -> otError;
9218}
9219unsafe extern "C" {
9220 #[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."]
9221 pub fn otLinkRawSrcMatchClearExtEntry(
9222 aInstance: *mut otInstance,
9223 aExtAddress: *const otExtAddress,
9224 ) -> otError;
9225}
9226unsafe extern "C" {
9227 #[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."]
9228 pub fn otLinkRawSrcMatchClearShortEntries(aInstance: *mut otInstance) -> otError;
9229}
9230unsafe extern "C" {
9231 #[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."]
9232 pub fn otLinkRawSrcMatchClearExtEntries(aInstance: *mut otInstance) -> otError;
9233}
9234unsafe extern "C" {
9235 #[doc = " Update MAC keys and key index.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aKeyIdMode The key ID mode.\n @param[in] aKeyId The key index.\n @param[in] aPrevKey The previous MAC key.\n @param[in] aCurrKey The current MAC key.\n @param[in] aNextKey The next MAC key.\n\n @retval OT_ERROR_NONE If successful.\n @retval OT_ERROR_INVALID_STATE If the raw link-layer isn't enabled."]
9236 pub fn otLinkRawSetMacKey(
9237 aInstance: *mut otInstance,
9238 aKeyIdMode: u8,
9239 aKeyId: u8,
9240 aPrevKey: *const otMacKey,
9241 aCurrKey: *const otMacKey,
9242 aNextKey: *const otMacKey,
9243 ) -> otError;
9244}
9245unsafe extern "C" {
9246 #[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."]
9247 pub fn otLinkRawSetMacFrameCounter(
9248 aInstance: *mut otInstance,
9249 aMacFrameCounter: u32,
9250 ) -> otError;
9251}
9252unsafe extern "C" {
9253 #[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."]
9254 pub fn otLinkRawSetMacFrameCounterIfLarger(
9255 aInstance: *mut otInstance,
9256 aMacFrameCounter: u32,
9257 ) -> otError;
9258}
9259unsafe extern "C" {
9260 #[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."]
9261 pub fn otLinkRawGetRadioTime(aInstance: *mut otInstance) -> u64;
9262}
9263unsafe extern "C" {
9264 #[doc = " Returns the current log level.\n\n If dynamic log level feature `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is enabled, this function returns the\n currently set dynamic log level. Otherwise, this function returns the build-time configured log level.\n\n @returns The log level."]
9265 pub fn otLoggingGetLevel() -> otLogLevel;
9266}
9267unsafe extern "C" {
9268 #[doc = " Sets the log level.\n\n @note This function requires `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1`.\n\n @param[in] aLogLevel The log level.\n\n @retval OT_ERROR_NONE Successfully updated log level.\n @retval OT_ERROR_INVALID_ARGS Log level value is invalid."]
9269 pub fn otLoggingSetLevel(aLogLevel: otLogLevel) -> otError;
9270}
9271unsafe extern "C" {
9272 #[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."]
9273 pub fn otLogCritPlat(aFormat: *const ::std::os::raw::c_char, ...);
9274}
9275unsafe extern "C" {
9276 #[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."]
9277 pub fn otLogWarnPlat(aFormat: *const ::std::os::raw::c_char, ...);
9278}
9279unsafe extern "C" {
9280 #[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."]
9281 pub fn otLogNotePlat(aFormat: *const ::std::os::raw::c_char, ...);
9282}
9283unsafe extern "C" {
9284 #[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."]
9285 pub fn otLogInfoPlat(aFormat: *const ::std::os::raw::c_char, ...);
9286}
9287unsafe extern "C" {
9288 #[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."]
9289 pub fn otLogDebgPlat(aFormat: *const ::std::os::raw::c_char, ...);
9290}
9291unsafe extern "C" {
9292 #[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."]
9293 pub fn otDumpCritPlat(
9294 aText: *const ::std::os::raw::c_char,
9295 aData: *const ::std::os::raw::c_void,
9296 aDataLength: u16,
9297 );
9298}
9299unsafe extern "C" {
9300 #[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."]
9301 pub fn otDumpWarnPlat(
9302 aText: *const ::std::os::raw::c_char,
9303 aData: *const ::std::os::raw::c_void,
9304 aDataLength: u16,
9305 );
9306}
9307unsafe extern "C" {
9308 #[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."]
9309 pub fn otDumpNotePlat(
9310 aText: *const ::std::os::raw::c_char,
9311 aData: *const ::std::os::raw::c_void,
9312 aDataLength: u16,
9313 );
9314}
9315unsafe extern "C" {
9316 #[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."]
9317 pub fn otDumpInfoPlat(
9318 aText: *const ::std::os::raw::c_char,
9319 aData: *const ::std::os::raw::c_void,
9320 aDataLength: u16,
9321 );
9322}
9323unsafe extern "C" {
9324 #[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."]
9325 pub fn otDumpDebgPlat(
9326 aText: *const ::std::os::raw::c_char,
9327 aData: *const ::std::os::raw::c_void,
9328 aDataLength: u16,
9329 );
9330}
9331unsafe extern "C" {
9332 #[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."]
9333 pub fn otLogPlat(
9334 aLogLevel: otLogLevel,
9335 aPlatModuleName: *const ::std::os::raw::c_char,
9336 aFormat: *const ::std::os::raw::c_char,
9337 ...
9338 );
9339}
9340unsafe extern "C" {
9341 #[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."]
9342 pub fn otLogPlatArgs(
9343 aLogLevel: otLogLevel,
9344 aPlatModuleName: *const ::std::os::raw::c_char,
9345 aFormat: *const ::std::os::raw::c_char,
9346 aArgs: *mut __va_list_tag,
9347 );
9348}
9349unsafe extern "C" {
9350 #[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."]
9351 pub fn otLogCli(aLogLevel: otLogLevel, aFormat: *const ::std::os::raw::c_char, ...);
9352}
9353#[doc = " Represents information used for generating hex dump output."]
9354#[repr(C)]
9355#[derive(Debug, Copy, Clone)]
9356pub struct otLogHexDumpInfo {
9357 #[doc = "< The data byes."]
9358 pub mDataBytes: *const u8,
9359 #[doc = "< The data length (number of bytes in @p mDataBytes)"]
9360 pub mDataLength: u16,
9361 #[doc = "< Title string to add table header (MUST NOT be `NULL`)."]
9362 pub mTitle: *const ::std::os::raw::c_char,
9363 #[doc = "< Buffer to output one line of generated hex dump."]
9364 pub mLine: [::std::os::raw::c_char; 73usize],
9365 #[doc = "< Iterator used by OT stack. MUST be initialized to zero."]
9366 pub mIterator: u16,
9367}
9368impl Default for otLogHexDumpInfo {
9369 fn default() -> Self {
9370 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9371 unsafe {
9372 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9373 s.assume_init()
9374 }
9375 }
9376}
9377unsafe extern "C" {
9378 #[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."]
9379 pub fn otLogGenerateNextHexDumpLine(aInfo: *mut otLogHexDumpInfo) -> otError;
9380}
9381#[doc = " Represents information associated with a radio link."]
9382#[repr(C)]
9383#[derive(Debug, Default, Copy, Clone)]
9384pub struct otRadioLinkInfo {
9385 #[doc = "< Preference level of radio link"]
9386 pub mPreference: u8,
9387}
9388#[doc = " Represents multi radio link information associated with a neighbor."]
9389#[repr(C)]
9390#[derive(Debug, Default, Copy, Clone)]
9391pub struct otMultiRadioNeighborInfo {
9392 pub _bitfield_align_1: [u8; 0],
9393 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9394 #[doc = "< Additional info for 15.4 radio link (applicable when supported)."]
9395 pub mIeee802154Info: otRadioLinkInfo,
9396 #[doc = "< Additional info for TREL radio link (applicable when supported)."]
9397 pub mTrelUdp6Info: otRadioLinkInfo,
9398}
9399impl otMultiRadioNeighborInfo {
9400 #[inline]
9401 pub fn mSupportsIeee802154(&self) -> bool {
9402 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9403 }
9404 #[inline]
9405 pub fn set_mSupportsIeee802154(&mut self, val: bool) {
9406 unsafe {
9407 let val: u8 = ::std::mem::transmute(val);
9408 self._bitfield_1.set(0usize, 1u8, val as u64)
9409 }
9410 }
9411 #[inline]
9412 pub unsafe fn mSupportsIeee802154_raw(this: *const Self) -> bool {
9413 unsafe {
9414 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9415 ::std::ptr::addr_of!((*this)._bitfield_1),
9416 0usize,
9417 1u8,
9418 ) as u8)
9419 }
9420 }
9421 #[inline]
9422 pub unsafe fn set_mSupportsIeee802154_raw(this: *mut Self, val: bool) {
9423 unsafe {
9424 let val: u8 = ::std::mem::transmute(val);
9425 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9426 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9427 0usize,
9428 1u8,
9429 val as u64,
9430 )
9431 }
9432 }
9433 #[inline]
9434 pub fn mSupportsTrelUdp6(&self) -> bool {
9435 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9436 }
9437 #[inline]
9438 pub fn set_mSupportsTrelUdp6(&mut self, val: bool) {
9439 unsafe {
9440 let val: u8 = ::std::mem::transmute(val);
9441 self._bitfield_1.set(1usize, 1u8, val as u64)
9442 }
9443 }
9444 #[inline]
9445 pub unsafe fn mSupportsTrelUdp6_raw(this: *const Self) -> bool {
9446 unsafe {
9447 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9448 ::std::ptr::addr_of!((*this)._bitfield_1),
9449 1usize,
9450 1u8,
9451 ) as u8)
9452 }
9453 }
9454 #[inline]
9455 pub unsafe fn set_mSupportsTrelUdp6_raw(this: *mut Self, val: bool) {
9456 unsafe {
9457 let val: u8 = ::std::mem::transmute(val);
9458 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9459 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9460 1usize,
9461 1u8,
9462 val as u64,
9463 )
9464 }
9465 }
9466 #[inline]
9467 pub fn new_bitfield_1(
9468 mSupportsIeee802154: bool,
9469 mSupportsTrelUdp6: bool,
9470 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9471 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9472 __bindgen_bitfield_unit.set(0usize, 1u8, {
9473 let mSupportsIeee802154: u8 = unsafe { ::std::mem::transmute(mSupportsIeee802154) };
9474 mSupportsIeee802154 as u64
9475 });
9476 __bindgen_bitfield_unit.set(1usize, 1u8, {
9477 let mSupportsTrelUdp6: u8 = unsafe { ::std::mem::transmute(mSupportsTrelUdp6) };
9478 mSupportsTrelUdp6 as u64
9479 });
9480 __bindgen_bitfield_unit
9481 }
9482}
9483unsafe extern "C" {
9484 #[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."]
9485 pub fn otMultiRadioGetNeighborInfo(
9486 aInstance: *mut otInstance,
9487 aExtAddress: *const otExtAddress,
9488 aNeighborInfo: *mut otMultiRadioNeighborInfo,
9489 ) -> otError;
9490}
9491#[doc = " @struct otIp4Address\n\n Represents an IPv4 address."]
9492#[repr(C, packed)]
9493#[derive(Copy, Clone)]
9494pub struct otIp4Address {
9495 pub mFields: otIp4Address__bindgen_ty_1,
9496}
9497#[repr(C, packed)]
9498#[derive(Copy, Clone)]
9499pub union otIp4Address__bindgen_ty_1 {
9500 #[doc = "< 8-bit fields"]
9501 pub m8: [u8; 4usize],
9502 #[doc = "< 32-bit representation"]
9503 pub m32: u32,
9504}
9505impl Default for otIp4Address__bindgen_ty_1 {
9506 fn default() -> Self {
9507 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9508 unsafe {
9509 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9510 s.assume_init()
9511 }
9512 }
9513}
9514impl Default for otIp4Address {
9515 fn default() -> Self {
9516 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9517 unsafe {
9518 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9519 s.assume_init()
9520 }
9521 }
9522}
9523#[doc = " @struct otIp4Cidr\n\n Represents an IPv4 CIDR block."]
9524#[repr(C)]
9525#[derive(Copy, Clone)]
9526pub struct otIp4Cidr {
9527 pub mAddress: otIp4Address,
9528 pub mLength: u8,
9529}
9530impl Default for otIp4Cidr {
9531 fn default() -> Self {
9532 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9533 unsafe {
9534 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9535 s.assume_init()
9536 }
9537 }
9538}
9539#[doc = " Represents the counters for NAT64."]
9540#[repr(C)]
9541#[derive(Debug, Default, Copy, Clone)]
9542pub struct otNat64Counters {
9543 #[doc = "< Number of packets translated from IPv4 to IPv6."]
9544 pub m4To6Packets: u64,
9545 #[doc = "< Sum of size of packets translated from IPv4 to IPv6."]
9546 pub m4To6Bytes: u64,
9547 #[doc = "< Number of packets translated from IPv6 to IPv4."]
9548 pub m6To4Packets: u64,
9549 #[doc = "< Sum of size of packets translated from IPv6 to IPv4."]
9550 pub m6To4Bytes: u64,
9551}
9552#[doc = " Represents the counters for the protocols supported by NAT64."]
9553#[repr(C)]
9554#[derive(Debug, Default, Copy, Clone)]
9555pub struct otNat64ProtocolCounters {
9556 #[doc = "< Counters for sum of all protocols."]
9557 pub mTotal: otNat64Counters,
9558 #[doc = "< Counters for ICMP and ICMPv6."]
9559 pub mIcmp: otNat64Counters,
9560 #[doc = "< Counters for UDP."]
9561 pub mUdp: otNat64Counters,
9562 #[doc = "< Counters for TCP."]
9563 pub mTcp: otNat64Counters,
9564}
9565#[doc = "< Packet drop for unknown reasons."]
9566pub const OT_NAT64_DROP_REASON_UNKNOWN: otNat64DropReason = 0;
9567#[doc = "< Packet drop due to failed to parse the datagram."]
9568pub const OT_NAT64_DROP_REASON_ILLEGAL_PACKET: otNat64DropReason = 1;
9569#[doc = "< Packet drop due to unsupported IP protocol."]
9570pub const OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO: otNat64DropReason = 2;
9571#[doc = "< Packet drop due to no mappings found or mapping pool exhausted."]
9572pub const OT_NAT64_DROP_REASON_NO_MAPPING: otNat64DropReason = 3;
9573pub const OT_NAT64_DROP_REASON_COUNT: otNat64DropReason = 4;
9574#[doc = " Packet drop reasons."]
9575pub type otNat64DropReason = ::std::os::raw::c_uint;
9576#[doc = " Represents the counters of dropped packets due to errors when handling NAT64 packets."]
9577#[repr(C)]
9578#[derive(Debug, Default, Copy, Clone)]
9579pub struct otNat64ErrorCounters {
9580 #[doc = "< Errors translating IPv4 packets."]
9581 pub mCount4To6: [u64; 4usize],
9582 #[doc = "< Errors translating IPv6 packets."]
9583 pub mCount6To4: [u64; 4usize],
9584}
9585unsafe extern "C" {
9586 #[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."]
9587 pub fn otNat64GetCounters(aInstance: *mut otInstance, aCounters: *mut otNat64ProtocolCounters);
9588}
9589unsafe extern "C" {
9590 #[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."]
9591 pub fn otNat64GetErrorCounters(
9592 aInstance: *mut otInstance,
9593 aCounters: *mut otNat64ErrorCounters,
9594 );
9595}
9596#[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."]
9597#[repr(C)]
9598#[derive(Copy, Clone)]
9599pub struct otNat64AddressMapping {
9600 #[doc = "< The unique id for a mapping session."]
9601 pub mId: u64,
9602 #[doc = "< The IPv4 address of the mapping."]
9603 pub mIp4: otIp4Address,
9604 #[doc = "< The IPv6 address of the mapping."]
9605 pub mIp6: otIp6Address,
9606 #[doc = " The source port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
9607 pub mSrcPortOrId: u16,
9608 #[doc = " The translated port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
9609 pub mTranslatedPortOrId: u16,
9610 #[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."]
9611 pub mRemainingTimeMs: u32,
9612 #[doc = "< Counters."]
9613 pub mCounters: otNat64ProtocolCounters,
9614}
9615impl Default for otNat64AddressMapping {
9616 fn default() -> Self {
9617 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9618 unsafe {
9619 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9620 s.assume_init()
9621 }
9622 }
9623}
9624#[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."]
9625#[repr(C)]
9626#[derive(Debug, Copy, Clone)]
9627pub struct otNat64AddressMappingIterator {
9628 pub mPtr: *const ::std::os::raw::c_void,
9629 pub mData32: u32,
9630}
9631impl Default for otNat64AddressMappingIterator {
9632 fn default() -> Self {
9633 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9634 unsafe {
9635 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9636 s.assume_init()
9637 }
9638 }
9639}
9640unsafe extern "C" {
9641 #[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."]
9642 pub fn otNat64InitAddressMappingIterator(
9643 aInstance: *mut otInstance,
9644 aIterator: *mut otNat64AddressMappingIterator,
9645 );
9646}
9647unsafe extern "C" {
9648 #[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."]
9649 pub fn otNat64GetNextAddressMapping(
9650 aInstance: *mut otInstance,
9651 aIterator: *mut otNat64AddressMappingIterator,
9652 aMapping: *mut otNat64AddressMapping,
9653 ) -> otError;
9654}
9655#[doc = "< NAT64 is disabled."]
9656pub const OT_NAT64_STATE_DISABLED: otNat64State = 0;
9657#[doc = "< NAT64 is enabled, but one or more dependencies of NAT64 are not running."]
9658pub const OT_NAT64_STATE_NOT_RUNNING: otNat64State = 1;
9659#[doc = "< NAT64 is enabled, but this BR is not an active NAT64 BR."]
9660pub const OT_NAT64_STATE_IDLE: otNat64State = 2;
9661#[doc = "< The BR is publishing a NAT64 prefix and/or translating packets."]
9662pub const OT_NAT64_STATE_ACTIVE: otNat64State = 3;
9663#[doc = " States of NAT64."]
9664pub type otNat64State = ::std::os::raw::c_uint;
9665unsafe extern "C" {
9666 #[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."]
9667 pub fn otNat64GetTranslatorState(aInstance: *mut otInstance) -> otNat64State;
9668}
9669unsafe extern "C" {
9670 #[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."]
9671 pub fn otNat64GetPrefixManagerState(aInstance: *mut otInstance) -> otNat64State;
9672}
9673unsafe extern "C" {
9674 #[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"]
9675 pub fn otNat64SetEnabled(aInstance: *mut otInstance, aEnabled: bool);
9676}
9677unsafe extern "C" {
9678 #[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"]
9679 pub fn otIp4NewMessage(
9680 aInstance: *mut otInstance,
9681 aSettings: *const otMessageSettings,
9682 ) -> *mut otMessage;
9683}
9684unsafe extern "C" {
9685 #[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"]
9686 pub fn otNat64SetIp4Cidr(aInstance: *mut otInstance, aCidr: *const otIp4Cidr) -> otError;
9687}
9688unsafe extern "C" {
9689 #[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"]
9690 pub fn otNat64ClearIp4Cidr(aInstance: *mut otInstance);
9691}
9692unsafe extern "C" {
9693 #[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."]
9694 pub fn otNat64Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
9695}
9696#[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."]
9697pub type otNat64ReceiveIp4Callback = ::std::option::Option<
9698 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
9699>;
9700unsafe extern "C" {
9701 #[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."]
9702 pub fn otNat64SetReceiveIp4Callback(
9703 aInstance: *mut otInstance,
9704 aCallback: otNat64ReceiveIp4Callback,
9705 aContext: *mut ::std::os::raw::c_void,
9706 );
9707}
9708unsafe extern "C" {
9709 #[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."]
9710 pub fn otNat64GetCidr(aInstance: *mut otInstance, aCidr: *mut otIp4Cidr) -> otError;
9711}
9712unsafe extern "C" {
9713 #[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."]
9714 pub fn otIp4IsAddressEqual(aFirst: *const otIp4Address, aSecond: *const otIp4Address) -> bool;
9715}
9716unsafe extern "C" {
9717 #[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."]
9718 pub fn otIp4ExtractFromIp6Address(
9719 aPrefixLength: u8,
9720 aIp6Address: *const otIp6Address,
9721 aIp4Address: *mut otIp4Address,
9722 );
9723}
9724unsafe extern "C" {
9725 #[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."]
9726 pub fn otIp4FromIp4MappedIp6Address(
9727 aIp6Address: *const otIp6Address,
9728 aIp4Address: *mut otIp4Address,
9729 ) -> otError;
9730}
9731unsafe extern "C" {
9732 #[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."]
9733 pub fn otIp4ToIp4MappedIp6Address(
9734 aIp4Address: *const otIp4Address,
9735 aIp6Address: *mut otIp6Address,
9736 );
9737}
9738unsafe extern "C" {
9739 #[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)."]
9740 pub fn otIp4AddressToString(
9741 aAddress: *const otIp4Address,
9742 aBuffer: *mut ::std::os::raw::c_char,
9743 aSize: u16,
9744 );
9745}
9746unsafe extern "C" {
9747 #[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."]
9748 pub fn otIp4CidrFromString(
9749 aString: *const ::std::os::raw::c_char,
9750 aCidr: *mut otIp4Cidr,
9751 ) -> otError;
9752}
9753unsafe extern "C" {
9754 #[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)."]
9755 pub fn otIp4CidrToString(
9756 aCidr: *const otIp4Cidr,
9757 aBuffer: *mut ::std::os::raw::c_char,
9758 aSize: u16,
9759 );
9760}
9761unsafe extern "C" {
9762 #[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."]
9763 pub fn otIp4AddressFromString(
9764 aString: *const ::std::os::raw::c_char,
9765 aAddress: *mut otIp4Address,
9766 ) -> otError;
9767}
9768unsafe extern "C" {
9769 #[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."]
9770 pub fn otNat64SynthesizeIp6Address(
9771 aInstance: *mut otInstance,
9772 aIp4Address: *const otIp4Address,
9773 aIp6Address: *mut otIp6Address,
9774 ) -> otError;
9775}
9776#[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."]
9777pub type otNcpHdlcSendCallback = ::std::option::Option<
9778 unsafe extern "C" fn(aBuf: *const u8, aBufLength: u16) -> ::std::os::raw::c_int,
9779>;
9780unsafe extern "C" {
9781 #[doc = " Is called after NCP send finished."]
9782 pub fn otNcpHdlcSendDone();
9783}
9784unsafe extern "C" {
9785 #[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."]
9786 pub fn otNcpHdlcReceive(aBuf: *const u8, aBufLength: u16);
9787}
9788unsafe extern "C" {
9789 #[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."]
9790 pub fn otNcpHdlcInit(aInstance: *mut otInstance, aSendCallback: otNcpHdlcSendCallback);
9791}
9792unsafe extern "C" {
9793 #[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."]
9794 pub fn otNcpHdlcInitMulti(
9795 aInstance: *mut *mut otInstance,
9796 aCount: u8,
9797 aSendCallback: otNcpHdlcSendCallback,
9798 );
9799}
9800unsafe extern "C" {
9801 #[doc = " Initialize the NCP based on SPI framing.\n\n @param[in] aInstance The OpenThread instance structure."]
9802 pub fn otNcpSpiInit(aInstance: *mut otInstance);
9803}
9804unsafe extern "C" {
9805 #[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."]
9806 pub fn otNcpStreamWrite(
9807 aStreamId: ::std::os::raw::c_int,
9808 aDataPtr: *const u8,
9809 aDataLen: ::std::os::raw::c_int,
9810 ) -> otError;
9811}
9812unsafe extern "C" {
9813 #[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."]
9814 pub fn otNcpPlatLogv(
9815 aLogLevel: otLogLevel,
9816 aLogRegion: otLogRegion,
9817 aFormat: *const ::std::os::raw::c_char,
9818 aArgs: *mut __va_list_tag,
9819 );
9820}
9821#[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."]
9822pub type otNcpDelegateAllowPeekPoke =
9823 ::std::option::Option<unsafe extern "C" fn(aAddress: u32, aCount: u16) -> bool>;
9824unsafe extern "C" {
9825 #[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."]
9826 pub fn otNcpRegisterPeekPokeDelegates(
9827 aAllowPeekDelegate: otNcpDelegateAllowPeekPoke,
9828 aAllowPokeDelegate: otNcpDelegateAllowPeekPoke,
9829 );
9830}
9831#[doc = "< The Thread stack is disabled."]
9832pub const OT_DEVICE_ROLE_DISABLED: otDeviceRole = 0;
9833#[doc = "< Not currently participating in a Thread network/partition."]
9834pub const OT_DEVICE_ROLE_DETACHED: otDeviceRole = 1;
9835#[doc = "< The Thread Child role."]
9836pub const OT_DEVICE_ROLE_CHILD: otDeviceRole = 2;
9837#[doc = "< The Thread Router role."]
9838pub const OT_DEVICE_ROLE_ROUTER: otDeviceRole = 3;
9839#[doc = "< The Thread Leader role."]
9840pub const OT_DEVICE_ROLE_LEADER: otDeviceRole = 4;
9841#[doc = " Represents a Thread device role."]
9842pub type otDeviceRole = ::std::os::raw::c_uint;
9843#[doc = " Represents an MLE Link Mode configuration."]
9844#[repr(C)]
9845#[derive(Debug, Default, Copy, Clone)]
9846pub struct otLinkModeConfig {
9847 pub _bitfield_align_1: [u8; 0],
9848 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9849}
9850impl otLinkModeConfig {
9851 #[inline]
9852 pub fn mRxOnWhenIdle(&self) -> bool {
9853 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9854 }
9855 #[inline]
9856 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
9857 unsafe {
9858 let val: u8 = ::std::mem::transmute(val);
9859 self._bitfield_1.set(0usize, 1u8, val as u64)
9860 }
9861 }
9862 #[inline]
9863 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
9864 unsafe {
9865 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9866 ::std::ptr::addr_of!((*this)._bitfield_1),
9867 0usize,
9868 1u8,
9869 ) as u8)
9870 }
9871 }
9872 #[inline]
9873 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
9874 unsafe {
9875 let val: u8 = ::std::mem::transmute(val);
9876 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9877 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9878 0usize,
9879 1u8,
9880 val as u64,
9881 )
9882 }
9883 }
9884 #[inline]
9885 pub fn mDeviceType(&self) -> bool {
9886 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9887 }
9888 #[inline]
9889 pub fn set_mDeviceType(&mut self, val: bool) {
9890 unsafe {
9891 let val: u8 = ::std::mem::transmute(val);
9892 self._bitfield_1.set(1usize, 1u8, val as u64)
9893 }
9894 }
9895 #[inline]
9896 pub unsafe fn mDeviceType_raw(this: *const Self) -> bool {
9897 unsafe {
9898 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9899 ::std::ptr::addr_of!((*this)._bitfield_1),
9900 1usize,
9901 1u8,
9902 ) as u8)
9903 }
9904 }
9905 #[inline]
9906 pub unsafe fn set_mDeviceType_raw(this: *mut Self, val: bool) {
9907 unsafe {
9908 let val: u8 = ::std::mem::transmute(val);
9909 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9910 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9911 1usize,
9912 1u8,
9913 val as u64,
9914 )
9915 }
9916 }
9917 #[inline]
9918 pub fn mNetworkData(&self) -> bool {
9919 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9920 }
9921 #[inline]
9922 pub fn set_mNetworkData(&mut self, val: bool) {
9923 unsafe {
9924 let val: u8 = ::std::mem::transmute(val);
9925 self._bitfield_1.set(2usize, 1u8, val as u64)
9926 }
9927 }
9928 #[inline]
9929 pub unsafe fn mNetworkData_raw(this: *const Self) -> bool {
9930 unsafe {
9931 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9932 ::std::ptr::addr_of!((*this)._bitfield_1),
9933 2usize,
9934 1u8,
9935 ) as u8)
9936 }
9937 }
9938 #[inline]
9939 pub unsafe fn set_mNetworkData_raw(this: *mut Self, val: bool) {
9940 unsafe {
9941 let val: u8 = ::std::mem::transmute(val);
9942 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9943 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9944 2usize,
9945 1u8,
9946 val as u64,
9947 )
9948 }
9949 }
9950 #[inline]
9951 pub fn new_bitfield_1(
9952 mRxOnWhenIdle: bool,
9953 mDeviceType: bool,
9954 mNetworkData: bool,
9955 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9956 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9957 __bindgen_bitfield_unit.set(0usize, 1u8, {
9958 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
9959 mRxOnWhenIdle as u64
9960 });
9961 __bindgen_bitfield_unit.set(1usize, 1u8, {
9962 let mDeviceType: u8 = unsafe { ::std::mem::transmute(mDeviceType) };
9963 mDeviceType as u64
9964 });
9965 __bindgen_bitfield_unit.set(2usize, 1u8, {
9966 let mNetworkData: u8 = unsafe { ::std::mem::transmute(mNetworkData) };
9967 mNetworkData as u64
9968 });
9969 __bindgen_bitfield_unit
9970 }
9971}
9972#[doc = " Holds diagnostic information for a neighboring Thread node"]
9973#[repr(C)]
9974#[derive(Debug, Default, Copy, Clone)]
9975pub struct otNeighborInfo {
9976 #[doc = "< IEEE 802.15.4 Extended Address"]
9977 pub mExtAddress: otExtAddress,
9978 #[doc = "< Seconds since last heard"]
9979 pub mAge: u32,
9980 #[doc = "< Seconds since link establishment (requires `CONFIG_UPTIME_ENABLE`)"]
9981 pub mConnectionTime: u32,
9982 #[doc = "< RLOC16"]
9983 pub mRloc16: u16,
9984 #[doc = "< Link Frame Counter"]
9985 pub mLinkFrameCounter: u32,
9986 #[doc = "< MLE Frame Counter"]
9987 pub mMleFrameCounter: u32,
9988 #[doc = "< Link Quality In"]
9989 pub mLinkQualityIn: u8,
9990 #[doc = "< Average RSSI"]
9991 pub mAverageRssi: i8,
9992 #[doc = "< Last observed RSSI"]
9993 pub mLastRssi: i8,
9994 #[doc = "< Link Margin"]
9995 pub mLinkMargin: u8,
9996 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
9997 pub mFrameErrorRate: u16,
9998 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
9999 pub mMessageErrorRate: u16,
10000 #[doc = "< Thread version of the neighbor"]
10001 pub mVersion: u16,
10002 pub _bitfield_align_1: [u8; 0],
10003 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10004 pub __bindgen_padding_0: u8,
10005}
10006impl otNeighborInfo {
10007 #[inline]
10008 pub fn mRxOnWhenIdle(&self) -> bool {
10009 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10010 }
10011 #[inline]
10012 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
10013 unsafe {
10014 let val: u8 = ::std::mem::transmute(val);
10015 self._bitfield_1.set(0usize, 1u8, val as u64)
10016 }
10017 }
10018 #[inline]
10019 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
10020 unsafe {
10021 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10022 ::std::ptr::addr_of!((*this)._bitfield_1),
10023 0usize,
10024 1u8,
10025 ) as u8)
10026 }
10027 }
10028 #[inline]
10029 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
10030 unsafe {
10031 let val: u8 = ::std::mem::transmute(val);
10032 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10033 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10034 0usize,
10035 1u8,
10036 val as u64,
10037 )
10038 }
10039 }
10040 #[inline]
10041 pub fn mFullThreadDevice(&self) -> bool {
10042 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10043 }
10044 #[inline]
10045 pub fn set_mFullThreadDevice(&mut self, val: bool) {
10046 unsafe {
10047 let val: u8 = ::std::mem::transmute(val);
10048 self._bitfield_1.set(1usize, 1u8, val as u64)
10049 }
10050 }
10051 #[inline]
10052 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
10053 unsafe {
10054 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10055 ::std::ptr::addr_of!((*this)._bitfield_1),
10056 1usize,
10057 1u8,
10058 ) as u8)
10059 }
10060 }
10061 #[inline]
10062 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
10063 unsafe {
10064 let val: u8 = ::std::mem::transmute(val);
10065 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10066 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10067 1usize,
10068 1u8,
10069 val as u64,
10070 )
10071 }
10072 }
10073 #[inline]
10074 pub fn mFullNetworkData(&self) -> bool {
10075 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
10076 }
10077 #[inline]
10078 pub fn set_mFullNetworkData(&mut self, val: bool) {
10079 unsafe {
10080 let val: u8 = ::std::mem::transmute(val);
10081 self._bitfield_1.set(2usize, 1u8, val as u64)
10082 }
10083 }
10084 #[inline]
10085 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
10086 unsafe {
10087 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10088 ::std::ptr::addr_of!((*this)._bitfield_1),
10089 2usize,
10090 1u8,
10091 ) as u8)
10092 }
10093 }
10094 #[inline]
10095 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
10096 unsafe {
10097 let val: u8 = ::std::mem::transmute(val);
10098 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10099 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10100 2usize,
10101 1u8,
10102 val as u64,
10103 )
10104 }
10105 }
10106 #[inline]
10107 pub fn mIsChild(&self) -> bool {
10108 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
10109 }
10110 #[inline]
10111 pub fn set_mIsChild(&mut self, val: bool) {
10112 unsafe {
10113 let val: u8 = ::std::mem::transmute(val);
10114 self._bitfield_1.set(3usize, 1u8, val as u64)
10115 }
10116 }
10117 #[inline]
10118 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
10119 unsafe {
10120 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10121 ::std::ptr::addr_of!((*this)._bitfield_1),
10122 3usize,
10123 1u8,
10124 ) as u8)
10125 }
10126 }
10127 #[inline]
10128 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
10129 unsafe {
10130 let val: u8 = ::std::mem::transmute(val);
10131 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10132 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10133 3usize,
10134 1u8,
10135 val as u64,
10136 )
10137 }
10138 }
10139 #[inline]
10140 pub fn new_bitfield_1(
10141 mRxOnWhenIdle: bool,
10142 mFullThreadDevice: bool,
10143 mFullNetworkData: bool,
10144 mIsChild: bool,
10145 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10146 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10147 __bindgen_bitfield_unit.set(0usize, 1u8, {
10148 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
10149 mRxOnWhenIdle as u64
10150 });
10151 __bindgen_bitfield_unit.set(1usize, 1u8, {
10152 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
10153 mFullThreadDevice as u64
10154 });
10155 __bindgen_bitfield_unit.set(2usize, 1u8, {
10156 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
10157 mFullNetworkData as u64
10158 });
10159 __bindgen_bitfield_unit.set(3usize, 1u8, {
10160 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
10161 mIsChild as u64
10162 });
10163 __bindgen_bitfield_unit
10164 }
10165}
10166pub type otNeighborInfoIterator = i16;
10167#[doc = " Represents the Thread Leader Data."]
10168#[repr(C)]
10169#[derive(Debug, Default, Copy, Clone)]
10170pub struct otLeaderData {
10171 #[doc = "< Partition ID"]
10172 pub mPartitionId: u32,
10173 #[doc = "< Leader Weight"]
10174 pub mWeighting: u8,
10175 #[doc = "< Full Network Data Version"]
10176 pub mDataVersion: u8,
10177 #[doc = "< Stable Network Data Version"]
10178 pub mStableDataVersion: u8,
10179 #[doc = "< Leader Router ID"]
10180 pub mLeaderRouterId: u8,
10181}
10182#[doc = " Holds diagnostic information for a Thread Router"]
10183#[repr(C)]
10184#[derive(Debug, Default, Copy, Clone)]
10185pub struct otRouterInfo {
10186 #[doc = "< IEEE 802.15.4 Extended Address"]
10187 pub mExtAddress: otExtAddress,
10188 #[doc = "< RLOC16"]
10189 pub mRloc16: u16,
10190 #[doc = "< Router ID"]
10191 pub mRouterId: u8,
10192 #[doc = "< Next hop to router"]
10193 pub mNextHop: u8,
10194 #[doc = "< Path cost to router"]
10195 pub mPathCost: u8,
10196 #[doc = "< Link Quality In"]
10197 pub mLinkQualityIn: u8,
10198 #[doc = "< Link Quality Out"]
10199 pub mLinkQualityOut: u8,
10200 #[doc = "< Time last heard"]
10201 pub mAge: u8,
10202 pub _bitfield_align_1: [u8; 0],
10203 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10204 #[doc = "< Thread version"]
10205 pub mVersion: u8,
10206 #[doc = "< CSL clock accuracy, in ± ppm"]
10207 pub mCslClockAccuracy: u8,
10208 #[doc = "< CSL uncertainty, in ±10 us"]
10209 pub mCslUncertainty: u8,
10210}
10211impl otRouterInfo {
10212 #[inline]
10213 pub fn mAllocated(&self) -> bool {
10214 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10215 }
10216 #[inline]
10217 pub fn set_mAllocated(&mut self, val: bool) {
10218 unsafe {
10219 let val: u8 = ::std::mem::transmute(val);
10220 self._bitfield_1.set(0usize, 1u8, val as u64)
10221 }
10222 }
10223 #[inline]
10224 pub unsafe fn mAllocated_raw(this: *const Self) -> bool {
10225 unsafe {
10226 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10227 ::std::ptr::addr_of!((*this)._bitfield_1),
10228 0usize,
10229 1u8,
10230 ) as u8)
10231 }
10232 }
10233 #[inline]
10234 pub unsafe fn set_mAllocated_raw(this: *mut Self, val: bool) {
10235 unsafe {
10236 let val: u8 = ::std::mem::transmute(val);
10237 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10238 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10239 0usize,
10240 1u8,
10241 val as u64,
10242 )
10243 }
10244 }
10245 #[inline]
10246 pub fn mLinkEstablished(&self) -> bool {
10247 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10248 }
10249 #[inline]
10250 pub fn set_mLinkEstablished(&mut self, val: bool) {
10251 unsafe {
10252 let val: u8 = ::std::mem::transmute(val);
10253 self._bitfield_1.set(1usize, 1u8, val as u64)
10254 }
10255 }
10256 #[inline]
10257 pub unsafe fn mLinkEstablished_raw(this: *const Self) -> bool {
10258 unsafe {
10259 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10260 ::std::ptr::addr_of!((*this)._bitfield_1),
10261 1usize,
10262 1u8,
10263 ) as u8)
10264 }
10265 }
10266 #[inline]
10267 pub unsafe fn set_mLinkEstablished_raw(this: *mut Self, val: bool) {
10268 unsafe {
10269 let val: u8 = ::std::mem::transmute(val);
10270 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10271 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10272 1usize,
10273 1u8,
10274 val as u64,
10275 )
10276 }
10277 }
10278 #[inline]
10279 pub fn new_bitfield_1(
10280 mAllocated: bool,
10281 mLinkEstablished: bool,
10282 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10283 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10284 __bindgen_bitfield_unit.set(0usize, 1u8, {
10285 let mAllocated: u8 = unsafe { ::std::mem::transmute(mAllocated) };
10286 mAllocated as u64
10287 });
10288 __bindgen_bitfield_unit.set(1usize, 1u8, {
10289 let mLinkEstablished: u8 = unsafe { ::std::mem::transmute(mLinkEstablished) };
10290 mLinkEstablished as u64
10291 });
10292 __bindgen_bitfield_unit
10293 }
10294}
10295#[doc = " Represents the IP level counters."]
10296#[repr(C)]
10297#[derive(Debug, Default, Copy, Clone)]
10298pub struct otIpCounters {
10299 #[doc = "< The number of IPv6 packets successfully transmitted."]
10300 pub mTxSuccess: u32,
10301 #[doc = "< The number of IPv6 packets successfully received."]
10302 pub mRxSuccess: u32,
10303 #[doc = "< The number of IPv6 packets failed to transmit."]
10304 pub mTxFailure: u32,
10305 #[doc = "< The number of IPv6 packets failed to receive."]
10306 pub mRxFailure: u32,
10307}
10308#[doc = " Represents the Thread MLE counters."]
10309#[repr(C)]
10310#[derive(Debug, Default, Copy, Clone)]
10311pub struct otMleCounters {
10312 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DISABLED role."]
10313 pub mDisabledRole: u16,
10314 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DETACHED role."]
10315 pub mDetachedRole: u16,
10316 #[doc = "< Number of times device entered OT_DEVICE_ROLE_CHILD role."]
10317 pub mChildRole: u16,
10318 #[doc = "< Number of times device entered OT_DEVICE_ROLE_ROUTER role."]
10319 pub mRouterRole: u16,
10320 #[doc = "< Number of times device entered OT_DEVICE_ROLE_LEADER role."]
10321 pub mLeaderRole: u16,
10322 #[doc = "< Number of attach attempts while device was detached."]
10323 pub mAttachAttempts: u16,
10324 #[doc = "< Number of changes to partition ID."]
10325 pub mPartitionIdChanges: u16,
10326 #[doc = "< Number of attempts to attach to a better partition."]
10327 pub mBetterPartitionAttachAttempts: u16,
10328 #[doc = "< Number of attempts to attach to find a better parent (parent search)."]
10329 pub mBetterParentAttachAttempts: u16,
10330 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role."]
10331 pub mDisabledTime: u64,
10332 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role."]
10333 pub mDetachedTime: u64,
10334 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role."]
10335 pub mChildTime: u64,
10336 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role."]
10337 pub mRouterTime: u64,
10338 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role."]
10339 pub mLeaderTime: u64,
10340 #[doc = "< Number of milliseconds tracked by previous counters."]
10341 pub mTrackedTime: u64,
10342 #[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)."]
10343 pub mParentChanges: u16,
10344}
10345#[doc = " Represents the MLE Parent Response data."]
10346#[repr(C)]
10347#[derive(Debug, Default, Copy, Clone)]
10348pub struct otThreadParentResponseInfo {
10349 #[doc = "< IEEE 802.15.4 Extended Address of the Parent"]
10350 pub mExtAddr: otExtAddress,
10351 #[doc = "< Short address of the Parent"]
10352 pub mRloc16: u16,
10353 #[doc = "< Rssi of the Parent"]
10354 pub mRssi: i8,
10355 #[doc = "< Parent priority"]
10356 pub mPriority: i8,
10357 #[doc = "< Parent Link Quality 3"]
10358 pub mLinkQuality3: u8,
10359 #[doc = "< Parent Link Quality 2"]
10360 pub mLinkQuality2: u8,
10361 #[doc = "< Parent Link Quality 1"]
10362 pub mLinkQuality1: u8,
10363 #[doc = "< Is the node receiving parent response attached"]
10364 pub mIsAttached: bool,
10365}
10366#[doc = " This callback informs the application that the detaching process has finished.\n\n @param[in] aContext A pointer to application-specific context."]
10367pub type otDetachGracefullyCallback =
10368 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
10369#[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."]
10370pub type otWakeupCallback = ::std::option::Option<
10371 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
10372>;
10373unsafe extern "C" {
10374 #[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."]
10375 pub fn otThreadSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
10376}
10377unsafe extern "C" {
10378 #[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."]
10379 pub fn otThreadGetVersion() -> u16;
10380}
10381unsafe extern "C" {
10382 #[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."]
10383 pub fn otThreadIsSingleton(aInstance: *mut otInstance) -> bool;
10384}
10385unsafe extern "C" {
10386 #[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."]
10387 pub fn otThreadDiscover(
10388 aInstance: *mut otInstance,
10389 aScanChannels: u32,
10390 aPanId: u16,
10391 aJoiner: bool,
10392 aEnableEui64Filtering: bool,
10393 aCallback: otHandleActiveScanResult,
10394 aCallbackContext: *mut ::std::os::raw::c_void,
10395 ) -> otError;
10396}
10397unsafe extern "C" {
10398 #[doc = " Determines if an MLE Thread Discovery is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10399 pub fn otThreadIsDiscoverInProgress(aInstance: *mut otInstance) -> bool;
10400}
10401unsafe extern "C" {
10402 #[doc = " Sets the Thread Joiner Advertisement when discovering Thread network.\n\n Thread Joiner Advertisement is used to allow a Joiner to advertise its own application-specific information\n (such as Vendor ID, Product ID, Discriminator, etc.) via a newly-proposed Joiner Advertisement TLV,\n and to make this information available to Commissioners or Commissioner Candidates without human interaction.\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.\n\n @retval OT_ERROR_NONE Successfully set Joiner Advertisement.\n @retval OT_ERROR_INVALID_ARGS Invalid AdvData."]
10403 pub fn otThreadSetJoinerAdvertisement(
10404 aInstance: *mut otInstance,
10405 aOui: u32,
10406 aAdvData: *const u8,
10407 aAdvDataLength: u8,
10408 ) -> otError;
10409}
10410unsafe extern "C" {
10411 #[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"]
10412 pub fn otThreadGetChildTimeout(aInstance: *mut otInstance) -> u32;
10413}
10414unsafe extern "C" {
10415 #[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"]
10416 pub fn otThreadSetChildTimeout(aInstance: *mut otInstance, aTimeout: u32);
10417}
10418unsafe extern "C" {
10419 #[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"]
10420 pub fn otThreadGetExtendedPanId(aInstance: *mut otInstance) -> *const otExtendedPanId;
10421}
10422unsafe extern "C" {
10423 #[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"]
10424 pub fn otThreadSetExtendedPanId(
10425 aInstance: *mut otInstance,
10426 aExtendedPanId: *const otExtendedPanId,
10427 ) -> otError;
10428}
10429unsafe extern "C" {
10430 #[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."]
10431 pub fn otThreadGetLeaderRloc(
10432 aInstance: *mut otInstance,
10433 aLeaderRloc: *mut otIp6Address,
10434 ) -> otError;
10435}
10436unsafe extern "C" {
10437 #[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"]
10438 pub fn otThreadGetLinkMode(aInstance: *mut otInstance) -> otLinkModeConfig;
10439}
10440unsafe extern "C" {
10441 #[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"]
10442 pub fn otThreadSetLinkMode(aInstance: *mut otInstance, aConfig: otLinkModeConfig) -> otError;
10443}
10444unsafe extern "C" {
10445 #[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"]
10446 pub fn otThreadGetNetworkKey(aInstance: *mut otInstance, aNetworkKey: *mut otNetworkKey);
10447}
10448unsafe extern "C" {
10449 #[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"]
10450 pub fn otThreadGetNetworkKeyRef(aInstance: *mut otInstance) -> otNetworkKeyRef;
10451}
10452unsafe extern "C" {
10453 #[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"]
10454 pub fn otThreadSetNetworkKey(aInstance: *mut otInstance, aKey: *const otNetworkKey) -> otError;
10455}
10456unsafe extern "C" {
10457 #[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"]
10458 pub fn otThreadSetNetworkKeyRef(
10459 aInstance: *mut otInstance,
10460 aKeyRef: otNetworkKeyRef,
10461 ) -> otError;
10462}
10463unsafe extern "C" {
10464 #[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."]
10465 pub fn otThreadGetRloc(aInstance: *mut otInstance) -> *const otIp6Address;
10466}
10467unsafe extern "C" {
10468 #[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."]
10469 pub fn otThreadGetMeshLocalEid(aInstance: *mut otInstance) -> *const otIp6Address;
10470}
10471unsafe extern "C" {
10472 #[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."]
10473 pub fn otThreadGetMeshLocalPrefix(aInstance: *mut otInstance) -> *const otMeshLocalPrefix;
10474}
10475unsafe extern "C" {
10476 #[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."]
10477 pub fn otThreadSetMeshLocalPrefix(
10478 aInstance: *mut otInstance,
10479 aMeshLocalPrefix: *const otMeshLocalPrefix,
10480 ) -> otError;
10481}
10482unsafe extern "C" {
10483 #[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."]
10484 pub fn otThreadGetLinkLocalIp6Address(aInstance: *mut otInstance) -> *const otIp6Address;
10485}
10486unsafe extern "C" {
10487 #[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."]
10488 pub fn otThreadGetLinkLocalAllThreadNodesMulticastAddress(
10489 aInstance: *mut otInstance,
10490 ) -> *const otIp6Address;
10491}
10492unsafe extern "C" {
10493 #[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."]
10494 pub fn otThreadGetRealmLocalAllThreadNodesMulticastAddress(
10495 aInstance: *mut otInstance,
10496 ) -> *const otIp6Address;
10497}
10498unsafe extern "C" {
10499 #[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."]
10500 pub fn otThreadGetServiceAloc(
10501 aInstance: *mut otInstance,
10502 aServiceId: u8,
10503 aServiceAloc: *mut otIp6Address,
10504 ) -> otError;
10505}
10506unsafe extern "C" {
10507 #[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"]
10508 pub fn otThreadGetNetworkName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10509}
10510unsafe extern "C" {
10511 #[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"]
10512 pub fn otThreadSetNetworkName(
10513 aInstance: *mut otInstance,
10514 aNetworkName: *const ::std::os::raw::c_char,
10515 ) -> otError;
10516}
10517unsafe extern "C" {
10518 #[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"]
10519 pub fn otThreadGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10520}
10521unsafe extern "C" {
10522 #[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"]
10523 pub fn otThreadSetDomainName(
10524 aInstance: *mut otInstance,
10525 aDomainName: *const ::std::os::raw::c_char,
10526 ) -> otError;
10527}
10528unsafe extern "C" {
10529 #[doc = " Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.\n\n Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.\n\n @note Only available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.\n\n @retval OT_ERROR_NONE Successfully set/cleared the Interface Identifier.\n @retval OT_ERROR_INVALID_ARGS The specified Interface Identifier is reserved.\n\n @sa otThreadGetFixedDuaInterfaceIdentifier"]
10530 pub fn otThreadSetFixedDuaInterfaceIdentifier(
10531 aInstance: *mut otInstance,
10532 aIid: *const otIp6InterfaceIdentifier,
10533 ) -> otError;
10534}
10535unsafe extern "C" {
10536 #[doc = " Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.\n\n Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.\n\n @note Only available since Thread 1.2.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns A pointer to the Interface Identifier which was set manually, or NULL if none was set.\n\n @sa otThreadSetFixedDuaInterfaceIdentifier"]
10537 pub fn otThreadGetFixedDuaInterfaceIdentifier(
10538 aInstance: *mut otInstance,
10539 ) -> *const otIp6InterfaceIdentifier;
10540}
10541unsafe extern "C" {
10542 #[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"]
10543 pub fn otThreadGetKeySequenceCounter(aInstance: *mut otInstance) -> u32;
10544}
10545unsafe extern "C" {
10546 #[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"]
10547 pub fn otThreadSetKeySequenceCounter(aInstance: *mut otInstance, aKeySequenceCounter: u32);
10548}
10549unsafe extern "C" {
10550 #[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"]
10551 pub fn otThreadGetKeySwitchGuardTime(aInstance: *mut otInstance) -> u16;
10552}
10553unsafe extern "C" {
10554 #[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"]
10555 pub fn otThreadSetKeySwitchGuardTime(aInstance: *mut otInstance, aKeySwitchGuardTime: u16);
10556}
10557unsafe extern "C" {
10558 #[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."]
10559 pub fn otThreadBecomeDetached(aInstance: *mut otInstance) -> otError;
10560}
10561unsafe extern "C" {
10562 #[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."]
10563 pub fn otThreadBecomeChild(aInstance: *mut otInstance) -> otError;
10564}
10565unsafe extern "C" {
10566 #[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."]
10567 pub fn otThreadGetNextNeighborInfo(
10568 aInstance: *mut otInstance,
10569 aIterator: *mut otNeighborInfoIterator,
10570 aInfo: *mut otNeighborInfo,
10571 ) -> otError;
10572}
10573unsafe extern "C" {
10574 #[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."]
10575 pub fn otThreadGetDeviceRole(aInstance: *mut otInstance) -> otDeviceRole;
10576}
10577unsafe extern "C" {
10578 #[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."]
10579 pub fn otThreadDeviceRoleToString(aRole: otDeviceRole) -> *const ::std::os::raw::c_char;
10580}
10581unsafe extern "C" {
10582 #[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."]
10583 pub fn otThreadGetLeaderData(
10584 aInstance: *mut otInstance,
10585 aLeaderData: *mut otLeaderData,
10586 ) -> otError;
10587}
10588unsafe extern "C" {
10589 #[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."]
10590 pub fn otThreadGetLeaderRouterId(aInstance: *mut otInstance) -> u8;
10591}
10592unsafe extern "C" {
10593 #[doc = " Get the Leader's Weight.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Weight."]
10594 pub fn otThreadGetLeaderWeight(aInstance: *mut otInstance) -> u8;
10595}
10596unsafe extern "C" {
10597 #[doc = " Get the Partition ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Partition ID."]
10598 pub fn otThreadGetPartitionId(aInstance: *mut otInstance) -> u32;
10599}
10600unsafe extern "C" {
10601 #[doc = " Get the RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RLOC16."]
10602 pub fn otThreadGetRloc16(aInstance: *mut otInstance) -> u16;
10603}
10604unsafe extern "C" {
10605 #[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."]
10606 pub fn otThreadGetParentInfo(
10607 aInstance: *mut otInstance,
10608 aParentInfo: *mut otRouterInfo,
10609 ) -> otError;
10610}
10611unsafe extern "C" {
10612 #[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."]
10613 pub fn otThreadGetParentAverageRssi(
10614 aInstance: *mut otInstance,
10615 aParentRssi: *mut i8,
10616 ) -> otError;
10617}
10618unsafe extern "C" {
10619 #[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."]
10620 pub fn otThreadGetParentLastRssi(aInstance: *mut otInstance, aLastRssi: *mut i8) -> otError;
10621}
10622unsafe extern "C" {
10623 #[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."]
10624 pub fn otThreadSearchForBetterParent(aInstance: *mut otInstance) -> otError;
10625}
10626unsafe extern "C" {
10627 #[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."]
10628 pub fn otThreadGetIp6Counters(aInstance: *mut otInstance) -> *const otIpCounters;
10629}
10630unsafe extern "C" {
10631 #[doc = " Resets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10632 pub fn otThreadResetIp6Counters(aInstance: *mut otInstance);
10633}
10634unsafe extern "C" {
10635 #[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."]
10636 pub fn otThreadGetTimeInQueueHistogram(
10637 aInstance: *mut otInstance,
10638 aNumBins: *mut u16,
10639 aBinInterval: *mut u32,
10640 ) -> *const u32;
10641}
10642unsafe extern "C" {
10643 #[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)."]
10644 pub fn otThreadGetMaxTimeInQueue(aInstance: *mut otInstance) -> u32;
10645}
10646unsafe extern "C" {
10647 #[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."]
10648 pub fn otThreadResetTimeInQueueStat(aInstance: *mut otInstance);
10649}
10650unsafe extern "C" {
10651 #[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."]
10652 pub fn otThreadGetMleCounters(aInstance: *mut otInstance) -> *const otMleCounters;
10653}
10654unsafe extern "C" {
10655 #[doc = " Resets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10656 pub fn otThreadResetMleCounters(aInstance: *mut otInstance);
10657}
10658unsafe extern "C" {
10659 #[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."]
10660 pub fn otThreadGetCurrentAttachDuration(aInstance: *mut otInstance) -> u32;
10661}
10662#[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."]
10663pub type otThreadParentResponseCallback = ::std::option::Option<
10664 unsafe extern "C" fn(
10665 aInfo: *mut otThreadParentResponseInfo,
10666 aContext: *mut ::std::os::raw::c_void,
10667 ),
10668>;
10669unsafe extern "C" {
10670 #[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."]
10671 pub fn otThreadRegisterParentResponseCallback(
10672 aInstance: *mut otInstance,
10673 aCallback: otThreadParentResponseCallback,
10674 aContext: *mut ::std::os::raw::c_void,
10675 );
10676}
10677#[doc = " Represents the Thread Discovery Request data."]
10678#[repr(C)]
10679#[derive(Debug, Default, Copy, Clone)]
10680pub struct otThreadDiscoveryRequestInfo {
10681 #[doc = "< IEEE 802.15.4 Extended Address of the requester"]
10682 pub mExtAddress: otExtAddress,
10683 pub _bitfield_align_1: [u8; 0],
10684 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10685}
10686impl otThreadDiscoveryRequestInfo {
10687 #[inline]
10688 pub fn mVersion(&self) -> u8 {
10689 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10690 }
10691 #[inline]
10692 pub fn set_mVersion(&mut self, val: u8) {
10693 unsafe {
10694 let val: u8 = ::std::mem::transmute(val);
10695 self._bitfield_1.set(0usize, 4u8, val as u64)
10696 }
10697 }
10698 #[inline]
10699 pub unsafe fn mVersion_raw(this: *const Self) -> u8 {
10700 unsafe {
10701 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10702 ::std::ptr::addr_of!((*this)._bitfield_1),
10703 0usize,
10704 4u8,
10705 ) as u8)
10706 }
10707 }
10708 #[inline]
10709 pub unsafe fn set_mVersion_raw(this: *mut Self, val: u8) {
10710 unsafe {
10711 let val: u8 = ::std::mem::transmute(val);
10712 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10713 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10714 0usize,
10715 4u8,
10716 val as u64,
10717 )
10718 }
10719 }
10720 #[inline]
10721 pub fn mIsJoiner(&self) -> bool {
10722 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10723 }
10724 #[inline]
10725 pub fn set_mIsJoiner(&mut self, val: bool) {
10726 unsafe {
10727 let val: u8 = ::std::mem::transmute(val);
10728 self._bitfield_1.set(4usize, 1u8, val as u64)
10729 }
10730 }
10731 #[inline]
10732 pub unsafe fn mIsJoiner_raw(this: *const Self) -> bool {
10733 unsafe {
10734 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10735 ::std::ptr::addr_of!((*this)._bitfield_1),
10736 4usize,
10737 1u8,
10738 ) as u8)
10739 }
10740 }
10741 #[inline]
10742 pub unsafe fn set_mIsJoiner_raw(this: *mut Self, val: bool) {
10743 unsafe {
10744 let val: u8 = ::std::mem::transmute(val);
10745 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10746 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10747 4usize,
10748 1u8,
10749 val as u64,
10750 )
10751 }
10752 }
10753 #[inline]
10754 pub fn new_bitfield_1(mVersion: u8, mIsJoiner: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10755 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10756 __bindgen_bitfield_unit.set(0usize, 4u8, {
10757 let mVersion: u8 = unsafe { ::std::mem::transmute(mVersion) };
10758 mVersion as u64
10759 });
10760 __bindgen_bitfield_unit.set(4usize, 1u8, {
10761 let mIsJoiner: u8 = unsafe { ::std::mem::transmute(mIsJoiner) };
10762 mIsJoiner as u64
10763 });
10764 __bindgen_bitfield_unit
10765 }
10766}
10767#[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."]
10768pub type otThreadDiscoveryRequestCallback = ::std::option::Option<
10769 unsafe extern "C" fn(
10770 aInfo: *const otThreadDiscoveryRequestInfo,
10771 aContext: *mut ::std::os::raw::c_void,
10772 ),
10773>;
10774unsafe extern "C" {
10775 #[doc = " Sets a callback to receive MLE Discovery Request data.\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."]
10776 pub fn otThreadSetDiscoveryRequestCallback(
10777 aInstance: *mut otInstance,
10778 aCallback: otThreadDiscoveryRequestCallback,
10779 aContext: *mut ::std::os::raw::c_void,
10780 );
10781}
10782#[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)."]
10783pub type otThreadAnycastLocatorCallback = ::std::option::Option<
10784 unsafe extern "C" fn(
10785 aContext: *mut ::std::os::raw::c_void,
10786 aError: otError,
10787 aMeshLocalAddress: *const otIp6Address,
10788 aRloc16: u16,
10789 ),
10790>;
10791unsafe extern "C" {
10792 #[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."]
10793 pub fn otThreadLocateAnycastDestination(
10794 aInstance: *mut otInstance,
10795 aAnycastAddress: *const otIp6Address,
10796 aCallback: otThreadAnycastLocatorCallback,
10797 aContext: *mut ::std::os::raw::c_void,
10798 ) -> otError;
10799}
10800unsafe extern "C" {
10801 #[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."]
10802 pub fn otThreadIsAnycastLocateInProgress(aInstance: *mut otInstance) -> bool;
10803}
10804unsafe extern "C" {
10805 #[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."]
10806 pub fn otThreadSendAddressNotification(
10807 aInstance: *mut otInstance,
10808 aDestination: *mut otIp6Address,
10809 aTarget: *mut otIp6Address,
10810 aMlIid: *mut otIp6InterfaceIdentifier,
10811 );
10812}
10813unsafe extern "C" {
10814 #[doc = " Sends a Proactive Backbone Notification (PRO_BB.ntf) message on the Backbone link.\n\n Is only available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aTarget The target address of the PRO_BB.ntf message.\n @param[in] aMlIid The ML-IID of the PRO_BB.ntf message.\n @param[in] aTimeSinceLastTransaction Time since last transaction (in seconds).\n\n @retval OT_ERROR_NONE Successfully sent PRO_BB.ntf on backbone link.\n @retval OT_ERROR_NO_BUFS If insufficient message buffers available."]
10815 pub fn otThreadSendProactiveBackboneNotification(
10816 aInstance: *mut otInstance,
10817 aTarget: *mut otIp6Address,
10818 aMlIid: *mut otIp6InterfaceIdentifier,
10819 aTimeSinceLastTransaction: u32,
10820 ) -> otError;
10821}
10822unsafe extern "C" {
10823 #[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."]
10824 pub fn otThreadDetachGracefully(
10825 aInstance: *mut otInstance,
10826 aCallback: otDetachGracefullyCallback,
10827 aContext: *mut ::std::os::raw::c_void,
10828 ) -> otError;
10829}
10830unsafe extern "C" {
10831 #[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`."]
10832 pub fn otConvertDurationInSecondsToString(
10833 aDuration: u32,
10834 aBuffer: *mut ::std::os::raw::c_char,
10835 aSize: u16,
10836 );
10837}
10838unsafe extern "C" {
10839 #[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."]
10840 pub fn otThreadSetStoreFrameCounterAhead(
10841 aInstance: *mut otInstance,
10842 aStoreFrameCounterAhead: u32,
10843 );
10844}
10845unsafe extern "C" {
10846 #[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."]
10847 pub fn otThreadGetStoreFrameCounterAhead(aInstance: *mut otInstance) -> u32;
10848}
10849unsafe extern "C" {
10850 #[doc = " Attempts to wake a Wake-up End Device.\n\n Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` to be enabled.\n\n The wake-up starts with transmitting a wake-up frame sequence to the Wake-up End Device.\n During the wake-up sequence, and for a short time after the last wake-up frame is sent, the Wake-up Coordinator keeps\n its receiver on to be able to receive an initial mesh link establishment message from the WED.\n\n @warning The functionality implemented by this function is still in the design phase.\n Consequently, the prototype and semantics of this function are subject to change.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aWedAddress The extended address of the Wake-up End Device.\n @param[in] aWakeupIntervalUs An interval between consecutive wake-up frames (in microseconds).\n @param[in] aWakeupDurationMs Duration of the wake-up sequence (in milliseconds).\n @param[in] aCallback A pointer to function that is called when the wake-up succeeds or fails.\n @param[in] aCallbackContext A pointer to callback application-specific context.\n\n @retval OT_ERROR_NONE Successfully started the wake-up.\n @retval OT_ERROR_INVALID_STATE Another attachment request is still in progress.\n @retval OT_ERROR_INVALID_ARGS The wake-up interval or duration are invalid."]
10851 pub fn otThreadWakeup(
10852 aInstance: *mut otInstance,
10853 aWedAddress: *const otExtAddress,
10854 aWakeupIntervalUs: u16,
10855 aWakeupDurationMs: u16,
10856 aCallback: otWakeupCallback,
10857 aCallbackContext: *mut ::std::os::raw::c_void,
10858 ) -> otError;
10859}
10860pub type otNetworkDiagIterator = u16;
10861#[doc = " Represents a Network Diagnostics IPv6 Address List TLV value."]
10862#[repr(C)]
10863#[derive(Copy, Clone)]
10864pub struct otNetworkDiagIp6AddrList {
10865 #[doc = "< Number of IPv6 addresses."]
10866 pub mCount: u8,
10867 #[doc = "< Array of IPv6 addresses."]
10868 pub mList: [otIp6Address; 15usize],
10869}
10870impl Default for otNetworkDiagIp6AddrList {
10871 fn default() -> Self {
10872 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10873 unsafe {
10874 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10875 s.assume_init()
10876 }
10877 }
10878}
10879#[doc = " Represents a Network Diagnostic TLV Data."]
10880#[repr(C)]
10881#[derive(Debug, Copy, Clone)]
10882pub struct otNetworkDiagData {
10883 #[doc = "< Number of bytes in the data."]
10884 pub mCount: u8,
10885 #[doc = "< Array containing the data bytes."]
10886 pub m8: [u8; 254usize],
10887}
10888impl Default for otNetworkDiagData {
10889 fn default() -> Self {
10890 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
10891 unsafe {
10892 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
10893 s.assume_init()
10894 }
10895 }
10896}
10897#[doc = " Represents a Network Diagnostic Connectivity value."]
10898#[repr(C)]
10899#[derive(Debug, Default, Copy, Clone)]
10900pub struct otNetworkDiagConnectivity {
10901 #[doc = "< The priority of the sender as a parent."]
10902 pub mParentPriority: i8,
10903 #[doc = "< Number of neighbors with link of quality 3."]
10904 pub mLinkQuality3: u8,
10905 #[doc = "< Number of neighbors with link of quality 2."]
10906 pub mLinkQuality2: u8,
10907 #[doc = "< Number of neighbors with link of quality 1."]
10908 pub mLinkQuality1: u8,
10909 #[doc = "< Cost to the Leader."]
10910 pub mLeaderCost: u8,
10911 #[doc = "< Most recent received ID seq number."]
10912 pub mIdSequence: u8,
10913 #[doc = "< Number of active routers."]
10914 pub mActiveRouters: u8,
10915 #[doc = "< Buffer capacity in bytes for SEDs. Optional."]
10916 pub mSedBufferSize: u16,
10917 #[doc = "< Queue capacity (number of IPv6 datagrams) per SED. Optional."]
10918 pub mSedDatagramCount: u8,
10919}
10920#[doc = " Represents a Network Diagnostic Route data."]
10921#[repr(C)]
10922#[derive(Debug, Default, Copy, Clone)]
10923pub struct otNetworkDiagRouteData {
10924 #[doc = "< The Assigned Router ID."]
10925 pub mRouterId: u8,
10926 pub _bitfield_align_1: [u8; 0],
10927 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10928}
10929impl otNetworkDiagRouteData {
10930 #[inline]
10931 pub fn mLinkQualityOut(&self) -> u8 {
10932 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
10933 }
10934 #[inline]
10935 pub fn set_mLinkQualityOut(&mut self, val: u8) {
10936 unsafe {
10937 let val: u8 = ::std::mem::transmute(val);
10938 self._bitfield_1.set(0usize, 2u8, val as u64)
10939 }
10940 }
10941 #[inline]
10942 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
10943 unsafe {
10944 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10945 ::std::ptr::addr_of!((*this)._bitfield_1),
10946 0usize,
10947 2u8,
10948 ) as u8)
10949 }
10950 }
10951 #[inline]
10952 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
10953 unsafe {
10954 let val: u8 = ::std::mem::transmute(val);
10955 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10956 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10957 0usize,
10958 2u8,
10959 val as u64,
10960 )
10961 }
10962 }
10963 #[inline]
10964 pub fn mLinkQualityIn(&self) -> u8 {
10965 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
10966 }
10967 #[inline]
10968 pub fn set_mLinkQualityIn(&mut self, val: u8) {
10969 unsafe {
10970 let val: u8 = ::std::mem::transmute(val);
10971 self._bitfield_1.set(2usize, 2u8, val as u64)
10972 }
10973 }
10974 #[inline]
10975 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
10976 unsafe {
10977 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10978 ::std::ptr::addr_of!((*this)._bitfield_1),
10979 2usize,
10980 2u8,
10981 ) as u8)
10982 }
10983 }
10984 #[inline]
10985 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
10986 unsafe {
10987 let val: u8 = ::std::mem::transmute(val);
10988 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10989 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10990 2usize,
10991 2u8,
10992 val as u64,
10993 )
10994 }
10995 }
10996 #[inline]
10997 pub fn mRouteCost(&self) -> u8 {
10998 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) }
10999 }
11000 #[inline]
11001 pub fn set_mRouteCost(&mut self, val: u8) {
11002 unsafe {
11003 let val: u8 = ::std::mem::transmute(val);
11004 self._bitfield_1.set(4usize, 4u8, val as u64)
11005 }
11006 }
11007 #[inline]
11008 pub unsafe fn mRouteCost_raw(this: *const Self) -> u8 {
11009 unsafe {
11010 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11011 ::std::ptr::addr_of!((*this)._bitfield_1),
11012 4usize,
11013 4u8,
11014 ) as u8)
11015 }
11016 }
11017 #[inline]
11018 pub unsafe fn set_mRouteCost_raw(this: *mut Self, val: u8) {
11019 unsafe {
11020 let val: u8 = ::std::mem::transmute(val);
11021 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11022 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11023 4usize,
11024 4u8,
11025 val as u64,
11026 )
11027 }
11028 }
11029 #[inline]
11030 pub fn new_bitfield_1(
11031 mLinkQualityOut: u8,
11032 mLinkQualityIn: u8,
11033 mRouteCost: u8,
11034 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11035 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11036 __bindgen_bitfield_unit.set(0usize, 2u8, {
11037 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
11038 mLinkQualityOut as u64
11039 });
11040 __bindgen_bitfield_unit.set(2usize, 2u8, {
11041 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
11042 mLinkQualityIn as u64
11043 });
11044 __bindgen_bitfield_unit.set(4usize, 4u8, {
11045 let mRouteCost: u8 = unsafe { ::std::mem::transmute(mRouteCost) };
11046 mRouteCost as u64
11047 });
11048 __bindgen_bitfield_unit
11049 }
11050}
11051#[doc = " Represents a Network Diagnostic Route64 TLV value."]
11052#[repr(C)]
11053#[derive(Debug, Copy, Clone)]
11054pub struct otNetworkDiagRoute {
11055 #[doc = "< Sequence number for Router ID assignments."]
11056 pub mIdSequence: u8,
11057 #[doc = "< Number of routes."]
11058 pub mRouteCount: u8,
11059 #[doc = "< Link Quality and Routing Cost data."]
11060 pub mRouteData: [otNetworkDiagRouteData; 63usize],
11061}
11062impl Default for otNetworkDiagRoute {
11063 fn default() -> Self {
11064 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11065 unsafe {
11066 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11067 s.assume_init()
11068 }
11069 }
11070}
11071#[doc = " Represents a Network Diagnostic Enhanced Route data."]
11072#[repr(C)]
11073#[derive(Debug, Default, Copy, Clone)]
11074pub struct otNetworkDiagEnhRouteData {
11075 #[doc = "< The Router ID."]
11076 pub mRouterId: u8,
11077 pub _bitfield_align_1: [u8; 0],
11078 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11079 #[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."]
11080 pub mNextHop: u8,
11081 #[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."]
11082 pub mNextHopCost: u8,
11083}
11084impl otNetworkDiagEnhRouteData {
11085 #[inline]
11086 pub fn mIsSelf(&self) -> bool {
11087 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11088 }
11089 #[inline]
11090 pub fn set_mIsSelf(&mut self, val: bool) {
11091 unsafe {
11092 let val: u8 = ::std::mem::transmute(val);
11093 self._bitfield_1.set(0usize, 1u8, val as u64)
11094 }
11095 }
11096 #[inline]
11097 pub unsafe fn mIsSelf_raw(this: *const Self) -> bool {
11098 unsafe {
11099 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11100 ::std::ptr::addr_of!((*this)._bitfield_1),
11101 0usize,
11102 1u8,
11103 ) as u8)
11104 }
11105 }
11106 #[inline]
11107 pub unsafe fn set_mIsSelf_raw(this: *mut Self, val: bool) {
11108 unsafe {
11109 let val: u8 = ::std::mem::transmute(val);
11110 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11111 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11112 0usize,
11113 1u8,
11114 val as u64,
11115 )
11116 }
11117 }
11118 #[inline]
11119 pub fn mHasLink(&self) -> bool {
11120 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
11121 }
11122 #[inline]
11123 pub fn set_mHasLink(&mut self, val: bool) {
11124 unsafe {
11125 let val: u8 = ::std::mem::transmute(val);
11126 self._bitfield_1.set(1usize, 1u8, val as u64)
11127 }
11128 }
11129 #[inline]
11130 pub unsafe fn mHasLink_raw(this: *const Self) -> bool {
11131 unsafe {
11132 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11133 ::std::ptr::addr_of!((*this)._bitfield_1),
11134 1usize,
11135 1u8,
11136 ) as u8)
11137 }
11138 }
11139 #[inline]
11140 pub unsafe fn set_mHasLink_raw(this: *mut Self, val: bool) {
11141 unsafe {
11142 let val: u8 = ::std::mem::transmute(val);
11143 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11144 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11145 1usize,
11146 1u8,
11147 val as u64,
11148 )
11149 }
11150 }
11151 #[inline]
11152 pub fn mLinkQualityOut(&self) -> u8 {
11153 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
11154 }
11155 #[inline]
11156 pub fn set_mLinkQualityOut(&mut self, val: u8) {
11157 unsafe {
11158 let val: u8 = ::std::mem::transmute(val);
11159 self._bitfield_1.set(2usize, 2u8, val as u64)
11160 }
11161 }
11162 #[inline]
11163 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
11164 unsafe {
11165 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11166 ::std::ptr::addr_of!((*this)._bitfield_1),
11167 2usize,
11168 2u8,
11169 ) as u8)
11170 }
11171 }
11172 #[inline]
11173 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
11174 unsafe {
11175 let val: u8 = ::std::mem::transmute(val);
11176 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11177 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11178 2usize,
11179 2u8,
11180 val as u64,
11181 )
11182 }
11183 }
11184 #[inline]
11185 pub fn mLinkQualityIn(&self) -> u8 {
11186 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u8) }
11187 }
11188 #[inline]
11189 pub fn set_mLinkQualityIn(&mut self, val: u8) {
11190 unsafe {
11191 let val: u8 = ::std::mem::transmute(val);
11192 self._bitfield_1.set(4usize, 2u8, val as u64)
11193 }
11194 }
11195 #[inline]
11196 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
11197 unsafe {
11198 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11199 ::std::ptr::addr_of!((*this)._bitfield_1),
11200 4usize,
11201 2u8,
11202 ) as u8)
11203 }
11204 }
11205 #[inline]
11206 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
11207 unsafe {
11208 let val: u8 = ::std::mem::transmute(val);
11209 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11210 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11211 4usize,
11212 2u8,
11213 val as u64,
11214 )
11215 }
11216 }
11217 #[inline]
11218 pub fn new_bitfield_1(
11219 mIsSelf: bool,
11220 mHasLink: bool,
11221 mLinkQualityOut: u8,
11222 mLinkQualityIn: u8,
11223 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11224 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11225 __bindgen_bitfield_unit.set(0usize, 1u8, {
11226 let mIsSelf: u8 = unsafe { ::std::mem::transmute(mIsSelf) };
11227 mIsSelf as u64
11228 });
11229 __bindgen_bitfield_unit.set(1usize, 1u8, {
11230 let mHasLink: u8 = unsafe { ::std::mem::transmute(mHasLink) };
11231 mHasLink as u64
11232 });
11233 __bindgen_bitfield_unit.set(2usize, 2u8, {
11234 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
11235 mLinkQualityOut as u64
11236 });
11237 __bindgen_bitfield_unit.set(4usize, 2u8, {
11238 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
11239 mLinkQualityIn as u64
11240 });
11241 __bindgen_bitfield_unit
11242 }
11243}
11244#[doc = " Represents a Network Diagnostic Enhanced Route TLV value."]
11245#[repr(C)]
11246#[derive(Debug, Copy, Clone)]
11247pub struct otNetworkDiagEnhRoute {
11248 #[doc = "< Number of `mRouteData` entries."]
11249 pub mRouteCount: u8,
11250 #[doc = "< Route Data per router."]
11251 pub mRouteData: [otNetworkDiagEnhRouteData; 63usize],
11252}
11253impl Default for otNetworkDiagEnhRoute {
11254 fn default() -> Self {
11255 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11256 unsafe {
11257 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11258 s.assume_init()
11259 }
11260 }
11261}
11262#[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."]
11263#[repr(C)]
11264#[derive(Debug, Default, Copy, Clone)]
11265pub struct otNetworkDiagMacCounters {
11266 pub mIfInUnknownProtos: u32,
11267 pub mIfInErrors: u32,
11268 pub mIfOutErrors: u32,
11269 pub mIfInUcastPkts: u32,
11270 pub mIfInBroadcastPkts: u32,
11271 pub mIfInDiscards: u32,
11272 pub mIfOutUcastPkts: u32,
11273 pub mIfOutBroadcastPkts: u32,
11274 pub mIfOutDiscards: u32,
11275}
11276#[doc = " Represents a Network Diagnostics MLE Counters value."]
11277#[repr(C)]
11278#[derive(Debug, Default, Copy, Clone)]
11279pub struct otNetworkDiagMleCounters {
11280 #[doc = "< Number of times device entered disabled role."]
11281 pub mDisabledRole: u16,
11282 #[doc = "< Number of times device entered detached role."]
11283 pub mDetachedRole: u16,
11284 #[doc = "< Number of times device entered child role."]
11285 pub mChildRole: u16,
11286 #[doc = "< Number of times device entered router role."]
11287 pub mRouterRole: u16,
11288 #[doc = "< Number of times device entered leader role."]
11289 pub mLeaderRole: u16,
11290 #[doc = "< Number of attach attempts while device was detached."]
11291 pub mAttachAttempts: u16,
11292 #[doc = "< Number of changes to partition ID."]
11293 pub mPartitionIdChanges: u16,
11294 #[doc = "< Number of attempts to attach to a better partition."]
11295 pub mBetterPartitionAttachAttempts: u16,
11296 #[doc = "< Number of time device changed its parent."]
11297 pub mParentChanges: u16,
11298 #[doc = "< Milliseconds tracked by next counters (zero if not supported)."]
11299 pub mTrackedTime: u64,
11300 #[doc = "< Milliseconds device has been in disabled role."]
11301 pub mDisabledTime: u64,
11302 #[doc = "< Milliseconds device has been in detached role."]
11303 pub mDetachedTime: u64,
11304 #[doc = "< Milliseconds device has been in child role."]
11305 pub mChildTime: u64,
11306 #[doc = "< Milliseconds device has been in router role."]
11307 pub mRouterTime: u64,
11308 #[doc = "< Milliseconds device has been in leader role."]
11309 pub mLeaderTime: u64,
11310}
11311#[doc = " Represents a Network Diagnostic Child Table Entry."]
11312#[repr(C)]
11313#[derive(Debug, Default, Copy, Clone)]
11314pub struct otNetworkDiagChildEntry {
11315 pub _bitfield_align_1: [u16; 0],
11316 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
11317 #[doc = "< Link mode."]
11318 pub mMode: otLinkModeConfig,
11319}
11320impl otNetworkDiagChildEntry {
11321 #[inline]
11322 pub fn mTimeout(&self) -> u16 {
11323 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 5u8) as u16) }
11324 }
11325 #[inline]
11326 pub fn set_mTimeout(&mut self, val: u16) {
11327 unsafe {
11328 let val: u16 = ::std::mem::transmute(val);
11329 self._bitfield_1.set(0usize, 5u8, val as u64)
11330 }
11331 }
11332 #[inline]
11333 pub unsafe fn mTimeout_raw(this: *const Self) -> u16 {
11334 unsafe {
11335 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11336 ::std::ptr::addr_of!((*this)._bitfield_1),
11337 0usize,
11338 5u8,
11339 ) as u16)
11340 }
11341 }
11342 #[inline]
11343 pub unsafe fn set_mTimeout_raw(this: *mut Self, val: u16) {
11344 unsafe {
11345 let val: u16 = ::std::mem::transmute(val);
11346 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11347 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11348 0usize,
11349 5u8,
11350 val as u64,
11351 )
11352 }
11353 }
11354 #[inline]
11355 pub fn mLinkQuality(&self) -> u8 {
11356 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u8) }
11357 }
11358 #[inline]
11359 pub fn set_mLinkQuality(&mut self, val: u8) {
11360 unsafe {
11361 let val: u8 = ::std::mem::transmute(val);
11362 self._bitfield_1.set(5usize, 2u8, val as u64)
11363 }
11364 }
11365 #[inline]
11366 pub unsafe fn mLinkQuality_raw(this: *const Self) -> u8 {
11367 unsafe {
11368 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11369 ::std::ptr::addr_of!((*this)._bitfield_1),
11370 5usize,
11371 2u8,
11372 ) as u8)
11373 }
11374 }
11375 #[inline]
11376 pub unsafe fn set_mLinkQuality_raw(this: *mut Self, val: u8) {
11377 unsafe {
11378 let val: u8 = ::std::mem::transmute(val);
11379 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11380 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11381 5usize,
11382 2u8,
11383 val as u64,
11384 )
11385 }
11386 }
11387 #[inline]
11388 pub fn mChildId(&self) -> u16 {
11389 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u16) }
11390 }
11391 #[inline]
11392 pub fn set_mChildId(&mut self, val: u16) {
11393 unsafe {
11394 let val: u16 = ::std::mem::transmute(val);
11395 self._bitfield_1.set(7usize, 9u8, val as u64)
11396 }
11397 }
11398 #[inline]
11399 pub unsafe fn mChildId_raw(this: *const Self) -> u16 {
11400 unsafe {
11401 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11402 ::std::ptr::addr_of!((*this)._bitfield_1),
11403 7usize,
11404 9u8,
11405 ) as u16)
11406 }
11407 }
11408 #[inline]
11409 pub unsafe fn set_mChildId_raw(this: *mut Self, val: u16) {
11410 unsafe {
11411 let val: u16 = ::std::mem::transmute(val);
11412 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11413 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11414 7usize,
11415 9u8,
11416 val as u64,
11417 )
11418 }
11419 }
11420 #[inline]
11421 pub fn new_bitfield_1(
11422 mTimeout: u16,
11423 mLinkQuality: u8,
11424 mChildId: u16,
11425 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
11426 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
11427 __bindgen_bitfield_unit.set(0usize, 5u8, {
11428 let mTimeout: u16 = unsafe { ::std::mem::transmute(mTimeout) };
11429 mTimeout as u64
11430 });
11431 __bindgen_bitfield_unit.set(5usize, 2u8, {
11432 let mLinkQuality: u8 = unsafe { ::std::mem::transmute(mLinkQuality) };
11433 mLinkQuality as u64
11434 });
11435 __bindgen_bitfield_unit.set(7usize, 9u8, {
11436 let mChildId: u16 = unsafe { ::std::mem::transmute(mChildId) };
11437 mChildId as u64
11438 });
11439 __bindgen_bitfield_unit
11440 }
11441}
11442#[doc = " Represents a Network Diagnostic Child Table TLV value."]
11443#[repr(C)]
11444#[derive(Debug, Copy, Clone)]
11445pub struct otNetworkDiagChildTable {
11446 #[doc = "< Number of child entries in the table."]
11447 pub mCount: u8,
11448 #[doc = "< Child table."]
11449 pub mTable: [otNetworkDiagChildEntry; 63usize],
11450}
11451impl Default for otNetworkDiagChildTable {
11452 fn default() -> Self {
11453 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11454 unsafe {
11455 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11456 s.assume_init()
11457 }
11458 }
11459}
11460#[doc = " Represents a Network Diagnostic TLV."]
11461#[repr(C)]
11462#[derive(Copy, Clone)]
11463pub struct otNetworkDiagTlv {
11464 #[doc = "< The Network Diagnostic TLV type."]
11465 pub mType: u8,
11466 pub mData: otNetworkDiagTlv__bindgen_ty_1,
11467}
11468#[repr(C)]
11469#[derive(Copy, Clone)]
11470pub union otNetworkDiagTlv__bindgen_ty_1 {
11471 pub mExtAddress: otExtAddress,
11472 pub mEui64: otExtAddress,
11473 pub mAddr16: u16,
11474 pub mMode: otLinkModeConfig,
11475 pub mTimeout: u32,
11476 pub mConnectivity: otNetworkDiagConnectivity,
11477 pub mRoute: otNetworkDiagRoute,
11478 pub mEnhRoute: otNetworkDiagEnhRoute,
11479 pub mLeaderData: otLeaderData,
11480 pub mNetworkData: otNetworkDiagData,
11481 pub mIp6AddrList: otNetworkDiagIp6AddrList,
11482 pub mMacCounters: otNetworkDiagMacCounters,
11483 pub mMleCounters: otNetworkDiagMleCounters,
11484 pub mBatteryLevel: u8,
11485 pub mSupplyVoltage: u16,
11486 pub mMaxChildTimeout: u32,
11487 pub mVersion: u16,
11488 pub mVendorName: [::std::os::raw::c_char; 33usize],
11489 pub mVendorModel: [::std::os::raw::c_char; 33usize],
11490 pub mVendorSwVersion: [::std::os::raw::c_char; 17usize],
11491 pub mThreadStackVersion: [::std::os::raw::c_char; 65usize],
11492 pub mVendorAppUrl: [::std::os::raw::c_char; 97usize],
11493 pub mNonPreferredChannels: otChannelMask,
11494 pub mChannelPages: otNetworkDiagData,
11495 pub mChildTable: otNetworkDiagChildTable,
11496}
11497impl Default for otNetworkDiagTlv__bindgen_ty_1 {
11498 fn default() -> Self {
11499 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11500 unsafe {
11501 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11502 s.assume_init()
11503 }
11504 }
11505}
11506impl Default for otNetworkDiagTlv {
11507 fn default() -> Self {
11508 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11509 unsafe {
11510 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11511 s.assume_init()
11512 }
11513 }
11514}
11515unsafe extern "C" {
11516 #[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."]
11517 pub fn otThreadGetNextDiagnosticTlv(
11518 aMessage: *const otMessage,
11519 aIterator: *mut otNetworkDiagIterator,
11520 aNetworkDiagTlv: *mut otNetworkDiagTlv,
11521 ) -> otError;
11522}
11523#[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."]
11524pub type otReceiveDiagnosticGetCallback = ::std::option::Option<
11525 unsafe extern "C" fn(
11526 aError: otError,
11527 aMessage: *mut otMessage,
11528 aMessageInfo: *const otMessageInfo,
11529 aContext: *mut ::std::os::raw::c_void,
11530 ),
11531>;
11532unsafe extern "C" {
11533 #[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."]
11534 pub fn otThreadSendDiagnosticGet(
11535 aInstance: *mut otInstance,
11536 aDestination: *const otIp6Address,
11537 aTlvTypes: *const u8,
11538 aCount: u8,
11539 aCallback: otReceiveDiagnosticGetCallback,
11540 aCallbackContext: *mut ::std::os::raw::c_void,
11541 ) -> otError;
11542}
11543unsafe extern "C" {
11544 #[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."]
11545 pub fn otThreadSendDiagnosticReset(
11546 aInstance: *mut otInstance,
11547 aDestination: *const otIp6Address,
11548 aTlvTypes: *const u8,
11549 aCount: u8,
11550 ) -> otError;
11551}
11552unsafe extern "C" {
11553 #[doc = " Get the vendor name string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor name string."]
11554 pub fn otThreadGetVendorName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11555}
11556unsafe extern "C" {
11557 #[doc = " Get the vendor model string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor model string."]
11558 pub fn otThreadGetVendorModel(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11559}
11560unsafe extern "C" {
11561 #[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."]
11562 pub fn otThreadGetVendorSwVersion(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11563}
11564unsafe extern "C" {
11565 #[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."]
11566 pub fn otThreadGetVendorAppUrl(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11567}
11568unsafe extern "C" {
11569 #[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 @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 (too long or not UTF8)."]
11570 pub fn otThreadSetVendorName(
11571 aInstance: *mut otInstance,
11572 aVendorName: *const ::std::os::raw::c_char,
11573 ) -> otError;
11574}
11575unsafe extern "C" {
11576 #[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)."]
11577 pub fn otThreadSetVendorModel(
11578 aInstance: *mut otInstance,
11579 aVendorModel: *const ::std::os::raw::c_char,
11580 ) -> otError;
11581}
11582unsafe extern "C" {
11583 #[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)."]
11584 pub fn otThreadSetVendorSwVersion(
11585 aInstance: *mut otInstance,
11586 aVendorSwVersion: *const ::std::os::raw::c_char,
11587 ) -> otError;
11588}
11589unsafe extern "C" {
11590 #[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)."]
11591 pub fn otThreadSetVendorAppUrl(
11592 aInstance: *mut otInstance,
11593 aVendorAppUrl: *const ::std::os::raw::c_char,
11594 ) -> otError;
11595}
11596#[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."]
11597pub type otThreadNonPreferredChannelsResetCallback =
11598 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
11599unsafe extern "C" {
11600 #[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."]
11601 pub fn otThreadSetNonPreferredChannels(aInstance: *mut otInstance, aChannelMask: otChannelMask);
11602}
11603unsafe extern "C" {
11604 #[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."]
11605 pub fn otThreadGetNonPreferredChannels(aInstance: *mut otInstance) -> otChannelMask;
11606}
11607unsafe extern "C" {
11608 #[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."]
11609 pub fn otThreadSetNonPreferredChannelsResetCallback(
11610 aInstance: *mut otInstance,
11611 aCallback: otThreadNonPreferredChannelsResetCallback,
11612 aContext: *mut ::std::os::raw::c_void,
11613 );
11614}
11615#[doc = "< The device hasn't attached to a network."]
11616pub const OT_NETWORK_TIME_UNSYNCHRONIZED: otNetworkTimeStatus = -1;
11617#[doc = "< The device hasn’t received time sync for more than two periods time."]
11618pub const OT_NETWORK_TIME_RESYNC_NEEDED: otNetworkTimeStatus = 0;
11619#[doc = "< The device network time is synchronized."]
11620pub const OT_NETWORK_TIME_SYNCHRONIZED: otNetworkTimeStatus = 1;
11621#[doc = " Represents OpenThread time synchronization status."]
11622pub type otNetworkTimeStatus = ::std::os::raw::c_int;
11623#[doc = " Pointer is called when a network time sync or status change occurs."]
11624pub type otNetworkTimeSyncCallbackFn =
11625 ::std::option::Option<unsafe extern "C" fn(aCallbackContext: *mut ::std::os::raw::c_void)>;
11626unsafe extern "C" {
11627 #[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."]
11628 pub fn otNetworkTimeGet(
11629 aInstance: *mut otInstance,
11630 aNetworkTime: *mut u64,
11631 ) -> otNetworkTimeStatus;
11632}
11633unsafe extern "C" {
11634 #[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."]
11635 pub fn otNetworkTimeSetSyncPeriod(aInstance: *mut otInstance, aTimeSyncPeriod: u16) -> otError;
11636}
11637unsafe extern "C" {
11638 #[doc = " Get the time synchronization period.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The time synchronization period."]
11639 pub fn otNetworkTimeGetSyncPeriod(aInstance: *mut otInstance) -> u16;
11640}
11641unsafe extern "C" {
11642 #[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."]
11643 pub fn otNetworkTimeSetXtalThreshold(
11644 aInstance: *mut otInstance,
11645 aXTALThreshold: u16,
11646 ) -> otError;
11647}
11648unsafe extern "C" {
11649 #[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."]
11650 pub fn otNetworkTimeGetXtalThreshold(aInstance: *mut otInstance) -> u16;
11651}
11652unsafe extern "C" {
11653 #[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"]
11654 pub fn otNetworkTimeSyncSetCallback(
11655 aInstance: *mut otInstance,
11656 aCallbackFn: otNetworkTimeSyncCallbackFn,
11657 aCallbackContext: *mut ::std::os::raw::c_void,
11658 );
11659}
11660#[doc = " Represents a ping reply."]
11661#[repr(C)]
11662#[derive(Copy, Clone)]
11663pub struct otPingSenderReply {
11664 #[doc = "< Sender IPv6 address (address from which ping reply was received)."]
11665 pub mSenderAddress: otIp6Address,
11666 #[doc = "< Round trip time in msec."]
11667 pub mRoundTripTime: u16,
11668 #[doc = "< Data size (number of bytes) in reply (excluding IPv6 and ICMP6 headers)."]
11669 pub mSize: u16,
11670 #[doc = "< Sequence number."]
11671 pub mSequenceNumber: u16,
11672 #[doc = "< Hop limit."]
11673 pub mHopLimit: u8,
11674}
11675impl Default for otPingSenderReply {
11676 fn default() -> Self {
11677 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11678 unsafe {
11679 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11680 s.assume_init()
11681 }
11682 }
11683}
11684#[doc = " Represents statistics of a ping request."]
11685#[repr(C)]
11686#[derive(Debug, Default, Copy, Clone)]
11687pub struct otPingSenderStatistics {
11688 #[doc = "< The number of ping requests already sent."]
11689 pub mSentCount: u16,
11690 #[doc = "< The number of ping replies received."]
11691 pub mReceivedCount: u16,
11692 #[doc = "< The total round trip time of ping requests."]
11693 pub mTotalRoundTripTime: u32,
11694 #[doc = "< The min round trip time among ping requests."]
11695 pub mMinRoundTripTime: u16,
11696 #[doc = "< The max round trip time among ping requests."]
11697 pub mMaxRoundTripTime: u16,
11698 #[doc = "< Whether this is a multicast ping request."]
11699 pub mIsMulticast: bool,
11700}
11701#[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."]
11702pub type otPingSenderReplyCallback = ::std::option::Option<
11703 unsafe extern "C" fn(aReply: *const otPingSenderReply, aContext: *mut ::std::os::raw::c_void),
11704>;
11705#[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."]
11706pub type otPingSenderStatisticsCallback = ::std::option::Option<
11707 unsafe extern "C" fn(
11708 aStatistics: *const otPingSenderStatistics,
11709 aContext: *mut ::std::os::raw::c_void,
11710 ),
11711>;
11712#[doc = " Represents a ping request configuration."]
11713#[repr(C)]
11714#[derive(Copy, Clone)]
11715pub struct otPingSenderConfig {
11716 #[doc = "< Source address of the ping."]
11717 pub mSource: otIp6Address,
11718 #[doc = "< Destination address to ping."]
11719 pub mDestination: otIp6Address,
11720 #[doc = "< Callback function to report replies (can be NULL if not needed)."]
11721 pub mReplyCallback: otPingSenderReplyCallback,
11722 #[doc = "< Callback function to report statistics (can be NULL if not needed)."]
11723 pub mStatisticsCallback: otPingSenderStatisticsCallback,
11724 #[doc = "< A pointer to the callback application-specific context."]
11725 pub mCallbackContext: *mut ::std::os::raw::c_void,
11726 #[doc = "< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default."]
11727 pub mSize: u16,
11728 #[doc = "< Number of ping messages to send. Zero to use default."]
11729 pub mCount: u16,
11730 #[doc = "< Ping tx interval in milliseconds. Zero to use default."]
11731 pub mInterval: u32,
11732 #[doc = "< Time in milliseconds to wait for final reply after sending final request.\n< Zero to use default."]
11733 pub mTimeout: u16,
11734 #[doc = "< Hop limit (used if `mAllowZeroHopLimit` is false). Zero for default."]
11735 pub mHopLimit: u8,
11736 #[doc = "< Indicates whether hop limit is zero."]
11737 pub mAllowZeroHopLimit: bool,
11738 #[doc = "< Allow looping back pings to multicast address that device is subscribed to."]
11739 pub mMulticastLoop: bool,
11740}
11741impl Default for otPingSenderConfig {
11742 fn default() -> Self {
11743 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11744 unsafe {
11745 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11746 s.assume_init()
11747 }
11748 }
11749}
11750unsafe extern "C" {
11751 #[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"]
11752 pub fn otPingSenderPing(
11753 aInstance: *mut otInstance,
11754 aConfig: *const otPingSenderConfig,
11755 ) -> otError;
11756}
11757unsafe extern "C" {
11758 #[doc = " Stops an ongoing ping.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
11759 pub fn otPingSenderStop(aInstance: *mut otInstance);
11760}
11761unsafe extern "C" {
11762 #[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."]
11763 pub fn otPlatAlarmMicroStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
11764}
11765unsafe extern "C" {
11766 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
11767 pub fn otPlatAlarmMicroStop(aInstance: *mut otInstance);
11768}
11769unsafe extern "C" {
11770 #[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."]
11771 pub fn otPlatAlarmMicroGetNow() -> u32;
11772}
11773unsafe extern "C" {
11774 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11775 pub fn otPlatAlarmMicroFired(aInstance: *mut otInstance);
11776}
11777unsafe extern "C" {
11778 #[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."]
11779 pub fn otPlatAlarmMilliStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
11780}
11781unsafe extern "C" {
11782 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
11783 pub fn otPlatAlarmMilliStop(aInstance: *mut otInstance);
11784}
11785unsafe extern "C" {
11786 #[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."]
11787 pub fn otPlatAlarmMilliGetNow() -> u32;
11788}
11789unsafe extern "C" {
11790 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11791 pub fn otPlatAlarmMilliFired(aInstance: *mut otInstance);
11792}
11793unsafe extern "C" {
11794 #[doc = " Signal diagnostics module that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11795 pub fn otPlatDiagAlarmFired(aInstance: *mut otInstance);
11796}
11797#[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()`."]
11798#[repr(C)]
11799#[derive(Debug, Copy, Clone)]
11800pub struct otBorderRoutingPrefixTableIterator {
11801 pub mPtr1: *const ::std::os::raw::c_void,
11802 pub mPtr2: *const ::std::os::raw::c_void,
11803 pub mData0: u32,
11804 pub mData1: u32,
11805 pub mData2: u8,
11806 pub mData3: u8,
11807}
11808impl Default for otBorderRoutingPrefixTableIterator {
11809 fn default() -> Self {
11810 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11811 unsafe {
11812 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11813 s.assume_init()
11814 }
11815 }
11816}
11817#[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."]
11818#[repr(C)]
11819#[derive(Copy, Clone)]
11820pub struct otBorderRoutingRouterEntry {
11821 #[doc = "< IPv6 address of the router."]
11822 pub mAddress: otIp6Address,
11823 #[doc = "< Milliseconds since last update (any message rx) from this router."]
11824 pub mMsecSinceLastUpdate: u32,
11825 #[doc = "< The router's age in seconds (duration since its first discovery)."]
11826 pub mAge: u32,
11827 pub _bitfield_align_1: [u8; 0],
11828 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11829 pub __bindgen_padding_0: [u8; 3usize],
11830}
11831impl Default for otBorderRoutingRouterEntry {
11832 fn default() -> Self {
11833 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11834 unsafe {
11835 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11836 s.assume_init()
11837 }
11838 }
11839}
11840impl otBorderRoutingRouterEntry {
11841 #[inline]
11842 pub fn mManagedAddressConfigFlag(&self) -> bool {
11843 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
11844 }
11845 #[inline]
11846 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
11847 unsafe {
11848 let val: u8 = ::std::mem::transmute(val);
11849 self._bitfield_1.set(0usize, 1u8, val as u64)
11850 }
11851 }
11852 #[inline]
11853 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
11854 unsafe {
11855 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11856 ::std::ptr::addr_of!((*this)._bitfield_1),
11857 0usize,
11858 1u8,
11859 ) as u8)
11860 }
11861 }
11862 #[inline]
11863 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
11864 unsafe {
11865 let val: u8 = ::std::mem::transmute(val);
11866 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11867 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11868 0usize,
11869 1u8,
11870 val as u64,
11871 )
11872 }
11873 }
11874 #[inline]
11875 pub fn mOtherConfigFlag(&self) -> bool {
11876 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
11877 }
11878 #[inline]
11879 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
11880 unsafe {
11881 let val: u8 = ::std::mem::transmute(val);
11882 self._bitfield_1.set(1usize, 1u8, val as u64)
11883 }
11884 }
11885 #[inline]
11886 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
11887 unsafe {
11888 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11889 ::std::ptr::addr_of!((*this)._bitfield_1),
11890 1usize,
11891 1u8,
11892 ) as u8)
11893 }
11894 }
11895 #[inline]
11896 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
11897 unsafe {
11898 let val: u8 = ::std::mem::transmute(val);
11899 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11900 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11901 1usize,
11902 1u8,
11903 val as u64,
11904 )
11905 }
11906 }
11907 #[inline]
11908 pub fn mSnacRouterFlag(&self) -> bool {
11909 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
11910 }
11911 #[inline]
11912 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
11913 unsafe {
11914 let val: u8 = ::std::mem::transmute(val);
11915 self._bitfield_1.set(2usize, 1u8, val as u64)
11916 }
11917 }
11918 #[inline]
11919 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
11920 unsafe {
11921 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11922 ::std::ptr::addr_of!((*this)._bitfield_1),
11923 2usize,
11924 1u8,
11925 ) as u8)
11926 }
11927 }
11928 #[inline]
11929 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
11930 unsafe {
11931 let val: u8 = ::std::mem::transmute(val);
11932 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11933 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11934 2usize,
11935 1u8,
11936 val as u64,
11937 )
11938 }
11939 }
11940 #[inline]
11941 pub fn mIsLocalDevice(&self) -> bool {
11942 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
11943 }
11944 #[inline]
11945 pub fn set_mIsLocalDevice(&mut self, val: bool) {
11946 unsafe {
11947 let val: u8 = ::std::mem::transmute(val);
11948 self._bitfield_1.set(3usize, 1u8, val as u64)
11949 }
11950 }
11951 #[inline]
11952 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
11953 unsafe {
11954 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11955 ::std::ptr::addr_of!((*this)._bitfield_1),
11956 3usize,
11957 1u8,
11958 ) as u8)
11959 }
11960 }
11961 #[inline]
11962 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
11963 unsafe {
11964 let val: u8 = ::std::mem::transmute(val);
11965 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11966 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11967 3usize,
11968 1u8,
11969 val as u64,
11970 )
11971 }
11972 }
11973 #[inline]
11974 pub fn mIsReachable(&self) -> bool {
11975 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
11976 }
11977 #[inline]
11978 pub fn set_mIsReachable(&mut self, val: bool) {
11979 unsafe {
11980 let val: u8 = ::std::mem::transmute(val);
11981 self._bitfield_1.set(4usize, 1u8, val as u64)
11982 }
11983 }
11984 #[inline]
11985 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
11986 unsafe {
11987 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11988 ::std::ptr::addr_of!((*this)._bitfield_1),
11989 4usize,
11990 1u8,
11991 ) as u8)
11992 }
11993 }
11994 #[inline]
11995 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
11996 unsafe {
11997 let val: u8 = ::std::mem::transmute(val);
11998 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11999 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12000 4usize,
12001 1u8,
12002 val as u64,
12003 )
12004 }
12005 }
12006 #[inline]
12007 pub fn mIsPeerBr(&self) -> bool {
12008 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
12009 }
12010 #[inline]
12011 pub fn set_mIsPeerBr(&mut self, val: bool) {
12012 unsafe {
12013 let val: u8 = ::std::mem::transmute(val);
12014 self._bitfield_1.set(5usize, 1u8, val as u64)
12015 }
12016 }
12017 #[inline]
12018 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
12019 unsafe {
12020 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
12021 ::std::ptr::addr_of!((*this)._bitfield_1),
12022 5usize,
12023 1u8,
12024 ) as u8)
12025 }
12026 }
12027 #[inline]
12028 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
12029 unsafe {
12030 let val: u8 = ::std::mem::transmute(val);
12031 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
12032 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
12033 5usize,
12034 1u8,
12035 val as u64,
12036 )
12037 }
12038 }
12039 #[inline]
12040 pub fn new_bitfield_1(
12041 mManagedAddressConfigFlag: bool,
12042 mOtherConfigFlag: bool,
12043 mSnacRouterFlag: bool,
12044 mIsLocalDevice: bool,
12045 mIsReachable: bool,
12046 mIsPeerBr: bool,
12047 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
12048 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
12049 __bindgen_bitfield_unit.set(0usize, 1u8, {
12050 let mManagedAddressConfigFlag: u8 =
12051 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
12052 mManagedAddressConfigFlag as u64
12053 });
12054 __bindgen_bitfield_unit.set(1usize, 1u8, {
12055 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
12056 mOtherConfigFlag as u64
12057 });
12058 __bindgen_bitfield_unit.set(2usize, 1u8, {
12059 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
12060 mSnacRouterFlag as u64
12061 });
12062 __bindgen_bitfield_unit.set(3usize, 1u8, {
12063 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
12064 mIsLocalDevice as u64
12065 });
12066 __bindgen_bitfield_unit.set(4usize, 1u8, {
12067 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
12068 mIsReachable as u64
12069 });
12070 __bindgen_bitfield_unit.set(5usize, 1u8, {
12071 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
12072 mIsPeerBr as u64
12073 });
12074 __bindgen_bitfield_unit
12075 }
12076}
12077#[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."]
12078#[repr(C)]
12079#[derive(Copy, Clone)]
12080pub struct otBorderRoutingPrefixTableEntry {
12081 #[doc = "< Information about the router advertising this prefix."]
12082 pub mRouter: otBorderRoutingRouterEntry,
12083 #[doc = "< The discovered IPv6 prefix."]
12084 pub mPrefix: otIp6Prefix,
12085 #[doc = "< Indicates whether the prefix is on-link or route prefix."]
12086 pub mIsOnLink: bool,
12087 #[doc = "< Milliseconds since last update of this prefix."]
12088 pub mMsecSinceLastUpdate: u32,
12089 #[doc = "< Valid lifetime of the prefix (in seconds)."]
12090 pub mValidLifetime: u32,
12091 #[doc = "< Route preference when `mIsOnlink` is false."]
12092 pub mRoutePreference: otRoutePreference,
12093 #[doc = "< Preferred lifetime of the on-link prefix when `mIsOnLink`."]
12094 pub mPreferredLifetime: u32,
12095}
12096impl Default for otBorderRoutingPrefixTableEntry {
12097 fn default() -> Self {
12098 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12099 unsafe {
12100 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12101 s.assume_init()
12102 }
12103 }
12104}
12105#[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."]
12106#[repr(C)]
12107#[derive(Copy, Clone)]
12108pub struct otBorderRoutingRdnssAddrEntry {
12109 #[doc = "< Information about the router advertising this address."]
12110 pub mRouter: otBorderRoutingRouterEntry,
12111 #[doc = "< The DNS Server IPv6 address."]
12112 pub mAddress: otIp6Address,
12113 #[doc = "< Milliseconds since last update of this address."]
12114 pub mMsecSinceLastUpdate: u32,
12115 #[doc = "< Lifetime of the address (in seconds)."]
12116 pub mLifetime: u32,
12117}
12118impl Default for otBorderRoutingRdnssAddrEntry {
12119 fn default() -> Self {
12120 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12121 unsafe {
12122 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12123 s.assume_init()
12124 }
12125 }
12126}
12127#[doc = " Represents information about a peer Border Router found in the Network Data."]
12128#[repr(C)]
12129#[derive(Debug, Default, Copy, Clone)]
12130pub struct otBorderRoutingPeerBorderRouterEntry {
12131 #[doc = "< The RLOC16 of BR."]
12132 pub mRloc16: u16,
12133 #[doc = "< Seconds since the BR appeared in the Network Data."]
12134 pub mAge: u32,
12135}
12136#[doc = " Represents an infra-if IPv6 address entry (an address used by this BR itself on the AIL)."]
12137#[repr(C)]
12138#[derive(Copy, Clone)]
12139pub struct otBorderRoutingIfAddrEntry {
12140 #[doc = "< The IPv6 address."]
12141 pub mAddress: otIp6Address,
12142 #[doc = "< Seconds since the last RA was sent from this BR using this address."]
12143 pub mSecSinceLastUse: u32,
12144}
12145impl Default for otBorderRoutingIfAddrEntry {
12146 fn default() -> Self {
12147 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12148 unsafe {
12149 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12150 s.assume_init()
12151 }
12152 }
12153}
12154#[doc = " Represents a group of data of platform-generated RA messages processed."]
12155#[repr(C)]
12156#[derive(Debug, Default, Copy, Clone)]
12157pub struct otPdProcessedRaInfo {
12158 #[doc = "< The number of platform generated RA handled by ProcessPlatformGeneratedRa."]
12159 pub mNumPlatformRaReceived: u32,
12160 #[doc = "< The number of PIO processed for adding OMR prefixes."]
12161 pub mNumPlatformPioProcessed: u32,
12162 #[doc = "< The timestamp of last processed RA message."]
12163 pub mLastPlatformRaMsec: u32,
12164}
12165#[doc = "< BR auto-generates the local OMR prefix."]
12166pub const OT_BORDER_ROUTING_OMR_CONFIG_AUTO: otBorderRoutingOmrConfig = 0;
12167#[doc = "< BR uses a given custom OMR prefix."]
12168pub const OT_BORDER_ROUTING_OMR_CONFIG_CUSTOM: otBorderRoutingOmrConfig = 1;
12169#[doc = "< BR does not add local/PD OMR prefix in Network Data."]
12170pub const OT_BORDER_ROUTING_OMR_CONFIG_DISABLED: otBorderRoutingOmrConfig = 2;
12171#[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."]
12172pub type otBorderRoutingOmrConfig = ::std::os::raw::c_uint;
12173#[doc = "< Routing Manager is uninitialized."]
12174pub const OT_BORDER_ROUTING_STATE_UNINITIALIZED: otBorderRoutingState = 0;
12175#[doc = "< Routing Manager is initialized but disabled."]
12176pub const OT_BORDER_ROUTING_STATE_DISABLED: otBorderRoutingState = 1;
12177#[doc = "< Routing Manager in initialized and enabled but currently stopped."]
12178pub const OT_BORDER_ROUTING_STATE_STOPPED: otBorderRoutingState = 2;
12179#[doc = "< Routing Manager is initialized, enabled, and running."]
12180pub const OT_BORDER_ROUTING_STATE_RUNNING: otBorderRoutingState = 3;
12181#[doc = " Represents the state of Border Routing Manager."]
12182pub type otBorderRoutingState = ::std::os::raw::c_uint;
12183#[doc = "< DHCPv6 PD is disabled on the border router."]
12184pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED: otBorderRoutingDhcp6PdState = 0;
12185#[doc = "< DHCPv6 PD in enabled but won't try to request and publish a prefix."]
12186pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED: otBorderRoutingDhcp6PdState = 1;
12187#[doc = "< DHCPv6 PD is enabled and will try to request and publish a prefix."]
12188pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING: otBorderRoutingDhcp6PdState = 2;
12189#[doc = "< DHCPv6 PD is idle; Higher-prf prefix published by other BRs."]
12190pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE: otBorderRoutingDhcp6PdState = 3;
12191#[doc = " This enumeration represents the state of DHCPv6 Prefix Delegation State."]
12192pub type otBorderRoutingDhcp6PdState = ::std::os::raw::c_uint;
12193unsafe extern "C" {
12194 #[doc = " Initializes the Border Routing Manager on given infrastructure interface.\n\n @note This method MUST be called before any other otBorderRouting* APIs.\n @note This method can be re-called to change the infrastructure interface, but the Border Routing Manager should be\n disabled first, and re-enabled after.\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 interface is running.\n\n @retval OT_ERROR_NONE Successfully started the Border Routing Manager on given infrastructure.\n @retval OT_ERROR_INVALID_STATE The Border Routing Manager is in a state other than disabled or uninitialized.\n @retval OT_ERROR_INVALID_ARGS The index of the infrastructure interface is not valid.\n @retval OT_ERROR_FAILED Internal failure. Usually due to failure in generating random prefixes.\n\n @sa otPlatInfraIfStateChanged.\n @sa otBorderRoutingSetEnabled."]
12195 pub fn otBorderRoutingInit(
12196 aInstance: *mut otInstance,
12197 aInfraIfIndex: u32,
12198 aInfraIfIsRunning: bool,
12199 ) -> otError;
12200}
12201unsafe extern "C" {
12202 #[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"]
12203 pub fn otBorderRoutingGetInfraIfInfo(
12204 aInstance: *mut otInstance,
12205 aInfraIfIndex: *mut u32,
12206 aInfraIfIsRunning: *mut bool,
12207 ) -> otError;
12208}
12209unsafe extern "C" {
12210 #[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."]
12211 pub fn otBorderRoutingSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
12212}
12213unsafe extern "C" {
12214 #[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."]
12215 pub fn otBorderRoutingGetState(aInstance: *mut otInstance) -> otBorderRoutingState;
12216}
12217unsafe extern "C" {
12218 #[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."]
12219 pub fn otBorderRoutingSetOmrConfig(
12220 aInstance: *mut otInstance,
12221 aConfig: otBorderRoutingOmrConfig,
12222 aOmrPrefix: *const otIp6Prefix,
12223 aPreference: otRoutePreference,
12224 ) -> otError;
12225}
12226unsafe extern "C" {
12227 #[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."]
12228 pub fn otBorderRoutingGetOmrConfig(
12229 aInstance: *mut otInstance,
12230 aOmrPrefix: *mut otIp6Prefix,
12231 aPreference: *mut otRoutePreference,
12232 ) -> otBorderRoutingOmrConfig;
12233}
12234unsafe extern "C" {
12235 #[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."]
12236 pub fn otBorderRoutingGetRouteInfoOptionPreference(
12237 aInstance: *mut otInstance,
12238 ) -> otRoutePreference;
12239}
12240unsafe extern "C" {
12241 #[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."]
12242 pub fn otBorderRoutingSetRouteInfoOptionPreference(
12243 aInstance: *mut otInstance,
12244 aPreference: otRoutePreference,
12245 );
12246}
12247unsafe extern "C" {
12248 #[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."]
12249 pub fn otBorderRoutingClearRouteInfoOptionPreference(aInstance: *mut otInstance);
12250}
12251unsafe extern "C" {
12252 #[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."]
12253 pub fn otBorderRoutingSetExtraRouterAdvertOptions(
12254 aInstance: *mut otInstance,
12255 aOptions: *const u8,
12256 aLength: u16,
12257 ) -> otError;
12258}
12259unsafe extern "C" {
12260 #[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."]
12261 pub fn otBorderRoutingGetRoutePreference(aInstance: *mut otInstance) -> otRoutePreference;
12262}
12263unsafe extern "C" {
12264 #[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."]
12265 pub fn otBorderRoutingSetRoutePreference(
12266 aInstance: *mut otInstance,
12267 aPreference: otRoutePreference,
12268 );
12269}
12270unsafe extern "C" {
12271 #[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."]
12272 pub fn otBorderRoutingClearRoutePreference(aInstance: *mut otInstance);
12273}
12274unsafe extern "C" {
12275 #[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"]
12276 pub fn otBorderRoutingGetOmrPrefix(
12277 aInstance: *mut otInstance,
12278 aPrefix: *mut otIp6Prefix,
12279 ) -> otError;
12280}
12281unsafe extern "C" {
12282 #[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"]
12283 pub fn otBorderRoutingGetPdOmrPrefix(
12284 aInstance: *mut otInstance,
12285 aPrefixInfo: *mut otBorderRoutingPrefixTableEntry,
12286 ) -> otError;
12287}
12288unsafe extern "C" {
12289 #[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."]
12290 pub fn otBorderRoutingGetPdProcessedRaInfo(
12291 aInstance: *mut otInstance,
12292 aPdProcessedRaInfo: *mut otPdProcessedRaInfo,
12293 ) -> otError;
12294}
12295unsafe extern "C" {
12296 #[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."]
12297 pub fn otBorderRoutingGetFavoredOmrPrefix(
12298 aInstance: *mut otInstance,
12299 aPrefix: *mut otIp6Prefix,
12300 aPreference: *mut otRoutePreference,
12301 ) -> otError;
12302}
12303unsafe extern "C" {
12304 #[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."]
12305 pub fn otBorderRoutingGetOnLinkPrefix(
12306 aInstance: *mut otInstance,
12307 aPrefix: *mut otIp6Prefix,
12308 ) -> otError;
12309}
12310unsafe extern "C" {
12311 #[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."]
12312 pub fn otBorderRoutingGetFavoredOnLinkPrefix(
12313 aInstance: *mut otInstance,
12314 aPrefix: *mut otIp6Prefix,
12315 ) -> otError;
12316}
12317unsafe extern "C" {
12318 #[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."]
12319 pub fn otBorderRoutingGetNat64Prefix(
12320 aInstance: *mut otInstance,
12321 aPrefix: *mut otIp6Prefix,
12322 ) -> otError;
12323}
12324unsafe extern "C" {
12325 #[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."]
12326 pub fn otBorderRoutingGetFavoredNat64Prefix(
12327 aInstance: *mut otInstance,
12328 aPrefix: *mut otIp6Prefix,
12329 aPreference: *mut otRoutePreference,
12330 ) -> otError;
12331}
12332unsafe extern "C" {
12333 #[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."]
12334 pub fn otBorderRoutingPrefixTableInitIterator(
12335 aInstance: *mut otInstance,
12336 aIterator: *mut otBorderRoutingPrefixTableIterator,
12337 );
12338}
12339unsafe extern "C" {
12340 #[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."]
12341 pub fn otBorderRoutingGetNextPrefixTableEntry(
12342 aInstance: *mut otInstance,
12343 aIterator: *mut otBorderRoutingPrefixTableIterator,
12344 aEntry: *mut otBorderRoutingPrefixTableEntry,
12345 ) -> otError;
12346}
12347unsafe extern "C" {
12348 #[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."]
12349 pub fn otBorderRoutingGetNextRouterEntry(
12350 aInstance: *mut otInstance,
12351 aIterator: *mut otBorderRoutingPrefixTableIterator,
12352 aEntry: *mut otBorderRoutingRouterEntry,
12353 ) -> otError;
12354}
12355unsafe extern "C" {
12356 #[doc = " Iterates over the peer BRs found in the Network Data.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.\n\n Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered\n to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data\n entries:\n\n - It has added at least one external route entry.\n - It has added at least one prefix entry with both the default-route and on-mesh flags set.\n - It has added at least one domain prefix (with both the domain and on-mesh flags set).\n\n The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.\n\n @param[in] aInstance The OpenThread instance.\n @param[in,out] aIterator A pointer to the iterator.\n @param[out] aEntry A pointer to the entry to populate.\n\n @retval OT_ERROR_NONE Iterated to the next entry, @p aEntry and @p aIterator are updated.\n @retval OT_ERROR_NOT_FOUND No more entries."]
12357 pub fn otBorderRoutingGetNextPeerBrEntry(
12358 aInstance: *mut otInstance,
12359 aIterator: *mut otBorderRoutingPrefixTableIterator,
12360 aEntry: *mut otBorderRoutingPeerBorderRouterEntry,
12361 ) -> otError;
12362}
12363unsafe extern "C" {
12364 #[doc = " Returns the number of peer BRs found in the Network Data.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.\n\n Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered\n to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data\n entries:\n\n - It has added at least one external route entry.\n - It has added at least one prefix entry with both the default-route and on-mesh flags set.\n - It has added at least one domain prefix (with both the domain and on-mesh flags set).\n\n The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.\n\n @param[in] aInstance The OpenThread instance.\n @param[out] aMinAge Pointer to an `uint32_t` to return the minimum age among all peer BRs.\n Can be NULL if the caller does not need this information.\n Age is represented as seconds since appearance of the BR entry in the Network Data.\n\n @returns The number of peer BRs."]
12365 pub fn otBorderRoutingCountPeerBrs(aInstance: *mut otInstance, aMinAge: *mut u32) -> u16;
12366}
12367#[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 Routing Manager determines a change in\n whether 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()`."]
12368pub type otBorderRoutingMultiAilCallback = ::std::option::Option<
12369 unsafe extern "C" fn(aDetected: bool, aContext: *mut ::std::os::raw::c_void),
12370>;
12371unsafe extern "C" {
12372 #[doc = " Gets the current detected state regarding multiple Adjacent Infrastructure Links (AILs).\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_MULTI_AIL_DETECTION_ENABLE`.\n\n It returns whether the Routing Manager currently believes that Border Routers (BRs) on the Thread mesh may be\n connected to different AILs.\n\n The detection mechanism operates as follows: The Routing Manager 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 Routing Manager 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."]
12373 pub fn otBorderRoutingIsMultiAilDetected(aInstance: *mut otInstance) -> bool;
12374}
12375unsafe extern "C" {
12376 #[doc = " Sets a callback function to be notified of changes in the multi-AIL detection state.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_MULTI_AIL_DETECTION_ENABLE`.\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."]
12377 pub fn otBorderRoutingSetMultiAilCallback(
12378 aInstance: *mut otInstance,
12379 aCallback: otBorderRoutingMultiAilCallback,
12380 aContext: *mut ::std::os::raw::c_void,
12381 );
12382}
12383unsafe extern "C" {
12384 #[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)."]
12385 pub fn otBorderRoutingGetNextRdnssAddrEntry(
12386 aInstance: *mut otInstance,
12387 aIterator: *mut otBorderRoutingPrefixTableIterator,
12388 aEntry: *mut otBorderRoutingRdnssAddrEntry,
12389 ) -> otError;
12390}
12391#[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."]
12392pub type otBorderRoutingRdnssAddrCallback =
12393 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
12394unsafe extern "C" {
12395 #[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).\n"]
12396 pub fn otBorderRoutingSetRdnssAddrCallback(
12397 aInstance: *mut otInstance,
12398 aCallback: otBorderRoutingRdnssAddrCallback,
12399 aContext: *mut ::std::os::raw::c_void,
12400 );
12401}
12402unsafe extern "C" {
12403 #[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)."]
12404 pub fn otBorderRoutingGetNextIfAddrEntry(
12405 aInstance: *mut otInstance,
12406 aIterator: *mut otBorderRoutingPrefixTableIterator,
12407 aEntry: *mut otBorderRoutingIfAddrEntry,
12408 ) -> otError;
12409}
12410unsafe extern "C" {
12411 #[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."]
12412 pub fn otBorderRoutingDhcp6PdSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
12413}
12414unsafe extern "C" {
12415 #[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."]
12416 pub fn otBorderRoutingDhcp6PdGetState(
12417 aInstance: *mut otInstance,
12418 ) -> otBorderRoutingDhcp6PdState;
12419}
12420#[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."]
12421pub type otBorderRoutingRequestDhcp6PdCallback = ::std::option::Option<
12422 unsafe extern "C" fn(
12423 aState: otBorderRoutingDhcp6PdState,
12424 aContext: *mut ::std::os::raw::c_void,
12425 ),
12426>;
12427unsafe extern "C" {
12428 #[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."]
12429 pub fn otBorderRoutingDhcp6PdSetRequestCallback(
12430 aInstance: *mut otInstance,
12431 aCallback: otBorderRoutingRequestDhcp6PdCallback,
12432 aContext: *mut ::std::os::raw::c_void,
12433 );
12434}
12435unsafe extern "C" {
12436 #[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."]
12437 pub fn otBorderRoutingSetOnLinkPrefix(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix);
12438}
12439unsafe extern "C" {
12440 #[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."]
12441 pub fn otPlatBorderRoutingProcessIcmp6Ra(
12442 aInstance: *mut otInstance,
12443 aMessage: *const u8,
12444 aLength: u16,
12445 );
12446}
12447unsafe extern "C" {
12448 #[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."]
12449 pub fn otPlatBorderRoutingProcessDhcp6PdPrefix(
12450 aInstance: *mut otInstance,
12451 aPrefixInfo: *const otBorderRoutingPrefixTableEntry,
12452 );
12453}
12454unsafe extern "C" {
12455 #[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."]
12456 pub fn otPlatDebugUart_printf(fmt: *const ::std::os::raw::c_char, ...);
12457}
12458unsafe extern "C" {
12459 #[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."]
12460 pub fn otPlatDebugUart_vprintf(fmt: *const ::std::os::raw::c_char, ap: *mut __va_list_tag);
12461}
12462unsafe extern "C" {
12463 #[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"]
12464 pub fn otPlatDebugUart_putchar_raw(c: ::std::os::raw::c_int);
12465}
12466unsafe extern "C" {
12467 #[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."]
12468 pub fn otPlatDebugUart_kbhit() -> ::std::os::raw::c_int;
12469}
12470unsafe extern "C" {
12471 #[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"]
12472 pub fn otPlatDebugUart_getc() -> ::std::os::raw::c_int;
12473}
12474unsafe extern "C" {
12475 #[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"]
12476 pub fn otPlatDebugUart_putchar(c: ::std::os::raw::c_int);
12477}
12478unsafe extern "C" {
12479 #[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"]
12480 pub fn otPlatDebugUart_puts(s: *const ::std::os::raw::c_char);
12481}
12482unsafe extern "C" {
12483 #[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."]
12484 pub fn otPlatDebugUart_write_bytes(pBytes: *const u8, nBytes: ::std::os::raw::c_int);
12485}
12486unsafe extern "C" {
12487 #[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()"]
12488 pub fn otPlatDebugUart_puts_no_nl(s: *const ::std::os::raw::c_char);
12489}
12490unsafe extern "C" {
12491 #[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."]
12492 pub fn otPlatDebugUart_logfile(filename: *const ::std::os::raw::c_char) -> otError;
12493}
12494#[repr(C)]
12495#[derive(Debug, Copy, Clone)]
12496pub struct otPlatDnsUpstreamQuery {
12497 _unused: [u8; 0],
12498}
12499unsafe extern "C" {
12500 #[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."]
12501 pub fn otPlatDnsIsUpstreamQueryAvailable(aInstance: *mut otInstance) -> bool;
12502}
12503unsafe extern "C" {
12504 #[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 (possibly timeout) query transaction by calling\n `otPlatDnsCancelUpstreamQuery`, the platform must not call `otPlatDnsUpstreamQueryDone` on a\n cancelled 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."]
12505 pub fn otPlatDnsStartUpstreamQuery(
12506 aInstance: *mut otInstance,
12507 aTxn: *mut otPlatDnsUpstreamQuery,
12508 aQuery: *const otMessage,
12509 );
12510}
12511unsafe extern "C" {
12512 #[doc = " Cancels a transaction of upstream query.\n\n The platform must call `otPlatDnsUpstreamQueryDone` to release the resources.\n\n @param[in] aInstance The OpenThread instance structure.\n @param[in] aTxn A pointer to the opaque DNS query transaction object."]
12513 pub fn otPlatDnsCancelUpstreamQuery(
12514 aInstance: *mut otInstance,
12515 aTxn: *mut otPlatDnsUpstreamQuery,
12516 );
12517}
12518unsafe extern "C" {
12519 #[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."]
12520 pub fn otPlatDnsUpstreamQueryDone(
12521 aInstance: *mut otInstance,
12522 aTxn: *mut otPlatDnsUpstreamQuery,
12523 aResponse: *mut otMessage,
12524 );
12525}
12526unsafe extern "C" {
12527 #[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."]
12528 pub fn otPlatEntropyGet(aOutput: *mut u8, aOutputLength: u16) -> otError;
12529}
12530unsafe extern "C" {
12531 #[doc = " Initializes the flash driver.\n\n @param[in] aInstance The OpenThread instance structure."]
12532 pub fn otPlatFlashInit(aInstance: *mut otInstance);
12533}
12534unsafe extern "C" {
12535 #[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."]
12536 pub fn otPlatFlashGetSwapSize(aInstance: *mut otInstance) -> u32;
12537}
12538unsafe extern "C" {
12539 #[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."]
12540 pub fn otPlatFlashErase(aInstance: *mut otInstance, aSwapIndex: u8);
12541}
12542unsafe extern "C" {
12543 #[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."]
12544 pub fn otPlatFlashRead(
12545 aInstance: *mut otInstance,
12546 aSwapIndex: u8,
12547 aOffset: u32,
12548 aData: *mut ::std::os::raw::c_void,
12549 aSize: u32,
12550 );
12551}
12552unsafe extern "C" {
12553 #[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."]
12554 pub fn otPlatFlashWrite(
12555 aInstance: *mut otInstance,
12556 aSwapIndex: u8,
12557 aOffset: u32,
12558 aData: *const ::std::os::raw::c_void,
12559 aSize: u32,
12560 );
12561}
12562#[doc = " Represents an InfraIf Link-Layer Address."]
12563#[repr(C)]
12564#[derive(Debug, Default, Copy, Clone)]
12565pub struct otPlatInfraIfLinkLayerAddress {
12566 #[doc = "< The link-layer address bytes."]
12567 pub mAddress: [u8; 16usize],
12568 #[doc = "< The address length (number of bytes)."]
12569 pub mLength: u8,
12570}
12571unsafe extern "C" {
12572 #[doc = " Tells whether an infra interface has the given IPv6 address assigned.\n\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."]
12573 pub fn otPlatInfraIfHasAddress(aInfraIfIndex: u32, aAddress: *const otIp6Address) -> bool;
12574}
12575unsafe extern "C" {
12576 #[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] 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."]
12577 pub fn otPlatInfraIfSendIcmp6Nd(
12578 aInfraIfIndex: u32,
12579 aDestAddress: *const otIp6Address,
12580 aBuffer: *const u8,
12581 aBufferLength: u16,
12582 ) -> otError;
12583}
12584unsafe extern "C" {
12585 #[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."]
12586 pub fn otPlatInfraIfRecvIcmp6Nd(
12587 aInstance: *mut otInstance,
12588 aInfraIfIndex: u32,
12589 aSrcAddress: *const otIp6Address,
12590 aBuffer: *const u8,
12591 aBufferLength: u16,
12592 );
12593}
12594unsafe extern "C" {
12595 #[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."]
12596 pub fn otPlatInfraIfStateChanged(
12597 aInstance: *mut otInstance,
12598 aInfraIfIndex: u32,
12599 aIsRunning: bool,
12600 ) -> otError;
12601}
12602unsafe extern "C" {
12603 #[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] aInfraIfIndex The index of the infrastructure interface to discover the NAT64 prefix.\n\n @retval OT_ERROR_NONE Successfully request NAT64 prefix discovery.\n @retval OT_ERROR_FAILED Failed to request NAT64 prefix discovery."]
12604 pub fn otPlatInfraIfDiscoverNat64Prefix(aInfraIfIndex: u32) -> otError;
12605}
12606unsafe extern "C" {
12607 #[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."]
12608 pub fn otPlatInfraIfDiscoverNat64PrefixDone(
12609 aInstance: *mut otInstance,
12610 aInfraIfIndex: u32,
12611 aIp6Prefix: *const otIp6Prefix,
12612 );
12613}
12614unsafe extern "C" {
12615 #[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."]
12616 pub fn otPlatGetInfraIfLinkLayerAddress(
12617 aInstance: *mut otInstance,
12618 aIfIndex: u32,
12619 aInfraIfLinkLayerAddress: *mut otPlatInfraIfLinkLayerAddress,
12620 ) -> otError;
12621}
12622unsafe extern "C" {
12623 #[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.\n"]
12624 pub fn otPlatInfraIfDhcp6PdClientSetListeningEnabled(
12625 aInstance: *mut otInstance,
12626 aEnable: bool,
12627 aInfraIfIndex: u32,
12628 );
12629}
12630unsafe extern "C" {
12631 #[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."]
12632 pub fn otPlatInfraIfDhcp6PdClientSend(
12633 aInstance: *mut otInstance,
12634 aMessage: *mut otMessage,
12635 aDestAddress: *mut otIp6Address,
12636 aInfraIfIndex: u32,
12637 );
12638}
12639unsafe extern "C" {
12640 #[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.."]
12641 pub fn otPlatInfraIfDhcp6PdClientHandleReceived(
12642 aInstance: *mut otInstance,
12643 aMessage: *mut otMessage,
12644 aInfraIfIndex: u32,
12645 );
12646}
12647unsafe extern "C" {
12648 #[doc = " Dynamically allocates new memory. On platforms that support it, should just redirect to calloc. For\n those that don't support calloc, should support the same functionality:\n\n \"The calloc() function contiguously allocates enough space for count objects that are size bytes of\n memory each and returns a pointer to the allocated memory. The allocated memory is filled with bytes\n of value zero.\"\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."]
12649 pub fn otPlatCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
12650}
12651unsafe extern "C" {
12652 #[doc = " Frees memory that was dynamically allocated.\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."]
12653 pub fn otPlatFree(aPtr: *mut ::std::os::raw::c_void);
12654}
12655#[doc = " Represents an OpenThread message buffer."]
12656#[repr(C)]
12657#[derive(Debug, Copy, Clone)]
12658pub struct otMessageBuffer {
12659 #[doc = "< Pointer to the next buffer."]
12660 pub mNext: *mut otMessageBuffer,
12661}
12662impl Default for otMessageBuffer {
12663 fn default() -> Self {
12664 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12665 unsafe {
12666 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12667 s.assume_init()
12668 }
12669 }
12670}
12671unsafe extern "C" {
12672 #[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."]
12673 pub fn otPlatMessagePoolInit(
12674 aInstance: *mut otInstance,
12675 aMinNumFreeBuffers: u16,
12676 aBufferSize: usize,
12677 );
12678}
12679unsafe extern "C" {
12680 #[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."]
12681 pub fn otPlatMessagePoolNew(aInstance: *mut otInstance) -> *mut otMessageBuffer;
12682}
12683unsafe extern "C" {
12684 #[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."]
12685 pub fn otPlatMessagePoolFree(aInstance: *mut otInstance, aBuffer: *mut otMessageBuffer);
12686}
12687unsafe extern "C" {
12688 #[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."]
12689 pub fn otPlatMessagePoolNumFreeBuffers(aInstance: *mut otInstance) -> u16;
12690}
12691unsafe extern "C" {
12692 #[doc = " Performs a software reset on the platform, if supported.\n\n @param[in] aInstance The OpenThread instance structure."]
12693 pub fn otPlatReset(aInstance: *mut otInstance);
12694}
12695unsafe extern "C" {
12696 #[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."]
12697 pub fn otPlatResetToBootloader(aInstance: *mut otInstance) -> otError;
12698}
12699pub const OT_PLAT_RESET_REASON_POWER_ON: otPlatResetReason = 0;
12700pub const OT_PLAT_RESET_REASON_EXTERNAL: otPlatResetReason = 1;
12701pub const OT_PLAT_RESET_REASON_SOFTWARE: otPlatResetReason = 2;
12702pub const OT_PLAT_RESET_REASON_FAULT: otPlatResetReason = 3;
12703pub const OT_PLAT_RESET_REASON_CRASH: otPlatResetReason = 4;
12704pub const OT_PLAT_RESET_REASON_ASSERT: otPlatResetReason = 5;
12705pub const OT_PLAT_RESET_REASON_OTHER: otPlatResetReason = 6;
12706pub const OT_PLAT_RESET_REASON_UNKNOWN: otPlatResetReason = 7;
12707pub const OT_PLAT_RESET_REASON_WATCHDOG: otPlatResetReason = 8;
12708pub const OT_PLAT_RESET_REASON_COUNT: otPlatResetReason = 9;
12709#[doc = " Enumeration of possible reset reason codes.\n\n These are in the same order as the Spinel reset reason codes."]
12710pub type otPlatResetReason = ::std::os::raw::c_uint;
12711unsafe extern "C" {
12712 #[doc = " Returns the reason for the last platform reset.\n\n @param[in] aInstance The OpenThread instance structure."]
12713 pub fn otPlatGetResetReason(aInstance: *mut otInstance) -> otPlatResetReason;
12714}
12715unsafe extern "C" {
12716 #[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."]
12717 pub fn otPlatAssertFail(
12718 aFilename: *const ::std::os::raw::c_char,
12719 aLineNumber: ::std::os::raw::c_int,
12720 );
12721}
12722unsafe extern "C" {
12723 #[doc = " Performs a platform specific operation to wake the host MCU.\n This is used only for NCP configurations."]
12724 pub fn otPlatWakeHost();
12725}
12726#[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."]
12727pub const OT_PLAT_MCU_POWER_STATE_ON: otPlatMcuPowerState = 0;
12728#[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."]
12729pub const OT_PLAT_MCU_POWER_STATE_LOW_POWER: otPlatMcuPowerState = 1;
12730#[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."]
12731pub const OT_PLAT_MCU_POWER_STATE_OFF: otPlatMcuPowerState = 2;
12732#[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`."]
12733pub type otPlatMcuPowerState = ::std::os::raw::c_uint;
12734unsafe extern "C" {
12735 #[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."]
12736 pub fn otPlatSetMcuPowerState(
12737 aInstance: *mut otInstance,
12738 aState: otPlatMcuPowerState,
12739 ) -> otError;
12740}
12741unsafe extern "C" {
12742 #[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."]
12743 pub fn otPlatGetMcuPowerState(aInstance: *mut otInstance) -> otPlatMcuPowerState;
12744}
12745unsafe extern "C" {
12746 #[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"]
12747 pub fn otPlatLogCrashDump() -> otError;
12748}
12749unsafe extern "C" {
12750 #[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."]
12751 pub fn otPlatOtnsStatus(aStatus: *const ::std::os::raw::c_char);
12752}
12753#[doc = "< Active Operational Dataset."]
12754pub const OT_SETTINGS_KEY_ACTIVE_DATASET: _bindgen_ty_10 = 1;
12755#[doc = "< Pending Operational Dataset."]
12756pub const OT_SETTINGS_KEY_PENDING_DATASET: _bindgen_ty_10 = 2;
12757#[doc = "< Thread network information."]
12758pub const OT_SETTINGS_KEY_NETWORK_INFO: _bindgen_ty_10 = 3;
12759#[doc = "< Parent information."]
12760pub const OT_SETTINGS_KEY_PARENT_INFO: _bindgen_ty_10 = 4;
12761#[doc = "< Child information."]
12762pub const OT_SETTINGS_KEY_CHILD_INFO: _bindgen_ty_10 = 5;
12763#[doc = "< SLAAC key to generate semantically opaque IID."]
12764pub const OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY: _bindgen_ty_10 = 7;
12765#[doc = "< Duplicate Address Detection (DAD) information."]
12766pub const OT_SETTINGS_KEY_DAD_INFO: _bindgen_ty_10 = 8;
12767#[doc = "< SRP client ECDSA public/private key pair."]
12768pub const OT_SETTINGS_KEY_SRP_ECDSA_KEY: _bindgen_ty_10 = 11;
12769#[doc = "< The SRP client info (selected SRP server address)."]
12770pub const OT_SETTINGS_KEY_SRP_CLIENT_INFO: _bindgen_ty_10 = 12;
12771#[doc = "< The SRP server info (UDP port)."]
12772pub const OT_SETTINGS_KEY_SRP_SERVER_INFO: _bindgen_ty_10 = 13;
12773#[doc = "< BR ULA prefix."]
12774pub const OT_SETTINGS_KEY_BR_ULA_PREFIX: _bindgen_ty_10 = 15;
12775#[doc = "< BR local on-link prefixes."]
12776pub const OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES: _bindgen_ty_10 = 16;
12777#[doc = "< Unique Border Agent/Router ID."]
12778pub const OT_SETTINGS_KEY_BORDER_AGENT_ID: _bindgen_ty_10 = 17;
12779#[doc = "< TCAT Commissioner certificate"]
12780pub const OT_SETTINGS_KEY_TCAT_COMMR_CERT: _bindgen_ty_10 = 18;
12781pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MIN: _bindgen_ty_10 = 32768;
12782pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MAX: _bindgen_ty_10 = 65535;
12783#[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()`."]
12784pub type _bindgen_ty_10 = ::std::os::raw::c_uint;
12785unsafe extern "C" {
12786 #[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."]
12787 pub fn otPlatSettingsInit(
12788 aInstance: *mut otInstance,
12789 aSensitiveKeys: *const u16,
12790 aSensitiveKeysLength: u16,
12791 );
12792}
12793unsafe extern "C" {
12794 #[doc = " Performs any de-initialization for the settings subsystem, if necessary.\n\n @param[in] aInstance The OpenThread instance structure."]
12795 pub fn otPlatSettingsDeinit(aInstance: *mut otInstance);
12796}
12797unsafe extern "C" {
12798 #[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."]
12799 pub fn otPlatSettingsGet(
12800 aInstance: *mut otInstance,
12801 aKey: u16,
12802 aIndex: ::std::os::raw::c_int,
12803 aValue: *mut u8,
12804 aValueLength: *mut u16,
12805 ) -> otError;
12806}
12807unsafe extern "C" {
12808 #[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."]
12809 pub fn otPlatSettingsSet(
12810 aInstance: *mut otInstance,
12811 aKey: u16,
12812 aValue: *const u8,
12813 aValueLength: u16,
12814 ) -> otError;
12815}
12816unsafe extern "C" {
12817 #[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."]
12818 pub fn otPlatSettingsAdd(
12819 aInstance: *mut otInstance,
12820 aKey: u16,
12821 aValue: *const u8,
12822 aValueLength: u16,
12823 ) -> otError;
12824}
12825unsafe extern "C" {
12826 #[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."]
12827 pub fn otPlatSettingsDelete(
12828 aInstance: *mut otInstance,
12829 aKey: u16,
12830 aIndex: ::std::os::raw::c_int,
12831 ) -> otError;
12832}
12833unsafe extern "C" {
12834 #[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."]
12835 pub fn otPlatSettingsWipe(aInstance: *mut otInstance);
12836}
12837#[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."]
12838pub type otPlatSpiSlaveTransactionCompleteCallback = ::std::option::Option<
12839 unsafe extern "C" fn(
12840 aContext: *mut ::std::os::raw::c_void,
12841 aOutputBuf: *mut u8,
12842 aOutputBufLen: u16,
12843 aInputBuf: *mut u8,
12844 aInputBufLen: u16,
12845 aTransactionLength: u16,
12846 ) -> bool,
12847>;
12848#[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()`."]
12849pub type otPlatSpiSlaveTransactionProcessCallback =
12850 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
12851unsafe extern "C" {
12852 #[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."]
12853 pub fn otPlatSpiSlaveEnable(
12854 aCompleteCallback: otPlatSpiSlaveTransactionCompleteCallback,
12855 aProcessCallback: otPlatSpiSlaveTransactionProcessCallback,
12856 aContext: *mut ::std::os::raw::c_void,
12857 ) -> otError;
12858}
12859unsafe extern "C" {
12860 #[doc = " Shutdown and disable the SPI slave interface."]
12861 pub fn otPlatSpiSlaveDisable();
12862}
12863unsafe extern "C" {
12864 #[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."]
12865 pub fn otPlatSpiSlavePrepareTransaction(
12866 aOutputBuf: *mut u8,
12867 aOutputBufLen: u16,
12868 aInputBuf: *mut u8,
12869 aInputBufLen: u16,
12870 aRequestTransactionFlag: bool,
12871 ) -> otError;
12872}
12873unsafe extern "C" {
12874 #[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."]
12875 pub fn otPlatTimeGet() -> u64;
12876}
12877unsafe extern "C" {
12878 #[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."]
12879 pub fn otPlatTimeGetXtalAccuracy() -> u16;
12880}
12881unsafe extern "C" {
12882 #[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."]
12883 pub fn otPlatTrelEnable(aInstance: *mut otInstance, aUdpPort: *mut u16);
12884}
12885unsafe extern "C" {
12886 #[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."]
12887 pub fn otPlatTrelDisable(aInstance: *mut otInstance);
12888}
12889#[doc = " Represents a TREL peer info discovered using DNS-SD browse on the service name \"_trel._udp\"."]
12890#[repr(C)]
12891#[derive(Copy, Clone)]
12892pub struct otPlatTrelPeerInfo {
12893 #[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."]
12894 pub mRemoved: bool,
12895 #[doc = " The TXT record data (encoded as specified by DNS-SD) from the SRV record of the discovered TREL peer service\n instance."]
12896 pub mTxtData: *const u8,
12897 #[doc = "< Number of bytes in @p mTxtData buffer."]
12898 pub mTxtLength: u16,
12899 #[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."]
12900 pub mSockAddr: otSockAddr,
12901}
12902impl Default for otPlatTrelPeerInfo {
12903 fn default() -> Self {
12904 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12905 unsafe {
12906 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12907 s.assume_init()
12908 }
12909 }
12910}
12911unsafe extern "C" {
12912 #[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."]
12913 pub fn otPlatTrelHandleDiscoveredPeerInfo(
12914 aInstance: *mut otInstance,
12915 aInfo: *const otPlatTrelPeerInfo,
12916 );
12917}
12918unsafe extern "C" {
12919 #[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)."]
12920 pub fn otPlatTrelNotifyPeerSocketAddressDifference(
12921 aInstance: *mut otInstance,
12922 aPeerSockAddr: *const otSockAddr,
12923 aRxSockAddr: *const otSockAddr,
12924 );
12925}
12926unsafe extern "C" {
12927 #[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)."]
12928 pub fn otPlatTrelRegisterService(
12929 aInstance: *mut otInstance,
12930 aPort: u16,
12931 aTxtData: *const u8,
12932 aTxtLength: u8,
12933 );
12934}
12935unsafe extern "C" {
12936 #[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."]
12937 pub fn otPlatTrelSend(
12938 aInstance: *mut otInstance,
12939 aUdpPayload: *const u8,
12940 aUdpPayloadLen: u16,
12941 aDestSockAddr: *const otSockAddr,
12942 );
12943}
12944unsafe extern "C" {
12945 #[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."]
12946 pub fn otPlatTrelHandleReceived(
12947 aInstance: *mut otInstance,
12948 aBuffer: *mut u8,
12949 aLength: u16,
12950 aSenderAddr: *const otSockAddr,
12951 );
12952}
12953#[doc = " Represents a group of TREL related counters in the platform layer."]
12954#[repr(C)]
12955#[derive(Debug, Default, Copy, Clone)]
12956pub struct otPlatTrelCounters {
12957 #[doc = "< Number of packets successfully transmitted through TREL."]
12958 pub mTxPackets: u64,
12959 #[doc = "< Sum of size of packets successfully transmitted through TREL."]
12960 pub mTxBytes: u64,
12961 #[doc = "< Number of packet transmission failures through TREL."]
12962 pub mTxFailure: u64,
12963 #[doc = "< Number of packets received through TREL."]
12964 pub mRxPackets: u64,
12965 #[doc = "< Sum of size of packets received through TREL."]
12966 pub mRxBytes: u64,
12967}
12968unsafe extern "C" {
12969 #[doc = " Gets the pointer to the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
12970 pub fn otPlatTrelGetCounters(aInstance: *mut otInstance) -> *const otPlatTrelCounters;
12971}
12972unsafe extern "C" {
12973 #[doc = " Resets the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
12974 pub fn otPlatTrelResetCounters(aInstance: *mut otInstance);
12975}
12976#[doc = " This callback allows OpenThread to provide specific handlers for certain UDP messages.\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."]
12977pub type otUdpHandler = ::std::option::Option<
12978 unsafe extern "C" fn(
12979 aContext: *mut ::std::os::raw::c_void,
12980 aMessage: *const otMessage,
12981 aMessageInfo: *const otMessageInfo,
12982 ) -> bool,
12983>;
12984#[doc = " Represents a UDP receiver."]
12985#[repr(C)]
12986#[derive(Debug, Copy, Clone)]
12987pub struct otUdpReceiver {
12988 #[doc = "< A pointer to the next UDP receiver (internal use only)."]
12989 pub mNext: *mut otUdpReceiver,
12990 #[doc = "< A function pointer to the receiver callback."]
12991 pub mHandler: otUdpHandler,
12992 #[doc = "< A pointer to application-specific context."]
12993 pub mContext: *mut ::std::os::raw::c_void,
12994}
12995impl Default for otUdpReceiver {
12996 fn default() -> Self {
12997 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12998 unsafe {
12999 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13000 s.assume_init()
13001 }
13002 }
13003}
13004unsafe extern "C" {
13005 #[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."]
13006 pub fn otUdpAddReceiver(
13007 aInstance: *mut otInstance,
13008 aUdpReceiver: *mut otUdpReceiver,
13009 ) -> otError;
13010}
13011unsafe extern "C" {
13012 #[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."]
13013 pub fn otUdpRemoveReceiver(
13014 aInstance: *mut otInstance,
13015 aUdpReceiver: *mut otUdpReceiver,
13016 ) -> otError;
13017}
13018unsafe extern "C" {
13019 #[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."]
13020 pub fn otUdpSendDatagram(
13021 aInstance: *mut otInstance,
13022 aMessage: *mut otMessage,
13023 aMessageInfo: *mut otMessageInfo,
13024 ) -> otError;
13025}
13026#[doc = " This callback allows OpenThread to inform the application of a received UDP message."]
13027pub type otUdpReceive = ::std::option::Option<
13028 unsafe extern "C" fn(
13029 aContext: *mut ::std::os::raw::c_void,
13030 aMessage: *mut otMessage,
13031 aMessageInfo: *const otMessageInfo,
13032 ),
13033>;
13034#[doc = "< Unspecified network interface."]
13035pub const OT_NETIF_UNSPECIFIED: otNetifIdentifier = 0;
13036#[doc = "< The host Thread interface - allow use of platform UDP."]
13037pub const OT_NETIF_THREAD_HOST: otNetifIdentifier = 1;
13038#[doc = "< The internal Thread interface (within OpenThread) - do not use platform UDP."]
13039pub const OT_NETIF_THREAD_INTERNAL: otNetifIdentifier = 2;
13040#[doc = "< The Backbone interface."]
13041pub const OT_NETIF_BACKBONE: otNetifIdentifier = 3;
13042#[doc = " Defines the OpenThread network interface identifiers."]
13043pub type otNetifIdentifier = ::std::os::raw::c_uint;
13044#[doc = " Represents a UDP socket."]
13045#[repr(C)]
13046#[derive(Copy, Clone)]
13047pub struct otUdpSocket {
13048 #[doc = "< The local IPv6 socket address."]
13049 pub mSockName: otSockAddr,
13050 #[doc = "< The peer IPv6 socket address."]
13051 pub mPeerName: otSockAddr,
13052 #[doc = "< A function pointer to the application callback."]
13053 pub mHandler: otUdpReceive,
13054 #[doc = "< A pointer to application-specific context."]
13055 pub mContext: *mut ::std::os::raw::c_void,
13056 #[doc = "< A handle to platform's UDP."]
13057 pub mHandle: *mut ::std::os::raw::c_void,
13058 #[doc = "< A pointer to the next UDP socket (internal use only)."]
13059 pub mNext: *mut otUdpSocket,
13060 #[doc = "< The network interface identifier."]
13061 pub mNetifId: otNetifIdentifier,
13062}
13063impl Default for otUdpSocket {
13064 fn default() -> Self {
13065 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13066 unsafe {
13067 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13068 s.assume_init()
13069 }
13070 }
13071}
13072unsafe extern "C" {
13073 #[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"]
13074 pub fn otUdpNewMessage(
13075 aInstance: *mut otInstance,
13076 aSettings: *const otMessageSettings,
13077 ) -> *mut otMessage;
13078}
13079unsafe extern "C" {
13080 #[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."]
13081 pub fn otUdpOpen(
13082 aInstance: *mut otInstance,
13083 aSocket: *mut otUdpSocket,
13084 aCallback: otUdpReceive,
13085 aContext: *mut ::std::os::raw::c_void,
13086 ) -> otError;
13087}
13088unsafe extern "C" {
13089 #[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."]
13090 pub fn otUdpIsOpen(aInstance: *mut otInstance, aSocket: *const otUdpSocket) -> bool;
13091}
13092unsafe extern "C" {
13093 #[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."]
13094 pub fn otUdpClose(aInstance: *mut otInstance, aSocket: *mut otUdpSocket) -> otError;
13095}
13096unsafe extern "C" {
13097 #[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."]
13098 pub fn otUdpBind(
13099 aInstance: *mut otInstance,
13100 aSocket: *mut otUdpSocket,
13101 aSockName: *const otSockAddr,
13102 aNetif: otNetifIdentifier,
13103 ) -> otError;
13104}
13105unsafe extern "C" {
13106 #[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."]
13107 pub fn otUdpConnect(
13108 aInstance: *mut otInstance,
13109 aSocket: *mut otUdpSocket,
13110 aSockName: *const otSockAddr,
13111 ) -> otError;
13112}
13113unsafe extern "C" {
13114 #[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."]
13115 pub fn otUdpSend(
13116 aInstance: *mut otInstance,
13117 aSocket: *mut otUdpSocket,
13118 aMessage: *mut otMessage,
13119 aMessageInfo: *const otMessageInfo,
13120 ) -> otError;
13121}
13122unsafe extern "C" {
13123 #[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."]
13124 pub fn otUdpGetSockets(aInstance: *mut otInstance) -> *mut otUdpSocket;
13125}
13126#[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."]
13127pub type otUdpForwarder = ::std::option::Option<
13128 unsafe extern "C" fn(
13129 aMessage: *mut otMessage,
13130 aPeerPort: u16,
13131 aPeerAddr: *mut otIp6Address,
13132 aSockPort: u16,
13133 aContext: *mut ::std::os::raw::c_void,
13134 ),
13135>;
13136unsafe extern "C" {
13137 #[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."]
13138 pub fn otUdpForwardSetForwarder(
13139 aInstance: *mut otInstance,
13140 aForwarder: otUdpForwarder,
13141 aContext: *mut ::std::os::raw::c_void,
13142 );
13143}
13144unsafe extern "C" {
13145 #[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."]
13146 pub fn otUdpForwardReceive(
13147 aInstance: *mut otInstance,
13148 aMessage: *mut otMessage,
13149 aPeerPort: u16,
13150 aPeerAddr: *const otIp6Address,
13151 aSockPort: u16,
13152 );
13153}
13154unsafe extern "C" {
13155 #[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)."]
13156 pub fn otUdpIsPortInUse(aInstance: *mut otInstance, port: u16) -> bool;
13157}
13158unsafe extern "C" {
13159 #[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."]
13160 pub fn otPlatUdpSocket(aUdpSocket: *mut otUdpSocket) -> otError;
13161}
13162unsafe extern "C" {
13163 #[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."]
13164 pub fn otPlatUdpClose(aUdpSocket: *mut otUdpSocket) -> otError;
13165}
13166unsafe extern "C" {
13167 #[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."]
13168 pub fn otPlatUdpBind(aUdpSocket: *mut otUdpSocket) -> otError;
13169}
13170unsafe extern "C" {
13171 #[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."]
13172 pub fn otPlatUdpBindToNetif(
13173 aUdpSocket: *mut otUdpSocket,
13174 aNetifIdentifier: otNetifIdentifier,
13175 ) -> otError;
13176}
13177unsafe extern "C" {
13178 #[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."]
13179 pub fn otPlatUdpConnect(aUdpSocket: *mut otUdpSocket) -> otError;
13180}
13181unsafe extern "C" {
13182 #[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."]
13183 pub fn otPlatUdpSend(
13184 aUdpSocket: *mut otUdpSocket,
13185 aMessage: *mut otMessage,
13186 aMessageInfo: *const otMessageInfo,
13187 ) -> otError;
13188}
13189unsafe extern "C" {
13190 #[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."]
13191 pub fn otPlatUdpJoinMulticastGroup(
13192 aUdpSocket: *mut otUdpSocket,
13193 aNetifIdentifier: otNetifIdentifier,
13194 aAddress: *const otIp6Address,
13195 ) -> otError;
13196}
13197unsafe extern "C" {
13198 #[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."]
13199 pub fn otPlatUdpLeaveMulticastGroup(
13200 aUdpSocket: *mut otUdpSocket,
13201 aNetifIdentifier: otNetifIdentifier,
13202 aAddress: *const otIp6Address,
13203 ) -> otError;
13204}
13205unsafe extern "C" {
13206 #[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)."]
13207 pub fn otRandomCryptoFillBuffer(aBuffer: *mut u8, aSize: u16) -> otError;
13208}
13209unsafe extern "C" {
13210 #[doc = " Generates and returns a random `uint32_t` value.\n\n @returns A random `uint32_t` value."]
13211 pub fn otRandomNonCryptoGetUint32() -> u32;
13212}
13213unsafe extern "C" {
13214 #[doc = " Generates and returns a random byte.\n\n @returns A random `uint8_t` value."]
13215 pub fn otRandomNonCryptoGetUint8() -> u8;
13216}
13217unsafe extern "C" {
13218 #[doc = " Generates and returns a random `uint16_t` value.\n\n @returns A random `uint16_t` value."]
13219 pub fn otRandomNonCryptoGetUint16() -> u16;
13220}
13221unsafe extern "C" {
13222 #[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)."]
13223 pub fn otRandomNonCryptoGetUint8InRange(aMin: u8, aMax: u8) -> u8;
13224}
13225unsafe extern "C" {
13226 #[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)."]
13227 pub fn otRandomNonCryptoGetUint16InRange(aMin: u16, aMax: u16) -> u16;
13228}
13229unsafe extern "C" {
13230 #[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)."]
13231 pub fn otRandomNonCryptoGetUint32InRange(aMin: u32, aMax: u32) -> u32;
13232}
13233unsafe extern "C" {
13234 #[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)."]
13235 pub fn otRandomNonCryptoFillBuffer(aBuffer: *mut u8, aSize: u16);
13236}
13237unsafe extern "C" {
13238 #[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."]
13239 pub fn otRandomNonCryptoAddJitter(aValue: u32, aJitter: u16) -> u32;
13240}
13241unsafe extern "C" {
13242 #[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."]
13243 pub fn otServerGetNetDataLocal(
13244 aInstance: *mut otInstance,
13245 aStable: bool,
13246 aData: *mut u8,
13247 aDataLength: *mut u8,
13248 ) -> otError;
13249}
13250unsafe extern "C" {
13251 #[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"]
13252 pub fn otServerAddService(
13253 aInstance: *mut otInstance,
13254 aConfig: *const otServiceConfig,
13255 ) -> otError;
13256}
13257unsafe extern "C" {
13258 #[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"]
13259 pub fn otServerRemoveService(
13260 aInstance: *mut otInstance,
13261 aEnterpriseNumber: u32,
13262 aServiceData: *const u8,
13263 aServiceDataLength: u8,
13264 ) -> otError;
13265}
13266unsafe extern "C" {
13267 #[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."]
13268 pub fn otServerGetNextService(
13269 aInstance: *mut otInstance,
13270 aIterator: *mut otNetworkDataIterator,
13271 aConfig: *mut otServiceConfig,
13272 ) -> otError;
13273}
13274unsafe extern "C" {
13275 #[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"]
13276 pub fn otServerRegister(aInstance: *mut otInstance) -> otError;
13277}
13278#[doc = " Implements SNTP Query parameters."]
13279#[repr(C)]
13280#[derive(Debug, Copy, Clone)]
13281pub struct otSntpQuery {
13282 #[doc = "< A reference to the message info related with SNTP Server."]
13283 pub mMessageInfo: *const otMessageInfo,
13284}
13285impl Default for otSntpQuery {
13286 fn default() -> Self {
13287 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13288 unsafe {
13289 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13290 s.assume_init()
13291 }
13292 }
13293}
13294#[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."]
13295pub type otSntpResponseHandler = ::std::option::Option<
13296 unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void, aTime: u64, aResult: otError),
13297>;
13298unsafe extern "C" {
13299 #[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."]
13300 pub fn otSntpClientQuery(
13301 aInstance: *mut otInstance,
13302 aQuery: *const otSntpQuery,
13303 aHandler: otSntpResponseHandler,
13304 aContext: *mut ::std::os::raw::c_void,
13305 ) -> otError;
13306}
13307unsafe extern "C" {
13308 #[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."]
13309 pub fn otSntpClientSetUnixEra(aInstance: *mut otInstance, aUnixEra: u32);
13310}
13311#[doc = "< Item to be added/registered."]
13312pub const OT_SRP_CLIENT_ITEM_STATE_TO_ADD: otSrpClientItemState = 0;
13313#[doc = "< Item is being added/registered."]
13314pub const OT_SRP_CLIENT_ITEM_STATE_ADDING: otSrpClientItemState = 1;
13315#[doc = "< Item to be refreshed (re-register to renew lease)."]
13316pub const OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: otSrpClientItemState = 2;
13317#[doc = "< Item is being refreshed."]
13318pub const OT_SRP_CLIENT_ITEM_STATE_REFRESHING: otSrpClientItemState = 3;
13319#[doc = "< Item to be removed."]
13320pub const OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: otSrpClientItemState = 4;
13321#[doc = "< Item is being removed."]
13322pub const OT_SRP_CLIENT_ITEM_STATE_REMOVING: otSrpClientItemState = 5;
13323#[doc = "< Item is registered with server."]
13324pub const OT_SRP_CLIENT_ITEM_STATE_REGISTERED: otSrpClientItemState = 6;
13325#[doc = "< Item is removed."]
13326pub const OT_SRP_CLIENT_ITEM_STATE_REMOVED: otSrpClientItemState = 7;
13327#[doc = " Specifies an SRP client item (service or host info) state."]
13328pub type otSrpClientItemState = ::std::os::raw::c_uint;
13329#[doc = " Represents an SRP client host info."]
13330#[repr(C)]
13331#[derive(Debug, Copy, Clone)]
13332pub struct otSrpClientHostInfo {
13333 #[doc = "< Host name (label) string (NULL if not yet set)."]
13334 pub mName: *const ::std::os::raw::c_char,
13335 #[doc = "< Array of host IPv6 addresses (NULL if not set or auto address is enabled)."]
13336 pub mAddresses: *const otIp6Address,
13337 #[doc = "< Number of IPv6 addresses in `mAddresses` array."]
13338 pub mNumAddresses: u8,
13339 #[doc = "< Indicates whether auto address mode is enabled or not."]
13340 pub mAutoAddress: bool,
13341 #[doc = "< Host info state."]
13342 pub mState: otSrpClientItemState,
13343}
13344impl Default for otSrpClientHostInfo {
13345 fn default() -> Self {
13346 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13347 unsafe {
13348 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13349 s.assume_init()
13350 }
13351 }
13352}
13353#[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."]
13354#[repr(C)]
13355#[derive(Debug, Copy, Clone)]
13356pub struct otSrpClientService {
13357 #[doc = "< The service labels (e.g., \"_mt._udp\", not the full domain name)."]
13358 pub mName: *const ::std::os::raw::c_char,
13359 #[doc = "< The service instance name label (not the full name)."]
13360 pub mInstanceName: *const ::std::os::raw::c_char,
13361 #[doc = "< Array of sub-type labels (must end with `NULL` or can be `NULL`)."]
13362 pub mSubTypeLabels: *const *const ::std::os::raw::c_char,
13363 #[doc = "< Array of TXT entries (`mNumTxtEntries` gives num of entries)."]
13364 pub mTxtEntries: *const otDnsTxtEntry,
13365 #[doc = "< The service port number."]
13366 pub mPort: u16,
13367 #[doc = "< The service priority."]
13368 pub mPriority: u16,
13369 #[doc = "< The service weight."]
13370 pub mWeight: u16,
13371 #[doc = "< Number of entries in the `mTxtEntries` array."]
13372 pub mNumTxtEntries: u8,
13373 #[doc = "< Service state (managed by OT core)."]
13374 pub mState: otSrpClientItemState,
13375 #[doc = "< Internal data (used by OT core)."]
13376 pub mData: u32,
13377 #[doc = "< Pointer to next entry in a linked-list (managed by OT core)."]
13378 pub mNext: *mut otSrpClientService,
13379 #[doc = "< Desired lease interval in sec - zero to use default."]
13380 pub mLease: u32,
13381 #[doc = "< Desired key lease interval in sec - zero to use default."]
13382 pub mKeyLease: u32,
13383}
13384impl Default for otSrpClientService {
13385 fn default() -> Self {
13386 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13387 unsafe {
13388 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13389 s.assume_init()
13390 }
13391 }
13392}
13393#[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)."]
13394pub type otSrpClientCallback = ::std::option::Option<
13395 unsafe extern "C" fn(
13396 aError: otError,
13397 aHostInfo: *const otSrpClientHostInfo,
13398 aServices: *const otSrpClientService,
13399 aRemovedServices: *const otSrpClientService,
13400 aContext: *mut ::std::os::raw::c_void,
13401 ),
13402>;
13403#[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)."]
13404pub type otSrpClientAutoStartCallback = ::std::option::Option<
13405 unsafe extern "C" fn(aServerSockAddr: *const otSockAddr, aContext: *mut ::std::os::raw::c_void),
13406>;
13407unsafe extern "C" {
13408 #[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."]
13409 pub fn otSrpClientStart(
13410 aInstance: *mut otInstance,
13411 aServerSockAddr: *const otSockAddr,
13412 ) -> otError;
13413}
13414unsafe extern "C" {
13415 #[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."]
13416 pub fn otSrpClientStop(aInstance: *mut otInstance);
13417}
13418unsafe extern "C" {
13419 #[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."]
13420 pub fn otSrpClientIsRunning(aInstance: *mut otInstance) -> bool;
13421}
13422unsafe extern "C" {
13423 #[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)."]
13424 pub fn otSrpClientGetServerAddress(aInstance: *mut otInstance) -> *const otSockAddr;
13425}
13426unsafe extern "C" {
13427 #[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."]
13428 pub fn otSrpClientSetCallback(
13429 aInstance: *mut otInstance,
13430 aCallback: otSrpClientCallback,
13431 aContext: *mut ::std::os::raw::c_void,
13432 );
13433}
13434unsafe extern "C" {
13435 #[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."]
13436 pub fn otSrpClientEnableAutoStartMode(
13437 aInstance: *mut otInstance,
13438 aCallback: otSrpClientAutoStartCallback,
13439 aContext: *mut ::std::os::raw::c_void,
13440 );
13441}
13442unsafe extern "C" {
13443 #[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."]
13444 pub fn otSrpClientDisableAutoStartMode(aInstance: *mut otInstance);
13445}
13446unsafe extern "C" {
13447 #[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."]
13448 pub fn otSrpClientIsAutoStartModeEnabled(aInstance: *mut otInstance) -> bool;
13449}
13450unsafe extern "C" {
13451 #[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)."]
13452 pub fn otSrpClientGetTtl(aInstance: *mut otInstance) -> u32;
13453}
13454unsafe extern "C" {
13455 #[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."]
13456 pub fn otSrpClientSetTtl(aInstance: *mut otInstance, aTtl: u32);
13457}
13458unsafe extern "C" {
13459 #[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)."]
13460 pub fn otSrpClientGetLeaseInterval(aInstance: *mut otInstance) -> u32;
13461}
13462unsafe extern "C" {
13463 #[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."]
13464 pub fn otSrpClientSetLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
13465}
13466unsafe extern "C" {
13467 #[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)."]
13468 pub fn otSrpClientGetKeyLeaseInterval(aInstance: *mut otInstance) -> u32;
13469}
13470unsafe extern "C" {
13471 #[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."]
13472 pub fn otSrpClientSetKeyLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
13473}
13474unsafe extern "C" {
13475 #[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."]
13476 pub fn otSrpClientGetHostInfo(aInstance: *mut otInstance) -> *const otSrpClientHostInfo;
13477}
13478unsafe extern "C" {
13479 #[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."]
13480 pub fn otSrpClientSetHostName(
13481 aInstance: *mut otInstance,
13482 aName: *const ::std::os::raw::c_char,
13483 ) -> otError;
13484}
13485unsafe extern "C" {
13486 #[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."]
13487 pub fn otSrpClientEnableAutoHostAddress(aInstance: *mut otInstance) -> otError;
13488}
13489unsafe extern "C" {
13490 #[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."]
13491 pub fn otSrpClientSetHostAddresses(
13492 aInstance: *mut otInstance,
13493 aIp6Addresses: *const otIp6Address,
13494 aNumAddresses: u8,
13495 ) -> otError;
13496}
13497unsafe extern "C" {
13498 #[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`)."]
13499 pub fn otSrpClientAddService(
13500 aInstance: *mut otInstance,
13501 aService: *mut otSrpClientService,
13502 ) -> otError;
13503}
13504unsafe extern "C" {
13505 #[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."]
13506 pub fn otSrpClientRemoveService(
13507 aInstance: *mut otInstance,
13508 aService: *mut otSrpClientService,
13509 ) -> otError;
13510}
13511unsafe extern "C" {
13512 #[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."]
13513 pub fn otSrpClientClearService(
13514 aInstance: *mut otInstance,
13515 aService: *mut otSrpClientService,
13516 ) -> otError;
13517}
13518unsafe extern "C" {
13519 #[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."]
13520 pub fn otSrpClientGetServices(aInstance: *mut otInstance) -> *const otSrpClientService;
13521}
13522unsafe extern "C" {
13523 #[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."]
13524 pub fn otSrpClientRemoveHostAndServices(
13525 aInstance: *mut otInstance,
13526 aRemoveKeyLease: bool,
13527 aSendUnregToServer: bool,
13528 ) -> otError;
13529}
13530unsafe extern "C" {
13531 #[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."]
13532 pub fn otSrpClientClearHostAndServices(aInstance: *mut otInstance);
13533}
13534unsafe extern "C" {
13535 #[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."]
13536 pub fn otSrpClientGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
13537}
13538unsafe extern "C" {
13539 #[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."]
13540 pub fn otSrpClientSetDomainName(
13541 aInstance: *mut otInstance,
13542 aName: *const ::std::os::raw::c_char,
13543 ) -> otError;
13544}
13545unsafe extern "C" {
13546 #[doc = " Converts a `otSrpClientItemState` to a string.\n\n @param[in] aItemState An item state.\n\n @returns A string representation of @p aItemState."]
13547 pub fn otSrpClientItemStateToString(
13548 aItemState: otSrpClientItemState,
13549 ) -> *const ::std::os::raw::c_char;
13550}
13551unsafe extern "C" {
13552 #[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."]
13553 pub fn otSrpClientSetServiceKeyRecordEnabled(aInstance: *mut otInstance, aEnabled: bool);
13554}
13555unsafe extern "C" {
13556 #[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."]
13557 pub fn otSrpClientIsServiceKeyRecordEnabled(aInstance: *mut otInstance) -> bool;
13558}
13559#[doc = " Represents a SRP client service pool entry."]
13560#[repr(C)]
13561#[derive(Debug, Copy, Clone)]
13562pub struct otSrpClientBuffersServiceEntry {
13563 #[doc = "< The SRP client service structure."]
13564 pub mService: otSrpClientService,
13565 #[doc = "< The SRP client TXT entry."]
13566 pub mTxtEntry: otDnsTxtEntry,
13567}
13568impl Default for otSrpClientBuffersServiceEntry {
13569 fn default() -> Self {
13570 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13571 unsafe {
13572 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13573 s.assume_init()
13574 }
13575 }
13576}
13577unsafe extern "C" {
13578 #[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."]
13579 pub fn otSrpClientBuffersGetHostNameString(
13580 aInstance: *mut otInstance,
13581 aSize: *mut u16,
13582 ) -> *mut ::std::os::raw::c_char;
13583}
13584unsafe extern "C" {
13585 #[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)."]
13586 pub fn otSrpClientBuffersGetHostAddressesArray(
13587 aInstance: *mut otInstance,
13588 aArrayLength: *mut u8,
13589 ) -> *mut otIp6Address;
13590}
13591unsafe extern "C" {
13592 #[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."]
13593 pub fn otSrpClientBuffersAllocateService(
13594 aInstance: *mut otInstance,
13595 ) -> *mut otSrpClientBuffersServiceEntry;
13596}
13597unsafe extern "C" {
13598 #[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)."]
13599 pub fn otSrpClientBuffersFreeService(
13600 aInstance: *mut otInstance,
13601 aService: *mut otSrpClientBuffersServiceEntry,
13602 );
13603}
13604unsafe extern "C" {
13605 #[doc = " Frees all previously allocated service entries.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
13606 pub fn otSrpClientBuffersFreeAllServices(aInstance: *mut otInstance);
13607}
13608unsafe extern "C" {
13609 #[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."]
13610 pub fn otSrpClientBuffersGetServiceEntryServiceNameString(
13611 aEntry: *mut otSrpClientBuffersServiceEntry,
13612 aSize: *mut u16,
13613 ) -> *mut ::std::os::raw::c_char;
13614}
13615unsafe extern "C" {
13616 #[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."]
13617 pub fn otSrpClientBuffersGetServiceEntryInstanceNameString(
13618 aEntry: *mut otSrpClientBuffersServiceEntry,
13619 aSize: *mut u16,
13620 ) -> *mut ::std::os::raw::c_char;
13621}
13622unsafe extern "C" {
13623 #[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."]
13624 pub fn otSrpClientBuffersGetServiceEntryTxtBuffer(
13625 aEntry: *mut otSrpClientBuffersServiceEntry,
13626 aSize: *mut u16,
13627 ) -> *mut u8;
13628}
13629unsafe extern "C" {
13630 #[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."]
13631 pub fn otSrpClientBuffersGetSubTypeLabelsArray(
13632 aEntry: *mut otSrpClientBuffersServiceEntry,
13633 aArrayLength: *mut u16,
13634 ) -> *mut *const ::std::os::raw::c_char;
13635}
13636#[repr(C)]
13637#[derive(Debug, Copy, Clone)]
13638pub struct otSrpServerHost {
13639 _unused: [u8; 0],
13640}
13641#[repr(C)]
13642#[derive(Debug, Copy, Clone)]
13643pub struct otSrpServerService {
13644 _unused: [u8; 0],
13645}
13646#[doc = " The ID of a SRP service update transaction on the SRP Server."]
13647pub type otSrpServerServiceUpdateId = u32;
13648#[doc = "< The SRP server is disabled."]
13649pub const OT_SRP_SERVER_STATE_DISABLED: otSrpServerState = 0;
13650#[doc = "< The SRP server is enabled and running."]
13651pub const OT_SRP_SERVER_STATE_RUNNING: otSrpServerState = 1;
13652#[doc = "< The SRP server is enabled but stopped."]
13653pub const OT_SRP_SERVER_STATE_STOPPED: otSrpServerState = 2;
13654#[doc = " Represents the state of the SRP server."]
13655pub type otSrpServerState = ::std::os::raw::c_uint;
13656#[doc = "< Unicast address mode. Use Network Data publisher."]
13657pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST: otSrpServerAddressMode = 0;
13658#[doc = "< Anycast address mode. Use Network Data publisher"]
13659pub const OT_SRP_SERVER_ADDRESS_MODE_ANYCAST: otSrpServerAddressMode = 1;
13660#[doc = "< Unicast address mode. Immediately force add to Network Data."]
13661pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST_FORCE_ADD: otSrpServerAddressMode = 2;
13662#[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."]
13663pub type otSrpServerAddressMode = ::std::os::raw::c_uint;
13664#[doc = " Includes SRP server TTL configurations."]
13665#[repr(C)]
13666#[derive(Debug, Default, Copy, Clone)]
13667pub struct otSrpServerTtlConfig {
13668 #[doc = "< The minimum TTL in seconds."]
13669 pub mMinTtl: u32,
13670 #[doc = "< The maximum TTL in seconds."]
13671 pub mMaxTtl: u32,
13672}
13673#[doc = " Includes SRP server LEASE and KEY-LEASE configurations."]
13674#[repr(C)]
13675#[derive(Debug, Default, Copy, Clone)]
13676pub struct otSrpServerLeaseConfig {
13677 #[doc = "< The minimum LEASE interval in seconds."]
13678 pub mMinLease: u32,
13679 #[doc = "< The maximum LEASE interval in seconds."]
13680 pub mMaxLease: u32,
13681 #[doc = "< The minimum KEY-LEASE interval in seconds."]
13682 pub mMinKeyLease: u32,
13683 #[doc = "< The maximum KEY-LEASE interval in seconds."]
13684 pub mMaxKeyLease: u32,
13685}
13686#[doc = " Includes SRP server lease information of a host/service."]
13687#[repr(C)]
13688#[derive(Debug, Default, Copy, Clone)]
13689pub struct otSrpServerLeaseInfo {
13690 #[doc = "< The lease time of a host/service in milliseconds."]
13691 pub mLease: u32,
13692 #[doc = "< The key lease time of a host/service in milliseconds."]
13693 pub mKeyLease: u32,
13694 #[doc = "< The remaining lease time of the host/service in milliseconds."]
13695 pub mRemainingLease: u32,
13696 #[doc = "< The remaining key lease time of a host/service in milliseconds."]
13697 pub mRemainingKeyLease: u32,
13698}
13699#[doc = " Includes the statistics of SRP server responses."]
13700#[repr(C)]
13701#[derive(Debug, Default, Copy, Clone)]
13702pub struct otSrpServerResponseCounters {
13703 #[doc = "< The number of successful responses."]
13704 pub mSuccess: u32,
13705 #[doc = "< The number of server failure responses."]
13706 pub mServerFailure: u32,
13707 #[doc = "< The number of format error responses."]
13708 pub mFormatError: u32,
13709 #[doc = "< The number of 'name exists' responses."]
13710 pub mNameExists: u32,
13711 #[doc = "< The number of refused responses."]
13712 pub mRefused: u32,
13713 #[doc = "< The number of other responses."]
13714 pub mOther: u32,
13715}
13716unsafe extern "C" {
13717 #[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."]
13718 pub fn otSrpServerGetDomain(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
13719}
13720unsafe extern "C" {
13721 #[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."]
13722 pub fn otSrpServerSetDomain(
13723 aInstance: *mut otInstance,
13724 aDomain: *const ::std::os::raw::c_char,
13725 ) -> otError;
13726}
13727unsafe extern "C" {
13728 #[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."]
13729 pub fn otSrpServerGetState(aInstance: *mut otInstance) -> otSrpServerState;
13730}
13731unsafe extern "C" {
13732 #[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."]
13733 pub fn otSrpServerGetPort(aInstance: *mut otInstance) -> u16;
13734}
13735unsafe extern "C" {
13736 #[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."]
13737 pub fn otSrpServerGetAddressMode(aInstance: *mut otInstance) -> otSrpServerAddressMode;
13738}
13739unsafe extern "C" {
13740 #[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."]
13741 pub fn otSrpServerSetAddressMode(
13742 aInstance: *mut otInstance,
13743 aMode: otSrpServerAddressMode,
13744 ) -> otError;
13745}
13746unsafe extern "C" {
13747 #[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."]
13748 pub fn otSrpServerGetAnycastModeSequenceNumber(aInstance: *mut otInstance) -> u8;
13749}
13750unsafe extern "C" {
13751 #[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."]
13752 pub fn otSrpServerSetAnycastModeSequenceNumber(
13753 aInstance: *mut otInstance,
13754 aSequenceNumber: u8,
13755 ) -> otError;
13756}
13757unsafe extern "C" {
13758 #[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."]
13759 pub fn otSrpServerSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
13760}
13761unsafe extern "C" {
13762 #[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."]
13763 pub fn otSrpServerSetAutoEnableMode(aInstance: *mut otInstance, aEnabled: bool);
13764}
13765unsafe extern "C" {
13766 #[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."]
13767 pub fn otSrpServerIsAutoEnableMode(aInstance: *mut otInstance) -> bool;
13768}
13769unsafe extern "C" {
13770 #[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)."]
13771 pub fn otSrpServerEnableFastStartMode(aInstance: *mut otInstance) -> otError;
13772}
13773unsafe extern "C" {
13774 #[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."]
13775 pub fn otSrpServerIsFastStartModeEnabled(aInstance: *mut otInstance) -> bool;
13776}
13777unsafe extern "C" {
13778 #[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."]
13779 pub fn otSrpServerGetTtlConfig(
13780 aInstance: *mut otInstance,
13781 aTtlConfig: *mut otSrpServerTtlConfig,
13782 );
13783}
13784unsafe extern "C" {
13785 #[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."]
13786 pub fn otSrpServerSetTtlConfig(
13787 aInstance: *mut otInstance,
13788 aTtlConfig: *const otSrpServerTtlConfig,
13789 ) -> otError;
13790}
13791unsafe extern "C" {
13792 #[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."]
13793 pub fn otSrpServerGetLeaseConfig(
13794 aInstance: *mut otInstance,
13795 aLeaseConfig: *mut otSrpServerLeaseConfig,
13796 );
13797}
13798unsafe extern "C" {
13799 #[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."]
13800 pub fn otSrpServerSetLeaseConfig(
13801 aInstance: *mut otInstance,
13802 aLeaseConfig: *const otSrpServerLeaseConfig,
13803 ) -> otError;
13804}
13805#[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"]
13806pub type otSrpServerServiceUpdateHandler = ::std::option::Option<
13807 unsafe extern "C" fn(
13808 aId: otSrpServerServiceUpdateId,
13809 aHost: *const otSrpServerHost,
13810 aTimeout: u32,
13811 aContext: *mut ::std::os::raw::c_void,
13812 ),
13813>;
13814unsafe extern "C" {
13815 #[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."]
13816 pub fn otSrpServerSetServiceUpdateHandler(
13817 aInstance: *mut otInstance,
13818 aServiceHandler: otSrpServerServiceUpdateHandler,
13819 aContext: *mut ::std::os::raw::c_void,
13820 );
13821}
13822unsafe extern "C" {
13823 #[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."]
13824 pub fn otSrpServerHandleServiceUpdateResult(
13825 aInstance: *mut otInstance,
13826 aId: otSrpServerServiceUpdateId,
13827 aError: otError,
13828 );
13829}
13830unsafe extern "C" {
13831 #[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."]
13832 pub fn otSrpServerGetNextHost(
13833 aInstance: *mut otInstance,
13834 aHost: *const otSrpServerHost,
13835 ) -> *const otSrpServerHost;
13836}
13837unsafe extern "C" {
13838 #[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."]
13839 pub fn otSrpServerGetResponseCounters(
13840 aInstance: *mut otInstance,
13841 ) -> *const otSrpServerResponseCounters;
13842}
13843unsafe extern "C" {
13844 #[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."]
13845 pub fn otSrpServerHostIsDeleted(aHost: *const otSrpServerHost) -> bool;
13846}
13847unsafe extern "C" {
13848 #[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."]
13849 pub fn otSrpServerHostGetFullName(
13850 aHost: *const otSrpServerHost,
13851 ) -> *const ::std::os::raw::c_char;
13852}
13853unsafe extern "C" {
13854 #[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."]
13855 pub fn otSrpServerHostMatchesFullName(
13856 aHost: *const otSrpServerHost,
13857 aFullName: *const ::std::os::raw::c_char,
13858 ) -> bool;
13859}
13860unsafe extern "C" {
13861 #[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."]
13862 pub fn otSrpServerHostGetAddresses(
13863 aHost: *const otSrpServerHost,
13864 aAddressesNum: *mut u8,
13865 ) -> *const otIp6Address;
13866}
13867unsafe extern "C" {
13868 #[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."]
13869 pub fn otSrpServerHostGetLeaseInfo(
13870 aHost: *const otSrpServerHost,
13871 aLeaseInfo: *mut otSrpServerLeaseInfo,
13872 );
13873}
13874unsafe extern "C" {
13875 #[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."]
13876 pub fn otSrpServerHostGetNextService(
13877 aHost: *const otSrpServerHost,
13878 aService: *const otSrpServerService,
13879 ) -> *const otSrpServerService;
13880}
13881unsafe extern "C" {
13882 #[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."]
13883 pub fn otSrpServerServiceIsDeleted(aService: *const otSrpServerService) -> bool;
13884}
13885unsafe extern "C" {
13886 #[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."]
13887 pub fn otSrpServerServiceGetInstanceName(
13888 aService: *const otSrpServerService,
13889 ) -> *const ::std::os::raw::c_char;
13890}
13891unsafe extern "C" {
13892 #[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."]
13893 pub fn otSrpServerServiceMatchesInstanceName(
13894 aService: *const otSrpServerService,
13895 aInstanceName: *const ::std::os::raw::c_char,
13896 ) -> bool;
13897}
13898unsafe extern "C" {
13899 #[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.."]
13900 pub fn otSrpServerServiceGetInstanceLabel(
13901 aService: *const otSrpServerService,
13902 ) -> *const ::std::os::raw::c_char;
13903}
13904unsafe extern "C" {
13905 #[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."]
13906 pub fn otSrpServerServiceGetServiceName(
13907 aService: *const otSrpServerService,
13908 ) -> *const ::std::os::raw::c_char;
13909}
13910unsafe extern "C" {
13911 #[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."]
13912 pub fn otSrpServerServiceMatchesServiceName(
13913 aService: *const otSrpServerService,
13914 aServiceName: *const ::std::os::raw::c_char,
13915 ) -> bool;
13916}
13917unsafe extern "C" {
13918 #[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."]
13919 pub fn otSrpServerServiceGetNumberOfSubTypes(aService: *const otSrpServerService) -> u16;
13920}
13921unsafe extern "C" {
13922 #[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."]
13923 pub fn otSrpServerServiceGetSubTypeServiceNameAt(
13924 aService: *const otSrpServerService,
13925 aIndex: u16,
13926 ) -> *const ::std::os::raw::c_char;
13927}
13928unsafe extern "C" {
13929 #[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."]
13930 pub fn otSrpServerServiceHasSubTypeServiceName(
13931 aService: *const otSrpServerService,
13932 aSubTypeServiceName: *const ::std::os::raw::c_char,
13933 ) -> bool;
13934}
13935unsafe extern "C" {
13936 #[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."]
13937 pub fn otSrpServerParseSubTypeServiceName(
13938 aSubTypeServiceName: *const ::std::os::raw::c_char,
13939 aLabel: *mut ::std::os::raw::c_char,
13940 aLabelSize: u8,
13941 ) -> otError;
13942}
13943unsafe extern "C" {
13944 #[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."]
13945 pub fn otSrpServerServiceGetPort(aService: *const otSrpServerService) -> u16;
13946}
13947unsafe extern "C" {
13948 #[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."]
13949 pub fn otSrpServerServiceGetWeight(aService: *const otSrpServerService) -> u16;
13950}
13951unsafe extern "C" {
13952 #[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."]
13953 pub fn otSrpServerServiceGetPriority(aService: *const otSrpServerService) -> u16;
13954}
13955unsafe extern "C" {
13956 #[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.."]
13957 pub fn otSrpServerServiceGetTtl(aService: *const otSrpServerService) -> u32;
13958}
13959unsafe extern "C" {
13960 #[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)."]
13961 pub fn otSrpServerServiceGetTxtData(
13962 aService: *const otSrpServerService,
13963 aDataLength: *mut u16,
13964 ) -> *const u8;
13965}
13966unsafe extern "C" {
13967 #[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."]
13968 pub fn otSrpServerServiceGetHost(aService: *const otSrpServerService)
13969 -> *const otSrpServerHost;
13970}
13971unsafe extern "C" {
13972 #[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."]
13973 pub fn otSrpServerServiceGetLeaseInfo(
13974 aService: *const otSrpServerService,
13975 aLeaseInfo: *mut otSrpServerLeaseInfo,
13976 );
13977}
13978unsafe extern "C" {
13979 #[doc = " Run all queued OpenThread tasklets at the time this is called.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
13980 pub fn otTaskletsProcess(aInstance: *mut otInstance);
13981}
13982unsafe extern "C" {
13983 #[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."]
13984 pub fn otTaskletsArePending(aInstance: *mut otInstance) -> bool;
13985}
13986unsafe extern "C" {
13987 #[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."]
13988 pub fn otTaskletsSignalPending(aInstance: *mut otInstance);
13989}
13990#[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."]
13991#[repr(C)]
13992#[derive(Debug, Copy, Clone)]
13993pub struct otLinkedBuffer {
13994 #[doc = "< Pointer to the next linked buffer in the chain, or NULL if it is the end."]
13995 pub mNext: *mut otLinkedBuffer,
13996 #[doc = "< Pointer to data referenced by this linked buffer."]
13997 pub mData: *const u8,
13998 #[doc = "< Length of this linked buffer (number of bytes)."]
13999 pub mLength: usize,
14000}
14001impl Default for otLinkedBuffer {
14002 fn default() -> Self {
14003 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14004 unsafe {
14005 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14006 s.assume_init()
14007 }
14008 }
14009}
14010#[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."]
14011pub type otTcpEstablished =
14012 ::std::option::Option<unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint)>;
14013#[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."]
14014pub type otTcpSendDone = ::std::option::Option<
14015 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aData: *mut otLinkedBuffer),
14016>;
14017#[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)."]
14018pub type otTcpForwardProgress = ::std::option::Option<
14019 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aInSendBuffer: usize, aBacklog: usize),
14020>;
14021#[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."]
14022pub type otTcpReceiveAvailable = ::std::option::Option<
14023 unsafe extern "C" fn(
14024 aEndpoint: *mut otTcpEndpoint,
14025 aBytesAvailable: usize,
14026 aEndOfStream: bool,
14027 aBytesRemaining: usize,
14028 ),
14029>;
14030pub const OT_TCP_DISCONNECTED_REASON_NORMAL: otTcpDisconnectedReason = 0;
14031pub const OT_TCP_DISCONNECTED_REASON_REFUSED: otTcpDisconnectedReason = 1;
14032pub const OT_TCP_DISCONNECTED_REASON_RESET: otTcpDisconnectedReason = 2;
14033pub const OT_TCP_DISCONNECTED_REASON_TIME_WAIT: otTcpDisconnectedReason = 3;
14034pub const OT_TCP_DISCONNECTED_REASON_TIMED_OUT: otTcpDisconnectedReason = 4;
14035pub type otTcpDisconnectedReason = ::std::os::raw::c_uint;
14036#[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."]
14037pub type otTcpDisconnected = ::std::option::Option<
14038 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aReason: otTcpDisconnectedReason),
14039>;
14040#[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."]
14041#[repr(C)]
14042#[derive(Copy, Clone)]
14043pub struct otTcpEndpoint {
14044 pub mTcb: otTcpEndpoint__bindgen_ty_1,
14045 #[doc = "< A pointer to the next TCP endpoint (internal use only)"]
14046 pub mNext: *mut otTcpEndpoint,
14047 #[doc = "< A pointer to application-specific context"]
14048 pub mContext: *mut ::std::os::raw::c_void,
14049 #[doc = "< \"Established\" callback function"]
14050 pub mEstablishedCallback: otTcpEstablished,
14051 #[doc = "< \"Send done\" callback function"]
14052 pub mSendDoneCallback: otTcpSendDone,
14053 #[doc = "< \"Forward progress\" callback function"]
14054 pub mForwardProgressCallback: otTcpForwardProgress,
14055 #[doc = "< \"Receive available\" callback function"]
14056 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
14057 #[doc = "< \"Disconnected\" callback function"]
14058 pub mDisconnectedCallback: otTcpDisconnected,
14059 pub mTimers: [u32; 4usize],
14060 pub mReceiveLinks: [otLinkedBuffer; 2usize],
14061 pub mSockAddr: otSockAddr,
14062 pub mPendingCallbacks: u8,
14063}
14064#[repr(C)]
14065#[derive(Copy, Clone)]
14066pub union otTcpEndpoint__bindgen_ty_1 {
14067 pub mSize: [u8; 680usize],
14068 pub mAlign: u64,
14069}
14070impl Default for otTcpEndpoint__bindgen_ty_1 {
14071 fn default() -> Self {
14072 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14073 unsafe {
14074 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14075 s.assume_init()
14076 }
14077 }
14078}
14079impl Default for otTcpEndpoint {
14080 fn default() -> Self {
14081 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14082 unsafe {
14083 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14084 s.assume_init()
14085 }
14086 }
14087}
14088#[doc = " Contains arguments to the otTcpEndpointInitialize() function."]
14089#[repr(C)]
14090#[derive(Debug, Copy, Clone)]
14091pub struct otTcpEndpointInitializeArgs {
14092 #[doc = "< Pointer to application-specific context"]
14093 pub mContext: *mut ::std::os::raw::c_void,
14094 #[doc = "< \"Established\" callback function"]
14095 pub mEstablishedCallback: otTcpEstablished,
14096 #[doc = "< \"Send done\" callback function"]
14097 pub mSendDoneCallback: otTcpSendDone,
14098 #[doc = "< \"Forward progress\" callback function"]
14099 pub mForwardProgressCallback: otTcpForwardProgress,
14100 #[doc = "< \"Receive available\" callback function"]
14101 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
14102 #[doc = "< \"Disconnected\" callback function"]
14103 pub mDisconnectedCallback: otTcpDisconnected,
14104 #[doc = "< Pointer to memory provided to the system for the TCP receive buffer"]
14105 pub mReceiveBuffer: *mut ::std::os::raw::c_void,
14106 #[doc = "< Size of memory provided to the system for the TCP receive buffer"]
14107 pub mReceiveBufferSize: usize,
14108}
14109impl Default for otTcpEndpointInitializeArgs {
14110 fn default() -> Self {
14111 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14112 unsafe {
14113 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14114 s.assume_init()
14115 }
14116 }
14117}
14118unsafe extern "C" {
14119 #[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."]
14120 pub fn otTcpEndpointInitialize(
14121 aInstance: *mut otInstance,
14122 aEndpoint: *mut otTcpEndpoint,
14123 aArgs: *const otTcpEndpointInitializeArgs,
14124 ) -> otError;
14125}
14126unsafe extern "C" {
14127 #[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."]
14128 pub fn otTcpEndpointGetInstance(aEndpoint: *mut otTcpEndpoint) -> *mut otInstance;
14129}
14130unsafe extern "C" {
14131 #[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."]
14132 pub fn otTcpEndpointGetContext(aEndpoint: *mut otTcpEndpoint) -> *mut ::std::os::raw::c_void;
14133}
14134unsafe extern "C" {
14135 #[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."]
14136 pub fn otTcpGetLocalAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
14137}
14138unsafe extern "C" {
14139 #[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."]
14140 pub fn otTcpGetPeerAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
14141}
14142unsafe extern "C" {
14143 #[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."]
14144 pub fn otTcpBind(aEndpoint: *mut otTcpEndpoint, aSockName: *const otSockAddr) -> otError;
14145}
14146pub const OT_TCP_CONNECT_NO_FAST_OPEN: _bindgen_ty_11 = 1;
14147#[doc = " Defines flags passed to otTcpConnect()."]
14148pub type _bindgen_ty_11 = ::std::os::raw::c_uint;
14149unsafe extern "C" {
14150 #[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."]
14151 pub fn otTcpConnect(
14152 aEndpoint: *mut otTcpEndpoint,
14153 aSockName: *const otSockAddr,
14154 aFlags: u32,
14155 ) -> otError;
14156}
14157pub const OT_TCP_SEND_MORE_TO_COME: _bindgen_ty_12 = 1;
14158#[doc = " Defines flags passed to @p otTcpSendByReference."]
14159pub type _bindgen_ty_12 = ::std::os::raw::c_uint;
14160unsafe extern "C" {
14161 #[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."]
14162 pub fn otTcpSendByReference(
14163 aEndpoint: *mut otTcpEndpoint,
14164 aBuffer: *mut otLinkedBuffer,
14165 aFlags: u32,
14166 ) -> otError;
14167}
14168unsafe extern "C" {
14169 #[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."]
14170 pub fn otTcpSendByExtension(
14171 aEndpoint: *mut otTcpEndpoint,
14172 aNumBytes: usize,
14173 aFlags: u32,
14174 ) -> otError;
14175}
14176unsafe extern "C" {
14177 #[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."]
14178 pub fn otTcpReceiveByReference(
14179 aEndpoint: *mut otTcpEndpoint,
14180 aBuffer: *mut *const otLinkedBuffer,
14181 ) -> otError;
14182}
14183unsafe extern "C" {
14184 #[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."]
14185 pub fn otTcpReceiveContiguify(aEndpoint: *mut otTcpEndpoint) -> otError;
14186}
14187unsafe extern "C" {
14188 #[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."]
14189 pub fn otTcpCommitReceive(
14190 aEndpoint: *mut otTcpEndpoint,
14191 aNumBytes: usize,
14192 aFlags: u32,
14193 ) -> otError;
14194}
14195unsafe extern "C" {
14196 #[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."]
14197 pub fn otTcpSendEndOfStream(aEndpoint: *mut otTcpEndpoint) -> otError;
14198}
14199unsafe extern "C" {
14200 #[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."]
14201 pub fn otTcpAbort(aEndpoint: *mut otTcpEndpoint) -> otError;
14202}
14203unsafe extern "C" {
14204 #[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."]
14205 pub fn otTcpEndpointDeinitialize(aEndpoint: *mut otTcpEndpoint) -> otError;
14206}
14207#[doc = "< Accept the incoming connection."]
14208pub const OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT: otTcpIncomingConnectionAction = 0;
14209#[doc = "< Defer (silently ignore) the incoming connection."]
14210pub const OT_TCP_INCOMING_CONNECTION_ACTION_DEFER: otTcpIncomingConnectionAction = 1;
14211#[doc = "< Refuse the incoming connection."]
14212pub const OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE: otTcpIncomingConnectionAction = 2;
14213#[doc = " Defines incoming connection actions.\n\n This is used in otTcpAcceptReady() callback."]
14214pub type otTcpIncomingConnectionAction = ::std::os::raw::c_uint;
14215#[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."]
14216pub type otTcpAcceptReady = ::std::option::Option<
14217 unsafe extern "C" fn(
14218 aListener: *mut otTcpListener,
14219 aPeer: *const otSockAddr,
14220 aAcceptInto: *mut *mut otTcpEndpoint,
14221 ) -> otTcpIncomingConnectionAction,
14222>;
14223#[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."]
14224pub type otTcpAcceptDone = ::std::option::Option<
14225 unsafe extern "C" fn(
14226 aListener: *mut otTcpListener,
14227 aEndpoint: *mut otTcpEndpoint,
14228 aPeer: *const otSockAddr,
14229 ),
14230>;
14231#[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."]
14232#[repr(C)]
14233#[derive(Copy, Clone)]
14234pub struct otTcpListener {
14235 pub mTcbListen: otTcpListener__bindgen_ty_1,
14236 #[doc = "< A pointer to the next TCP listener (internal use only)"]
14237 pub mNext: *mut otTcpListener,
14238 #[doc = "< A pointer to application-specific context"]
14239 pub mContext: *mut ::std::os::raw::c_void,
14240 #[doc = "< \"Accept ready\" callback function"]
14241 pub mAcceptReadyCallback: otTcpAcceptReady,
14242 #[doc = "< \"Accept done\" callback function"]
14243 pub mAcceptDoneCallback: otTcpAcceptDone,
14244}
14245#[repr(C)]
14246#[derive(Copy, Clone)]
14247pub union otTcpListener__bindgen_ty_1 {
14248 pub mSize: [u8; 40usize],
14249 pub mAlign: *mut ::std::os::raw::c_void,
14250}
14251impl Default for otTcpListener__bindgen_ty_1 {
14252 fn default() -> Self {
14253 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14254 unsafe {
14255 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14256 s.assume_init()
14257 }
14258 }
14259}
14260impl Default for otTcpListener {
14261 fn default() -> Self {
14262 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14263 unsafe {
14264 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14265 s.assume_init()
14266 }
14267 }
14268}
14269#[doc = " Contains arguments to the otTcpListenerInitialize() function."]
14270#[repr(C)]
14271#[derive(Debug, Copy, Clone)]
14272pub struct otTcpListenerInitializeArgs {
14273 #[doc = "< Pointer to application-specific context"]
14274 pub mContext: *mut ::std::os::raw::c_void,
14275 #[doc = "< \"Accept ready\" callback function"]
14276 pub mAcceptReadyCallback: otTcpAcceptReady,
14277 #[doc = "< \"Accept done\" callback function"]
14278 pub mAcceptDoneCallback: otTcpAcceptDone,
14279}
14280impl Default for otTcpListenerInitializeArgs {
14281 fn default() -> Self {
14282 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14283 unsafe {
14284 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14285 s.assume_init()
14286 }
14287 }
14288}
14289unsafe extern "C" {
14290 #[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."]
14291 pub fn otTcpListenerInitialize(
14292 aInstance: *mut otInstance,
14293 aListener: *mut otTcpListener,
14294 aArgs: *const otTcpListenerInitializeArgs,
14295 ) -> otError;
14296}
14297unsafe extern "C" {
14298 #[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."]
14299 pub fn otTcpListenerGetInstance(aListener: *mut otTcpListener) -> *mut otInstance;
14300}
14301unsafe extern "C" {
14302 #[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."]
14303 pub fn otTcpListenerGetContext(aListener: *mut otTcpListener) -> *mut ::std::os::raw::c_void;
14304}
14305unsafe extern "C" {
14306 #[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."]
14307 pub fn otTcpListen(aListener: *mut otTcpListener, aSockName: *const otSockAddr) -> otError;
14308}
14309unsafe extern "C" {
14310 #[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."]
14311 pub fn otTcpStopListening(aListener: *mut otTcpListener) -> otError;
14312}
14313unsafe extern "C" {
14314 #[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."]
14315 pub fn otTcpListenerDeinitialize(aListener: *mut otTcpListener) -> otError;
14316}
14317#[doc = " Holds diagnostic information for a Thread Child"]
14318#[repr(C)]
14319#[derive(Debug, Default, Copy, Clone)]
14320pub struct otChildInfo {
14321 #[doc = "< IEEE 802.15.4 Extended Address"]
14322 pub mExtAddress: otExtAddress,
14323 #[doc = "< Timeout"]
14324 pub mTimeout: u32,
14325 #[doc = "< Seconds since last heard"]
14326 pub mAge: u32,
14327 #[doc = "< Seconds since attach"]
14328 pub mConnectionTime: u64,
14329 #[doc = "< RLOC16"]
14330 pub mRloc16: u16,
14331 #[doc = "< Child ID"]
14332 pub mChildId: u16,
14333 #[doc = "< Network Data Version"]
14334 pub mNetworkDataVersion: u8,
14335 #[doc = "< Link Quality In"]
14336 pub mLinkQualityIn: u8,
14337 #[doc = "< Average RSSI"]
14338 pub mAverageRssi: i8,
14339 #[doc = "< Last observed RSSI"]
14340 pub mLastRssi: i8,
14341 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
14342 pub mFrameErrorRate: u16,
14343 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
14344 pub mMessageErrorRate: u16,
14345 #[doc = "< Number of queued messages for the child."]
14346 pub mQueuedMessageCnt: u16,
14347 #[doc = "< Supervision interval (in seconds)."]
14348 pub mSupervisionInterval: u16,
14349 #[doc = "< MLE version"]
14350 pub mVersion: u8,
14351 pub _bitfield_align_1: [u8; 0],
14352 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
14353 pub __bindgen_padding_0: [u16; 3usize],
14354}
14355impl otChildInfo {
14356 #[inline]
14357 pub fn mRxOnWhenIdle(&self) -> bool {
14358 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
14359 }
14360 #[inline]
14361 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
14362 unsafe {
14363 let val: u8 = ::std::mem::transmute(val);
14364 self._bitfield_1.set(0usize, 1u8, val as u64)
14365 }
14366 }
14367 #[inline]
14368 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
14369 unsafe {
14370 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14371 ::std::ptr::addr_of!((*this)._bitfield_1),
14372 0usize,
14373 1u8,
14374 ) as u8)
14375 }
14376 }
14377 #[inline]
14378 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
14379 unsafe {
14380 let val: u8 = ::std::mem::transmute(val);
14381 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14382 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14383 0usize,
14384 1u8,
14385 val as u64,
14386 )
14387 }
14388 }
14389 #[inline]
14390 pub fn mFullThreadDevice(&self) -> bool {
14391 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
14392 }
14393 #[inline]
14394 pub fn set_mFullThreadDevice(&mut self, val: bool) {
14395 unsafe {
14396 let val: u8 = ::std::mem::transmute(val);
14397 self._bitfield_1.set(1usize, 1u8, val as u64)
14398 }
14399 }
14400 #[inline]
14401 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
14402 unsafe {
14403 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14404 ::std::ptr::addr_of!((*this)._bitfield_1),
14405 1usize,
14406 1u8,
14407 ) as u8)
14408 }
14409 }
14410 #[inline]
14411 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
14412 unsafe {
14413 let val: u8 = ::std::mem::transmute(val);
14414 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14415 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14416 1usize,
14417 1u8,
14418 val as u64,
14419 )
14420 }
14421 }
14422 #[inline]
14423 pub fn mFullNetworkData(&self) -> bool {
14424 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
14425 }
14426 #[inline]
14427 pub fn set_mFullNetworkData(&mut self, val: bool) {
14428 unsafe {
14429 let val: u8 = ::std::mem::transmute(val);
14430 self._bitfield_1.set(2usize, 1u8, val as u64)
14431 }
14432 }
14433 #[inline]
14434 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
14435 unsafe {
14436 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14437 ::std::ptr::addr_of!((*this)._bitfield_1),
14438 2usize,
14439 1u8,
14440 ) as u8)
14441 }
14442 }
14443 #[inline]
14444 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
14445 unsafe {
14446 let val: u8 = ::std::mem::transmute(val);
14447 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14448 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14449 2usize,
14450 1u8,
14451 val as u64,
14452 )
14453 }
14454 }
14455 #[inline]
14456 pub fn mIsStateRestoring(&self) -> bool {
14457 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
14458 }
14459 #[inline]
14460 pub fn set_mIsStateRestoring(&mut self, val: bool) {
14461 unsafe {
14462 let val: u8 = ::std::mem::transmute(val);
14463 self._bitfield_1.set(3usize, 1u8, val as u64)
14464 }
14465 }
14466 #[inline]
14467 pub unsafe fn mIsStateRestoring_raw(this: *const Self) -> bool {
14468 unsafe {
14469 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14470 ::std::ptr::addr_of!((*this)._bitfield_1),
14471 3usize,
14472 1u8,
14473 ) as u8)
14474 }
14475 }
14476 #[inline]
14477 pub unsafe fn set_mIsStateRestoring_raw(this: *mut Self, val: bool) {
14478 unsafe {
14479 let val: u8 = ::std::mem::transmute(val);
14480 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14481 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14482 3usize,
14483 1u8,
14484 val as u64,
14485 )
14486 }
14487 }
14488 #[inline]
14489 pub fn mIsCslSynced(&self) -> bool {
14490 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
14491 }
14492 #[inline]
14493 pub fn set_mIsCslSynced(&mut self, val: bool) {
14494 unsafe {
14495 let val: u8 = ::std::mem::transmute(val);
14496 self._bitfield_1.set(4usize, 1u8, val as u64)
14497 }
14498 }
14499 #[inline]
14500 pub unsafe fn mIsCslSynced_raw(this: *const Self) -> bool {
14501 unsafe {
14502 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14503 ::std::ptr::addr_of!((*this)._bitfield_1),
14504 4usize,
14505 1u8,
14506 ) as u8)
14507 }
14508 }
14509 #[inline]
14510 pub unsafe fn set_mIsCslSynced_raw(this: *mut Self, val: bool) {
14511 unsafe {
14512 let val: u8 = ::std::mem::transmute(val);
14513 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14514 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14515 4usize,
14516 1u8,
14517 val as u64,
14518 )
14519 }
14520 }
14521 #[inline]
14522 pub fn new_bitfield_1(
14523 mRxOnWhenIdle: bool,
14524 mFullThreadDevice: bool,
14525 mFullNetworkData: bool,
14526 mIsStateRestoring: bool,
14527 mIsCslSynced: bool,
14528 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
14529 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
14530 __bindgen_bitfield_unit.set(0usize, 1u8, {
14531 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
14532 mRxOnWhenIdle as u64
14533 });
14534 __bindgen_bitfield_unit.set(1usize, 1u8, {
14535 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
14536 mFullThreadDevice as u64
14537 });
14538 __bindgen_bitfield_unit.set(2usize, 1u8, {
14539 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
14540 mFullNetworkData as u64
14541 });
14542 __bindgen_bitfield_unit.set(3usize, 1u8, {
14543 let mIsStateRestoring: u8 = unsafe { ::std::mem::transmute(mIsStateRestoring) };
14544 mIsStateRestoring as u64
14545 });
14546 __bindgen_bitfield_unit.set(4usize, 1u8, {
14547 let mIsCslSynced: u8 = unsafe { ::std::mem::transmute(mIsCslSynced) };
14548 mIsCslSynced as u64
14549 });
14550 __bindgen_bitfield_unit
14551 }
14552}
14553pub type otChildIp6AddressIterator = u16;
14554pub const OT_CACHE_ENTRY_STATE_CACHED: otCacheEntryState = 0;
14555pub const OT_CACHE_ENTRY_STATE_SNOOPED: otCacheEntryState = 1;
14556pub const OT_CACHE_ENTRY_STATE_QUERY: otCacheEntryState = 2;
14557pub const OT_CACHE_ENTRY_STATE_RETRY_QUERY: otCacheEntryState = 3;
14558#[doc = " Defines the EID cache entry state."]
14559pub type otCacheEntryState = ::std::os::raw::c_uint;
14560#[doc = " Represents an EID cache entry."]
14561#[repr(C)]
14562#[derive(Copy, Clone)]
14563pub struct otCacheEntryInfo {
14564 #[doc = "< Target EID"]
14565 pub mTarget: otIp6Address,
14566 #[doc = "< RLOC16"]
14567 pub mRloc16: otShortAddress,
14568 #[doc = "< Entry state"]
14569 pub mState: otCacheEntryState,
14570 pub _bitfield_align_1: [u8; 0],
14571 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
14572 #[doc = "< Last transaction time (applicable in cached state)."]
14573 pub mLastTransTime: u32,
14574 #[doc = "< Mesh Local EID (applicable if entry in cached state)."]
14575 pub mMeshLocalEid: otIp6Address,
14576 #[doc = "< Timeout in seconds (applicable if in snooped/query/retry-query states)."]
14577 pub mTimeout: u16,
14578 #[doc = "< Retry delay in seconds (applicable if in query-retry state)."]
14579 pub mRetryDelay: u16,
14580}
14581impl Default for otCacheEntryInfo {
14582 fn default() -> Self {
14583 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14584 unsafe {
14585 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14586 s.assume_init()
14587 }
14588 }
14589}
14590impl otCacheEntryInfo {
14591 #[inline]
14592 pub fn mCanEvict(&self) -> bool {
14593 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
14594 }
14595 #[inline]
14596 pub fn set_mCanEvict(&mut self, val: bool) {
14597 unsafe {
14598 let val: u8 = ::std::mem::transmute(val);
14599 self._bitfield_1.set(0usize, 1u8, val as u64)
14600 }
14601 }
14602 #[inline]
14603 pub unsafe fn mCanEvict_raw(this: *const Self) -> bool {
14604 unsafe {
14605 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14606 ::std::ptr::addr_of!((*this)._bitfield_1),
14607 0usize,
14608 1u8,
14609 ) as u8)
14610 }
14611 }
14612 #[inline]
14613 pub unsafe fn set_mCanEvict_raw(this: *mut Self, val: bool) {
14614 unsafe {
14615 let val: u8 = ::std::mem::transmute(val);
14616 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14617 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14618 0usize,
14619 1u8,
14620 val as u64,
14621 )
14622 }
14623 }
14624 #[inline]
14625 pub fn mRampDown(&self) -> bool {
14626 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
14627 }
14628 #[inline]
14629 pub fn set_mRampDown(&mut self, val: bool) {
14630 unsafe {
14631 let val: u8 = ::std::mem::transmute(val);
14632 self._bitfield_1.set(1usize, 1u8, val as u64)
14633 }
14634 }
14635 #[inline]
14636 pub unsafe fn mRampDown_raw(this: *const Self) -> bool {
14637 unsafe {
14638 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14639 ::std::ptr::addr_of!((*this)._bitfield_1),
14640 1usize,
14641 1u8,
14642 ) as u8)
14643 }
14644 }
14645 #[inline]
14646 pub unsafe fn set_mRampDown_raw(this: *mut Self, val: bool) {
14647 unsafe {
14648 let val: u8 = ::std::mem::transmute(val);
14649 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14650 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14651 1usize,
14652 1u8,
14653 val as u64,
14654 )
14655 }
14656 }
14657 #[inline]
14658 pub fn mValidLastTrans(&self) -> bool {
14659 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
14660 }
14661 #[inline]
14662 pub fn set_mValidLastTrans(&mut self, val: bool) {
14663 unsafe {
14664 let val: u8 = ::std::mem::transmute(val);
14665 self._bitfield_1.set(2usize, 1u8, val as u64)
14666 }
14667 }
14668 #[inline]
14669 pub unsafe fn mValidLastTrans_raw(this: *const Self) -> bool {
14670 unsafe {
14671 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14672 ::std::ptr::addr_of!((*this)._bitfield_1),
14673 2usize,
14674 1u8,
14675 ) as u8)
14676 }
14677 }
14678 #[inline]
14679 pub unsafe fn set_mValidLastTrans_raw(this: *mut Self, val: bool) {
14680 unsafe {
14681 let val: u8 = ::std::mem::transmute(val);
14682 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14683 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14684 2usize,
14685 1u8,
14686 val as u64,
14687 )
14688 }
14689 }
14690 #[inline]
14691 pub fn new_bitfield_1(
14692 mCanEvict: bool,
14693 mRampDown: bool,
14694 mValidLastTrans: bool,
14695 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
14696 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
14697 __bindgen_bitfield_unit.set(0usize, 1u8, {
14698 let mCanEvict: u8 = unsafe { ::std::mem::transmute(mCanEvict) };
14699 mCanEvict as u64
14700 });
14701 __bindgen_bitfield_unit.set(1usize, 1u8, {
14702 let mRampDown: u8 = unsafe { ::std::mem::transmute(mRampDown) };
14703 mRampDown as u64
14704 });
14705 __bindgen_bitfield_unit.set(2usize, 1u8, {
14706 let mValidLastTrans: u8 = unsafe { ::std::mem::transmute(mValidLastTrans) };
14707 mValidLastTrans as u64
14708 });
14709 __bindgen_bitfield_unit
14710 }
14711}
14712#[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)."]
14713#[repr(C)]
14714#[derive(Debug, Copy, Clone)]
14715pub struct otCacheEntryIterator {
14716 #[doc = "< Opaque data used by the core implementation. Should not be changed by user."]
14717 pub mData: [*const ::std::os::raw::c_void; 2usize],
14718}
14719impl Default for otCacheEntryIterator {
14720 fn default() -> Self {
14721 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14722 unsafe {
14723 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14724 s.assume_init()
14725 }
14726 }
14727}
14728unsafe extern "C" {
14729 #[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"]
14730 pub fn otThreadGetMaxAllowedChildren(aInstance: *mut otInstance) -> u16;
14731}
14732unsafe extern "C" {
14733 #[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"]
14734 pub fn otThreadSetMaxAllowedChildren(aInstance: *mut otInstance, aMaxChildren: u16) -> otError;
14735}
14736unsafe extern "C" {
14737 #[doc = " Indicates whether or not the device is router-eligible.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @retval TRUE If device is router-eligible.\n @retval FALSE If device is not router-eligible."]
14738 pub fn otThreadIsRouterEligible(aInstance: *mut otInstance) -> bool;
14739}
14740unsafe extern "C" {
14741 #[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."]
14742 pub fn otThreadSetRouterEligible(aInstance: *mut otInstance, aEligible: bool) -> otError;
14743}
14744unsafe extern "C" {
14745 #[doc = " Set the preferred Router Id.\n\n Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if\n it can not be used, a randomly generated router id is picked. This property can be set only when the device role is\n either detached or disabled.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aRouterId The preferred Router Id.\n\n @retval OT_ERROR_NONE Successfully set the preferred Router Id.\n @retval OT_ERROR_INVALID_STATE Could not set (role is not detached or disabled)"]
14746 pub fn otThreadSetPreferredRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
14747}
14748#[doc = "< Battery powered."]
14749pub const OT_POWER_SUPPLY_BATTERY: otPowerSupply = 0;
14750#[doc = "< Externally powered (mains-powered)."]
14751pub const OT_POWER_SUPPLY_EXTERNAL: otPowerSupply = 1;
14752#[doc = "< Stable external power with a battery backup or UPS."]
14753pub const OT_POWER_SUPPLY_EXTERNAL_STABLE: otPowerSupply = 2;
14754#[doc = "< Potentially unstable ext power (e.g. light bulb powered via a switch)."]
14755pub const OT_POWER_SUPPLY_EXTERNAL_UNSTABLE: otPowerSupply = 3;
14756#[doc = " Represents the power supply property on a device.\n\n This is used as a property in `otDeviceProperties` to calculate the leader weight."]
14757pub type otPowerSupply = ::std::os::raw::c_uint;
14758#[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."]
14759#[repr(C)]
14760#[derive(Debug, Copy, Clone)]
14761pub struct otDeviceProperties {
14762 #[doc = "< Power supply config."]
14763 pub mPowerSupply: otPowerSupply,
14764 pub _bitfield_align_1: [u8; 0],
14765 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
14766 #[doc = "< Weight adjustment. Should be -16 to +16 (clamped otherwise)."]
14767 pub mLeaderWeightAdjustment: i8,
14768}
14769impl Default for otDeviceProperties {
14770 fn default() -> Self {
14771 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14772 unsafe {
14773 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14774 s.assume_init()
14775 }
14776 }
14777}
14778impl otDeviceProperties {
14779 #[inline]
14780 pub fn mIsBorderRouter(&self) -> bool {
14781 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
14782 }
14783 #[inline]
14784 pub fn set_mIsBorderRouter(&mut self, val: bool) {
14785 unsafe {
14786 let val: u8 = ::std::mem::transmute(val);
14787 self._bitfield_1.set(0usize, 1u8, val as u64)
14788 }
14789 }
14790 #[inline]
14791 pub unsafe fn mIsBorderRouter_raw(this: *const Self) -> bool {
14792 unsafe {
14793 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14794 ::std::ptr::addr_of!((*this)._bitfield_1),
14795 0usize,
14796 1u8,
14797 ) as u8)
14798 }
14799 }
14800 #[inline]
14801 pub unsafe fn set_mIsBorderRouter_raw(this: *mut Self, val: bool) {
14802 unsafe {
14803 let val: u8 = ::std::mem::transmute(val);
14804 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14805 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14806 0usize,
14807 1u8,
14808 val as u64,
14809 )
14810 }
14811 }
14812 #[inline]
14813 pub fn mSupportsCcm(&self) -> bool {
14814 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
14815 }
14816 #[inline]
14817 pub fn set_mSupportsCcm(&mut self, val: bool) {
14818 unsafe {
14819 let val: u8 = ::std::mem::transmute(val);
14820 self._bitfield_1.set(1usize, 1u8, val as u64)
14821 }
14822 }
14823 #[inline]
14824 pub unsafe fn mSupportsCcm_raw(this: *const Self) -> bool {
14825 unsafe {
14826 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14827 ::std::ptr::addr_of!((*this)._bitfield_1),
14828 1usize,
14829 1u8,
14830 ) as u8)
14831 }
14832 }
14833 #[inline]
14834 pub unsafe fn set_mSupportsCcm_raw(this: *mut Self, val: bool) {
14835 unsafe {
14836 let val: u8 = ::std::mem::transmute(val);
14837 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14838 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14839 1usize,
14840 1u8,
14841 val as u64,
14842 )
14843 }
14844 }
14845 #[inline]
14846 pub fn mIsUnstable(&self) -> bool {
14847 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
14848 }
14849 #[inline]
14850 pub fn set_mIsUnstable(&mut self, val: bool) {
14851 unsafe {
14852 let val: u8 = ::std::mem::transmute(val);
14853 self._bitfield_1.set(2usize, 1u8, val as u64)
14854 }
14855 }
14856 #[inline]
14857 pub unsafe fn mIsUnstable_raw(this: *const Self) -> bool {
14858 unsafe {
14859 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14860 ::std::ptr::addr_of!((*this)._bitfield_1),
14861 2usize,
14862 1u8,
14863 ) as u8)
14864 }
14865 }
14866 #[inline]
14867 pub unsafe fn set_mIsUnstable_raw(this: *mut Self, val: bool) {
14868 unsafe {
14869 let val: u8 = ::std::mem::transmute(val);
14870 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14871 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14872 2usize,
14873 1u8,
14874 val as u64,
14875 )
14876 }
14877 }
14878 #[inline]
14879 pub fn new_bitfield_1(
14880 mIsBorderRouter: bool,
14881 mSupportsCcm: bool,
14882 mIsUnstable: bool,
14883 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
14884 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
14885 __bindgen_bitfield_unit.set(0usize, 1u8, {
14886 let mIsBorderRouter: u8 = unsafe { ::std::mem::transmute(mIsBorderRouter) };
14887 mIsBorderRouter as u64
14888 });
14889 __bindgen_bitfield_unit.set(1usize, 1u8, {
14890 let mSupportsCcm: u8 = unsafe { ::std::mem::transmute(mSupportsCcm) };
14891 mSupportsCcm as u64
14892 });
14893 __bindgen_bitfield_unit.set(2usize, 1u8, {
14894 let mIsUnstable: u8 = unsafe { ::std::mem::transmute(mIsUnstable) };
14895 mIsUnstable as u64
14896 });
14897 __bindgen_bitfield_unit
14898 }
14899}
14900unsafe extern "C" {
14901 #[doc = " Get the current device properties.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @returns The device properties `otDeviceProperties`."]
14902 pub fn otThreadGetDeviceProperties(aInstance: *mut otInstance) -> *const otDeviceProperties;
14903}
14904unsafe extern "C" {
14905 #[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."]
14906 pub fn otThreadSetDeviceProperties(
14907 aInstance: *mut otInstance,
14908 aDeviceProperties: *const otDeviceProperties,
14909 );
14910}
14911unsafe extern "C" {
14912 #[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"]
14913 pub fn otThreadGetLocalLeaderWeight(aInstance: *mut otInstance) -> u8;
14914}
14915unsafe extern "C" {
14916 #[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"]
14917 pub fn otThreadSetLocalLeaderWeight(aInstance: *mut otInstance, aWeight: u8);
14918}
14919unsafe extern "C" {
14920 #[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."]
14921 pub fn otThreadGetPreferredLeaderPartitionId(aInstance: *mut otInstance) -> u32;
14922}
14923unsafe extern "C" {
14924 #[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."]
14925 pub fn otThreadSetPreferredLeaderPartitionId(aInstance: *mut otInstance, aPartitionId: u32);
14926}
14927unsafe extern "C" {
14928 #[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"]
14929 pub fn otThreadGetJoinerUdpPort(aInstance: *mut otInstance) -> u16;
14930}
14931unsafe extern "C" {
14932 #[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"]
14933 pub fn otThreadSetJoinerUdpPort(aInstance: *mut otInstance, aJoinerUdpPort: u16) -> otError;
14934}
14935unsafe extern "C" {
14936 #[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."]
14937 pub fn otThreadSetSteeringData(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
14938}
14939unsafe extern "C" {
14940 #[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"]
14941 pub fn otThreadGetContextIdReuseDelay(aInstance: *mut otInstance) -> u32;
14942}
14943unsafe extern "C" {
14944 #[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"]
14945 pub fn otThreadSetContextIdReuseDelay(aInstance: *mut otInstance, aDelay: u32);
14946}
14947unsafe extern "C" {
14948 #[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"]
14949 pub fn otThreadGetNetworkIdTimeout(aInstance: *mut otInstance) -> u8;
14950}
14951unsafe extern "C" {
14952 #[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"]
14953 pub fn otThreadSetNetworkIdTimeout(aInstance: *mut otInstance, aTimeout: u8);
14954}
14955unsafe extern "C" {
14956 #[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"]
14957 pub fn otThreadGetRouterUpgradeThreshold(aInstance: *mut otInstance) -> u8;
14958}
14959unsafe extern "C" {
14960 #[doc = " Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.\n\n @note This API is reserved for testing and demo purposes only. Changing settings with\n this API will render a production application non-compliant with the Thread Specification.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.\n\n @sa otThreadGetRouterUpgradeThreshold"]
14961 pub fn otThreadSetRouterUpgradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
14962}
14963unsafe extern "C" {
14964 #[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"]
14965 pub fn otThreadGetChildRouterLinks(aInstance: *mut otInstance) -> u8;
14966}
14967unsafe extern "C" {
14968 #[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"]
14969 pub fn otThreadSetChildRouterLinks(
14970 aInstance: *mut otInstance,
14971 aChildRouterLinks: u8,
14972 ) -> otError;
14973}
14974unsafe extern "C" {
14975 #[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."]
14976 pub fn otThreadReleaseRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
14977}
14978unsafe extern "C" {
14979 #[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."]
14980 pub fn otThreadBecomeRouter(aInstance: *mut otInstance) -> otError;
14981}
14982unsafe extern "C" {
14983 #[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."]
14984 pub fn otThreadBecomeLeader(aInstance: *mut otInstance) -> otError;
14985}
14986unsafe extern "C" {
14987 #[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"]
14988 pub fn otThreadGetRouterDowngradeThreshold(aInstance: *mut otInstance) -> u8;
14989}
14990unsafe extern "C" {
14991 #[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"]
14992 pub fn otThreadSetRouterDowngradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
14993}
14994unsafe extern "C" {
14995 #[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"]
14996 pub fn otThreadGetRouterSelectionJitter(aInstance: *mut otInstance) -> u8;
14997}
14998unsafe extern "C" {
14999 #[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"]
15000 pub fn otThreadSetRouterSelectionJitter(aInstance: *mut otInstance, aRouterJitter: u8);
15001}
15002unsafe extern "C" {
15003 #[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."]
15004 pub fn otThreadGetChildInfoById(
15005 aInstance: *mut otInstance,
15006 aChildId: u16,
15007 aChildInfo: *mut otChildInfo,
15008 ) -> otError;
15009}
15010unsafe extern "C" {
15011 #[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"]
15012 pub fn otThreadGetChildInfoByIndex(
15013 aInstance: *mut otInstance,
15014 aChildIndex: u16,
15015 aChildInfo: *mut otChildInfo,
15016 ) -> otError;
15017}
15018unsafe extern "C" {
15019 #[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"]
15020 pub fn otThreadGetChildNextIp6Address(
15021 aInstance: *mut otInstance,
15022 aChildIndex: u16,
15023 aIterator: *mut otChildIp6AddressIterator,
15024 aAddress: *mut otIp6Address,
15025 ) -> otError;
15026}
15027unsafe extern "C" {
15028 #[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."]
15029 pub fn otThreadGetRouterIdSequence(aInstance: *mut otInstance) -> u8;
15030}
15031unsafe extern "C" {
15032 #[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."]
15033 pub fn otThreadGetMaxRouterId(aInstance: *mut otInstance) -> u8;
15034}
15035unsafe extern "C" {
15036 #[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."]
15037 pub fn otThreadGetRouterInfo(
15038 aInstance: *mut otInstance,
15039 aRouterId: u16,
15040 aRouterInfo: *mut otRouterInfo,
15041 ) -> otError;
15042}
15043unsafe extern "C" {
15044 #[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."]
15045 pub fn otThreadGetNextCacheEntry(
15046 aInstance: *mut otInstance,
15047 aEntryInfo: *mut otCacheEntryInfo,
15048 aIterator: *mut otCacheEntryIterator,
15049 ) -> otError;
15050}
15051unsafe extern "C" {
15052 #[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"]
15053 pub fn otThreadGetPskc(aInstance: *mut otInstance, aPskc: *mut otPskc);
15054}
15055unsafe extern "C" {
15056 #[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"]
15057 pub fn otThreadGetPskcRef(aInstance: *mut otInstance) -> otPskcRef;
15058}
15059unsafe extern "C" {
15060 #[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"]
15061 pub fn otThreadSetPskc(aInstance: *mut otInstance, aPskc: *const otPskc) -> otError;
15062}
15063unsafe extern "C" {
15064 #[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"]
15065 pub fn otThreadSetPskcRef(aInstance: *mut otInstance, aKeyRef: otPskcRef) -> otError;
15066}
15067unsafe extern "C" {
15068 #[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"]
15069 pub fn otThreadGetParentPriority(aInstance: *mut otInstance) -> i8;
15070}
15071unsafe extern "C" {
15072 #[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"]
15073 pub fn otThreadSetParentPriority(aInstance: *mut otInstance, aParentPriority: i8) -> otError;
15074}
15075unsafe extern "C" {
15076 #[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"]
15077 pub fn otThreadGetMaxChildIpAddresses(aInstance: *mut otInstance) -> u8;
15078}
15079unsafe extern "C" {
15080 #[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"]
15081 pub fn otThreadSetMaxChildIpAddresses(
15082 aInstance: *mut otInstance,
15083 aMaxIpAddresses: u8,
15084 ) -> otError;
15085}
15086#[doc = "< A child is being added."]
15087pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED: otNeighborTableEvent = 0;
15088#[doc = "< A child is being removed."]
15089pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED: otNeighborTableEvent = 1;
15090#[doc = "< An existing child's mode is changed."]
15091pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED: otNeighborTableEvent = 2;
15092#[doc = "< A router is being added."]
15093pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED: otNeighborTableEvent = 3;
15094#[doc = "< A router is being removed."]
15095pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED: otNeighborTableEvent = 4;
15096#[doc = " Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table."]
15097pub type otNeighborTableEvent = ::std::os::raw::c_uint;
15098#[doc = " Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table\n callback `otNeighborTableCallback`."]
15099#[repr(C)]
15100#[derive(Copy, Clone)]
15101pub struct otNeighborTableEntryInfo {
15102 #[doc = "< The OpenThread instance."]
15103 pub mInstance: *mut otInstance,
15104 pub mInfo: otNeighborTableEntryInfo__bindgen_ty_1,
15105}
15106#[repr(C)]
15107#[derive(Copy, Clone)]
15108pub union otNeighborTableEntryInfo__bindgen_ty_1 {
15109 #[doc = "< The child neighbor info."]
15110 pub mChild: otChildInfo,
15111 #[doc = "< The router neighbor info."]
15112 pub mRouter: otNeighborInfo,
15113}
15114impl Default for otNeighborTableEntryInfo__bindgen_ty_1 {
15115 fn default() -> Self {
15116 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15117 unsafe {
15118 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15119 s.assume_init()
15120 }
15121 }
15122}
15123impl Default for otNeighborTableEntryInfo {
15124 fn default() -> Self {
15125 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15126 unsafe {
15127 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15128 s.assume_init()
15129 }
15130 }
15131}
15132#[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."]
15133pub type otNeighborTableCallback = ::std::option::Option<
15134 unsafe extern "C" fn(aEvent: otNeighborTableEvent, aEntryInfo: *const otNeighborTableEntryInfo),
15135>;
15136unsafe extern "C" {
15137 #[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."]
15138 pub fn otThreadRegisterNeighborTableCallback(
15139 aInstance: *mut otInstance,
15140 aCallback: otNeighborTableCallback,
15141 );
15142}
15143unsafe extern "C" {
15144 #[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."]
15145 pub fn otThreadSetCcmEnabled(aInstance: *mut otInstance, aEnabled: bool);
15146}
15147unsafe extern "C" {
15148 #[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."]
15149 pub fn otThreadSetThreadVersionCheckEnabled(aInstance: *mut otInstance, aEnabled: bool);
15150}
15151unsafe extern "C" {
15152 #[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."]
15153 pub fn otThreadSetTmfOriginFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
15154}
15155unsafe extern "C" {
15156 #[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."]
15157 pub fn otThreadIsTmfOriginFilterEnabled(aInstance: *mut otInstance) -> bool;
15158}
15159unsafe extern "C" {
15160 #[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"]
15161 pub fn otThreadGetRouterIdRange(
15162 aInstance: *mut otInstance,
15163 aMinRouterId: *mut u8,
15164 aMaxRouterId: *mut u8,
15165 );
15166}
15167unsafe extern "C" {
15168 #[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"]
15169 pub fn otThreadSetRouterIdRange(
15170 aInstance: *mut otInstance,
15171 aMinRouterId: u8,
15172 aMaxRouterId: u8,
15173 ) -> otError;
15174}
15175unsafe extern "C" {
15176 #[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."]
15177 pub fn otThreadGetAdvertisementTrickleIntervalMax(aInstance: *mut otInstance) -> u32;
15178}
15179unsafe extern "C" {
15180 #[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."]
15181 pub fn otThreadIsRouterIdAllocated(aInstance: *mut otInstance, aRouterId: u8) -> bool;
15182}
15183unsafe extern "C" {
15184 #[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."]
15185 pub fn otThreadGetNextHopAndPathCost(
15186 aInstance: *mut otInstance,
15187 aDestRloc16: u16,
15188 aNextHopRloc16: *mut u16,
15189 aPathCost: *mut u8,
15190 );
15191}
15192#[doc = " Represents a TREL peer."]
15193#[repr(C)]
15194#[derive(Copy, Clone)]
15195pub struct otTrelPeer {
15196 #[doc = "< The Extended MAC Address of TREL peer."]
15197 pub mExtAddress: otExtAddress,
15198 #[doc = "< The Extended PAN Identifier of TREL peer."]
15199 pub mExtPanId: otExtendedPanId,
15200 #[doc = "< The IPv6 socket address of TREL peer."]
15201 pub mSockAddr: otSockAddr,
15202}
15203impl Default for otTrelPeer {
15204 fn default() -> Self {
15205 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15206 unsafe {
15207 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15208 s.assume_init()
15209 }
15210 }
15211}
15212#[doc = " Represents an iterator for iterating over TREL peer table entries."]
15213pub type otTrelPeerIterator = *const ::std::os::raw::c_void;
15214unsafe extern "C" {
15215 #[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."]
15216 pub fn otTrelSetEnabled(aInstance: *mut otInstance, aEnable: bool);
15217}
15218unsafe extern "C" {
15219 #[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."]
15220 pub fn otTrelIsEnabled(aInstance: *mut otInstance) -> bool;
15221}
15222unsafe extern "C" {
15223 #[doc = " Initializes a peer table iterator.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
15224 pub fn otTrelInitPeerIterator(aInstance: *mut otInstance, aIterator: *mut otTrelPeerIterator);
15225}
15226unsafe extern "C" {
15227 #[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."]
15228 pub fn otTrelGetNextPeer(
15229 aInstance: *mut otInstance,
15230 aIterator: *mut otTrelPeerIterator,
15231 ) -> *const otTrelPeer;
15232}
15233unsafe extern "C" {
15234 #[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."]
15235 pub fn otTrelGetNumberOfPeers(aInstance: *mut otInstance) -> u16;
15236}
15237unsafe extern "C" {
15238 #[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."]
15239 pub fn otTrelSetFilterEnabled(aInstance: *mut otInstance, aEnable: bool);
15240}
15241unsafe extern "C" {
15242 #[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."]
15243 pub fn otTrelIsFilterEnabled(aInstance: *mut otInstance) -> bool;
15244}
15245#[doc = " Represents a group of TREL related counters."]
15246pub type otTrelCounters = otPlatTrelCounters;
15247unsafe extern "C" {
15248 #[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."]
15249 pub fn otTrelGetCounters(aInstance: *mut otInstance) -> *const otTrelCounters;
15250}
15251unsafe extern "C" {
15252 #[doc = " Resets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
15253 pub fn otTrelResetCounters(aInstance: *mut otInstance);
15254}
15255unsafe extern "C" {
15256 #[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."]
15257 pub fn otTrelGetUdpPort(aInstance: *mut otInstance) -> u16;
15258}
15259unsafe extern "C" {
15260 #[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`."]
15261 pub fn otVerhoeffChecksumCalculate(
15262 aDecimalString: *const ::std::os::raw::c_char,
15263 aChecksum: *mut ::std::os::raw::c_char,
15264 ) -> otError;
15265}
15266unsafe extern "C" {
15267 #[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`."]
15268 pub fn otVerhoeffChecksumValidate(aDecimalString: *const ::std::os::raw::c_char) -> otError;
15269}
15270pub type __builtin_va_list = [__va_list_tag; 1usize];
15271#[repr(C)]
15272#[derive(Debug, Copy, Clone)]
15273pub struct __va_list_tag {
15274 pub gp_offset: ::std::os::raw::c_uint,
15275 pub fp_offset: ::std::os::raw::c_uint,
15276 pub overflow_arg_area: *mut ::std::os::raw::c_void,
15277 pub reg_save_area: *mut ::std::os::raw::c_void,
15278}
15279impl Default for __va_list_tag {
15280 fn default() -> Self {
15281 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
15282 unsafe {
15283 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
15284 s.assume_init()
15285 }
15286 }
15287}