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 = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
46 Self::extract_bit(byte, index)
47 }
48 #[inline]
49 fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
50 let bit_index = if cfg!(target_endian = "big") { 7 - (index % 8) } else { index % 8 };
51 let mask = 1 << bit_index;
52 if val {
53 byte | mask
54 } else {
55 byte & !mask
56 }
57 }
58 #[inline]
59 pub fn set_bit(&mut self, index: usize, val: bool) {
60 debug_assert!(index / 8 < self.storage.as_ref().len());
61 let byte_index = index / 8;
62 let byte = &mut self.storage.as_mut()[byte_index];
63 *byte = Self::change_bit(*byte, index, val);
64 }
65 #[inline]
66 pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
67 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
68 let byte_index = index / 8;
69 let byte =
70 (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
71 *byte = Self::change_bit(*byte, index, val);
72 }
73 #[inline]
74 pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
75 debug_assert!(bit_width <= 64);
76 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
77 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
78 let mut val = 0;
79 for i in 0..(bit_width as usize) {
80 if self.get_bit(i + bit_offset) {
81 let index =
82 if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
83 val |= 1 << index;
84 }
85 }
86 val
87 }
88 #[inline]
89 pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
90 debug_assert!(bit_width <= 64);
91 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
92 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
93 let mut val = 0;
94 for i in 0..(bit_width as usize) {
95 if Self::raw_get_bit(this, i + bit_offset) {
96 let index =
97 if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
98 val |= 1 << index;
99 }
100 }
101 val
102 }
103 #[inline]
104 pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
105 debug_assert!(bit_width <= 64);
106 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
107 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
108 for i in 0..(bit_width as usize) {
109 let mask = 1 << i;
110 let val_bit_is_set = val & mask == mask;
111 let index = if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
112 self.set_bit(index + bit_offset, val_bit_is_set);
113 }
114 }
115 #[inline]
116 pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
117 debug_assert!(bit_width <= 64);
118 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
119 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
120 for i in 0..(bit_width as usize) {
121 let mask = 1 << i;
122 let val_bit_is_set = val & mask == mask;
123 let index = if cfg!(target_endian = "big") { bit_width as usize - 1 - i } else { i };
124 Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
125 }
126 }
127}
128pub const OT_LOG_LEVEL_NONE: u32 = 0;
129pub const OT_LOG_LEVEL_CRIT: u32 = 1;
130pub const OT_LOG_LEVEL_WARN: u32 = 2;
131pub const OT_LOG_LEVEL_NOTE: u32 = 3;
132pub const OT_LOG_LEVEL_INFO: u32 = 4;
133pub const OT_LOG_LEVEL_DEBG: u32 = 5;
134pub const OPENTHREAD_API_VERSION: u32 = 478;
135pub const OT_UPTIME_STRING_SIZE: u32 = 24;
136pub const OT_CHANGED_IP6_ADDRESS_ADDED: u32 = 1;
137pub const OT_CHANGED_IP6_ADDRESS_REMOVED: u32 = 2;
138pub const OT_CHANGED_THREAD_ROLE: u32 = 4;
139pub const OT_CHANGED_THREAD_LL_ADDR: u32 = 8;
140pub const OT_CHANGED_THREAD_ML_ADDR: u32 = 16;
141pub const OT_CHANGED_THREAD_RLOC_ADDED: u32 = 32;
142pub const OT_CHANGED_THREAD_RLOC_REMOVED: u32 = 64;
143pub const OT_CHANGED_THREAD_PARTITION_ID: u32 = 128;
144pub const OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER: u32 = 256;
145pub const OT_CHANGED_THREAD_NETDATA: u32 = 512;
146pub const OT_CHANGED_THREAD_CHILD_ADDED: u32 = 1024;
147pub const OT_CHANGED_THREAD_CHILD_REMOVED: u32 = 2048;
148pub const OT_CHANGED_IP6_MULTICAST_SUBSCRIBED: u32 = 4096;
149pub const OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED: u32 = 8192;
150pub const OT_CHANGED_THREAD_CHANNEL: u32 = 16384;
151pub const OT_CHANGED_THREAD_PANID: u32 = 32768;
152pub const OT_CHANGED_THREAD_NETWORK_NAME: u32 = 65536;
153pub const OT_CHANGED_THREAD_EXT_PANID: u32 = 131072;
154pub const OT_CHANGED_NETWORK_KEY: u32 = 262144;
155pub const OT_CHANGED_PSKC: u32 = 524288;
156pub const OT_CHANGED_SECURITY_POLICY: u32 = 1048576;
157pub const OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL: u32 = 2097152;
158pub const OT_CHANGED_SUPPORTED_CHANNEL_MASK: u32 = 4194304;
159pub const OT_CHANGED_COMMISSIONER_STATE: u32 = 8388608;
160pub const OT_CHANGED_THREAD_NETIF_STATE: u32 = 16777216;
161pub const OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE: u32 = 33554432;
162pub const OT_CHANGED_THREAD_BACKBONE_ROUTER_LOCAL: u32 = 67108864;
163pub const OT_CHANGED_JOINER_STATE: u32 = 134217728;
164pub const OT_CHANGED_ACTIVE_DATASET: u32 = 268435456;
165pub const OT_CHANGED_PENDING_DATASET: u32 = 536870912;
166pub const OT_CHANGED_NAT64_TRANSLATOR_STATE: u32 = 1073741824;
167pub const OT_CHANGED_PARENT_LINK_QUALITY: u32 = 2147483648;
168pub const OT_CRYPTO_SHA256_HASH_SIZE: u32 = 32;
169pub const OT_CRYPTO_ECDSA_MAX_DER_SIZE: u32 = 125;
170pub const OT_CRYPTO_ECDSA_PUBLIC_KEY_SIZE: u32 = 64;
171pub const OT_CRYPTO_ECDSA_SIGNATURE_SIZE: u32 = 64;
172pub const OT_CRYPTO_PBDKF2_MAX_SALT_SIZE: u32 = 30;
173pub const OT_PANID_BROADCAST: u32 = 65535;
174pub const OT_EXT_ADDRESS_SIZE: u32 = 8;
175pub const OT_MAC_KEY_SIZE: u32 = 16;
176pub const OT_IP6_PREFIX_SIZE: u32 = 8;
177pub const OT_IP6_PREFIX_BITSIZE: u32 = 64;
178pub const OT_IP6_IID_SIZE: u32 = 8;
179pub const OT_IP6_ADDRESS_SIZE: u32 = 16;
180pub const OT_IP6_ADDRESS_BITSIZE: u32 = 128;
181pub const OT_IP6_HEADER_SIZE: u32 = 40;
182pub const OT_IP6_HEADER_PROTO_OFFSET: u32 = 6;
183pub const OT_IP6_ADDRESS_STRING_SIZE: u32 = 40;
184pub const OT_IP6_SOCK_ADDR_STRING_SIZE: u32 = 48;
185pub const OT_IP6_PREFIX_STRING_SIZE: u32 = 45;
186pub const OT_IP6_MAX_MLR_ADDRESSES: u32 = 15;
187pub const OT_NETWORK_KEY_SIZE: u32 = 16;
188pub const OT_NETWORK_NAME_MAX_SIZE: u32 = 16;
189pub const OT_EXT_PAN_ID_SIZE: u32 = 8;
190pub const OT_MESH_LOCAL_PREFIX_SIZE: u32 = 8;
191pub const OT_PSKC_MAX_SIZE: u32 = 16;
192pub const OT_CHANNEL_1_MASK: u32 = 2;
193pub const OT_CHANNEL_2_MASK: u32 = 4;
194pub const OT_CHANNEL_3_MASK: u32 = 8;
195pub const OT_CHANNEL_4_MASK: u32 = 16;
196pub const OT_CHANNEL_5_MASK: u32 = 32;
197pub const OT_CHANNEL_6_MASK: u32 = 64;
198pub const OT_CHANNEL_7_MASK: u32 = 128;
199pub const OT_CHANNEL_8_MASK: u32 = 256;
200pub const OT_CHANNEL_9_MASK: u32 = 512;
201pub const OT_CHANNEL_10_MASK: u32 = 1024;
202pub const OT_CHANNEL_11_MASK: u32 = 2048;
203pub const OT_CHANNEL_12_MASK: u32 = 4096;
204pub const OT_CHANNEL_13_MASK: u32 = 8192;
205pub const OT_CHANNEL_14_MASK: u32 = 16384;
206pub const OT_CHANNEL_15_MASK: u32 = 32768;
207pub const OT_CHANNEL_16_MASK: u32 = 65536;
208pub const OT_CHANNEL_17_MASK: u32 = 131072;
209pub const OT_CHANNEL_18_MASK: u32 = 262144;
210pub const OT_CHANNEL_19_MASK: u32 = 524288;
211pub const OT_CHANNEL_20_MASK: u32 = 1048576;
212pub const OT_CHANNEL_21_MASK: u32 = 2097152;
213pub const OT_CHANNEL_22_MASK: u32 = 4194304;
214pub const OT_CHANNEL_23_MASK: u32 = 8388608;
215pub const OT_CHANNEL_24_MASK: u32 = 16777216;
216pub const OT_CHANNEL_25_MASK: u32 = 33554432;
217pub const OT_CHANNEL_26_MASK: u32 = 67108864;
218pub const OT_OPERATIONAL_DATASET_MAX_LENGTH: u32 = 254;
219pub const OT_JOINER_MAX_DISCERNER_LENGTH: u32 = 64;
220pub const OT_COMMISSIONING_PASSPHRASE_MIN_SIZE: u32 = 6;
221pub const OT_COMMISSIONING_PASSPHRASE_MAX_SIZE: u32 = 255;
222pub const OT_PROVISIONING_URL_MAX_SIZE: u32 = 64;
223pub const OT_STEERING_DATA_MAX_LENGTH: u32 = 16;
224pub const OT_JOINER_MAX_PSKD_LENGTH: u32 = 32;
225pub const OT_NETWORK_DATA_ITERATOR_INIT: u32 = 0;
226pub const OT_SERVICE_DATA_MAX_SIZE: u32 = 252;
227pub const OT_SERVER_DATA_MAX_SIZE: u32 = 248;
228pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ITERATOR_INIT: u32 = 0;
229pub const OT_BORDER_AGENT_ID_LENGTH: u32 = 16;
230pub const OT_BORDER_AGENT_MIN_EPHEMERAL_KEY_LENGTH: u32 = 6;
231pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_LENGTH: u32 = 32;
232pub const OT_BORDER_AGENT_DEFAULT_EPHEMERAL_KEY_TIMEOUT: u32 = 120000;
233pub const OT_BORDER_AGENT_MAX_EPHEMERAL_KEY_TIMEOUT: u32 = 600000;
234pub const OT_DEFAULT_COAP_PORT: u32 = 5683;
235pub const OT_COAP_DEFAULT_TOKEN_LENGTH: u32 = 2;
236pub const OT_COAP_MAX_TOKEN_LENGTH: u32 = 8;
237pub const OT_COAP_MAX_RETRANSMIT: u32 = 20;
238pub const OT_COAP_MIN_ACK_TIMEOUT: u32 = 1000;
239pub const OT_DEFAULT_COAP_SECURE_PORT: u32 = 5684;
240pub const OPENTHREAD_LIB_SPINEL_RX_FRAME_BUFFER_SIZE: u32 = 65535;
241pub const OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL: u32 = 60000000;
242pub const OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE: u32 = 1;
243pub const OT_DNS_MAX_NAME_SIZE: u32 = 255;
244pub const OT_DNS_MAX_LABEL_SIZE: u32 = 64;
245pub const OT_DNS_TXT_KEY_MIN_LENGTH: u32 = 1;
246pub const OT_DNS_TXT_KEY_MAX_LENGTH: u32 = 9;
247pub const OT_DNS_TXT_KEY_ITER_MAX_LENGTH: u32 = 64;
248pub const OT_ICMP6_HEADER_DATA_SIZE: u32 = 4;
249pub const OT_ICMP6_ROUTER_ADVERT_MIN_SIZE: u32 = 16;
250pub const OT_MAC_FILTER_FIXED_RSS_DISABLED: u32 = 127;
251pub const OT_MAC_FILTER_ITERATOR_INIT: u32 = 0;
252pub const OT_LINK_CSL_PERIOD_TEN_SYMBOLS_UNIT_IN_USEC: u32 = 160;
253pub const OT_LOG_HEX_DUMP_LINE_SIZE: u32 = 73;
254pub const OT_IP4_ADDRESS_SIZE: u32 = 4;
255pub const OT_IP4_ADDRESS_STRING_SIZE: u32 = 17;
256pub const OT_IP4_CIDR_STRING_SIZE: u32 = 20;
257pub const OT_THREAD_VERSION_INVALID: u32 = 0;
258pub const OT_THREAD_VERSION_1_1: u32 = 2;
259pub const OT_THREAD_VERSION_1_2: u32 = 3;
260pub const OT_THREAD_VERSION_1_3: u32 = 4;
261pub const OT_THREAD_VERSION_1_3_1: u32 = 5;
262pub const OT_THREAD_VERSION_1_4: u32 = 5;
263pub const OT_NETWORK_BASE_TLV_MAX_LENGTH: u32 = 254;
264pub const OT_NETWORK_MAX_ROUTER_ID: u32 = 62;
265pub const OT_NEIGHBOR_INFO_ITERATOR_INIT: u32 = 0;
266pub const OT_JOINER_ADVDATA_MAX_LENGTH: u32 = 64;
267pub const OT_DURATION_STRING_SIZE: u32 = 21;
268pub const OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS: u32 = 0;
269pub const OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS: u32 = 1;
270pub const OT_NETWORK_DIAGNOSTIC_TLV_MODE: u32 = 2;
271pub const OT_NETWORK_DIAGNOSTIC_TLV_TIMEOUT: u32 = 3;
272pub const OT_NETWORK_DIAGNOSTIC_TLV_CONNECTIVITY: u32 = 4;
273pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTE: u32 = 5;
274pub const OT_NETWORK_DIAGNOSTIC_TLV_LEADER_DATA: u32 = 6;
275pub const OT_NETWORK_DIAGNOSTIC_TLV_NETWORK_DATA: u32 = 7;
276pub const OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST: u32 = 8;
277pub const OT_NETWORK_DIAGNOSTIC_TLV_MAC_COUNTERS: u32 = 9;
278pub const OT_NETWORK_DIAGNOSTIC_TLV_BATTERY_LEVEL: u32 = 14;
279pub const OT_NETWORK_DIAGNOSTIC_TLV_SUPPLY_VOLTAGE: u32 = 15;
280pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE: u32 = 16;
281pub const OT_NETWORK_DIAGNOSTIC_TLV_CHANNEL_PAGES: u32 = 17;
282pub const OT_NETWORK_DIAGNOSTIC_TLV_TYPE_LIST: u32 = 18;
283pub const OT_NETWORK_DIAGNOSTIC_TLV_MAX_CHILD_TIMEOUT: u32 = 19;
284pub const OT_NETWORK_DIAGNOSTIC_TLV_EUI64: u32 = 23;
285pub const OT_NETWORK_DIAGNOSTIC_TLV_VERSION: u32 = 24;
286pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_NAME: u32 = 25;
287pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_MODEL: u32 = 26;
288pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_SW_VERSION: u32 = 27;
289pub const OT_NETWORK_DIAGNOSTIC_TLV_THREAD_STACK_VERSION: u32 = 28;
290pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD: u32 = 29;
291pub const OT_NETWORK_DIAGNOSTIC_TLV_CHILD_IP6_ADDR_LIST: u32 = 30;
292pub const OT_NETWORK_DIAGNOSTIC_TLV_ROUTER_NEIGHBOR: u32 = 31;
293pub const OT_NETWORK_DIAGNOSTIC_TLV_ANSWER: u32 = 32;
294pub const OT_NETWORK_DIAGNOSTIC_TLV_QUERY_ID: u32 = 33;
295pub const OT_NETWORK_DIAGNOSTIC_TLV_MLE_COUNTERS: u32 = 34;
296pub const OT_NETWORK_DIAGNOSTIC_TLV_VENDOR_APP_URL: u32 = 35;
297pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_NAME_TLV_LENGTH: u32 = 32;
298pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_MODEL_TLV_LENGTH: u32 = 32;
299pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_SW_VERSION_TLV_LENGTH: u32 = 16;
300pub const OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH: u32 = 64;
301pub const OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH: u32 = 96;
302pub const OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT: u32 = 0;
303pub const OT_TIME_SYNC_INVALID_SEQ: u32 = 0;
304pub const OT_PLAT_INFRA_IF_MAX_LINK_LAYER_ADDR_LENGTH: u32 = 16;
305pub const OT_MS_PER_S: u32 = 1000;
306pub const OT_US_PER_MS: u32 = 1000;
307pub const OT_US_PER_S: u32 = 1000000;
308pub const OT_NS_PER_US: u32 = 1000;
309pub const OT_SNTP_DEFAULT_SERVER_IP: &[u8; 19] = b"2001:4860:4806:8::\0";
310pub const OT_SNTP_DEFAULT_SERVER_PORT: u32 = 123;
311pub const OT_TCP_ENDPOINT_TCB_SIZE_BASE: u32 = 392;
312pub const OT_TCP_ENDPOINT_TCB_NUM_PTR: u32 = 36;
313pub const OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS: u32 = 2598;
314pub const OT_TCP_RECEIVE_BUFFER_SIZE_MANY_HOPS: u32 = 4157;
315pub const OT_TCP_LISTENER_TCB_SIZE_BASE: u32 = 16;
316pub const OT_TCP_LISTENER_TCB_NUM_PTR: u32 = 3;
317pub const OT_CHILD_IP6_ADDRESS_ITERATOR_INIT: u32 = 0;
318#[doc = " No error."]
319pub const OT_ERROR_NONE: otError = 0;
320#[doc = " Operational failed."]
321pub const OT_ERROR_FAILED: otError = 1;
322#[doc = " Message was dropped."]
323pub const OT_ERROR_DROP: otError = 2;
324#[doc = " Insufficient buffers."]
325pub const OT_ERROR_NO_BUFS: otError = 3;
326#[doc = " No route available."]
327pub const OT_ERROR_NO_ROUTE: otError = 4;
328#[doc = " Service is busy and could not service the operation."]
329pub const OT_ERROR_BUSY: otError = 5;
330#[doc = " Failed to parse message."]
331pub const OT_ERROR_PARSE: otError = 6;
332#[doc = " Input arguments are invalid."]
333pub const OT_ERROR_INVALID_ARGS: otError = 7;
334#[doc = " Security checks failed."]
335pub const OT_ERROR_SECURITY: otError = 8;
336#[doc = " Address resolution requires an address query operation."]
337pub const OT_ERROR_ADDRESS_QUERY: otError = 9;
338#[doc = " Address is not in the source match table."]
339pub const OT_ERROR_NO_ADDRESS: otError = 10;
340#[doc = " Operation was aborted."]
341pub const OT_ERROR_ABORT: otError = 11;
342#[doc = " Function or method is not implemented."]
343pub const OT_ERROR_NOT_IMPLEMENTED: otError = 12;
344#[doc = " Cannot complete due to invalid state."]
345pub const OT_ERROR_INVALID_STATE: otError = 13;
346#[doc = " No acknowledgment was received after macMaxFrameRetries (IEEE 802.15.4-2006)."]
347pub const OT_ERROR_NO_ACK: otError = 14;
348#[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)."]
349pub const OT_ERROR_CHANNEL_ACCESS_FAILURE: otError = 15;
350#[doc = " Not currently attached to a Thread Partition."]
351pub const OT_ERROR_DETACHED: otError = 16;
352#[doc = " FCS check failure while receiving."]
353pub const OT_ERROR_FCS: otError = 17;
354#[doc = " No frame received."]
355pub const OT_ERROR_NO_FRAME_RECEIVED: otError = 18;
356#[doc = " Received a frame from an unknown neighbor."]
357pub const OT_ERROR_UNKNOWN_NEIGHBOR: otError = 19;
358#[doc = " Received a frame from an invalid source address."]
359pub const OT_ERROR_INVALID_SOURCE_ADDRESS: otError = 20;
360#[doc = " Received a frame filtered by the address filter (allowlisted or denylisted)."]
361pub const OT_ERROR_ADDRESS_FILTERED: otError = 21;
362#[doc = " Received a frame filtered by the destination address check."]
363pub const OT_ERROR_DESTINATION_ADDRESS_FILTERED: otError = 22;
364#[doc = " The requested item could not be found."]
365pub const OT_ERROR_NOT_FOUND: otError = 23;
366#[doc = " The operation is already in progress."]
367pub const OT_ERROR_ALREADY: otError = 24;
368#[doc = " The creation of IPv6 address failed."]
369pub const OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: otError = 26;
370#[doc = " Operation prevented by mode flags"]
371pub const OT_ERROR_NOT_CAPABLE: otError = 27;
372#[doc = " Coap response or acknowledgment or DNS, SNTP response not received."]
373pub const OT_ERROR_RESPONSE_TIMEOUT: otError = 28;
374#[doc = " Received a duplicated frame."]
375pub const OT_ERROR_DUPLICATED: otError = 29;
376#[doc = " Message is being dropped from reassembly list due to timeout."]
377pub const OT_ERROR_REASSEMBLY_TIMEOUT: otError = 30;
378#[doc = " Message is not a TMF Message."]
379pub const OT_ERROR_NOT_TMF: otError = 31;
380#[doc = " Received a non-lowpan data frame."]
381pub const OT_ERROR_NOT_LOWPAN_DATA_FRAME: otError = 32;
382#[doc = " The link margin was too low."]
383pub const OT_ERROR_LINK_MARGIN_LOW: otError = 34;
384#[doc = " Input (CLI) command is invalid."]
385pub const OT_ERROR_INVALID_COMMAND: otError = 35;
386#[doc = " Special error code used to indicate success/error status is pending and not yet known."]
387pub const OT_ERROR_PENDING: otError = 36;
388#[doc = " Request rejected."]
389pub const OT_ERROR_REJECTED: otError = 37;
390#[doc = " The number of defined errors."]
391pub const OT_NUM_ERRORS: otError = 38;
392#[doc = " Generic error (should not use)."]
393pub const OT_ERROR_GENERIC: otError = 255;
394#[doc = " Represents error codes used throughout OpenThread."]
395pub type otError = ::std::os::raw::c_uint;
396unsafe extern "C" {
397 #[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."]
398 pub fn otThreadErrorToString(aError: otError) -> *const ::std::os::raw::c_char;
399}
400pub type va_list = __builtin_va_list;
401#[doc = " Represents the log level."]
402pub type otLogLevel = ::std::os::raw::c_int;
403#[doc = "< OpenThread API"]
404pub const OT_LOG_REGION_API: otLogRegion = 1;
405#[doc = "< MLE"]
406pub const OT_LOG_REGION_MLE: otLogRegion = 2;
407#[doc = "< EID-to-RLOC mapping."]
408pub const OT_LOG_REGION_ARP: otLogRegion = 3;
409#[doc = "< Network Data"]
410pub const OT_LOG_REGION_NET_DATA: otLogRegion = 4;
411#[doc = "< ICMPv6"]
412pub const OT_LOG_REGION_ICMP: otLogRegion = 5;
413#[doc = "< IPv6"]
414pub const OT_LOG_REGION_IP6: otLogRegion = 6;
415#[doc = "< TCP"]
416pub const OT_LOG_REGION_TCP: otLogRegion = 7;
417#[doc = "< IEEE 802.15.4 MAC"]
418pub const OT_LOG_REGION_MAC: otLogRegion = 8;
419#[doc = "< Memory"]
420pub const OT_LOG_REGION_MEM: otLogRegion = 9;
421#[doc = "< NCP"]
422pub const OT_LOG_REGION_NCP: otLogRegion = 10;
423#[doc = "< Mesh Commissioning Protocol"]
424pub const OT_LOG_REGION_MESH_COP: otLogRegion = 11;
425#[doc = "< Network Diagnostic"]
426pub const OT_LOG_REGION_NET_DIAG: otLogRegion = 12;
427#[doc = "< Platform"]
428pub const OT_LOG_REGION_PLATFORM: otLogRegion = 13;
429#[doc = "< CoAP"]
430pub const OT_LOG_REGION_COAP: otLogRegion = 14;
431#[doc = "< CLI"]
432pub const OT_LOG_REGION_CLI: otLogRegion = 15;
433#[doc = "< OpenThread Core"]
434pub const OT_LOG_REGION_CORE: otLogRegion = 16;
435#[doc = "< Utility module"]
436pub const OT_LOG_REGION_UTIL: otLogRegion = 17;
437#[doc = "< Backbone Router (available since Thread 1.2)"]
438pub const OT_LOG_REGION_BBR: otLogRegion = 18;
439#[doc = "< Multicast Listener Registration (available since Thread 1.2)"]
440pub const OT_LOG_REGION_MLR: otLogRegion = 19;
441#[doc = "< Domain Unicast Address (available since Thread 1.2)"]
442pub const OT_LOG_REGION_DUA: otLogRegion = 20;
443#[doc = "< Border Router"]
444pub const OT_LOG_REGION_BR: otLogRegion = 21;
445#[doc = "< Service Registration Protocol (SRP)"]
446pub const OT_LOG_REGION_SRP: otLogRegion = 22;
447#[doc = "< DNS"]
448pub const OT_LOG_REGION_DNS: otLogRegion = 23;
449#[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`."]
450pub type otLogRegion = ::std::os::raw::c_uint;
451unsafe extern "C" {
452 #[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."]
453 pub fn otPlatLog(
454 aLogLevel: otLogLevel,
455 aLogRegion: otLogRegion,
456 aFormat: *const ::std::os::raw::c_char,
457 ...
458 );
459}
460unsafe extern "C" {
461 #[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."]
462 pub fn otPlatLogHandleLevelChanged(aLogLevel: otLogLevel);
463}
464#[repr(C)]
465#[derive(Debug, Default, Copy, Clone)]
466pub struct otInstance {
467 _unused: [u8; 0],
468}
469unsafe extern "C" {
470 #[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"]
471 pub fn otInstanceInit(
472 aInstanceBuffer: *mut ::std::os::raw::c_void,
473 aInstanceBufferSize: *mut usize,
474 ) -> *mut otInstance;
475}
476unsafe extern "C" {
477 #[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."]
478 pub fn otInstanceInitSingle() -> *mut otInstance;
479}
480unsafe extern "C" {
481 #[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."]
482 pub fn otInstanceInitMultiple(aIdx: u8) -> *mut otInstance;
483}
484unsafe extern "C" {
485 #[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."]
486 pub fn otInstanceGetId(aInstance: *mut otInstance) -> u32;
487}
488unsafe extern "C" {
489 #[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."]
490 pub fn otInstanceIsInitialized(aInstance: *mut otInstance) -> bool;
491}
492unsafe extern "C" {
493 #[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."]
494 pub fn otInstanceFinalize(aInstance: *mut otInstance);
495}
496unsafe extern "C" {
497 #[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)."]
498 pub fn otInstanceGetUptime(aInstance: *mut otInstance) -> u64;
499}
500unsafe extern "C" {
501 #[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`."]
502 pub fn otInstanceGetUptimeAsString(
503 aInstance: *mut otInstance,
504 aBuffer: *mut ::std::os::raw::c_char,
505 aSize: u16,
506 );
507}
508#[doc = " Represents a bit-field indicating specific state/configuration that has changed. See `OT_CHANGED_*`\n definitions."]
509pub type otChangedFlags = u32;
510#[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."]
511pub type otStateChangedCallback = ::std::option::Option<
512 unsafe extern "C" fn(aFlags: otChangedFlags, aContext: *mut ::std::os::raw::c_void),
513>;
514unsafe extern "C" {
515 #[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."]
516 pub fn otSetStateChangedCallback(
517 aInstance: *mut otInstance,
518 aCallback: otStateChangedCallback,
519 aContext: *mut ::std::os::raw::c_void,
520 ) -> otError;
521}
522unsafe extern "C" {
523 #[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."]
524 pub fn otRemoveStateChangeCallback(
525 aInstance: *mut otInstance,
526 aCallback: otStateChangedCallback,
527 aContext: *mut ::std::os::raw::c_void,
528 );
529}
530unsafe extern "C" {
531 #[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."]
532 pub fn otInstanceReset(aInstance: *mut otInstance);
533}
534unsafe extern "C" {
535 #[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."]
536 pub fn otInstanceResetToBootloader(aInstance: *mut otInstance) -> otError;
537}
538unsafe extern "C" {
539 #[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."]
540 pub fn otInstanceFactoryReset(aInstance: *mut otInstance);
541}
542unsafe extern "C" {
543 #[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."]
544 pub fn otInstanceResetRadioStack(aInstance: *mut otInstance);
545}
546unsafe extern "C" {
547 #[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."]
548 pub fn otInstanceErasePersistentInfo(aInstance: *mut otInstance) -> otError;
549}
550unsafe extern "C" {
551 #[doc = " Gets the OpenThread version string.\n\n @returns A pointer to the OpenThread version."]
552 pub fn otGetVersionString() -> *const ::std::os::raw::c_char;
553}
554unsafe extern "C" {
555 #[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."]
556 pub fn otGetRadioVersionString(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
557}
558#[doc = " Represents Backbone Router configuration."]
559#[repr(C)]
560#[derive(Debug, Default, Copy, Clone)]
561pub struct otBackboneRouterConfig {
562 #[doc = "< Only used when get Primary Backbone Router information in the Thread Network"]
563 pub mServer16: u16,
564 #[doc = "< Reregistration Delay (in seconds)"]
565 pub mReregistrationDelay: u16,
566 #[doc = "< Multicast Listener Registration Timeout (in seconds)"]
567 pub mMlrTimeout: u32,
568 #[doc = "< Sequence Number"]
569 pub mSequenceNumber: u8,
570}
571unsafe extern "C" {
572 #[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."]
573 pub fn otBackboneRouterGetPrimary(
574 aInstance: *mut otInstance,
575 aConfig: *mut otBackboneRouterConfig,
576 ) -> otError;
577}
578#[repr(C)]
579#[derive(Debug, Default, Copy, Clone)]
580pub struct otMessage {
581 _unused: [u8; 0],
582}
583#[doc = "< Low priority level."]
584pub const OT_MESSAGE_PRIORITY_LOW: otMessagePriority = 0;
585#[doc = "< Normal priority level."]
586pub const OT_MESSAGE_PRIORITY_NORMAL: otMessagePriority = 1;
587#[doc = "< High priority level."]
588pub const OT_MESSAGE_PRIORITY_HIGH: otMessagePriority = 2;
589#[doc = " Defines the OpenThread message priority levels."]
590pub type otMessagePriority = ::std::os::raw::c_uint;
591#[doc = "< Message from Thread Netif."]
592pub const OT_MESSAGE_ORIGIN_THREAD_NETIF: otMessageOrigin = 0;
593#[doc = "< Message from a trusted source on host."]
594pub const OT_MESSAGE_ORIGIN_HOST_TRUSTED: otMessageOrigin = 1;
595#[doc = "< Message from an untrusted source on host."]
596pub const OT_MESSAGE_ORIGIN_HOST_UNTRUSTED: otMessageOrigin = 2;
597#[doc = " Defines the OpenThread message origins."]
598pub type otMessageOrigin = ::std::os::raw::c_uint;
599#[doc = " Represents a message settings."]
600#[repr(C)]
601#[derive(Debug, Default, Copy, Clone)]
602pub struct otMessageSettings {
603 #[doc = "< TRUE if the message should be secured at Layer 2."]
604 pub mLinkSecurityEnabled: bool,
605 #[doc = "< Priority level (MUST be a `OT_MESSAGE_PRIORITY_*` from `otMessagePriority`)."]
606 pub mPriority: u8,
607}
608#[doc = " Represents link-specific information for messages received from the Thread radio."]
609#[repr(C)]
610#[derive(Debug, Default, Copy, Clone)]
611pub struct otThreadLinkInfo {
612 #[doc = "< Source PAN ID"]
613 pub mPanId: u16,
614 #[doc = "< 802.15.4 Channel"]
615 pub mChannel: u8,
616 #[doc = "< Received Signal Strength in dBm (averaged over fragments)"]
617 pub mRss: i8,
618 #[doc = "< Average Link Quality Indicator (averaged over fragments)"]
619 pub mLqi: u8,
620 pub _bitfield_align_1: [u8; 0],
621 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
622 #[doc = "< The time sync sequence."]
623 pub mTimeSyncSeq: u8,
624 #[doc = "< The time offset to the Thread network time, in microseconds."]
625 pub mNetworkTimeOffset: i64,
626 #[doc = "< Radio link type."]
627 pub mRadioType: u8,
628}
629impl otThreadLinkInfo {
630 #[inline]
631 pub fn mLinkSecurity(&self) -> bool {
632 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
633 }
634 #[inline]
635 pub fn set_mLinkSecurity(&mut self, val: bool) {
636 unsafe {
637 let val: u8 = ::std::mem::transmute(val);
638 self._bitfield_1.set(0usize, 1u8, val as u64)
639 }
640 }
641 #[inline]
642 pub unsafe fn mLinkSecurity_raw(this: *const Self) -> bool {
643 unsafe {
644 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
645 ::std::ptr::addr_of!((*this)._bitfield_1),
646 0usize,
647 1u8,
648 ) as u8)
649 }
650 }
651 #[inline]
652 pub unsafe fn set_mLinkSecurity_raw(this: *mut Self, val: bool) {
653 unsafe {
654 let val: u8 = ::std::mem::transmute(val);
655 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
656 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
657 0usize,
658 1u8,
659 val as u64,
660 )
661 }
662 }
663 #[inline]
664 pub fn mIsDstPanIdBroadcast(&self) -> bool {
665 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
666 }
667 #[inline]
668 pub fn set_mIsDstPanIdBroadcast(&mut self, val: bool) {
669 unsafe {
670 let val: u8 = ::std::mem::transmute(val);
671 self._bitfield_1.set(1usize, 1u8, val as u64)
672 }
673 }
674 #[inline]
675 pub unsafe fn mIsDstPanIdBroadcast_raw(this: *const Self) -> bool {
676 unsafe {
677 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
678 ::std::ptr::addr_of!((*this)._bitfield_1),
679 1usize,
680 1u8,
681 ) as u8)
682 }
683 }
684 #[inline]
685 pub unsafe fn set_mIsDstPanIdBroadcast_raw(this: *mut Self, val: bool) {
686 unsafe {
687 let val: u8 = ::std::mem::transmute(val);
688 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
689 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
690 1usize,
691 1u8,
692 val as u64,
693 )
694 }
695 }
696 #[inline]
697 pub fn new_bitfield_1(
698 mLinkSecurity: bool,
699 mIsDstPanIdBroadcast: bool,
700 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
701 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
702 __bindgen_bitfield_unit.set(0usize, 1u8, {
703 let mLinkSecurity: u8 = unsafe { ::std::mem::transmute(mLinkSecurity) };
704 mLinkSecurity as u64
705 });
706 __bindgen_bitfield_unit.set(1usize, 1u8, {
707 let mIsDstPanIdBroadcast: u8 = unsafe { ::std::mem::transmute(mIsDstPanIdBroadcast) };
708 mIsDstPanIdBroadcast as u64
709 });
710 __bindgen_bitfield_unit
711 }
712}
713unsafe extern "C" {
714 #[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"]
715 pub fn otMessageFree(aMessage: *mut otMessage);
716}
717unsafe extern "C" {
718 #[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"]
719 pub fn otMessageGetLength(aMessage: *const otMessage) -> u16;
720}
721unsafe extern "C" {
722 #[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"]
723 pub fn otMessageSetLength(aMessage: *mut otMessage, aLength: u16) -> otError;
724}
725unsafe extern "C" {
726 #[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"]
727 pub fn otMessageGetOffset(aMessage: *const otMessage) -> u16;
728}
729unsafe extern "C" {
730 #[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"]
731 pub fn otMessageSetOffset(aMessage: *mut otMessage, aOffset: u16);
732}
733unsafe extern "C" {
734 #[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."]
735 pub fn otMessageIsLinkSecurityEnabled(aMessage: *const otMessage) -> bool;
736}
737unsafe extern "C" {
738 #[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."]
739 pub fn otMessageIsLoopbackToHostAllowed(aMessage: *const otMessage) -> bool;
740}
741unsafe extern "C" {
742 #[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."]
743 pub fn otMessageSetLoopbackToHostAllowed(aMessage: *mut otMessage, aAllowLoopbackToHost: bool);
744}
745unsafe extern "C" {
746 #[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."]
747 pub fn otMessageIsMulticastLoopEnabled(aMessage: *mut otMessage) -> bool;
748}
749unsafe extern "C" {
750 #[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."]
751 pub fn otMessageSetMulticastLoopEnabled(aMessage: *mut otMessage, aEnabled: bool);
752}
753unsafe extern "C" {
754 #[doc = " Gets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n\n @returns The message origin."]
755 pub fn otMessageGetOrigin(aMessage: *const otMessage) -> otMessageOrigin;
756}
757unsafe extern "C" {
758 #[doc = " Sets the message origin.\n\n @param[in] aMessage A pointer to a message buffer.\n @param[in] aOrigin The message origin."]
759 pub fn otMessageSetOrigin(aMessage: *mut otMessage, aOrigin: otMessageOrigin);
760}
761unsafe extern "C" {
762 #[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."]
763 pub fn otMessageSetDirectTransmission(aMessage: *mut otMessage, aEnabled: bool);
764}
765unsafe extern "C" {
766 #[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."]
767 pub fn otMessageGetRss(aMessage: *const otMessage) -> i8;
768}
769unsafe extern "C" {
770 #[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`."]
771 pub fn otMessageGetThreadLinkInfo(
772 aMessage: *const otMessage,
773 aLinkInfo: *mut otThreadLinkInfo,
774 ) -> otError;
775}
776unsafe extern "C" {
777 #[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"]
778 pub fn otMessageAppend(
779 aMessage: *mut otMessage,
780 aBuf: *const ::std::os::raw::c_void,
781 aLength: u16,
782 ) -> otError;
783}
784unsafe extern "C" {
785 #[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"]
786 pub fn otMessageRead(
787 aMessage: *const otMessage,
788 aOffset: u16,
789 aBuf: *mut ::std::os::raw::c_void,
790 aLength: u16,
791 ) -> u16;
792}
793unsafe extern "C" {
794 #[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"]
795 pub fn otMessageWrite(
796 aMessage: *mut otMessage,
797 aOffset: u16,
798 aBuf: *const ::std::os::raw::c_void,
799 aLength: u16,
800 ) -> ::std::os::raw::c_int;
801}
802#[doc = " Represents an OpenThread message queue."]
803#[repr(C)]
804#[derive(Debug, Copy, Clone)]
805pub struct otMessageQueue {
806 #[doc = "< Opaque data used by the implementation."]
807 pub mData: *mut ::std::os::raw::c_void,
808}
809impl Default for otMessageQueue {
810 fn default() -> Self {
811 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
812 unsafe {
813 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
814 s.assume_init()
815 }
816 }
817}
818#[doc = " Represents information about a message queue."]
819#[repr(C)]
820#[derive(Debug, Default, Copy, Clone)]
821pub struct otMessageQueueInfo {
822 #[doc = "< Number of messages in the queue."]
823 pub mNumMessages: u16,
824 #[doc = "< Number of data buffers used by messages in the queue."]
825 pub mNumBuffers: u16,
826 #[doc = "< Total number of bytes used by all messages in the queue."]
827 pub mTotalBytes: u32,
828}
829#[doc = " Represents the message buffer information for different queues used by OpenThread stack."]
830#[repr(C)]
831#[derive(Debug, Default, Copy, Clone)]
832pub struct otBufferInfo {
833 #[doc = "< The total number of buffers in the messages pool (0xffff if unknown)."]
834 pub mTotalBuffers: u16,
835 #[doc = "< The number of free buffers (0xffff if unknown)."]
836 pub mFreeBuffers: u16,
837 #[doc = " The maximum number of used buffers at the same time since OT stack initialization or last call to\n `otMessageResetBufferInfo()`."]
838 pub mMaxUsedBuffers: u16,
839 #[doc = "< Info about 6LoWPAN send queue."]
840 pub m6loSendQueue: otMessageQueueInfo,
841 #[doc = "< Info about 6LoWPAN reassembly queue."]
842 pub m6loReassemblyQueue: otMessageQueueInfo,
843 #[doc = "< Info about IPv6 send queue."]
844 pub mIp6Queue: otMessageQueueInfo,
845 #[doc = "< Info about MPL send queue."]
846 pub mMplQueue: otMessageQueueInfo,
847 #[doc = "< Info about MLE delayed message queue."]
848 pub mMleQueue: otMessageQueueInfo,
849 #[doc = "< Info about CoAP/TMF send queue."]
850 pub mCoapQueue: otMessageQueueInfo,
851 #[doc = "< Info about CoAP secure send queue."]
852 pub mCoapSecureQueue: otMessageQueueInfo,
853 #[doc = "< Info about application CoAP send queue."]
854 pub mApplicationCoapQueue: otMessageQueueInfo,
855}
856unsafe extern "C" {
857 #[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."]
858 pub fn otMessageQueueInit(aQueue: *mut otMessageQueue);
859}
860unsafe extern "C" {
861 #[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."]
862 pub fn otMessageQueueEnqueue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
863}
864unsafe extern "C" {
865 #[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."]
866 pub fn otMessageQueueEnqueueAtHead(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
867}
868unsafe extern "C" {
869 #[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."]
870 pub fn otMessageQueueDequeue(aQueue: *mut otMessageQueue, aMessage: *mut otMessage);
871}
872unsafe extern "C" {
873 #[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."]
874 pub fn otMessageQueueGetHead(aQueue: *mut otMessageQueue) -> *mut otMessage;
875}
876unsafe extern "C" {
877 #[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`."]
878 pub fn otMessageQueueGetNext(
879 aQueue: *mut otMessageQueue,
880 aMessage: *const otMessage,
881 ) -> *mut otMessage;
882}
883unsafe extern "C" {
884 #[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."]
885 pub fn otMessageGetBufferInfo(aInstance: *mut otInstance, aBufferInfo: *mut otBufferInfo);
886}
887unsafe extern "C" {
888 #[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."]
889 pub fn otMessageResetBufferInfo(aInstance: *mut otInstance);
890}
891#[doc = "< Key Type: Raw Data."]
892pub const OT_CRYPTO_KEY_TYPE_RAW: otCryptoKeyType = 0;
893#[doc = "< Key Type: AES."]
894pub const OT_CRYPTO_KEY_TYPE_AES: otCryptoKeyType = 1;
895#[doc = "< Key Type: HMAC."]
896pub const OT_CRYPTO_KEY_TYPE_HMAC: otCryptoKeyType = 2;
897#[doc = "< Key Type: ECDSA."]
898pub const OT_CRYPTO_KEY_TYPE_ECDSA: otCryptoKeyType = 3;
899#[doc = " Defines the key types."]
900pub type otCryptoKeyType = ::std::os::raw::c_uint;
901#[doc = "< Key Algorithm: Vendor Defined."]
902pub const OT_CRYPTO_KEY_ALG_VENDOR: otCryptoKeyAlgorithm = 0;
903#[doc = "< Key Algorithm: AES ECB."]
904pub const OT_CRYPTO_KEY_ALG_AES_ECB: otCryptoKeyAlgorithm = 1;
905#[doc = "< Key Algorithm: HMAC SHA-256."]
906pub const OT_CRYPTO_KEY_ALG_HMAC_SHA_256: otCryptoKeyAlgorithm = 2;
907#[doc = "< Key Algorithm: ECDSA."]
908pub const OT_CRYPTO_KEY_ALG_ECDSA: otCryptoKeyAlgorithm = 3;
909#[doc = " Defines the key algorithms."]
910pub type otCryptoKeyAlgorithm = ::std::os::raw::c_uint;
911#[doc = "< Key Usage: Key Usage is empty."]
912pub const OT_CRYPTO_KEY_USAGE_NONE: _bindgen_ty_1 = 0;
913#[doc = "< Key Usage: Key can be exported."]
914pub const OT_CRYPTO_KEY_USAGE_EXPORT: _bindgen_ty_1 = 1;
915#[doc = "< Key Usage: Encryption (vendor defined)."]
916pub const OT_CRYPTO_KEY_USAGE_ENCRYPT: _bindgen_ty_1 = 2;
917#[doc = "< Key Usage: AES ECB."]
918pub const OT_CRYPTO_KEY_USAGE_DECRYPT: _bindgen_ty_1 = 4;
919#[doc = "< Key Usage: Sign Hash."]
920pub const OT_CRYPTO_KEY_USAGE_SIGN_HASH: _bindgen_ty_1 = 8;
921#[doc = "< Key Usage: Verify Hash."]
922pub const OT_CRYPTO_KEY_USAGE_VERIFY_HASH: _bindgen_ty_1 = 16;
923#[doc = " Defines the key usage flags."]
924pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
925#[doc = "< Key Persistence: Key is volatile."]
926pub const OT_CRYPTO_KEY_STORAGE_VOLATILE: otCryptoKeyStorage = 0;
927#[doc = "< Key Persistence: Key is persistent."]
928pub const OT_CRYPTO_KEY_STORAGE_PERSISTENT: otCryptoKeyStorage = 1;
929#[doc = " Defines the key storage types."]
930pub type otCryptoKeyStorage = ::std::os::raw::c_uint;
931#[doc = " This datatype represents the key reference."]
932pub type otCryptoKeyRef = u32;
933#[doc = " @struct otCryptoKey\n\n Represents the Key Material required for Crypto operations."]
934#[repr(C)]
935#[derive(Debug, Copy, Clone)]
936pub struct otCryptoKey {
937 #[doc = "< Pointer to the buffer containing key. NULL indicates to use `mKeyRef`."]
938 pub mKey: *const u8,
939 #[doc = "< The key length in bytes (applicable when `mKey` is not NULL)."]
940 pub mKeyLength: u16,
941 #[doc = "< The PSA key ref (requires `mKey` to be NULL)."]
942 pub mKeyRef: u32,
943}
944impl Default for otCryptoKey {
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}
953#[doc = " @struct otCryptoContext\n\n Stores the context object for platform APIs."]
954#[repr(C)]
955#[derive(Debug, Copy, Clone)]
956pub struct otCryptoContext {
957 #[doc = "< Pointer to the context."]
958 pub mContext: *mut ::std::os::raw::c_void,
959 #[doc = "< The length of the context in bytes."]
960 pub mContextSize: u16,
961}
962impl Default for otCryptoContext {
963 fn default() -> Self {
964 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
965 unsafe {
966 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
967 s.assume_init()
968 }
969 }
970}
971#[doc = " @struct otPlatCryptoSha256Hash\n\n Represents a SHA-256 hash."]
972#[repr(C, packed)]
973#[derive(Debug, Default, Copy, Clone)]
974pub struct otPlatCryptoSha256Hash {
975 #[doc = "< Hash bytes."]
976 pub m8: [u8; 32usize],
977}
978#[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)."]
979#[repr(C)]
980#[derive(Debug, Copy, Clone)]
981pub struct otPlatCryptoEcdsaKeyPair {
982 pub mDerBytes: [u8; 125usize],
983 pub mDerLength: u8,
984}
985impl Default for otPlatCryptoEcdsaKeyPair {
986 fn default() -> Self {
987 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
988 unsafe {
989 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
990 s.assume_init()
991 }
992 }
993}
994#[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)."]
995#[repr(C, packed)]
996#[derive(Debug, Copy, Clone)]
997pub struct otPlatCryptoEcdsaPublicKey {
998 pub m8: [u8; 64usize],
999}
1000impl Default for otPlatCryptoEcdsaPublicKey {
1001 fn default() -> Self {
1002 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1003 unsafe {
1004 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1005 s.assume_init()
1006 }
1007 }
1008}
1009#[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)."]
1010#[repr(C, packed)]
1011#[derive(Debug, Copy, Clone)]
1012pub struct otPlatCryptoEcdsaSignature {
1013 pub m8: [u8; 64usize],
1014}
1015impl Default for otPlatCryptoEcdsaSignature {
1016 fn default() -> Self {
1017 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1018 unsafe {
1019 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1020 s.assume_init()
1021 }
1022 }
1023}
1024unsafe extern "C" {
1025 #[doc = " Initialize the Crypto module."]
1026 pub fn otPlatCryptoInit();
1027}
1028unsafe extern "C" {
1029 #[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."]
1030 pub fn otPlatCryptoImportKey(
1031 aKeyRef: *mut otCryptoKeyRef,
1032 aKeyType: otCryptoKeyType,
1033 aKeyAlgorithm: otCryptoKeyAlgorithm,
1034 aKeyUsage: ::std::os::raw::c_int,
1035 aKeyPersistence: otCryptoKeyStorage,
1036 aKey: *const u8,
1037 aKeyLen: usize,
1038 ) -> otError;
1039}
1040unsafe extern "C" {
1041 #[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."]
1042 pub fn otPlatCryptoExportKey(
1043 aKeyRef: otCryptoKeyRef,
1044 aBuffer: *mut u8,
1045 aBufferLen: usize,
1046 aKeyLen: *mut usize,
1047 ) -> otError;
1048}
1049unsafe extern "C" {
1050 #[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."]
1051 pub fn otPlatCryptoDestroyKey(aKeyRef: otCryptoKeyRef) -> otError;
1052}
1053unsafe extern "C" {
1054 #[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."]
1055 pub fn otPlatCryptoHasKey(aKeyRef: otCryptoKeyRef) -> bool;
1056}
1057unsafe extern "C" {
1058 #[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."]
1059 pub fn otPlatCryptoHmacSha256Init(aContext: *mut otCryptoContext) -> otError;
1060}
1061unsafe extern "C" {
1062 #[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"]
1063 pub fn otPlatCryptoHmacSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1064}
1065unsafe extern "C" {
1066 #[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"]
1067 pub fn otPlatCryptoHmacSha256Start(
1068 aContext: *mut otCryptoContext,
1069 aKey: *const otCryptoKey,
1070 ) -> otError;
1071}
1072unsafe extern "C" {
1073 #[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"]
1074 pub fn otPlatCryptoHmacSha256Update(
1075 aContext: *mut otCryptoContext,
1076 aBuf: *const ::std::os::raw::c_void,
1077 aBufLength: u16,
1078 ) -> otError;
1079}
1080unsafe extern "C" {
1081 #[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"]
1082 pub fn otPlatCryptoHmacSha256Finish(
1083 aContext: *mut otCryptoContext,
1084 aBuf: *mut u8,
1085 aBufLength: usize,
1086 ) -> otError;
1087}
1088unsafe extern "C" {
1089 #[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."]
1090 pub fn otPlatCryptoAesInit(aContext: *mut otCryptoContext) -> otError;
1091}
1092unsafe extern "C" {
1093 #[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"]
1094 pub fn otPlatCryptoAesSetKey(
1095 aContext: *mut otCryptoContext,
1096 aKey: *const otCryptoKey,
1097 ) -> otError;
1098}
1099unsafe extern "C" {
1100 #[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"]
1101 pub fn otPlatCryptoAesEncrypt(
1102 aContext: *mut otCryptoContext,
1103 aInput: *const u8,
1104 aOutput: *mut u8,
1105 ) -> otError;
1106}
1107unsafe extern "C" {
1108 #[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"]
1109 pub fn otPlatCryptoAesFree(aContext: *mut otCryptoContext) -> otError;
1110}
1111unsafe extern "C" {
1112 #[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"]
1113 pub fn otPlatCryptoHkdfInit(aContext: *mut otCryptoContext) -> otError;
1114}
1115unsafe extern "C" {
1116 #[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"]
1117 pub fn otPlatCryptoHkdfExpand(
1118 aContext: *mut otCryptoContext,
1119 aInfo: *const u8,
1120 aInfoLength: u16,
1121 aOutputKey: *mut u8,
1122 aOutputKeyLength: u16,
1123 ) -> otError;
1124}
1125unsafe extern "C" {
1126 #[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."]
1127 pub fn otPlatCryptoHkdfExtract(
1128 aContext: *mut otCryptoContext,
1129 aSalt: *const u8,
1130 aSaltLength: u16,
1131 aInputKey: *const otCryptoKey,
1132 ) -> otError;
1133}
1134unsafe extern "C" {
1135 #[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"]
1136 pub fn otPlatCryptoHkdfDeinit(aContext: *mut otCryptoContext) -> otError;
1137}
1138unsafe extern "C" {
1139 #[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."]
1140 pub fn otPlatCryptoSha256Init(aContext: *mut otCryptoContext) -> otError;
1141}
1142unsafe extern "C" {
1143 #[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"]
1144 pub fn otPlatCryptoSha256Deinit(aContext: *mut otCryptoContext) -> otError;
1145}
1146unsafe extern "C" {
1147 #[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"]
1148 pub fn otPlatCryptoSha256Start(aContext: *mut otCryptoContext) -> otError;
1149}
1150unsafe extern "C" {
1151 #[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"]
1152 pub fn otPlatCryptoSha256Update(
1153 aContext: *mut otCryptoContext,
1154 aBuf: *const ::std::os::raw::c_void,
1155 aBufLength: u16,
1156 ) -> otError;
1157}
1158unsafe extern "C" {
1159 #[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"]
1160 pub fn otPlatCryptoSha256Finish(
1161 aContext: *mut otCryptoContext,
1162 aHash: *mut u8,
1163 aHashSize: u16,
1164 ) -> otError;
1165}
1166unsafe extern "C" {
1167 #[doc = " Initialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1168 pub fn otPlatCryptoRandomInit();
1169}
1170unsafe extern "C" {
1171 #[doc = " Deinitialize cryptographically-secure pseudorandom number generator (CSPRNG)."]
1172 pub fn otPlatCryptoRandomDeinit();
1173}
1174unsafe extern "C" {
1175 #[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."]
1176 pub fn otPlatCryptoRandomGet(aBuffer: *mut u8, aSize: u16) -> otError;
1177}
1178unsafe extern "C" {
1179 #[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."]
1180 pub fn otPlatCryptoEcdsaGenerateKey(aKeyPair: *mut otPlatCryptoEcdsaKeyPair) -> otError;
1181}
1182unsafe extern "C" {
1183 #[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."]
1184 pub fn otPlatCryptoEcdsaGetPublicKey(
1185 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1186 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1187 ) -> otError;
1188}
1189unsafe extern "C" {
1190 #[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."]
1191 pub fn otPlatCryptoEcdsaSign(
1192 aKeyPair: *const otPlatCryptoEcdsaKeyPair,
1193 aHash: *const otPlatCryptoSha256Hash,
1194 aSignature: *mut otPlatCryptoEcdsaSignature,
1195 ) -> otError;
1196}
1197unsafe extern "C" {
1198 #[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."]
1199 pub fn otPlatCryptoEcdsaVerify(
1200 aPublicKey: *const otPlatCryptoEcdsaPublicKey,
1201 aHash: *const otPlatCryptoSha256Hash,
1202 aSignature: *const otPlatCryptoEcdsaSignature,
1203 ) -> otError;
1204}
1205unsafe extern "C" {
1206 #[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."]
1207 pub fn otPlatCryptoEcdsaSignUsingKeyRef(
1208 aKeyRef: otCryptoKeyRef,
1209 aHash: *const otPlatCryptoSha256Hash,
1210 aSignature: *mut otPlatCryptoEcdsaSignature,
1211 ) -> otError;
1212}
1213unsafe extern "C" {
1214 #[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."]
1215 pub fn otPlatCryptoEcdsaExportPublicKey(
1216 aKeyRef: otCryptoKeyRef,
1217 aPublicKey: *mut otPlatCryptoEcdsaPublicKey,
1218 ) -> otError;
1219}
1220unsafe extern "C" {
1221 #[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."]
1222 pub fn otPlatCryptoEcdsaGenerateAndImportKey(aKeyRef: otCryptoKeyRef) -> otError;
1223}
1224unsafe extern "C" {
1225 #[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."]
1226 pub fn otPlatCryptoEcdsaVerifyUsingKeyRef(
1227 aKeyRef: otCryptoKeyRef,
1228 aHash: *const otPlatCryptoSha256Hash,
1229 aSignature: *const otPlatCryptoEcdsaSignature,
1230 ) -> otError;
1231}
1232unsafe extern "C" {
1233 #[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."]
1234 pub fn otPlatCryptoPbkdf2GenerateKey(
1235 aPassword: *const u8,
1236 aPasswordLen: u16,
1237 aSalt: *const u8,
1238 aSaltLen: u16,
1239 aIterationCounter: u32,
1240 aKeyLen: u16,
1241 aKey: *mut u8,
1242 ) -> otError;
1243}
1244#[doc = "< aMaxPHYPacketSize (IEEE 802.15.4-2006)"]
1245pub const OT_RADIO_FRAME_MAX_SIZE: _bindgen_ty_2 = 127;
1246#[doc = "< Minimal size of frame FCS + CONTROL"]
1247pub const OT_RADIO_FRAME_MIN_SIZE: _bindgen_ty_2 = 3;
1248#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1249pub const OT_RADIO_SYMBOLS_PER_OCTET: _bindgen_ty_2 = 2;
1250#[doc = "< 2.4 GHz IEEE 802.15.4 (bits per second)"]
1251pub const OT_RADIO_BIT_RATE: _bindgen_ty_2 = 250000;
1252#[doc = "< Number of bits per octet"]
1253pub const OT_RADIO_BITS_PER_OCTET: _bindgen_ty_2 = 8;
1254#[doc = "< The O-QPSK PHY symbol rate when operating in the 780MHz, 915MHz, 2380MHz, 2450MHz"]
1255pub const OT_RADIO_SYMBOL_RATE: _bindgen_ty_2 = 62500;
1256#[doc = "< Symbol duration time in unit of microseconds"]
1257pub const OT_RADIO_SYMBOL_TIME: _bindgen_ty_2 = 16;
1258#[doc = "< Time for 10 symbols in unit of microseconds"]
1259pub const OT_RADIO_TEN_SYMBOLS_TIME: _bindgen_ty_2 = 160;
1260#[doc = "< LQI measurement not supported"]
1261pub const OT_RADIO_LQI_NONE: _bindgen_ty_2 = 0;
1262#[doc = "< Invalid or unknown RSSI value"]
1263pub const OT_RADIO_RSSI_INVALID: _bindgen_ty_2 = 127;
1264#[doc = "< Invalid or unknown power value"]
1265pub const OT_RADIO_POWER_INVALID: _bindgen_ty_2 = 127;
1266#[doc = "< Invalid short address."]
1267pub const OT_RADIO_INVALID_SHORT_ADDR: _bindgen_ty_2 = 65534;
1268#[doc = "< Broadcast short address."]
1269pub const OT_RADIO_BROADCAST_SHORT_ADDR: _bindgen_ty_2 = 65535;
1270#[doc = " @defgroup radio-types Radio Types\n\n @brief\n This module includes the platform abstraction for a radio frame.\n\n @{"]
1271pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
1272#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1273pub const OT_RADIO_CHANNEL_PAGE_0: _bindgen_ty_3 = 0;
1274#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1275pub const OT_RADIO_CHANNEL_PAGE_0_MASK: _bindgen_ty_3 = 1;
1276#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1277pub const OT_RADIO_CHANNEL_PAGE_2: _bindgen_ty_3 = 2;
1278#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1279pub const OT_RADIO_CHANNEL_PAGE_2_MASK: _bindgen_ty_3 = 4;
1280#[doc = " Defines the channel page."]
1281pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
1282#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1283pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 1;
1284#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1285pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 10;
1286#[doc = "< 915 MHz IEEE 802.15.4-2006"]
1287pub const OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 2046;
1288#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1289pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN: _bindgen_ty_4 = 11;
1290#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1291pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX: _bindgen_ty_4 = 26;
1292#[doc = "< 2.4 GHz IEEE 802.15.4-2006"]
1293pub const OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK: _bindgen_ty_4 = 134215680;
1294#[doc = " Defines the frequency band channel range."]
1295pub type _bindgen_ty_4 = ::std::os::raw::c_uint;
1296#[doc = " Represents radio capabilities.\n\n The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions."]
1297pub type otRadioCaps = u16;
1298#[doc = "< Radio supports no capability."]
1299pub const OT_RADIO_CAPS_NONE: _bindgen_ty_5 = 0;
1300#[doc = "< Radio supports AckTime event."]
1301pub const OT_RADIO_CAPS_ACK_TIMEOUT: _bindgen_ty_5 = 1;
1302#[doc = "< Radio supports Energy Scans."]
1303pub const OT_RADIO_CAPS_ENERGY_SCAN: _bindgen_ty_5 = 2;
1304#[doc = "< Radio supports tx retry logic with collision avoidance (CSMA)."]
1305pub const OT_RADIO_CAPS_TRANSMIT_RETRIES: _bindgen_ty_5 = 4;
1306#[doc = "< Radio supports CSMA backoff for frame tx (but no retry)."]
1307pub const OT_RADIO_CAPS_CSMA_BACKOFF: _bindgen_ty_5 = 8;
1308#[doc = "< Radio supports direct transition from sleep to TX with CSMA."]
1309pub const OT_RADIO_CAPS_SLEEP_TO_TX: _bindgen_ty_5 = 16;
1310#[doc = "< Radio supports tx security."]
1311pub const OT_RADIO_CAPS_TRANSMIT_SEC: _bindgen_ty_5 = 32;
1312#[doc = "< Radio supports tx at specific time."]
1313pub const OT_RADIO_CAPS_TRANSMIT_TIMING: _bindgen_ty_5 = 64;
1314#[doc = "< Radio supports rx at specific time."]
1315pub const OT_RADIO_CAPS_RECEIVE_TIMING: _bindgen_ty_5 = 128;
1316#[doc = "< Radio supports RxOnWhenIdle handling."]
1317pub const OT_RADIO_CAPS_RX_ON_WHEN_IDLE: _bindgen_ty_5 = 256;
1318#[doc = "< Radio supports setting per-frame transmit power."]
1319pub const OT_RADIO_CAPS_TRANSMIT_FRAME_POWER: _bindgen_ty_5 = 512;
1320#[doc = "< Radio supports setting alternate short address."]
1321pub const OT_RADIO_CAPS_ALT_SHORT_ADDR: _bindgen_ty_5 = 1024;
1322#[doc = " Defines constants that are used to indicate different radio capabilities. See `otRadioCaps`."]
1323pub type _bindgen_ty_5 = ::std::os::raw::c_uint;
1324#[doc = " Represents the IEEE 802.15.4 PAN ID."]
1325pub type otPanId = u16;
1326#[doc = " Represents the IEEE 802.15.4 Short Address."]
1327pub type otShortAddress = u16;
1328#[doc = "< Size of IE header in bytes."]
1329pub const OT_IE_HEADER_SIZE: _bindgen_ty_6 = 2;
1330#[doc = "< Size of CSL IE content in bytes."]
1331pub const OT_CSL_IE_SIZE: _bindgen_ty_6 = 4;
1332#[doc = "< Max length for header IE in ACK."]
1333pub const OT_ACK_IE_MAX_SIZE: _bindgen_ty_6 = 16;
1334#[doc = "< Max length of Link Metrics data in Vendor-Specific IE."]
1335pub const OT_ENH_PROBING_IE_DATA_MAX_SIZE: _bindgen_ty_6 = 2;
1336#[doc = " Defines constants about size of header IE in ACK."]
1337pub type _bindgen_ty_6 = ::std::os::raw::c_uint;
1338#[doc = " @struct otExtAddress\n\n Represents the IEEE 802.15.4 Extended Address."]
1339#[repr(C, packed)]
1340#[derive(Debug, Default, Copy, Clone)]
1341pub struct otExtAddress {
1342 #[doc = "< IEEE 802.15.4 Extended Address bytes"]
1343 pub m8: [u8; 8usize],
1344}
1345#[doc = " @struct otMacKey\n\n Represents a MAC Key."]
1346#[repr(C, packed)]
1347#[derive(Debug, Default, Copy, Clone)]
1348pub struct otMacKey {
1349 #[doc = "< MAC Key bytes."]
1350 pub m8: [u8; 16usize],
1351}
1352#[doc = " Represents a MAC Key Ref used by PSA."]
1353pub type otMacKeyRef = otCryptoKeyRef;
1354#[doc = " @struct otMacKeyMaterial\n\n Represents a MAC Key."]
1355#[repr(C)]
1356#[derive(Copy, Clone)]
1357pub struct otMacKeyMaterial {
1358 pub mKeyMaterial: otMacKeyMaterial__bindgen_ty_1,
1359}
1360#[repr(C)]
1361#[derive(Copy, Clone)]
1362pub union otMacKeyMaterial__bindgen_ty_1 {
1363 #[doc = "< Reference to the key stored."]
1364 pub mKeyRef: otMacKeyRef,
1365 #[doc = "< Key stored as literal."]
1366 pub mKey: otMacKey,
1367}
1368impl Default for otMacKeyMaterial__bindgen_ty_1 {
1369 fn default() -> Self {
1370 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1371 unsafe {
1372 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1373 s.assume_init()
1374 }
1375 }
1376}
1377impl Default for otMacKeyMaterial {
1378 fn default() -> Self {
1379 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1380 unsafe {
1381 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1382 s.assume_init()
1383 }
1384 }
1385}
1386#[doc = "< Use Literal Keys."]
1387pub const OT_KEY_TYPE_LITERAL_KEY: otRadioKeyType = 0;
1388#[doc = "< Use Reference to Key."]
1389pub const OT_KEY_TYPE_KEY_REF: otRadioKeyType = 1;
1390#[doc = " Defines constants about key types."]
1391pub type otRadioKeyType = ::std::os::raw::c_uint;
1392#[doc = " Represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame."]
1393#[repr(C)]
1394#[derive(Debug, Default, Copy, Clone)]
1395pub struct otRadioIeInfo {
1396 #[doc = "< The time offset to the Thread network time."]
1397 pub mNetworkTimeOffset: i64,
1398 #[doc = "< The Time IE offset from the start of PSDU."]
1399 pub mTimeIeOffset: u8,
1400 #[doc = "< The Time sync sequence."]
1401 pub mTimeSyncSeq: u8,
1402}
1403#[doc = " Represents an IEEE 802.15.4 radio frame."]
1404#[repr(C)]
1405#[derive(Copy, Clone)]
1406pub struct otRadioFrame {
1407 #[doc = "< The PSDU."]
1408 pub mPsdu: *mut u8,
1409 #[doc = "< Length of the PSDU."]
1410 pub mLength: u16,
1411 #[doc = "< Channel used to transmit/receive the frame."]
1412 pub mChannel: u8,
1413 #[doc = "< Radio link type - should be ignored by radio driver."]
1414 pub mRadioType: u8,
1415 pub mInfo: otRadioFrame__bindgen_ty_1,
1416}
1417#[doc = " The union of transmit and receive information for a radio frame."]
1418#[repr(C)]
1419#[derive(Copy, Clone)]
1420pub union otRadioFrame__bindgen_ty_1 {
1421 pub mTxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_1,
1422 pub mRxInfo: otRadioFrame__bindgen_ty_1__bindgen_ty_2,
1423}
1424#[doc = " Structure representing radio frame transmit information."]
1425#[repr(C)]
1426#[derive(Debug, Copy, Clone)]
1427pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1428 #[doc = "< The key material used for AES-CCM frame security."]
1429 pub mAesKey: *const otMacKeyMaterial,
1430 #[doc = "< The pointer to the Header IE(s) related information."]
1431 pub mIeInfo: *mut otRadioIeInfo,
1432 #[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`."]
1433 pub mTxDelayBaseTime: u32,
1434 #[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`."]
1435 pub mTxDelay: u32,
1436 #[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`)."]
1437 pub mMaxCsmaBackoffs: u8,
1438 #[doc = "< Maximum number of retries allowed after a transmission failure."]
1439 pub mMaxFrameRetries: u8,
1440 #[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."]
1441 pub mRxChannelAfterTxDone: u8,
1442 #[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()."]
1443 pub mTxPower: i8,
1444 pub _bitfield_align_1: [u8; 0],
1445 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1446 #[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."]
1447 pub mTimestamp: u64,
1448}
1449impl Default for otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1450 fn default() -> Self {
1451 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1452 unsafe {
1453 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1454 s.assume_init()
1455 }
1456 }
1457}
1458impl otRadioFrame__bindgen_ty_1__bindgen_ty_1 {
1459 #[inline]
1460 pub fn mIsHeaderUpdated(&self) -> bool {
1461 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1462 }
1463 #[inline]
1464 pub fn set_mIsHeaderUpdated(&mut self, val: bool) {
1465 unsafe {
1466 let val: u8 = ::std::mem::transmute(val);
1467 self._bitfield_1.set(0usize, 1u8, val as u64)
1468 }
1469 }
1470 #[inline]
1471 pub unsafe fn mIsHeaderUpdated_raw(this: *const Self) -> bool {
1472 unsafe {
1473 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1474 ::std::ptr::addr_of!((*this)._bitfield_1),
1475 0usize,
1476 1u8,
1477 ) as u8)
1478 }
1479 }
1480 #[inline]
1481 pub unsafe fn set_mIsHeaderUpdated_raw(this: *mut Self, val: bool) {
1482 unsafe {
1483 let val: u8 = ::std::mem::transmute(val);
1484 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1485 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1486 0usize,
1487 1u8,
1488 val as u64,
1489 )
1490 }
1491 }
1492 #[inline]
1493 pub fn mIsARetx(&self) -> bool {
1494 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1495 }
1496 #[inline]
1497 pub fn set_mIsARetx(&mut self, val: bool) {
1498 unsafe {
1499 let val: u8 = ::std::mem::transmute(val);
1500 self._bitfield_1.set(1usize, 1u8, val as u64)
1501 }
1502 }
1503 #[inline]
1504 pub unsafe fn mIsARetx_raw(this: *const Self) -> bool {
1505 unsafe {
1506 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1507 ::std::ptr::addr_of!((*this)._bitfield_1),
1508 1usize,
1509 1u8,
1510 ) as u8)
1511 }
1512 }
1513 #[inline]
1514 pub unsafe fn set_mIsARetx_raw(this: *mut Self, val: bool) {
1515 unsafe {
1516 let val: u8 = ::std::mem::transmute(val);
1517 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1518 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1519 1usize,
1520 1u8,
1521 val as u64,
1522 )
1523 }
1524 }
1525 #[inline]
1526 pub fn mCsmaCaEnabled(&self) -> bool {
1527 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1528 }
1529 #[inline]
1530 pub fn set_mCsmaCaEnabled(&mut self, val: bool) {
1531 unsafe {
1532 let val: u8 = ::std::mem::transmute(val);
1533 self._bitfield_1.set(2usize, 1u8, val as u64)
1534 }
1535 }
1536 #[inline]
1537 pub unsafe fn mCsmaCaEnabled_raw(this: *const Self) -> bool {
1538 unsafe {
1539 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1540 ::std::ptr::addr_of!((*this)._bitfield_1),
1541 2usize,
1542 1u8,
1543 ) as u8)
1544 }
1545 }
1546 #[inline]
1547 pub unsafe fn set_mCsmaCaEnabled_raw(this: *mut Self, val: bool) {
1548 unsafe {
1549 let val: u8 = ::std::mem::transmute(val);
1550 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1551 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1552 2usize,
1553 1u8,
1554 val as u64,
1555 )
1556 }
1557 }
1558 #[inline]
1559 pub fn mCslPresent(&self) -> bool {
1560 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1561 }
1562 #[inline]
1563 pub fn set_mCslPresent(&mut self, val: bool) {
1564 unsafe {
1565 let val: u8 = ::std::mem::transmute(val);
1566 self._bitfield_1.set(3usize, 1u8, val as u64)
1567 }
1568 }
1569 #[inline]
1570 pub unsafe fn mCslPresent_raw(this: *const Self) -> bool {
1571 unsafe {
1572 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1573 ::std::ptr::addr_of!((*this)._bitfield_1),
1574 3usize,
1575 1u8,
1576 ) as u8)
1577 }
1578 }
1579 #[inline]
1580 pub unsafe fn set_mCslPresent_raw(this: *mut Self, val: bool) {
1581 unsafe {
1582 let val: u8 = ::std::mem::transmute(val);
1583 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1584 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1585 3usize,
1586 1u8,
1587 val as u64,
1588 )
1589 }
1590 }
1591 #[inline]
1592 pub fn mIsSecurityProcessed(&self) -> bool {
1593 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1594 }
1595 #[inline]
1596 pub fn set_mIsSecurityProcessed(&mut self, val: bool) {
1597 unsafe {
1598 let val: u8 = ::std::mem::transmute(val);
1599 self._bitfield_1.set(4usize, 1u8, val as u64)
1600 }
1601 }
1602 #[inline]
1603 pub unsafe fn mIsSecurityProcessed_raw(this: *const Self) -> bool {
1604 unsafe {
1605 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1606 ::std::ptr::addr_of!((*this)._bitfield_1),
1607 4usize,
1608 1u8,
1609 ) as u8)
1610 }
1611 }
1612 #[inline]
1613 pub unsafe fn set_mIsSecurityProcessed_raw(this: *mut Self, val: bool) {
1614 unsafe {
1615 let val: u8 = ::std::mem::transmute(val);
1616 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1617 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1618 4usize,
1619 1u8,
1620 val as u64,
1621 )
1622 }
1623 }
1624 #[inline]
1625 pub fn new_bitfield_1(
1626 mIsHeaderUpdated: bool,
1627 mIsARetx: bool,
1628 mCsmaCaEnabled: bool,
1629 mCslPresent: bool,
1630 mIsSecurityProcessed: bool,
1631 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1632 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1633 __bindgen_bitfield_unit.set(0usize, 1u8, {
1634 let mIsHeaderUpdated: u8 = unsafe { ::std::mem::transmute(mIsHeaderUpdated) };
1635 mIsHeaderUpdated as u64
1636 });
1637 __bindgen_bitfield_unit.set(1usize, 1u8, {
1638 let mIsARetx: u8 = unsafe { ::std::mem::transmute(mIsARetx) };
1639 mIsARetx as u64
1640 });
1641 __bindgen_bitfield_unit.set(2usize, 1u8, {
1642 let mCsmaCaEnabled: u8 = unsafe { ::std::mem::transmute(mCsmaCaEnabled) };
1643 mCsmaCaEnabled as u64
1644 });
1645 __bindgen_bitfield_unit.set(3usize, 1u8, {
1646 let mCslPresent: u8 = unsafe { ::std::mem::transmute(mCslPresent) };
1647 mCslPresent as u64
1648 });
1649 __bindgen_bitfield_unit.set(4usize, 1u8, {
1650 let mIsSecurityProcessed: u8 = unsafe { ::std::mem::transmute(mIsSecurityProcessed) };
1651 mIsSecurityProcessed as u64
1652 });
1653 __bindgen_bitfield_unit
1654 }
1655}
1656#[doc = " Structure representing radio frame receive information."]
1657#[repr(C)]
1658#[derive(Debug, Default, Copy, Clone)]
1659pub struct otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1660 #[doc = " The time of the local radio clock in microseconds when the end of\n the SFD was present at the local antenna."]
1661 pub mTimestamp: u64,
1662 #[doc = "< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set)."]
1663 pub mAckFrameCounter: u32,
1664 #[doc = "< ACK security key index (applicable when `mAckedWithSecEnhAck` is set)."]
1665 pub mAckKeyId: u8,
1666 #[doc = "< Received signal strength indicator in dBm for received frames."]
1667 pub mRssi: i8,
1668 #[doc = "< Link Quality Indicator for received frames."]
1669 pub mLqi: u8,
1670 pub _bitfield_align_1: [u8; 0],
1671 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1672}
1673impl otRadioFrame__bindgen_ty_1__bindgen_ty_2 {
1674 #[inline]
1675 pub fn mAckedWithFramePending(&self) -> bool {
1676 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1677 }
1678 #[inline]
1679 pub fn set_mAckedWithFramePending(&mut self, val: bool) {
1680 unsafe {
1681 let val: u8 = ::std::mem::transmute(val);
1682 self._bitfield_1.set(0usize, 1u8, val as u64)
1683 }
1684 }
1685 #[inline]
1686 pub unsafe fn mAckedWithFramePending_raw(this: *const Self) -> bool {
1687 unsafe {
1688 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1689 ::std::ptr::addr_of!((*this)._bitfield_1),
1690 0usize,
1691 1u8,
1692 ) as u8)
1693 }
1694 }
1695 #[inline]
1696 pub unsafe fn set_mAckedWithFramePending_raw(this: *mut Self, val: bool) {
1697 unsafe {
1698 let val: u8 = ::std::mem::transmute(val);
1699 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1700 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1701 0usize,
1702 1u8,
1703 val as u64,
1704 )
1705 }
1706 }
1707 #[inline]
1708 pub fn mAckedWithSecEnhAck(&self) -> bool {
1709 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1710 }
1711 #[inline]
1712 pub fn set_mAckedWithSecEnhAck(&mut self, val: bool) {
1713 unsafe {
1714 let val: u8 = ::std::mem::transmute(val);
1715 self._bitfield_1.set(1usize, 1u8, val as u64)
1716 }
1717 }
1718 #[inline]
1719 pub unsafe fn mAckedWithSecEnhAck_raw(this: *const Self) -> bool {
1720 unsafe {
1721 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1722 ::std::ptr::addr_of!((*this)._bitfield_1),
1723 1usize,
1724 1u8,
1725 ) as u8)
1726 }
1727 }
1728 #[inline]
1729 pub unsafe fn set_mAckedWithSecEnhAck_raw(this: *mut Self, val: bool) {
1730 unsafe {
1731 let val: u8 = ::std::mem::transmute(val);
1732 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1733 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1734 1usize,
1735 1u8,
1736 val as u64,
1737 )
1738 }
1739 }
1740 #[inline]
1741 pub fn new_bitfield_1(
1742 mAckedWithFramePending: bool,
1743 mAckedWithSecEnhAck: bool,
1744 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
1745 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
1746 __bindgen_bitfield_unit.set(0usize, 1u8, {
1747 let mAckedWithFramePending: u8 =
1748 unsafe { ::std::mem::transmute(mAckedWithFramePending) };
1749 mAckedWithFramePending as u64
1750 });
1751 __bindgen_bitfield_unit.set(1usize, 1u8, {
1752 let mAckedWithSecEnhAck: u8 = unsafe { ::std::mem::transmute(mAckedWithSecEnhAck) };
1753 mAckedWithSecEnhAck as u64
1754 });
1755 __bindgen_bitfield_unit
1756 }
1757}
1758impl Default for otRadioFrame__bindgen_ty_1 {
1759 fn default() -> Self {
1760 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1761 unsafe {
1762 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1763 s.assume_init()
1764 }
1765 }
1766}
1767impl Default for otRadioFrame {
1768 fn default() -> Self {
1769 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1770 unsafe {
1771 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1772 s.assume_init()
1773 }
1774 }
1775}
1776pub const OT_RADIO_STATE_DISABLED: otRadioState = 0;
1777pub const OT_RADIO_STATE_SLEEP: otRadioState = 1;
1778pub const OT_RADIO_STATE_RECEIVE: otRadioState = 2;
1779pub const OT_RADIO_STATE_TRANSMIT: otRadioState = 3;
1780pub const OT_RADIO_STATE_INVALID: otRadioState = 255;
1781#[doc = " Represents the state of a radio.\n Initially, a radio is in the Disabled state."]
1782pub type otRadioState = ::std::os::raw::c_uint;
1783#[doc = " Represents radio coexistence metrics."]
1784#[repr(C)]
1785#[derive(Debug, Default, Copy, Clone)]
1786pub struct otRadioCoexMetrics {
1787 #[doc = "< Number of grant glitches."]
1788 pub mNumGrantGlitch: u32,
1789 #[doc = "< Number of tx requests."]
1790 pub mNumTxRequest: u32,
1791 #[doc = "< Number of tx requests while grant was active."]
1792 pub mNumTxGrantImmediate: u32,
1793 #[doc = "< Number of tx requests while grant was inactive."]
1794 pub mNumTxGrantWait: u32,
1795 #[doc = "< Number of tx requests while grant was inactive that were ultimately granted."]
1796 pub mNumTxGrantWaitActivated: u32,
1797 #[doc = "< Number of tx requests while grant was inactive that timed out."]
1798 pub mNumTxGrantWaitTimeout: u32,
1799 #[doc = "< Number of tx that were in progress when grant was deactivated."]
1800 pub mNumTxGrantDeactivatedDuringRequest: u32,
1801 #[doc = "< Number of tx requests that were not granted within 50us."]
1802 pub mNumTxDelayedGrant: u32,
1803 #[doc = "< Average time in usec from tx request to grant."]
1804 pub mAvgTxRequestToGrantTime: u32,
1805 #[doc = "< Number of rx requests."]
1806 pub mNumRxRequest: u32,
1807 #[doc = "< Number of rx requests while grant was active."]
1808 pub mNumRxGrantImmediate: u32,
1809 #[doc = "< Number of rx requests while grant was inactive."]
1810 pub mNumRxGrantWait: u32,
1811 #[doc = "< Number of rx requests while grant was inactive that were ultimately granted."]
1812 pub mNumRxGrantWaitActivated: u32,
1813 #[doc = "< Number of rx requests while grant was inactive that timed out."]
1814 pub mNumRxGrantWaitTimeout: u32,
1815 #[doc = "< Number of rx that were in progress when grant was deactivated."]
1816 pub mNumRxGrantDeactivatedDuringRequest: u32,
1817 #[doc = "< Number of rx requests that were not granted within 50us."]
1818 pub mNumRxDelayedGrant: u32,
1819 #[doc = "< Average time in usec from rx request to grant."]
1820 pub mAvgRxRequestToGrantTime: u32,
1821 #[doc = "< Number of rx requests that completed without receiving grant."]
1822 pub mNumRxGrantNone: u32,
1823 #[doc = "< Stats collection stopped due to saturation."]
1824 pub mStopped: bool,
1825}
1826#[doc = " Represents what metrics are specified to query."]
1827#[repr(C)]
1828#[derive(Debug, Default, Copy, Clone)]
1829pub struct otLinkMetrics {
1830 pub _bitfield_align_1: [u8; 0],
1831 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
1832}
1833impl otLinkMetrics {
1834 #[inline]
1835 pub fn mPduCount(&self) -> bool {
1836 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
1837 }
1838 #[inline]
1839 pub fn set_mPduCount(&mut self, val: bool) {
1840 unsafe {
1841 let val: u8 = ::std::mem::transmute(val);
1842 self._bitfield_1.set(0usize, 1u8, val as u64)
1843 }
1844 }
1845 #[inline]
1846 pub unsafe fn mPduCount_raw(this: *const Self) -> bool {
1847 unsafe {
1848 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1849 ::std::ptr::addr_of!((*this)._bitfield_1),
1850 0usize,
1851 1u8,
1852 ) as u8)
1853 }
1854 }
1855 #[inline]
1856 pub unsafe fn set_mPduCount_raw(this: *mut Self, val: bool) {
1857 unsafe {
1858 let val: u8 = ::std::mem::transmute(val);
1859 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1860 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1861 0usize,
1862 1u8,
1863 val as u64,
1864 )
1865 }
1866 }
1867 #[inline]
1868 pub fn mLqi(&self) -> bool {
1869 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
1870 }
1871 #[inline]
1872 pub fn set_mLqi(&mut self, val: bool) {
1873 unsafe {
1874 let val: u8 = ::std::mem::transmute(val);
1875 self._bitfield_1.set(1usize, 1u8, val as u64)
1876 }
1877 }
1878 #[inline]
1879 pub unsafe fn mLqi_raw(this: *const Self) -> bool {
1880 unsafe {
1881 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1882 ::std::ptr::addr_of!((*this)._bitfield_1),
1883 1usize,
1884 1u8,
1885 ) as u8)
1886 }
1887 }
1888 #[inline]
1889 pub unsafe fn set_mLqi_raw(this: *mut Self, val: bool) {
1890 unsafe {
1891 let val: u8 = ::std::mem::transmute(val);
1892 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1893 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1894 1usize,
1895 1u8,
1896 val as u64,
1897 )
1898 }
1899 }
1900 #[inline]
1901 pub fn mLinkMargin(&self) -> bool {
1902 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
1903 }
1904 #[inline]
1905 pub fn set_mLinkMargin(&mut self, val: bool) {
1906 unsafe {
1907 let val: u8 = ::std::mem::transmute(val);
1908 self._bitfield_1.set(2usize, 1u8, val as u64)
1909 }
1910 }
1911 #[inline]
1912 pub unsafe fn mLinkMargin_raw(this: *const Self) -> bool {
1913 unsafe {
1914 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1915 ::std::ptr::addr_of!((*this)._bitfield_1),
1916 2usize,
1917 1u8,
1918 ) as u8)
1919 }
1920 }
1921 #[inline]
1922 pub unsafe fn set_mLinkMargin_raw(this: *mut Self, val: bool) {
1923 unsafe {
1924 let val: u8 = ::std::mem::transmute(val);
1925 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1926 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1927 2usize,
1928 1u8,
1929 val as u64,
1930 )
1931 }
1932 }
1933 #[inline]
1934 pub fn mRssi(&self) -> bool {
1935 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
1936 }
1937 #[inline]
1938 pub fn set_mRssi(&mut self, val: bool) {
1939 unsafe {
1940 let val: u8 = ::std::mem::transmute(val);
1941 self._bitfield_1.set(3usize, 1u8, val as u64)
1942 }
1943 }
1944 #[inline]
1945 pub unsafe fn mRssi_raw(this: *const Self) -> bool {
1946 unsafe {
1947 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1948 ::std::ptr::addr_of!((*this)._bitfield_1),
1949 3usize,
1950 1u8,
1951 ) as u8)
1952 }
1953 }
1954 #[inline]
1955 pub unsafe fn set_mRssi_raw(this: *mut Self, val: bool) {
1956 unsafe {
1957 let val: u8 = ::std::mem::transmute(val);
1958 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1959 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1960 3usize,
1961 1u8,
1962 val as u64,
1963 )
1964 }
1965 }
1966 #[inline]
1967 pub fn mReserved(&self) -> bool {
1968 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
1969 }
1970 #[inline]
1971 pub fn set_mReserved(&mut self, val: bool) {
1972 unsafe {
1973 let val: u8 = ::std::mem::transmute(val);
1974 self._bitfield_1.set(4usize, 1u8, val as u64)
1975 }
1976 }
1977 #[inline]
1978 pub unsafe fn mReserved_raw(this: *const Self) -> bool {
1979 unsafe {
1980 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
1981 ::std::ptr::addr_of!((*this)._bitfield_1),
1982 4usize,
1983 1u8,
1984 ) as u8)
1985 }
1986 }
1987 #[inline]
1988 pub unsafe fn set_mReserved_raw(this: *mut Self, val: bool) {
1989 unsafe {
1990 let val: u8 = ::std::mem::transmute(val);
1991 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
1992 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1993 4usize,
1994 1u8,
1995 val as u64,
1996 )
1997 }
1998 }
1999 #[inline]
2000 pub fn new_bitfield_1(
2001 mPduCount: bool,
2002 mLqi: bool,
2003 mLinkMargin: bool,
2004 mRssi: bool,
2005 mReserved: bool,
2006 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
2007 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
2008 __bindgen_bitfield_unit.set(0usize, 1u8, {
2009 let mPduCount: u8 = unsafe { ::std::mem::transmute(mPduCount) };
2010 mPduCount as u64
2011 });
2012 __bindgen_bitfield_unit.set(1usize, 1u8, {
2013 let mLqi: u8 = unsafe { ::std::mem::transmute(mLqi) };
2014 mLqi as u64
2015 });
2016 __bindgen_bitfield_unit.set(2usize, 1u8, {
2017 let mLinkMargin: u8 = unsafe { ::std::mem::transmute(mLinkMargin) };
2018 mLinkMargin as u64
2019 });
2020 __bindgen_bitfield_unit.set(3usize, 1u8, {
2021 let mRssi: u8 = unsafe { ::std::mem::transmute(mRssi) };
2022 mRssi as u64
2023 });
2024 __bindgen_bitfield_unit.set(4usize, 1u8, {
2025 let mReserved: u8 = unsafe { ::std::mem::transmute(mReserved) };
2026 mReserved as u64
2027 });
2028 __bindgen_bitfield_unit
2029 }
2030}
2031unsafe extern "C" {
2032 #[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)."]
2033 pub fn otPlatRadioGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
2034}
2035unsafe extern "C" {
2036 #[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."]
2037 pub fn otPlatRadioGetVersionString(aInstance: *mut otInstance)
2038 -> *const ::std::os::raw::c_char;
2039}
2040unsafe extern "C" {
2041 #[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."]
2042 pub fn otPlatRadioGetReceiveSensitivity(aInstance: *mut otInstance) -> i8;
2043}
2044unsafe extern "C" {
2045 #[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."]
2046 pub fn otPlatRadioGetIeeeEui64(aInstance: *mut otInstance, aIeeeEui64: *mut u8);
2047}
2048unsafe extern "C" {
2049 #[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."]
2050 pub fn otPlatRadioSetPanId(aInstance: *mut otInstance, aPanId: otPanId);
2051}
2052unsafe extern "C" {
2053 #[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."]
2054 pub fn otPlatRadioSetExtendedAddress(
2055 aInstance: *mut otInstance,
2056 aExtAddress: *const otExtAddress,
2057 );
2058}
2059unsafe extern "C" {
2060 #[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."]
2061 pub fn otPlatRadioSetShortAddress(aInstance: *mut otInstance, aShortAddress: otShortAddress);
2062}
2063unsafe extern "C" {
2064 #[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."]
2065 pub fn otPlatRadioSetAlternateShortAddress(
2066 aInstance: *mut otInstance,
2067 aShortAddress: otShortAddress,
2068 );
2069}
2070unsafe extern "C" {
2071 #[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."]
2072 pub fn otPlatRadioGetTransmitPower(aInstance: *mut otInstance, aPower: *mut i8) -> otError;
2073}
2074unsafe extern "C" {
2075 #[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."]
2076 pub fn otPlatRadioSetTransmitPower(aInstance: *mut otInstance, aPower: i8) -> otError;
2077}
2078unsafe extern "C" {
2079 #[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."]
2080 pub fn otPlatRadioGetCcaEnergyDetectThreshold(
2081 aInstance: *mut otInstance,
2082 aThreshold: *mut i8,
2083 ) -> otError;
2084}
2085unsafe extern "C" {
2086 #[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."]
2087 pub fn otPlatRadioSetCcaEnergyDetectThreshold(
2088 aInstance: *mut otInstance,
2089 aThreshold: i8,
2090 ) -> otError;
2091}
2092unsafe extern "C" {
2093 #[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."]
2094 pub fn otPlatRadioGetFemLnaGain(aInstance: *mut otInstance, aGain: *mut i8) -> otError;
2095}
2096unsafe extern "C" {
2097 #[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."]
2098 pub fn otPlatRadioSetFemLnaGain(aInstance: *mut otInstance, aGain: i8) -> otError;
2099}
2100unsafe extern "C" {
2101 #[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."]
2102 pub fn otPlatRadioGetPromiscuous(aInstance: *mut otInstance) -> bool;
2103}
2104unsafe extern "C" {
2105 #[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."]
2106 pub fn otPlatRadioSetPromiscuous(aInstance: *mut otInstance, aEnable: bool);
2107}
2108unsafe extern "C" {
2109 #[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."]
2110 pub fn otPlatRadioSetRxOnWhenIdle(aInstance: *mut otInstance, aEnable: bool);
2111}
2112unsafe extern "C" {
2113 #[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."]
2114 pub fn otPlatRadioSetMacKey(
2115 aInstance: *mut otInstance,
2116 aKeyIdMode: u8,
2117 aKeyId: u8,
2118 aPrevKey: *const otMacKeyMaterial,
2119 aCurrKey: *const otMacKeyMaterial,
2120 aNextKey: *const otMacKeyMaterial,
2121 aKeyType: otRadioKeyType,
2122 );
2123}
2124unsafe extern "C" {
2125 #[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."]
2126 pub fn otPlatRadioSetMacFrameCounter(aInstance: *mut otInstance, aMacFrameCounter: u32);
2127}
2128unsafe extern "C" {
2129 #[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."]
2130 pub fn otPlatRadioSetMacFrameCounterIfLarger(aInstance: *mut otInstance, aMacFrameCounter: u32);
2131}
2132unsafe extern "C" {
2133 #[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."]
2134 pub fn otPlatRadioGetNow(aInstance: *mut otInstance) -> u64;
2135}
2136unsafe extern "C" {
2137 #[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."]
2138 pub fn otPlatRadioGetBusSpeed(aInstance: *mut otInstance) -> u32;
2139}
2140unsafe extern "C" {
2141 #[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."]
2142 pub fn otPlatRadioGetBusLatency(aInstance: *mut otInstance) -> u32;
2143}
2144unsafe extern "C" {
2145 #[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."]
2146 pub fn otPlatRadioGetState(aInstance: *mut otInstance) -> otRadioState;
2147}
2148unsafe extern "C" {
2149 #[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."]
2150 pub fn otPlatRadioEnable(aInstance: *mut otInstance) -> otError;
2151}
2152unsafe extern "C" {
2153 #[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."]
2154 pub fn otPlatRadioDisable(aInstance: *mut otInstance) -> otError;
2155}
2156unsafe extern "C" {
2157 #[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."]
2158 pub fn otPlatRadioIsEnabled(aInstance: *mut otInstance) -> bool;
2159}
2160unsafe extern "C" {
2161 #[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."]
2162 pub fn otPlatRadioSleep(aInstance: *mut otInstance) -> otError;
2163}
2164unsafe extern "C" {
2165 #[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."]
2166 pub fn otPlatRadioReceive(aInstance: *mut otInstance, aChannel: u8) -> otError;
2167}
2168unsafe extern "C" {
2169 #[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."]
2170 pub fn otPlatRadioReceiveAt(
2171 aInstance: *mut otInstance,
2172 aChannel: u8,
2173 aStart: u32,
2174 aDuration: u32,
2175 ) -> otError;
2176}
2177unsafe extern "C" {
2178 #[doc = " The radio driver calls this method 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."]
2179 pub fn otPlatRadioReceiveDone(
2180 aInstance: *mut otInstance,
2181 aFrame: *mut otRadioFrame,
2182 aError: otError,
2183 );
2184}
2185unsafe extern "C" {
2186 #[doc = " The radio driver calls this method to notify OpenThread diagnostics module of a received frame.\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."]
2187 pub fn otPlatDiagRadioReceiveDone(
2188 aInstance: *mut otInstance,
2189 aFrame: *mut otRadioFrame,
2190 aError: otError,
2191 );
2192}
2193unsafe extern "C" {
2194 #[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."]
2195 pub fn otPlatRadioGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
2196}
2197unsafe extern "C" {
2198 #[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."]
2199 pub fn otPlatRadioTransmit(aInstance: *mut otInstance, aFrame: *mut otRadioFrame) -> otError;
2200}
2201unsafe extern "C" {
2202 #[doc = " The radio driver calls this method 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."]
2203 pub fn otPlatRadioTxStarted(aInstance: *mut otInstance, aFrame: *mut otRadioFrame);
2204}
2205unsafe extern "C" {
2206 #[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."]
2207 pub fn otPlatRadioTxDone(
2208 aInstance: *mut otInstance,
2209 aFrame: *mut otRadioFrame,
2210 aAckFrame: *mut otRadioFrame,
2211 aError: otError,
2212 );
2213}
2214unsafe extern "C" {
2215 #[doc = " The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed.\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."]
2216 pub fn otPlatDiagRadioTransmitDone(
2217 aInstance: *mut otInstance,
2218 aFrame: *mut otRadioFrame,
2219 aError: otError,
2220 );
2221}
2222unsafe extern "C" {
2223 #[doc = " Get the most recent RSSI measurement.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid."]
2224 pub fn otPlatRadioGetRssi(aInstance: *mut otInstance) -> i8;
2225}
2226unsafe extern "C" {
2227 #[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."]
2228 pub fn otPlatRadioEnergyScan(
2229 aInstance: *mut otInstance,
2230 aScanChannel: u8,
2231 aScanDuration: u16,
2232 ) -> otError;
2233}
2234unsafe extern "C" {
2235 #[doc = " The radio driver calls this method 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."]
2236 pub fn otPlatRadioEnergyScanDone(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8);
2237}
2238unsafe extern "C" {
2239 #[doc = " The radio driver calls this method to notify OpenThread that the spinel bus latency has been changed.\n\n @param[in] aInstance The OpenThread instance structure."]
2240 pub fn otPlatRadioBusLatencyChanged(aInstance: *mut otInstance);
2241}
2242unsafe extern "C" {
2243 #[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."]
2244 pub fn otPlatRadioEnableSrcMatch(aInstance: *mut otInstance, aEnable: bool);
2245}
2246unsafe extern "C" {
2247 #[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."]
2248 pub fn otPlatRadioAddSrcMatchShortEntry(
2249 aInstance: *mut otInstance,
2250 aShortAddress: otShortAddress,
2251 ) -> otError;
2252}
2253unsafe extern "C" {
2254 #[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."]
2255 pub fn otPlatRadioAddSrcMatchExtEntry(
2256 aInstance: *mut otInstance,
2257 aExtAddress: *const otExtAddress,
2258 ) -> otError;
2259}
2260unsafe extern "C" {
2261 #[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."]
2262 pub fn otPlatRadioClearSrcMatchShortEntry(
2263 aInstance: *mut otInstance,
2264 aShortAddress: otShortAddress,
2265 ) -> otError;
2266}
2267unsafe extern "C" {
2268 #[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."]
2269 pub fn otPlatRadioClearSrcMatchExtEntry(
2270 aInstance: *mut otInstance,
2271 aExtAddress: *const otExtAddress,
2272 ) -> otError;
2273}
2274unsafe extern "C" {
2275 #[doc = " Clear all short addresses from the source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2276 pub fn otPlatRadioClearSrcMatchShortEntries(aInstance: *mut otInstance);
2277}
2278unsafe extern "C" {
2279 #[doc = " Clear all the extended/long addresses from source address match table.\n\n @param[in] aInstance The OpenThread instance structure."]
2280 pub fn otPlatRadioClearSrcMatchExtEntries(aInstance: *mut otInstance);
2281}
2282unsafe extern "C" {
2283 #[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."]
2284 pub fn otPlatRadioGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
2285}
2286unsafe extern "C" {
2287 #[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."]
2288 pub fn otPlatRadioGetPreferredChannelMask(aInstance: *mut otInstance) -> u32;
2289}
2290unsafe extern "C" {
2291 #[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."]
2292 pub fn otPlatRadioSetCoexEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
2293}
2294unsafe extern "C" {
2295 #[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."]
2296 pub fn otPlatRadioIsCoexEnabled(aInstance: *mut otInstance) -> bool;
2297}
2298unsafe extern "C" {
2299 #[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."]
2300 pub fn otPlatRadioGetCoexMetrics(
2301 aInstance: *mut otInstance,
2302 aCoexMetrics: *mut otRadioCoexMetrics,
2303 ) -> otError;
2304}
2305unsafe extern "C" {
2306 #[doc = " Enable or disable CSL receiver.\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.\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."]
2307 pub fn otPlatRadioEnableCsl(
2308 aInstance: *mut otInstance,
2309 aCslPeriod: u32,
2310 aShortAddr: otShortAddress,
2311 aExtAddr: *const otExtAddress,
2312 ) -> otError;
2313}
2314unsafe extern "C" {
2315 #[doc = " Reset CSL receiver in the platform.\n\n @note Defaults to `otPlatRadioEnableCsl(aInstance,0, Mac::kShortAddrInvalid, nullptr);`\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."]
2316 pub fn otPlatRadioResetCsl(aInstance: *mut otInstance) -> otError;
2317}
2318unsafe extern "C" {
2319 #[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."]
2320 pub fn otPlatRadioUpdateCslSampleTime(aInstance: *mut otInstance, aCslSampleTime: u32);
2321}
2322unsafe extern "C" {
2323 #[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."]
2324 pub fn otPlatRadioGetCslAccuracy(aInstance: *mut otInstance) -> u8;
2325}
2326unsafe extern "C" {
2327 #[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."]
2328 pub fn otPlatRadioGetCslUncertainty(aInstance: *mut otInstance) -> u8;
2329}
2330unsafe extern "C" {
2331 #[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."]
2332 pub fn otPlatRadioSetChannelMaxTransmitPower(
2333 aInstance: *mut otInstance,
2334 aChannel: u8,
2335 aMaxPower: i8,
2336 ) -> otError;
2337}
2338unsafe extern "C" {
2339 #[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."]
2340 pub fn otPlatRadioSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
2341}
2342unsafe extern "C" {
2343 #[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 nullptr.\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."]
2344 pub fn otPlatRadioGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
2345}
2346unsafe extern "C" {
2347 #[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 method 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 @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 aExtAddr MUST NOT be `NULL`.\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."]
2348 pub fn otPlatRadioConfigureEnhAckProbing(
2349 aInstance: *mut otInstance,
2350 aLinkMetrics: otLinkMetrics,
2351 aShortAddress: otShortAddress,
2352 aExtAddress: *const otExtAddress,
2353 ) -> otError;
2354}
2355unsafe extern "C" {
2356 #[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."]
2357 pub fn otPlatRadioAddCalibratedPower(
2358 aInstance: *mut otInstance,
2359 aChannel: u8,
2360 aActualPower: i16,
2361 aRawPowerSetting: *const u8,
2362 aRawPowerSettingLength: u16,
2363 ) -> otError;
2364}
2365unsafe extern "C" {
2366 #[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."]
2367 pub fn otPlatRadioClearCalibratedPowers(aInstance: *mut otInstance) -> otError;
2368}
2369unsafe extern "C" {
2370 #[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."]
2371 pub fn otPlatRadioSetChannelTargetPower(
2372 aInstance: *mut otInstance,
2373 aChannel: u8,
2374 aTargetPower: i16,
2375 ) -> otError;
2376}
2377unsafe extern "C" {
2378 #[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."]
2379 pub fn otPlatRadioGetRawPowerSetting(
2380 aInstance: *mut otInstance,
2381 aChannel: u8,
2382 aRawPowerSetting: *mut u8,
2383 aRawPowerSettingLength: *mut u16,
2384 ) -> otError;
2385}
2386#[doc = " @struct otIp6InterfaceIdentifier\n\n Represents the Interface Identifier of an IPv6 address."]
2387#[repr(C, packed)]
2388#[derive(Copy, Clone)]
2389pub struct otIp6InterfaceIdentifier {
2390 #[doc = "< The Interface Identifier accessor fields"]
2391 pub mFields: otIp6InterfaceIdentifier__bindgen_ty_1,
2392}
2393#[repr(C, packed)]
2394#[derive(Copy, Clone)]
2395pub union otIp6InterfaceIdentifier__bindgen_ty_1 {
2396 #[doc = "< 8-bit fields"]
2397 pub m8: [u8; 8usize],
2398 #[doc = "< 16-bit fields"]
2399 pub m16: [u16; 4usize],
2400 #[doc = "< 32-bit fields"]
2401 pub m32: [u32; 2usize],
2402}
2403impl Default for otIp6InterfaceIdentifier__bindgen_ty_1 {
2404 fn default() -> Self {
2405 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2406 unsafe {
2407 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2408 s.assume_init()
2409 }
2410 }
2411}
2412impl Default for otIp6InterfaceIdentifier {
2413 fn default() -> Self {
2414 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2415 unsafe {
2416 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2417 s.assume_init()
2418 }
2419 }
2420}
2421#[doc = " @struct otIp6NetworkPrefix\n\n Represents the Network Prefix of an IPv6 address (most significant 64 bits of the address)."]
2422#[repr(C, packed)]
2423#[derive(Debug, Default, Copy, Clone)]
2424pub struct otIp6NetworkPrefix {
2425 #[doc = "< The Network Prefix."]
2426 pub m8: [u8; 8usize],
2427}
2428#[doc = " @struct otIp6AddressComponents\n\n Represents the components of an IPv6 address."]
2429#[repr(C, packed)]
2430#[derive(Copy, Clone)]
2431pub struct otIp6AddressComponents {
2432 #[doc = "< The Network Prefix (most significant 64 bits of the address)"]
2433 pub mNetworkPrefix: otIp6NetworkPrefix,
2434 #[doc = "< The Interface Identifier (least significant 64 bits of the address)"]
2435 pub mIid: otIp6InterfaceIdentifier,
2436}
2437impl Default for otIp6AddressComponents {
2438 fn default() -> Self {
2439 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2440 unsafe {
2441 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2442 s.assume_init()
2443 }
2444 }
2445}
2446#[doc = " @struct otIp6Address\n\n Represents an IPv6 address."]
2447#[repr(C, packed)]
2448#[derive(Copy, Clone)]
2449pub struct otIp6Address {
2450 #[doc = "< IPv6 accessor fields"]
2451 pub mFields: otIp6Address__bindgen_ty_1,
2452}
2453#[repr(C, packed)]
2454#[derive(Copy, Clone)]
2455pub union otIp6Address__bindgen_ty_1 {
2456 #[doc = "< 8-bit fields"]
2457 pub m8: [u8; 16usize],
2458 #[doc = "< 16-bit fields"]
2459 pub m16: [u16; 8usize],
2460 #[doc = "< 32-bit fields"]
2461 pub m32: [u32; 4usize],
2462 #[doc = "< IPv6 address components"]
2463 pub mComponents: otIp6AddressComponents,
2464}
2465impl Default for otIp6Address__bindgen_ty_1 {
2466 fn default() -> Self {
2467 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2468 unsafe {
2469 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2470 s.assume_init()
2471 }
2472 }
2473}
2474impl Default for otIp6Address {
2475 fn default() -> Self {
2476 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2477 unsafe {
2478 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2479 s.assume_init()
2480 }
2481 }
2482}
2483#[doc = " @struct otIp6Prefix\n\n Represents an IPv6 prefix."]
2484#[repr(C, packed)]
2485#[derive(Copy, Clone)]
2486pub struct otIp6Prefix {
2487 #[doc = "< The IPv6 prefix."]
2488 pub mPrefix: otIp6Address,
2489 #[doc = "< The IPv6 prefix length (in bits)."]
2490 pub mLength: u8,
2491}
2492impl Default for otIp6Prefix {
2493 fn default() -> Self {
2494 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2495 unsafe {
2496 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2497 s.assume_init()
2498 }
2499 }
2500}
2501#[doc = "< Thread assigned address (ALOC, RLOC, MLEID, etc)"]
2502pub const OT_ADDRESS_ORIGIN_THREAD: _bindgen_ty_7 = 0;
2503#[doc = "< SLAAC assigned address"]
2504pub const OT_ADDRESS_ORIGIN_SLAAC: _bindgen_ty_7 = 1;
2505#[doc = "< DHCPv6 assigned address"]
2506pub const OT_ADDRESS_ORIGIN_DHCPV6: _bindgen_ty_7 = 2;
2507#[doc = "< Manually assigned address"]
2508pub const OT_ADDRESS_ORIGIN_MANUAL: _bindgen_ty_7 = 3;
2509#[doc = " IPv6 Address origins"]
2510pub type _bindgen_ty_7 = ::std::os::raw::c_uint;
2511#[doc = " Represents an IPv6 network interface unicast address."]
2512#[repr(C)]
2513#[derive(Copy, Clone)]
2514pub struct otNetifAddress {
2515 #[doc = "< The IPv6 unicast address."]
2516 pub mAddress: otIp6Address,
2517 #[doc = "< The Prefix length (in bits)."]
2518 pub mPrefixLength: u8,
2519 #[doc = "< The IPv6 address origin."]
2520 pub mAddressOrigin: u8,
2521 pub _bitfield_align_1: [u8; 0],
2522 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
2523 #[doc = "< A pointer to the next network interface address."]
2524 pub mNext: *const otNetifAddress,
2525}
2526impl Default for otNetifAddress {
2527 fn default() -> Self {
2528 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2529 unsafe {
2530 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2531 s.assume_init()
2532 }
2533 }
2534}
2535impl otNetifAddress {
2536 #[inline]
2537 pub fn mPreferred(&self) -> bool {
2538 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
2539 }
2540 #[inline]
2541 pub fn set_mPreferred(&mut self, val: bool) {
2542 unsafe {
2543 let val: u8 = ::std::mem::transmute(val);
2544 self._bitfield_1.set(0usize, 1u8, val as u64)
2545 }
2546 }
2547 #[inline]
2548 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
2549 unsafe {
2550 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2551 ::std::ptr::addr_of!((*this)._bitfield_1),
2552 0usize,
2553 1u8,
2554 ) as u8)
2555 }
2556 }
2557 #[inline]
2558 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
2559 unsafe {
2560 let val: u8 = ::std::mem::transmute(val);
2561 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2562 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2563 0usize,
2564 1u8,
2565 val as u64,
2566 )
2567 }
2568 }
2569 #[inline]
2570 pub fn mValid(&self) -> bool {
2571 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
2572 }
2573 #[inline]
2574 pub fn set_mValid(&mut self, val: bool) {
2575 unsafe {
2576 let val: u8 = ::std::mem::transmute(val);
2577 self._bitfield_1.set(1usize, 1u8, val as u64)
2578 }
2579 }
2580 #[inline]
2581 pub unsafe fn mValid_raw(this: *const Self) -> bool {
2582 unsafe {
2583 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2584 ::std::ptr::addr_of!((*this)._bitfield_1),
2585 1usize,
2586 1u8,
2587 ) as u8)
2588 }
2589 }
2590 #[inline]
2591 pub unsafe fn set_mValid_raw(this: *mut Self, val: bool) {
2592 unsafe {
2593 let val: u8 = ::std::mem::transmute(val);
2594 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2595 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2596 1usize,
2597 1u8,
2598 val as u64,
2599 )
2600 }
2601 }
2602 #[inline]
2603 pub fn mScopeOverrideValid(&self) -> bool {
2604 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2605 }
2606 #[inline]
2607 pub fn set_mScopeOverrideValid(&mut self, val: bool) {
2608 unsafe {
2609 let val: u8 = ::std::mem::transmute(val);
2610 self._bitfield_1.set(2usize, 1u8, val as u64)
2611 }
2612 }
2613 #[inline]
2614 pub unsafe fn mScopeOverrideValid_raw(this: *const Self) -> bool {
2615 unsafe {
2616 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2617 ::std::ptr::addr_of!((*this)._bitfield_1),
2618 2usize,
2619 1u8,
2620 ) as u8)
2621 }
2622 }
2623 #[inline]
2624 pub unsafe fn set_mScopeOverrideValid_raw(this: *mut Self, val: bool) {
2625 unsafe {
2626 let val: u8 = ::std::mem::transmute(val);
2627 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2628 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2629 2usize,
2630 1u8,
2631 val as u64,
2632 )
2633 }
2634 }
2635 #[inline]
2636 pub fn mScopeOverride(&self) -> ::std::os::raw::c_uint {
2637 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 4u8) as u32) }
2638 }
2639 #[inline]
2640 pub fn set_mScopeOverride(&mut self, val: ::std::os::raw::c_uint) {
2641 unsafe {
2642 let val: u32 = ::std::mem::transmute(val);
2643 self._bitfield_1.set(3usize, 4u8, val as u64)
2644 }
2645 }
2646 #[inline]
2647 pub unsafe fn mScopeOverride_raw(this: *const Self) -> ::std::os::raw::c_uint {
2648 unsafe {
2649 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2650 ::std::ptr::addr_of!((*this)._bitfield_1),
2651 3usize,
2652 4u8,
2653 ) as u32)
2654 }
2655 }
2656 #[inline]
2657 pub unsafe fn set_mScopeOverride_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
2658 unsafe {
2659 let val: u32 = ::std::mem::transmute(val);
2660 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2661 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2662 3usize,
2663 4u8,
2664 val as u64,
2665 )
2666 }
2667 }
2668 #[inline]
2669 pub fn mRloc(&self) -> bool {
2670 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
2671 }
2672 #[inline]
2673 pub fn set_mRloc(&mut self, val: bool) {
2674 unsafe {
2675 let val: u8 = ::std::mem::transmute(val);
2676 self._bitfield_1.set(7usize, 1u8, val as u64)
2677 }
2678 }
2679 #[inline]
2680 pub unsafe fn mRloc_raw(this: *const Self) -> bool {
2681 unsafe {
2682 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2683 ::std::ptr::addr_of!((*this)._bitfield_1),
2684 7usize,
2685 1u8,
2686 ) as u8)
2687 }
2688 }
2689 #[inline]
2690 pub unsafe fn set_mRloc_raw(this: *mut Self, val: bool) {
2691 unsafe {
2692 let val: u8 = ::std::mem::transmute(val);
2693 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2694 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2695 7usize,
2696 1u8,
2697 val as u64,
2698 )
2699 }
2700 }
2701 #[inline]
2702 pub fn mMeshLocal(&self) -> bool {
2703 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
2704 }
2705 #[inline]
2706 pub fn set_mMeshLocal(&mut self, val: bool) {
2707 unsafe {
2708 let val: u8 = ::std::mem::transmute(val);
2709 self._bitfield_1.set(8usize, 1u8, val as u64)
2710 }
2711 }
2712 #[inline]
2713 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
2714 unsafe {
2715 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2716 ::std::ptr::addr_of!((*this)._bitfield_1),
2717 8usize,
2718 1u8,
2719 ) as u8)
2720 }
2721 }
2722 #[inline]
2723 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
2724 unsafe {
2725 let val: u8 = ::std::mem::transmute(val);
2726 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2727 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2728 8usize,
2729 1u8,
2730 val as u64,
2731 )
2732 }
2733 }
2734 #[inline]
2735 pub fn mSrpRegistered(&self) -> bool {
2736 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
2737 }
2738 #[inline]
2739 pub fn set_mSrpRegistered(&mut self, val: bool) {
2740 unsafe {
2741 let val: u8 = ::std::mem::transmute(val);
2742 self._bitfield_1.set(9usize, 1u8, val as u64)
2743 }
2744 }
2745 #[inline]
2746 pub unsafe fn mSrpRegistered_raw(this: *const Self) -> bool {
2747 unsafe {
2748 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
2749 ::std::ptr::addr_of!((*this)._bitfield_1),
2750 9usize,
2751 1u8,
2752 ) as u8)
2753 }
2754 }
2755 #[inline]
2756 pub unsafe fn set_mSrpRegistered_raw(this: *mut Self, val: bool) {
2757 unsafe {
2758 let val: u8 = ::std::mem::transmute(val);
2759 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
2760 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2761 9usize,
2762 1u8,
2763 val as u64,
2764 )
2765 }
2766 }
2767 #[inline]
2768 pub fn new_bitfield_1(
2769 mPreferred: bool,
2770 mValid: bool,
2771 mScopeOverrideValid: bool,
2772 mScopeOverride: ::std::os::raw::c_uint,
2773 mRloc: bool,
2774 mMeshLocal: bool,
2775 mSrpRegistered: bool,
2776 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
2777 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
2778 __bindgen_bitfield_unit.set(0usize, 1u8, {
2779 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
2780 mPreferred as u64
2781 });
2782 __bindgen_bitfield_unit.set(1usize, 1u8, {
2783 let mValid: u8 = unsafe { ::std::mem::transmute(mValid) };
2784 mValid as u64
2785 });
2786 __bindgen_bitfield_unit.set(2usize, 1u8, {
2787 let mScopeOverrideValid: u8 = unsafe { ::std::mem::transmute(mScopeOverrideValid) };
2788 mScopeOverrideValid as u64
2789 });
2790 __bindgen_bitfield_unit.set(3usize, 4u8, {
2791 let mScopeOverride: u32 = unsafe { ::std::mem::transmute(mScopeOverride) };
2792 mScopeOverride as u64
2793 });
2794 __bindgen_bitfield_unit.set(7usize, 1u8, {
2795 let mRloc: u8 = unsafe { ::std::mem::transmute(mRloc) };
2796 mRloc as u64
2797 });
2798 __bindgen_bitfield_unit.set(8usize, 1u8, {
2799 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
2800 mMeshLocal as u64
2801 });
2802 __bindgen_bitfield_unit.set(9usize, 1u8, {
2803 let mSrpRegistered: u8 = unsafe { ::std::mem::transmute(mSrpRegistered) };
2804 mSrpRegistered as u64
2805 });
2806 __bindgen_bitfield_unit
2807 }
2808}
2809#[doc = " Represents an IPv6 network interface multicast address."]
2810#[repr(C)]
2811#[derive(Copy, Clone)]
2812pub struct otNetifMulticastAddress {
2813 #[doc = "< The IPv6 multicast address."]
2814 pub mAddress: otIp6Address,
2815 #[doc = "< A pointer to the next network interface multicast address."]
2816 pub mNext: *const otNetifMulticastAddress,
2817}
2818impl Default for otNetifMulticastAddress {
2819 fn default() -> Self {
2820 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2821 unsafe {
2822 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2823 s.assume_init()
2824 }
2825 }
2826}
2827#[doc = " Represents an IPv6 socket address."]
2828#[repr(C)]
2829#[derive(Copy, Clone)]
2830pub struct otSockAddr {
2831 #[doc = "< An IPv6 address."]
2832 pub mAddress: otIp6Address,
2833 #[doc = "< A transport-layer port."]
2834 pub mPort: u16,
2835}
2836impl Default for otSockAddr {
2837 fn default() -> Self {
2838 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2839 unsafe {
2840 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2841 s.assume_init()
2842 }
2843 }
2844}
2845#[doc = "< Non-ECT"]
2846pub const OT_ECN_NOT_CAPABLE: _bindgen_ty_8 = 0;
2847#[doc = "< ECT(0)"]
2848pub const OT_ECN_CAPABLE_0: _bindgen_ty_8 = 2;
2849#[doc = "< ECT(1)"]
2850pub const OT_ECN_CAPABLE_1: _bindgen_ty_8 = 1;
2851#[doc = "< Congestion encountered (CE)"]
2852pub const OT_ECN_MARKED: _bindgen_ty_8 = 3;
2853#[doc = " ECN statuses, represented as in the IP header."]
2854pub type _bindgen_ty_8 = ::std::os::raw::c_uint;
2855#[doc = " Represents the local and peer IPv6 socket addresses."]
2856#[repr(C)]
2857#[derive(Copy, Clone)]
2858pub struct otMessageInfo {
2859 #[doc = "< The local IPv6 address."]
2860 pub mSockAddr: otIp6Address,
2861 #[doc = "< The peer IPv6 address."]
2862 pub mPeerAddr: otIp6Address,
2863 #[doc = "< The local transport-layer port."]
2864 pub mSockPort: u16,
2865 #[doc = "< The peer transport-layer port."]
2866 pub mPeerPort: u16,
2867 #[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."]
2868 pub mHopLimit: u8,
2869 pub _bitfield_align_1: [u8; 0],
2870 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
2871}
2872impl Default for otMessageInfo {
2873 fn default() -> Self {
2874 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2875 unsafe {
2876 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2877 s.assume_init()
2878 }
2879 }
2880}
2881impl otMessageInfo {
2882 #[inline]
2883 pub fn mEcn(&self) -> u8 {
2884 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
2885 }
2886 #[inline]
2887 pub fn set_mEcn(&mut self, val: u8) {
2888 unsafe {
2889 let val: u8 = ::std::mem::transmute(val);
2890 self._bitfield_1.set(0usize, 2u8, val as u64)
2891 }
2892 }
2893 #[inline]
2894 pub unsafe fn mEcn_raw(this: *const Self) -> u8 {
2895 unsafe {
2896 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
2897 ::std::ptr::addr_of!((*this)._bitfield_1),
2898 0usize,
2899 2u8,
2900 ) as u8)
2901 }
2902 }
2903 #[inline]
2904 pub unsafe fn set_mEcn_raw(this: *mut Self, val: u8) {
2905 unsafe {
2906 let val: u8 = ::std::mem::transmute(val);
2907 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
2908 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
2909 0usize,
2910 2u8,
2911 val as u64,
2912 )
2913 }
2914 }
2915 #[inline]
2916 pub fn mIsHostInterface(&self) -> bool {
2917 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
2918 }
2919 #[inline]
2920 pub fn set_mIsHostInterface(&mut self, val: bool) {
2921 unsafe {
2922 let val: u8 = ::std::mem::transmute(val);
2923 self._bitfield_1.set(2usize, 1u8, val as u64)
2924 }
2925 }
2926 #[inline]
2927 pub unsafe fn mIsHostInterface_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 2usize,
2932 1u8,
2933 ) as u8)
2934 }
2935 }
2936 #[inline]
2937 pub unsafe fn set_mIsHostInterface_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 2usize,
2943 1u8,
2944 val as u64,
2945 )
2946 }
2947 }
2948 #[inline]
2949 pub fn mAllowZeroHopLimit(&self) -> bool {
2950 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
2951 }
2952 #[inline]
2953 pub fn set_mAllowZeroHopLimit(&mut self, val: bool) {
2954 unsafe {
2955 let val: u8 = ::std::mem::transmute(val);
2956 self._bitfield_1.set(3usize, 1u8, val as u64)
2957 }
2958 }
2959 #[inline]
2960 pub unsafe fn mAllowZeroHopLimit_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 3usize,
2965 1u8,
2966 ) as u8)
2967 }
2968 }
2969 #[inline]
2970 pub unsafe fn set_mAllowZeroHopLimit_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 3usize,
2976 1u8,
2977 val as u64,
2978 )
2979 }
2980 }
2981 #[inline]
2982 pub fn mMulticastLoop(&self) -> bool {
2983 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
2984 }
2985 #[inline]
2986 pub fn set_mMulticastLoop(&mut self, val: bool) {
2987 unsafe {
2988 let val: u8 = ::std::mem::transmute(val);
2989 self._bitfield_1.set(4usize, 1u8, val as u64)
2990 }
2991 }
2992 #[inline]
2993 pub unsafe fn mMulticastLoop_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 4usize,
2998 1u8,
2999 ) as u8)
3000 }
3001 }
3002 #[inline]
3003 pub unsafe fn set_mMulticastLoop_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 4usize,
3009 1u8,
3010 val as u64,
3011 )
3012 }
3013 }
3014 #[inline]
3015 pub fn new_bitfield_1(
3016 mEcn: u8,
3017 mIsHostInterface: bool,
3018 mAllowZeroHopLimit: bool,
3019 mMulticastLoop: bool,
3020 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3021 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3022 __bindgen_bitfield_unit.set(0usize, 2u8, {
3023 let mEcn: u8 = unsafe { ::std::mem::transmute(mEcn) };
3024 mEcn as u64
3025 });
3026 __bindgen_bitfield_unit.set(2usize, 1u8, {
3027 let mIsHostInterface: u8 = unsafe { ::std::mem::transmute(mIsHostInterface) };
3028 mIsHostInterface as u64
3029 });
3030 __bindgen_bitfield_unit.set(3usize, 1u8, {
3031 let mAllowZeroHopLimit: u8 = unsafe { ::std::mem::transmute(mAllowZeroHopLimit) };
3032 mAllowZeroHopLimit as u64
3033 });
3034 __bindgen_bitfield_unit.set(4usize, 1u8, {
3035 let mMulticastLoop: u8 = unsafe { ::std::mem::transmute(mMulticastLoop) };
3036 mMulticastLoop as u64
3037 });
3038 __bindgen_bitfield_unit
3039 }
3040}
3041#[doc = "< IPv6 Hop-by-Hop Option"]
3042pub const OT_IP6_PROTO_HOP_OPTS: _bindgen_ty_9 = 0;
3043#[doc = "< Transmission Control Protocol"]
3044pub const OT_IP6_PROTO_TCP: _bindgen_ty_9 = 6;
3045#[doc = "< User Datagram"]
3046pub const OT_IP6_PROTO_UDP: _bindgen_ty_9 = 17;
3047#[doc = "< IPv6 encapsulation"]
3048pub const OT_IP6_PROTO_IP6: _bindgen_ty_9 = 41;
3049#[doc = "< Routing Header for IPv6"]
3050pub const OT_IP6_PROTO_ROUTING: _bindgen_ty_9 = 43;
3051#[doc = "< Fragment Header for IPv6"]
3052pub const OT_IP6_PROTO_FRAGMENT: _bindgen_ty_9 = 44;
3053#[doc = "< ICMP for IPv6"]
3054pub const OT_IP6_PROTO_ICMP6: _bindgen_ty_9 = 58;
3055#[doc = "< No Next Header for IPv6"]
3056pub const OT_IP6_PROTO_NONE: _bindgen_ty_9 = 59;
3057#[doc = "< Destination Options for IPv6"]
3058pub const OT_IP6_PROTO_DST_OPTS: _bindgen_ty_9 = 60;
3059#[doc = " Internet Protocol Numbers."]
3060pub type _bindgen_ty_9 = ::std::os::raw::c_uint;
3061unsafe extern "C" {
3062 #[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)."]
3063 pub fn otIp6SetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
3064}
3065unsafe extern "C" {
3066 #[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."]
3067 pub fn otIp6IsEnabled(aInstance: *mut otInstance) -> bool;
3068}
3069unsafe extern "C" {
3070 #[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."]
3071 pub fn otIp6AddUnicastAddress(
3072 aInstance: *mut otInstance,
3073 aAddress: *const otNetifAddress,
3074 ) -> otError;
3075}
3076unsafe extern "C" {
3077 #[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."]
3078 pub fn otIp6RemoveUnicastAddress(
3079 aInstance: *mut otInstance,
3080 aAddress: *const otIp6Address,
3081 ) -> otError;
3082}
3083unsafe extern "C" {
3084 #[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."]
3085 pub fn otIp6GetUnicastAddresses(aInstance: *mut otInstance) -> *const otNetifAddress;
3086}
3087unsafe extern "C" {
3088 #[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."]
3089 pub fn otIp6HasUnicastAddress(
3090 aInstance: *mut otInstance,
3091 aAddress: *const otIp6Address,
3092 ) -> bool;
3093}
3094unsafe extern "C" {
3095 #[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."]
3096 pub fn otIp6SubscribeMulticastAddress(
3097 aInstance: *mut otInstance,
3098 aAddress: *const otIp6Address,
3099 ) -> otError;
3100}
3101unsafe extern "C" {
3102 #[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."]
3103 pub fn otIp6UnsubscribeMulticastAddress(
3104 aInstance: *mut otInstance,
3105 aAddress: *const otIp6Address,
3106 ) -> otError;
3107}
3108unsafe extern "C" {
3109 #[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."]
3110 pub fn otIp6GetMulticastAddresses(aInstance: *mut otInstance)
3111 -> *const otNetifMulticastAddress;
3112}
3113unsafe extern "C" {
3114 #[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"]
3115 pub fn otIp6NewMessage(
3116 aInstance: *mut otInstance,
3117 aSettings: *const otMessageSettings,
3118 ) -> *mut otMessage;
3119}
3120unsafe extern "C" {
3121 #[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"]
3122 pub fn otIp6NewMessageFromBuffer(
3123 aInstance: *mut otInstance,
3124 aData: *const u8,
3125 aDataLength: u16,
3126 aSettings: *const otMessageSettings,
3127 ) -> *mut otMessage;
3128}
3129#[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."]
3130pub type otIp6ReceiveCallback = ::std::option::Option<
3131 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
3132>;
3133unsafe extern "C" {
3134 #[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"]
3135 pub fn otIp6SetReceiveCallback(
3136 aInstance: *mut otInstance,
3137 aCallback: otIp6ReceiveCallback,
3138 aCallbackContext: *mut ::std::os::raw::c_void,
3139 );
3140}
3141#[doc = " Represents IPv6 address information."]
3142#[repr(C)]
3143#[derive(Debug, Copy, Clone)]
3144pub struct otIp6AddressInfo {
3145 #[doc = "< A pointer to the IPv6 address."]
3146 pub mAddress: *const otIp6Address,
3147 #[doc = "< The prefix length of mAddress if it is a unicast address."]
3148 pub mPrefixLength: u8,
3149 pub _bitfield_align_1: [u8; 0],
3150 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
3151 pub __bindgen_padding_0: [u16; 3usize],
3152}
3153impl Default for otIp6AddressInfo {
3154 fn default() -> Self {
3155 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
3156 unsafe {
3157 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
3158 s.assume_init()
3159 }
3160 }
3161}
3162impl otIp6AddressInfo {
3163 #[inline]
3164 pub fn mScope(&self) -> u8 {
3165 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
3166 }
3167 #[inline]
3168 pub fn set_mScope(&mut self, val: u8) {
3169 unsafe {
3170 let val: u8 = ::std::mem::transmute(val);
3171 self._bitfield_1.set(0usize, 4u8, val as u64)
3172 }
3173 }
3174 #[inline]
3175 pub unsafe fn mScope_raw(this: *const Self) -> u8 {
3176 unsafe {
3177 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3178 ::std::ptr::addr_of!((*this)._bitfield_1),
3179 0usize,
3180 4u8,
3181 ) as u8)
3182 }
3183 }
3184 #[inline]
3185 pub unsafe fn set_mScope_raw(this: *mut Self, val: u8) {
3186 unsafe {
3187 let val: u8 = ::std::mem::transmute(val);
3188 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3189 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3190 0usize,
3191 4u8,
3192 val as u64,
3193 )
3194 }
3195 }
3196 #[inline]
3197 pub fn mPreferred(&self) -> bool {
3198 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3199 }
3200 #[inline]
3201 pub fn set_mPreferred(&mut self, val: bool) {
3202 unsafe {
3203 let val: u8 = ::std::mem::transmute(val);
3204 self._bitfield_1.set(4usize, 1u8, val as u64)
3205 }
3206 }
3207 #[inline]
3208 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
3209 unsafe {
3210 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3211 ::std::ptr::addr_of!((*this)._bitfield_1),
3212 4usize,
3213 1u8,
3214 ) as u8)
3215 }
3216 }
3217 #[inline]
3218 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
3219 unsafe {
3220 let val: u8 = ::std::mem::transmute(val);
3221 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3222 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3223 4usize,
3224 1u8,
3225 val as u64,
3226 )
3227 }
3228 }
3229 #[inline]
3230 pub fn mMeshLocal(&self) -> bool {
3231 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
3232 }
3233 #[inline]
3234 pub fn set_mMeshLocal(&mut self, val: bool) {
3235 unsafe {
3236 let val: u8 = ::std::mem::transmute(val);
3237 self._bitfield_1.set(5usize, 1u8, val as u64)
3238 }
3239 }
3240 #[inline]
3241 pub unsafe fn mMeshLocal_raw(this: *const Self) -> bool {
3242 unsafe {
3243 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
3244 ::std::ptr::addr_of!((*this)._bitfield_1),
3245 5usize,
3246 1u8,
3247 ) as u8)
3248 }
3249 }
3250 #[inline]
3251 pub unsafe fn set_mMeshLocal_raw(this: *mut Self, val: bool) {
3252 unsafe {
3253 let val: u8 = ::std::mem::transmute(val);
3254 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
3255 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3256 5usize,
3257 1u8,
3258 val as u64,
3259 )
3260 }
3261 }
3262 #[inline]
3263 pub fn new_bitfield_1(
3264 mScope: u8,
3265 mPreferred: bool,
3266 mMeshLocal: bool,
3267 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
3268 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
3269 __bindgen_bitfield_unit.set(0usize, 4u8, {
3270 let mScope: u8 = unsafe { ::std::mem::transmute(mScope) };
3271 mScope as u64
3272 });
3273 __bindgen_bitfield_unit.set(4usize, 1u8, {
3274 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
3275 mPreferred as u64
3276 });
3277 __bindgen_bitfield_unit.set(5usize, 1u8, {
3278 let mMeshLocal: u8 = unsafe { ::std::mem::transmute(mMeshLocal) };
3279 mMeshLocal as u64
3280 });
3281 __bindgen_bitfield_unit
3282 }
3283}
3284#[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."]
3285pub type otIp6AddressCallback = ::std::option::Option<
3286 unsafe extern "C" fn(
3287 aAddressInfo: *const otIp6AddressInfo,
3288 aIsAdded: bool,
3289 aContext: *mut ::std::os::raw::c_void,
3290 ),
3291>;
3292unsafe extern "C" {
3293 #[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."]
3294 pub fn otIp6SetAddressCallback(
3295 aInstance: *mut otInstance,
3296 aCallback: otIp6AddressCallback,
3297 aCallbackContext: *mut ::std::os::raw::c_void,
3298 );
3299}
3300unsafe extern "C" {
3301 #[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"]
3302 pub fn otIp6IsReceiveFilterEnabled(aInstance: *mut otInstance) -> bool;
3303}
3304unsafe extern "C" {
3305 #[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"]
3306 pub fn otIp6SetReceiveFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
3307}
3308unsafe extern "C" {
3309 #[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."]
3310 pub fn otIp6Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
3311}
3312unsafe extern "C" {
3313 #[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."]
3314 pub fn otIp6AddUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3315}
3316unsafe extern "C" {
3317 #[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."]
3318 pub fn otIp6RemoveUnsecurePort(aInstance: *mut otInstance, aPort: u16) -> otError;
3319}
3320unsafe extern "C" {
3321 #[doc = " Removes all ports from the allowed unsecure port list.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3322 pub fn otIp6RemoveAllUnsecurePorts(aInstance: *mut otInstance);
3323}
3324unsafe extern "C" {
3325 #[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."]
3326 pub fn otIp6GetUnsecurePorts(aInstance: *mut otInstance, aNumEntries: *mut u8) -> *const u16;
3327}
3328unsafe extern "C" {
3329 #[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."]
3330 pub fn otIp6IsAddressEqual(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> bool;
3331}
3332unsafe extern "C" {
3333 #[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."]
3334 pub fn otIp6ArePrefixesEqual(aFirst: *const otIp6Prefix, aSecond: *const otIp6Prefix) -> bool;
3335}
3336unsafe extern "C" {
3337 #[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."]
3338 pub fn otIp6AddressFromString(
3339 aString: *const ::std::os::raw::c_char,
3340 aAddress: *mut otIp6Address,
3341 ) -> otError;
3342}
3343unsafe extern "C" {
3344 #[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."]
3345 pub fn otIp6PrefixFromString(
3346 aString: *const ::std::os::raw::c_char,
3347 aPrefix: *mut otIp6Prefix,
3348 ) -> otError;
3349}
3350unsafe extern "C" {
3351 #[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`."]
3352 pub fn otIp6AddressToString(
3353 aAddress: *const otIp6Address,
3354 aBuffer: *mut ::std::os::raw::c_char,
3355 aSize: u16,
3356 );
3357}
3358unsafe extern "C" {
3359 #[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`."]
3360 pub fn otIp6SockAddrToString(
3361 aSockAddr: *const otSockAddr,
3362 aBuffer: *mut ::std::os::raw::c_char,
3363 aSize: u16,
3364 );
3365}
3366unsafe extern "C" {
3367 #[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`."]
3368 pub fn otIp6PrefixToString(
3369 aPrefix: *const otIp6Prefix,
3370 aBuffer: *mut ::std::os::raw::c_char,
3371 aSize: u16,
3372 );
3373}
3374unsafe extern "C" {
3375 #[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."]
3376 pub fn otIp6PrefixMatch(aFirst: *const otIp6Address, aSecond: *const otIp6Address) -> u8;
3377}
3378unsafe extern "C" {
3379 #[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."]
3380 pub fn otIp6GetPrefix(aAddress: *const otIp6Address, aLength: u8, aPrefix: *mut otIp6Prefix);
3381}
3382unsafe extern "C" {
3383 #[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."]
3384 pub fn otIp6IsAddressUnspecified(aAddress: *const otIp6Address) -> bool;
3385}
3386unsafe extern "C" {
3387 #[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."]
3388 pub fn otIp6SelectSourceAddress(
3389 aInstance: *mut otInstance,
3390 aMessageInfo: *mut otMessageInfo,
3391 ) -> otError;
3392}
3393unsafe extern "C" {
3394 #[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."]
3395 pub fn otIp6IsSlaacEnabled(aInstance: *mut otInstance) -> bool;
3396}
3397unsafe extern "C" {
3398 #[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."]
3399 pub fn otIp6SetSlaacEnabled(aInstance: *mut otInstance, aEnabled: bool);
3400}
3401#[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."]
3402pub type otIp6SlaacPrefixFilter = ::std::option::Option<
3403 unsafe extern "C" fn(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix) -> bool,
3404>;
3405unsafe extern "C" {
3406 #[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."]
3407 pub fn otIp6SetSlaacPrefixFilter(aInstance: *mut otInstance, aFilter: otIp6SlaacPrefixFilter);
3408}
3409#[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"]
3410pub type otIp6RegisterMulticastListenersCallback = ::std::option::Option<
3411 unsafe extern "C" fn(
3412 aContext: *mut ::std::os::raw::c_void,
3413 aError: otError,
3414 aMlrStatus: u8,
3415 aFailedAddresses: *const otIp6Address,
3416 aFailedAddressNum: u8,
3417 ),
3418>;
3419unsafe extern "C" {
3420 #[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"]
3421 pub fn otIp6RegisterMulticastListeners(
3422 aInstance: *mut otInstance,
3423 aAddresses: *const otIp6Address,
3424 aAddressNum: u8,
3425 aTimeout: *const u32,
3426 aCallback: otIp6RegisterMulticastListenersCallback,
3427 aContext: *mut ::std::os::raw::c_void,
3428 ) -> otError;
3429}
3430unsafe extern "C" {
3431 #[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."]
3432 pub fn otIp6SetMeshLocalIid(
3433 aInstance: *mut otInstance,
3434 aIid: *const otIp6InterfaceIdentifier,
3435 ) -> otError;
3436}
3437unsafe extern "C" {
3438 #[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."]
3439 pub fn otIp6ProtoToString(aIpProto: u8) -> *const ::std::os::raw::c_char;
3440}
3441#[doc = " Represents the counters for packets and bytes."]
3442#[repr(C)]
3443#[derive(Debug, Default, Copy, Clone)]
3444pub struct otPacketsAndBytes {
3445 #[doc = "< The number of packets."]
3446 pub mPackets: u64,
3447 #[doc = "< The number of bytes."]
3448 pub mBytes: u64,
3449}
3450#[doc = " Represents the counters of packets forwarded via Border Routing."]
3451#[repr(C)]
3452#[derive(Debug, Default, Copy, Clone)]
3453pub struct otBorderRoutingCounters {
3454 #[doc = "< The counters for inbound unicast."]
3455 pub mInboundUnicast: otPacketsAndBytes,
3456 #[doc = "< The counters for inbound multicast."]
3457 pub mInboundMulticast: otPacketsAndBytes,
3458 #[doc = "< The counters for outbound unicast."]
3459 pub mOutboundUnicast: otPacketsAndBytes,
3460 #[doc = "< The counters for outbound multicast."]
3461 pub mOutboundMulticast: otPacketsAndBytes,
3462 #[doc = "< The counters for inbound Internet when DHCPv6 PD enabled."]
3463 pub mInboundInternet: otPacketsAndBytes,
3464 #[doc = "< The counters for outbound Internet when DHCPv6 PD enabled."]
3465 pub mOutboundInternet: otPacketsAndBytes,
3466 #[doc = "< The number of received RA packets."]
3467 pub mRaRx: u32,
3468 #[doc = "< The number of RA packets successfully transmitted."]
3469 pub mRaTxSuccess: u32,
3470 #[doc = "< The number of RA packets failed to transmit."]
3471 pub mRaTxFailure: u32,
3472 #[doc = "< The number of received RS packets."]
3473 pub mRsRx: u32,
3474 #[doc = "< The number of RS packets successfully transmitted."]
3475 pub mRsTxSuccess: u32,
3476 #[doc = "< The number of RS packets failed to transmit."]
3477 pub mRsTxFailure: u32,
3478}
3479unsafe extern "C" {
3480 #[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."]
3481 pub fn otIp6GetBorderRoutingCounters(
3482 aInstance: *mut otInstance,
3483 ) -> *const otBorderRoutingCounters;
3484}
3485unsafe extern "C" {
3486 #[doc = " Resets the Border Routing counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
3487 pub fn otIp6ResetBorderRoutingCounters(aInstance: *mut otInstance);
3488}
3489#[doc = " @struct otNetworkKey\n\n Represents a Thread Network Key."]
3490#[repr(C, packed)]
3491#[derive(Debug, Default, Copy, Clone)]
3492pub struct otNetworkKey {
3493 #[doc = "< Byte values"]
3494 pub m8: [u8; 16usize],
3495}
3496#[doc = " This datatype represents KeyRef to NetworkKey."]
3497pub type otNetworkKeyRef = otCryptoKeyRef;
3498#[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`)."]
3499#[repr(C)]
3500#[derive(Debug, Default, Copy, Clone)]
3501pub struct otNetworkName {
3502 #[doc = "< Byte values. The `+ 1` is for null char."]
3503 pub m8: [::std::os::raw::c_char; 17usize],
3504}
3505#[doc = " Represents an Extended PAN ID."]
3506#[repr(C, packed)]
3507#[derive(Debug, Default, Copy, Clone)]
3508pub struct otExtendedPanId {
3509 #[doc = "< Byte values"]
3510 pub m8: [u8; 8usize],
3511}
3512#[doc = " Represents a Mesh Local Prefix."]
3513pub type otMeshLocalPrefix = otIp6NetworkPrefix;
3514#[doc = " Represents PSKc."]
3515#[repr(C, packed)]
3516#[derive(Debug, Default, Copy, Clone)]
3517pub struct otPskc {
3518 #[doc = "< Byte values"]
3519 pub m8: [u8; 16usize],
3520}
3521#[doc = " This datatype represents KeyRef to PSKc."]
3522pub type otPskcRef = otCryptoKeyRef;
3523#[doc = " Represent Security Policy."]
3524#[repr(C)]
3525#[derive(Debug, Default, Copy, Clone)]
3526pub struct otSecurityPolicy {
3527 #[doc = "< The value for thrKeyRotation in units of hours."]
3528 pub mRotationTime: u16,
3529 pub _bitfield_align_1: [u8; 0],
3530 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
3531}
3532impl otSecurityPolicy {
3533 #[inline]
3534 pub fn mObtainNetworkKeyEnabled(&self) -> bool {
3535 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
3536 }
3537 #[inline]
3538 pub fn set_mObtainNetworkKeyEnabled(&mut self, val: bool) {
3539 unsafe {
3540 let val: u8 = ::std::mem::transmute(val);
3541 self._bitfield_1.set(0usize, 1u8, val as u64)
3542 }
3543 }
3544 #[inline]
3545 pub unsafe fn mObtainNetworkKeyEnabled_raw(this: *const Self) -> bool {
3546 unsafe {
3547 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3548 ::std::ptr::addr_of!((*this)._bitfield_1),
3549 0usize,
3550 1u8,
3551 ) as u8)
3552 }
3553 }
3554 #[inline]
3555 pub unsafe fn set_mObtainNetworkKeyEnabled_raw(this: *mut Self, val: bool) {
3556 unsafe {
3557 let val: u8 = ::std::mem::transmute(val);
3558 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3559 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3560 0usize,
3561 1u8,
3562 val as u64,
3563 )
3564 }
3565 }
3566 #[inline]
3567 pub fn mNativeCommissioningEnabled(&self) -> bool {
3568 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
3569 }
3570 #[inline]
3571 pub fn set_mNativeCommissioningEnabled(&mut self, val: bool) {
3572 unsafe {
3573 let val: u8 = ::std::mem::transmute(val);
3574 self._bitfield_1.set(1usize, 1u8, val as u64)
3575 }
3576 }
3577 #[inline]
3578 pub unsafe fn mNativeCommissioningEnabled_raw(this: *const Self) -> bool {
3579 unsafe {
3580 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3581 ::std::ptr::addr_of!((*this)._bitfield_1),
3582 1usize,
3583 1u8,
3584 ) as u8)
3585 }
3586 }
3587 #[inline]
3588 pub unsafe fn set_mNativeCommissioningEnabled_raw(this: *mut Self, val: bool) {
3589 unsafe {
3590 let val: u8 = ::std::mem::transmute(val);
3591 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3592 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3593 1usize,
3594 1u8,
3595 val as u64,
3596 )
3597 }
3598 }
3599 #[inline]
3600 pub fn mRoutersEnabled(&self) -> bool {
3601 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
3602 }
3603 #[inline]
3604 pub fn set_mRoutersEnabled(&mut self, val: bool) {
3605 unsafe {
3606 let val: u8 = ::std::mem::transmute(val);
3607 self._bitfield_1.set(2usize, 1u8, val as u64)
3608 }
3609 }
3610 #[inline]
3611 pub unsafe fn mRoutersEnabled_raw(this: *const Self) -> bool {
3612 unsafe {
3613 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3614 ::std::ptr::addr_of!((*this)._bitfield_1),
3615 2usize,
3616 1u8,
3617 ) as u8)
3618 }
3619 }
3620 #[inline]
3621 pub unsafe fn set_mRoutersEnabled_raw(this: *mut Self, val: bool) {
3622 unsafe {
3623 let val: u8 = ::std::mem::transmute(val);
3624 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3625 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3626 2usize,
3627 1u8,
3628 val as u64,
3629 )
3630 }
3631 }
3632 #[inline]
3633 pub fn mExternalCommissioningEnabled(&self) -> bool {
3634 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
3635 }
3636 #[inline]
3637 pub fn set_mExternalCommissioningEnabled(&mut self, val: bool) {
3638 unsafe {
3639 let val: u8 = ::std::mem::transmute(val);
3640 self._bitfield_1.set(3usize, 1u8, val as u64)
3641 }
3642 }
3643 #[inline]
3644 pub unsafe fn mExternalCommissioningEnabled_raw(this: *const Self) -> bool {
3645 unsafe {
3646 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3647 ::std::ptr::addr_of!((*this)._bitfield_1),
3648 3usize,
3649 1u8,
3650 ) as u8)
3651 }
3652 }
3653 #[inline]
3654 pub unsafe fn set_mExternalCommissioningEnabled_raw(this: *mut Self, val: bool) {
3655 unsafe {
3656 let val: u8 = ::std::mem::transmute(val);
3657 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3658 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3659 3usize,
3660 1u8,
3661 val as u64,
3662 )
3663 }
3664 }
3665 #[inline]
3666 pub fn mCommercialCommissioningEnabled(&self) -> bool {
3667 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
3668 }
3669 #[inline]
3670 pub fn set_mCommercialCommissioningEnabled(&mut self, val: bool) {
3671 unsafe {
3672 let val: u8 = ::std::mem::transmute(val);
3673 self._bitfield_1.set(4usize, 1u8, val as u64)
3674 }
3675 }
3676 #[inline]
3677 pub unsafe fn mCommercialCommissioningEnabled_raw(this: *const Self) -> bool {
3678 unsafe {
3679 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3680 ::std::ptr::addr_of!((*this)._bitfield_1),
3681 4usize,
3682 1u8,
3683 ) as u8)
3684 }
3685 }
3686 #[inline]
3687 pub unsafe fn set_mCommercialCommissioningEnabled_raw(this: *mut Self, val: bool) {
3688 unsafe {
3689 let val: u8 = ::std::mem::transmute(val);
3690 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3691 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3692 4usize,
3693 1u8,
3694 val as u64,
3695 )
3696 }
3697 }
3698 #[inline]
3699 pub fn mAutonomousEnrollmentEnabled(&self) -> bool {
3700 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
3701 }
3702 #[inline]
3703 pub fn set_mAutonomousEnrollmentEnabled(&mut self, val: bool) {
3704 unsafe {
3705 let val: u8 = ::std::mem::transmute(val);
3706 self._bitfield_1.set(5usize, 1u8, val as u64)
3707 }
3708 }
3709 #[inline]
3710 pub unsafe fn mAutonomousEnrollmentEnabled_raw(this: *const Self) -> bool {
3711 unsafe {
3712 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3713 ::std::ptr::addr_of!((*this)._bitfield_1),
3714 5usize,
3715 1u8,
3716 ) as u8)
3717 }
3718 }
3719 #[inline]
3720 pub unsafe fn set_mAutonomousEnrollmentEnabled_raw(this: *mut Self, val: bool) {
3721 unsafe {
3722 let val: u8 = ::std::mem::transmute(val);
3723 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3724 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3725 5usize,
3726 1u8,
3727 val as u64,
3728 )
3729 }
3730 }
3731 #[inline]
3732 pub fn mNetworkKeyProvisioningEnabled(&self) -> bool {
3733 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
3734 }
3735 #[inline]
3736 pub fn set_mNetworkKeyProvisioningEnabled(&mut self, val: bool) {
3737 unsafe {
3738 let val: u8 = ::std::mem::transmute(val);
3739 self._bitfield_1.set(6usize, 1u8, val as u64)
3740 }
3741 }
3742 #[inline]
3743 pub unsafe fn mNetworkKeyProvisioningEnabled_raw(this: *const Self) -> bool {
3744 unsafe {
3745 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3746 ::std::ptr::addr_of!((*this)._bitfield_1),
3747 6usize,
3748 1u8,
3749 ) as u8)
3750 }
3751 }
3752 #[inline]
3753 pub unsafe fn set_mNetworkKeyProvisioningEnabled_raw(this: *mut Self, val: bool) {
3754 unsafe {
3755 let val: u8 = ::std::mem::transmute(val);
3756 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3757 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3758 6usize,
3759 1u8,
3760 val as u64,
3761 )
3762 }
3763 }
3764 #[inline]
3765 pub fn mTobleLinkEnabled(&self) -> bool {
3766 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
3767 }
3768 #[inline]
3769 pub fn set_mTobleLinkEnabled(&mut self, val: bool) {
3770 unsafe {
3771 let val: u8 = ::std::mem::transmute(val);
3772 self._bitfield_1.set(7usize, 1u8, val as u64)
3773 }
3774 }
3775 #[inline]
3776 pub unsafe fn mTobleLinkEnabled_raw(this: *const Self) -> bool {
3777 unsafe {
3778 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3779 ::std::ptr::addr_of!((*this)._bitfield_1),
3780 7usize,
3781 1u8,
3782 ) as u8)
3783 }
3784 }
3785 #[inline]
3786 pub unsafe fn set_mTobleLinkEnabled_raw(this: *mut Self, val: bool) {
3787 unsafe {
3788 let val: u8 = ::std::mem::transmute(val);
3789 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3790 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3791 7usize,
3792 1u8,
3793 val as u64,
3794 )
3795 }
3796 }
3797 #[inline]
3798 pub fn mNonCcmRoutersEnabled(&self) -> bool {
3799 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
3800 }
3801 #[inline]
3802 pub fn set_mNonCcmRoutersEnabled(&mut self, val: bool) {
3803 unsafe {
3804 let val: u8 = ::std::mem::transmute(val);
3805 self._bitfield_1.set(8usize, 1u8, val as u64)
3806 }
3807 }
3808 #[inline]
3809 pub unsafe fn mNonCcmRoutersEnabled_raw(this: *const Self) -> bool {
3810 unsafe {
3811 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3812 ::std::ptr::addr_of!((*this)._bitfield_1),
3813 8usize,
3814 1u8,
3815 ) as u8)
3816 }
3817 }
3818 #[inline]
3819 pub unsafe fn set_mNonCcmRoutersEnabled_raw(this: *mut Self, val: bool) {
3820 unsafe {
3821 let val: u8 = ::std::mem::transmute(val);
3822 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3823 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3824 8usize,
3825 1u8,
3826 val as u64,
3827 )
3828 }
3829 }
3830 #[inline]
3831 pub fn mVersionThresholdForRouting(&self) -> u8 {
3832 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 3u8) as u8) }
3833 }
3834 #[inline]
3835 pub fn set_mVersionThresholdForRouting(&mut self, val: u8) {
3836 unsafe {
3837 let val: u8 = ::std::mem::transmute(val);
3838 self._bitfield_1.set(9usize, 3u8, val as u64)
3839 }
3840 }
3841 #[inline]
3842 pub unsafe fn mVersionThresholdForRouting_raw(this: *const Self) -> u8 {
3843 unsafe {
3844 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
3845 ::std::ptr::addr_of!((*this)._bitfield_1),
3846 9usize,
3847 3u8,
3848 ) as u8)
3849 }
3850 }
3851 #[inline]
3852 pub unsafe fn set_mVersionThresholdForRouting_raw(this: *mut Self, val: u8) {
3853 unsafe {
3854 let val: u8 = ::std::mem::transmute(val);
3855 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
3856 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
3857 9usize,
3858 3u8,
3859 val as u64,
3860 )
3861 }
3862 }
3863 #[inline]
3864 pub fn new_bitfield_1(
3865 mObtainNetworkKeyEnabled: bool,
3866 mNativeCommissioningEnabled: bool,
3867 mRoutersEnabled: bool,
3868 mExternalCommissioningEnabled: bool,
3869 mCommercialCommissioningEnabled: bool,
3870 mAutonomousEnrollmentEnabled: bool,
3871 mNetworkKeyProvisioningEnabled: bool,
3872 mTobleLinkEnabled: bool,
3873 mNonCcmRoutersEnabled: bool,
3874 mVersionThresholdForRouting: u8,
3875 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
3876 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
3877 __bindgen_bitfield_unit.set(0usize, 1u8, {
3878 let mObtainNetworkKeyEnabled: u8 =
3879 unsafe { ::std::mem::transmute(mObtainNetworkKeyEnabled) };
3880 mObtainNetworkKeyEnabled as u64
3881 });
3882 __bindgen_bitfield_unit.set(1usize, 1u8, {
3883 let mNativeCommissioningEnabled: u8 =
3884 unsafe { ::std::mem::transmute(mNativeCommissioningEnabled) };
3885 mNativeCommissioningEnabled as u64
3886 });
3887 __bindgen_bitfield_unit.set(2usize, 1u8, {
3888 let mRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mRoutersEnabled) };
3889 mRoutersEnabled as u64
3890 });
3891 __bindgen_bitfield_unit.set(3usize, 1u8, {
3892 let mExternalCommissioningEnabled: u8 =
3893 unsafe { ::std::mem::transmute(mExternalCommissioningEnabled) };
3894 mExternalCommissioningEnabled as u64
3895 });
3896 __bindgen_bitfield_unit.set(4usize, 1u8, {
3897 let mCommercialCommissioningEnabled: u8 =
3898 unsafe { ::std::mem::transmute(mCommercialCommissioningEnabled) };
3899 mCommercialCommissioningEnabled as u64
3900 });
3901 __bindgen_bitfield_unit.set(5usize, 1u8, {
3902 let mAutonomousEnrollmentEnabled: u8 =
3903 unsafe { ::std::mem::transmute(mAutonomousEnrollmentEnabled) };
3904 mAutonomousEnrollmentEnabled as u64
3905 });
3906 __bindgen_bitfield_unit.set(6usize, 1u8, {
3907 let mNetworkKeyProvisioningEnabled: u8 =
3908 unsafe { ::std::mem::transmute(mNetworkKeyProvisioningEnabled) };
3909 mNetworkKeyProvisioningEnabled as u64
3910 });
3911 __bindgen_bitfield_unit.set(7usize, 1u8, {
3912 let mTobleLinkEnabled: u8 = unsafe { ::std::mem::transmute(mTobleLinkEnabled) };
3913 mTobleLinkEnabled as u64
3914 });
3915 __bindgen_bitfield_unit.set(8usize, 1u8, {
3916 let mNonCcmRoutersEnabled: u8 = unsafe { ::std::mem::transmute(mNonCcmRoutersEnabled) };
3917 mNonCcmRoutersEnabled as u64
3918 });
3919 __bindgen_bitfield_unit.set(9usize, 3u8, {
3920 let mVersionThresholdForRouting: u8 =
3921 unsafe { ::std::mem::transmute(mVersionThresholdForRouting) };
3922 mVersionThresholdForRouting as u64
3923 });
3924 __bindgen_bitfield_unit
3925 }
3926}
3927#[doc = " Represents Channel Mask."]
3928pub type otChannelMask = u32;
3929#[doc = " Represents presence of different components in Active or Pending Operational Dataset."]
3930#[repr(C)]
3931#[derive(Debug, Default, Copy, Clone)]
3932pub struct otOperationalDatasetComponents {
3933 #[doc = "< TRUE if Active Timestamp is present, FALSE otherwise."]
3934 pub mIsActiveTimestampPresent: bool,
3935 #[doc = "< TRUE if Pending Timestamp is present, FALSE otherwise."]
3936 pub mIsPendingTimestampPresent: bool,
3937 #[doc = "< TRUE if Network Key is present, FALSE otherwise."]
3938 pub mIsNetworkKeyPresent: bool,
3939 #[doc = "< TRUE if Network Name is present, FALSE otherwise."]
3940 pub mIsNetworkNamePresent: bool,
3941 #[doc = "< TRUE if Extended PAN ID is present, FALSE otherwise."]
3942 pub mIsExtendedPanIdPresent: bool,
3943 #[doc = "< TRUE if Mesh Local Prefix is present, FALSE otherwise."]
3944 pub mIsMeshLocalPrefixPresent: bool,
3945 #[doc = "< TRUE if Delay Timer is present, FALSE otherwise."]
3946 pub mIsDelayPresent: bool,
3947 #[doc = "< TRUE if PAN ID is present, FALSE otherwise."]
3948 pub mIsPanIdPresent: bool,
3949 #[doc = "< TRUE if Channel is present, FALSE otherwise."]
3950 pub mIsChannelPresent: bool,
3951 #[doc = "< TRUE if PSKc is present, FALSE otherwise."]
3952 pub mIsPskcPresent: bool,
3953 #[doc = "< TRUE if Security Policy is present, FALSE otherwise."]
3954 pub mIsSecurityPolicyPresent: bool,
3955 #[doc = "< TRUE if Channel Mask is present, FALSE otherwise."]
3956 pub mIsChannelMaskPresent: bool,
3957 #[doc = "< TRUE if Wake-up Channel is present, FALSE otherwise."]
3958 pub mIsWakeupChannelPresent: bool,
3959}
3960#[doc = " Represents a Thread Dataset timestamp component."]
3961#[repr(C)]
3962#[derive(Debug, Default, Copy, Clone)]
3963pub struct otTimestamp {
3964 pub mSeconds: u64,
3965 pub mTicks: u16,
3966 pub mAuthoritative: bool,
3967}
3968#[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."]
3969#[repr(C)]
3970#[derive(Debug, Default, Copy, Clone)]
3971pub struct otOperationalDataset {
3972 #[doc = "< Active Timestamp"]
3973 pub mActiveTimestamp: otTimestamp,
3974 #[doc = "< Pending Timestamp"]
3975 pub mPendingTimestamp: otTimestamp,
3976 #[doc = "< Network Key"]
3977 pub mNetworkKey: otNetworkKey,
3978 #[doc = "< Network Name"]
3979 pub mNetworkName: otNetworkName,
3980 #[doc = "< Extended PAN ID"]
3981 pub mExtendedPanId: otExtendedPanId,
3982 #[doc = "< Mesh Local Prefix"]
3983 pub mMeshLocalPrefix: otMeshLocalPrefix,
3984 #[doc = "< Delay Timer"]
3985 pub mDelay: u32,
3986 #[doc = "< PAN ID"]
3987 pub mPanId: otPanId,
3988 #[doc = "< Channel"]
3989 pub mChannel: u16,
3990 #[doc = "< Wake-up Channel"]
3991 pub mWakeupChannel: u16,
3992 #[doc = "< PSKc"]
3993 pub mPskc: otPskc,
3994 #[doc = "< Security Policy"]
3995 pub mSecurityPolicy: otSecurityPolicy,
3996 #[doc = "< Channel Mask"]
3997 pub mChannelMask: otChannelMask,
3998 #[doc = "< Specifies which components are set in the Dataset."]
3999 pub mComponents: otOperationalDatasetComponents,
4000}
4001#[doc = " Represents an Active or Pending Operational Dataset.\n\n The Operational Dataset is TLV encoded as specified by Thread."]
4002#[repr(C)]
4003#[derive(Debug, Copy, Clone)]
4004pub struct otOperationalDatasetTlvs {
4005 #[doc = "< Operational Dataset TLVs."]
4006 pub mTlvs: [u8; 254usize],
4007 #[doc = "< Size of Operational Dataset in bytes."]
4008 pub mLength: u8,
4009}
4010impl Default for otOperationalDatasetTlvs {
4011 fn default() -> Self {
4012 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4013 unsafe {
4014 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4015 s.assume_init()
4016 }
4017 }
4018}
4019#[doc = "< meshcop Channel TLV"]
4020pub const OT_MESHCOP_TLV_CHANNEL: otMeshcopTlvType = 0;
4021#[doc = "< meshcop Pan Id TLV"]
4022pub const OT_MESHCOP_TLV_PANID: otMeshcopTlvType = 1;
4023#[doc = "< meshcop Extended Pan Id TLV"]
4024pub const OT_MESHCOP_TLV_EXTPANID: otMeshcopTlvType = 2;
4025#[doc = "< meshcop Network Name TLV"]
4026pub const OT_MESHCOP_TLV_NETWORKNAME: otMeshcopTlvType = 3;
4027#[doc = "< meshcop PSKc TLV"]
4028pub const OT_MESHCOP_TLV_PSKC: otMeshcopTlvType = 4;
4029#[doc = "< meshcop Network Key TLV"]
4030pub const OT_MESHCOP_TLV_NETWORKKEY: otMeshcopTlvType = 5;
4031#[doc = "< meshcop Network Key Sequence TLV"]
4032pub const OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE: otMeshcopTlvType = 6;
4033#[doc = "< meshcop Mesh Local Prefix TLV"]
4034pub const OT_MESHCOP_TLV_MESHLOCALPREFIX: otMeshcopTlvType = 7;
4035#[doc = "< meshcop Steering Data TLV"]
4036pub const OT_MESHCOP_TLV_STEERING_DATA: otMeshcopTlvType = 8;
4037#[doc = "< meshcop Border Agent Locator TLV"]
4038pub const OT_MESHCOP_TLV_BORDER_AGENT_RLOC: otMeshcopTlvType = 9;
4039#[doc = "< meshcop Commissioner ID TLV"]
4040pub const OT_MESHCOP_TLV_COMMISSIONER_ID: otMeshcopTlvType = 10;
4041#[doc = "< meshcop Commissioner Session ID TLV"]
4042pub const OT_MESHCOP_TLV_COMM_SESSION_ID: otMeshcopTlvType = 11;
4043#[doc = "< meshcop Security Policy TLV"]
4044pub const OT_MESHCOP_TLV_SECURITYPOLICY: otMeshcopTlvType = 12;
4045#[doc = "< meshcop Get TLV"]
4046pub const OT_MESHCOP_TLV_GET: otMeshcopTlvType = 13;
4047#[doc = "< meshcop Active Timestamp TLV"]
4048pub const OT_MESHCOP_TLV_ACTIVETIMESTAMP: otMeshcopTlvType = 14;
4049#[doc = "< meshcop Commissioner UDP Port TLV"]
4050pub const OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT: otMeshcopTlvType = 15;
4051#[doc = "< meshcop State TLV"]
4052pub const OT_MESHCOP_TLV_STATE: otMeshcopTlvType = 16;
4053#[doc = "< meshcop Joiner DTLS Encapsulation TLV"]
4054pub const OT_MESHCOP_TLV_JOINER_DTLS: otMeshcopTlvType = 17;
4055#[doc = "< meshcop Joiner UDP Port TLV"]
4056pub const OT_MESHCOP_TLV_JOINER_UDP_PORT: otMeshcopTlvType = 18;
4057#[doc = "< meshcop Joiner IID TLV"]
4058pub const OT_MESHCOP_TLV_JOINER_IID: otMeshcopTlvType = 19;
4059#[doc = "< meshcop Joiner Router Locator TLV"]
4060pub const OT_MESHCOP_TLV_JOINER_RLOC: otMeshcopTlvType = 20;
4061#[doc = "< meshcop Joiner Router KEK TLV"]
4062pub const OT_MESHCOP_TLV_JOINER_ROUTER_KEK: otMeshcopTlvType = 21;
4063#[doc = "< meshcop Provisioning URL TLV"]
4064pub const OT_MESHCOP_TLV_PROVISIONING_URL: otMeshcopTlvType = 32;
4065#[doc = "< meshcop Vendor Name TLV"]
4066pub const OT_MESHCOP_TLV_VENDOR_NAME_TLV: otMeshcopTlvType = 33;
4067#[doc = "< meshcop Vendor Model TLV"]
4068pub const OT_MESHCOP_TLV_VENDOR_MODEL_TLV: otMeshcopTlvType = 34;
4069#[doc = "< meshcop Vendor SW Version TLV"]
4070pub const OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV: otMeshcopTlvType = 35;
4071#[doc = "< meshcop Vendor Data TLV"]
4072pub const OT_MESHCOP_TLV_VENDOR_DATA_TLV: otMeshcopTlvType = 36;
4073#[doc = "< meshcop Vendor Stack Version TLV"]
4074pub const OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV: otMeshcopTlvType = 37;
4075#[doc = "< meshcop UDP encapsulation TLV"]
4076pub const OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV: otMeshcopTlvType = 48;
4077#[doc = "< meshcop IPv6 address TLV"]
4078pub const OT_MESHCOP_TLV_IPV6_ADDRESS_TLV: otMeshcopTlvType = 49;
4079#[doc = "< meshcop Pending Timestamp TLV"]
4080pub const OT_MESHCOP_TLV_PENDINGTIMESTAMP: otMeshcopTlvType = 51;
4081#[doc = "< meshcop Delay Timer TLV"]
4082pub const OT_MESHCOP_TLV_DELAYTIMER: otMeshcopTlvType = 52;
4083#[doc = "< meshcop Channel Mask TLV"]
4084pub const OT_MESHCOP_TLV_CHANNELMASK: otMeshcopTlvType = 53;
4085#[doc = "< meshcop Count TLV"]
4086pub const OT_MESHCOP_TLV_COUNT: otMeshcopTlvType = 54;
4087#[doc = "< meshcop Period TLV"]
4088pub const OT_MESHCOP_TLV_PERIOD: otMeshcopTlvType = 55;
4089#[doc = "< meshcop Scan Duration TLV"]
4090pub const OT_MESHCOP_TLV_SCAN_DURATION: otMeshcopTlvType = 56;
4091#[doc = "< meshcop Energy List TLV"]
4092pub const OT_MESHCOP_TLV_ENERGY_LIST: otMeshcopTlvType = 57;
4093#[doc = "< meshcop Thread Domain Name TLV"]
4094pub const OT_MESHCOP_TLV_THREAD_DOMAIN_NAME: otMeshcopTlvType = 59;
4095#[doc = "< meshcop Wake-up Channel TLV"]
4096pub const OT_MESHCOP_TLV_WAKEUP_CHANNEL: otMeshcopTlvType = 74;
4097#[doc = "< meshcop Discovery Request TLV"]
4098pub const OT_MESHCOP_TLV_DISCOVERYREQUEST: otMeshcopTlvType = 128;
4099#[doc = "< meshcop Discovery Response TLV"]
4100pub const OT_MESHCOP_TLV_DISCOVERYRESPONSE: otMeshcopTlvType = 129;
4101#[doc = "< meshcop Joiner Advertisement TLV"]
4102pub const OT_MESHCOP_TLV_JOINERADVERTISEMENT: otMeshcopTlvType = 241;
4103#[doc = " Represents meshcop TLV types."]
4104pub type otMeshcopTlvType = ::std::os::raw::c_uint;
4105#[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."]
4106pub type otDatasetMgmtSetCallback = ::std::option::Option<
4107 unsafe extern "C" fn(aResult: otError, aContext: *mut ::std::os::raw::c_void),
4108>;
4109unsafe extern "C" {
4110 #[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."]
4111 pub fn otDatasetIsCommissioned(aInstance: *mut otInstance) -> bool;
4112}
4113unsafe extern "C" {
4114 #[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."]
4115 pub fn otDatasetGetActive(
4116 aInstance: *mut otInstance,
4117 aDataset: *mut otOperationalDataset,
4118 ) -> otError;
4119}
4120unsafe extern "C" {
4121 #[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."]
4122 pub fn otDatasetGetActiveTlvs(
4123 aInstance: *mut otInstance,
4124 aDataset: *mut otOperationalDatasetTlvs,
4125 ) -> otError;
4126}
4127unsafe extern "C" {
4128 #[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."]
4129 pub fn otDatasetSetActive(
4130 aInstance: *mut otInstance,
4131 aDataset: *const otOperationalDataset,
4132 ) -> otError;
4133}
4134unsafe extern "C" {
4135 #[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."]
4136 pub fn otDatasetSetActiveTlvs(
4137 aInstance: *mut otInstance,
4138 aDataset: *const otOperationalDatasetTlvs,
4139 ) -> otError;
4140}
4141unsafe extern "C" {
4142 #[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."]
4143 pub fn otDatasetGetPending(
4144 aInstance: *mut otInstance,
4145 aDataset: *mut otOperationalDataset,
4146 ) -> otError;
4147}
4148unsafe extern "C" {
4149 #[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."]
4150 pub fn otDatasetGetPendingTlvs(
4151 aInstance: *mut otInstance,
4152 aDataset: *mut otOperationalDatasetTlvs,
4153 ) -> otError;
4154}
4155unsafe extern "C" {
4156 #[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."]
4157 pub fn otDatasetSetPending(
4158 aInstance: *mut otInstance,
4159 aDataset: *const otOperationalDataset,
4160 ) -> otError;
4161}
4162unsafe extern "C" {
4163 #[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."]
4164 pub fn otDatasetSetPendingTlvs(
4165 aInstance: *mut otInstance,
4166 aDataset: *const otOperationalDatasetTlvs,
4167 ) -> otError;
4168}
4169unsafe extern "C" {
4170 #[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."]
4171 pub fn otDatasetSendMgmtActiveGet(
4172 aInstance: *mut otInstance,
4173 aDatasetComponents: *const otOperationalDatasetComponents,
4174 aTlvTypes: *const u8,
4175 aLength: u8,
4176 aAddress: *const otIp6Address,
4177 ) -> otError;
4178}
4179unsafe extern "C" {
4180 #[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."]
4181 pub fn otDatasetSendMgmtActiveSet(
4182 aInstance: *mut otInstance,
4183 aDataset: *const otOperationalDataset,
4184 aTlvs: *const u8,
4185 aLength: u8,
4186 aCallback: otDatasetMgmtSetCallback,
4187 aContext: *mut ::std::os::raw::c_void,
4188 ) -> otError;
4189}
4190unsafe extern "C" {
4191 #[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."]
4192 pub fn otDatasetSendMgmtPendingGet(
4193 aInstance: *mut otInstance,
4194 aDatasetComponents: *const otOperationalDatasetComponents,
4195 aTlvTypes: *const u8,
4196 aLength: u8,
4197 aAddress: *const otIp6Address,
4198 ) -> otError;
4199}
4200unsafe extern "C" {
4201 #[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."]
4202 pub fn otDatasetSendMgmtPendingSet(
4203 aInstance: *mut otInstance,
4204 aDataset: *const otOperationalDataset,
4205 aTlvs: *const u8,
4206 aLength: u8,
4207 aCallback: otDatasetMgmtSetCallback,
4208 aContext: *mut ::std::os::raw::c_void,
4209 ) -> otError;
4210}
4211unsafe extern "C" {
4212 #[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."]
4213 pub fn otDatasetGeneratePskc(
4214 aPassPhrase: *const ::std::os::raw::c_char,
4215 aNetworkName: *const otNetworkName,
4216 aExtPanId: *const otExtendedPanId,
4217 aPskc: *mut otPskc,
4218 ) -> otError;
4219}
4220unsafe extern "C" {
4221 #[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)."]
4222 pub fn otNetworkNameFromString(
4223 aNetworkName: *mut otNetworkName,
4224 aNameString: *const ::std::os::raw::c_char,
4225 ) -> otError;
4226}
4227unsafe extern "C" {
4228 #[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`."]
4229 pub fn otDatasetParseTlvs(
4230 aDatasetTlvs: *const otOperationalDatasetTlvs,
4231 aDataset: *mut otOperationalDataset,
4232 ) -> otError;
4233}
4234unsafe extern "C" {
4235 #[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."]
4236 pub fn otDatasetConvertToTlvs(
4237 aDataset: *const otOperationalDataset,
4238 aDatasetTlvs: *mut otOperationalDatasetTlvs,
4239 );
4240}
4241unsafe extern "C" {
4242 #[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."]
4243 pub fn otDatasetUpdateTlvs(
4244 aDataset: *const otOperationalDataset,
4245 aDatasetTlvs: *mut otOperationalDatasetTlvs,
4246 ) -> otError;
4247}
4248pub const OT_JOINER_STATE_IDLE: otJoinerState = 0;
4249pub const OT_JOINER_STATE_DISCOVER: otJoinerState = 1;
4250pub const OT_JOINER_STATE_CONNECT: otJoinerState = 2;
4251pub const OT_JOINER_STATE_CONNECTED: otJoinerState = 3;
4252pub const OT_JOINER_STATE_ENTRUST: otJoinerState = 4;
4253pub const OT_JOINER_STATE_JOINED: otJoinerState = 5;
4254#[doc = " Defines the Joiner State."]
4255pub type otJoinerState = ::std::os::raw::c_uint;
4256#[doc = " Represents a Joiner Discerner."]
4257#[repr(C)]
4258#[derive(Debug, Default, Copy, Clone)]
4259pub struct otJoinerDiscerner {
4260 #[doc = "< Discerner value (the lowest `mLength` bits specify the discerner)."]
4261 pub mValue: u64,
4262 #[doc = "< Length (number of bits) - must be non-zero and at most `OT_JOINER_MAX_DISCERNER_LENGTH`."]
4263 pub mLength: u8,
4264}
4265#[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."]
4266pub type otJoinerCallback = ::std::option::Option<
4267 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
4268>;
4269unsafe extern "C" {
4270 #[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."]
4271 pub fn otJoinerStart(
4272 aInstance: *mut otInstance,
4273 aPskd: *const ::std::os::raw::c_char,
4274 aProvisioningUrl: *const ::std::os::raw::c_char,
4275 aVendorName: *const ::std::os::raw::c_char,
4276 aVendorModel: *const ::std::os::raw::c_char,
4277 aVendorSwVersion: *const ::std::os::raw::c_char,
4278 aVendorData: *const ::std::os::raw::c_char,
4279 aCallback: otJoinerCallback,
4280 aContext: *mut ::std::os::raw::c_void,
4281 ) -> otError;
4282}
4283unsafe extern "C" {
4284 #[doc = " Disables the Thread Joiner role.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
4285 pub fn otJoinerStop(aInstance: *mut otInstance);
4286}
4287unsafe extern "C" {
4288 #[doc = " Gets the Joiner State.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The joiner state."]
4289 pub fn otJoinerGetState(aInstance: *mut otInstance) -> otJoinerState;
4290}
4291unsafe extern "C" {
4292 #[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."]
4293 pub fn otJoinerGetId(aInstance: *mut otInstance) -> *const otExtAddress;
4294}
4295unsafe extern "C" {
4296 #[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."]
4297 pub fn otJoinerSetDiscerner(
4298 aInstance: *mut otInstance,
4299 aDiscerner: *mut otJoinerDiscerner,
4300 ) -> otError;
4301}
4302unsafe extern "C" {
4303 #[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."]
4304 pub fn otJoinerGetDiscerner(aInstance: *mut otInstance) -> *const otJoinerDiscerner;
4305}
4306unsafe extern "C" {
4307 #[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."]
4308 pub fn otJoinerStateToString(aState: otJoinerState) -> *const ::std::os::raw::c_char;
4309}
4310#[doc = "< Commissioner role is disabled."]
4311pub const OT_COMMISSIONER_STATE_DISABLED: otCommissionerState = 0;
4312#[doc = "< Currently petitioning to become a Commissioner."]
4313pub const OT_COMMISSIONER_STATE_PETITION: otCommissionerState = 1;
4314#[doc = "< Commissioner role is active."]
4315pub const OT_COMMISSIONER_STATE_ACTIVE: otCommissionerState = 2;
4316#[doc = " Defines the Commissioner State."]
4317pub type otCommissionerState = ::std::os::raw::c_uint;
4318pub const OT_COMMISSIONER_JOINER_START: otCommissionerJoinerEvent = 0;
4319pub const OT_COMMISSIONER_JOINER_CONNECTED: otCommissionerJoinerEvent = 1;
4320pub const OT_COMMISSIONER_JOINER_FINALIZE: otCommissionerJoinerEvent = 2;
4321pub const OT_COMMISSIONER_JOINER_END: otCommissionerJoinerEvent = 3;
4322pub const OT_COMMISSIONER_JOINER_REMOVED: otCommissionerJoinerEvent = 4;
4323#[doc = " Defines a Joiner Event on the Commissioner."]
4324pub type otCommissionerJoinerEvent = ::std::os::raw::c_uint;
4325#[doc = " Represents the steering data."]
4326#[repr(C)]
4327#[derive(Debug, Default, Copy, Clone)]
4328pub struct otSteeringData {
4329 #[doc = "< Length of steering data (bytes)"]
4330 pub mLength: u8,
4331 #[doc = "< Byte values"]
4332 pub m8: [u8; 16usize],
4333}
4334#[doc = " Represents a Commissioning Dataset."]
4335#[repr(C)]
4336#[derive(Debug, Default, Copy, Clone)]
4337pub struct otCommissioningDataset {
4338 #[doc = "< Border Router RLOC16"]
4339 pub mLocator: u16,
4340 #[doc = "< Commissioner Session Id"]
4341 pub mSessionId: u16,
4342 #[doc = "< Steering Data"]
4343 pub mSteeringData: otSteeringData,
4344 #[doc = "< Joiner UDP Port"]
4345 pub mJoinerUdpPort: u16,
4346 pub _bitfield_align_1: [u8; 0],
4347 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
4348 pub __bindgen_padding_0: u8,
4349}
4350impl otCommissioningDataset {
4351 #[inline]
4352 pub fn mIsLocatorSet(&self) -> bool {
4353 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
4354 }
4355 #[inline]
4356 pub fn set_mIsLocatorSet(&mut self, val: bool) {
4357 unsafe {
4358 let val: u8 = ::std::mem::transmute(val);
4359 self._bitfield_1.set(0usize, 1u8, val as u64)
4360 }
4361 }
4362 #[inline]
4363 pub unsafe fn mIsLocatorSet_raw(this: *const Self) -> bool {
4364 unsafe {
4365 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4366 ::std::ptr::addr_of!((*this)._bitfield_1),
4367 0usize,
4368 1u8,
4369 ) as u8)
4370 }
4371 }
4372 #[inline]
4373 pub unsafe fn set_mIsLocatorSet_raw(this: *mut Self, val: bool) {
4374 unsafe {
4375 let val: u8 = ::std::mem::transmute(val);
4376 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4377 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4378 0usize,
4379 1u8,
4380 val as u64,
4381 )
4382 }
4383 }
4384 #[inline]
4385 pub fn mIsSessionIdSet(&self) -> bool {
4386 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
4387 }
4388 #[inline]
4389 pub fn set_mIsSessionIdSet(&mut self, val: bool) {
4390 unsafe {
4391 let val: u8 = ::std::mem::transmute(val);
4392 self._bitfield_1.set(1usize, 1u8, val as u64)
4393 }
4394 }
4395 #[inline]
4396 pub unsafe fn mIsSessionIdSet_raw(this: *const Self) -> bool {
4397 unsafe {
4398 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4399 ::std::ptr::addr_of!((*this)._bitfield_1),
4400 1usize,
4401 1u8,
4402 ) as u8)
4403 }
4404 }
4405 #[inline]
4406 pub unsafe fn set_mIsSessionIdSet_raw(this: *mut Self, val: bool) {
4407 unsafe {
4408 let val: u8 = ::std::mem::transmute(val);
4409 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4410 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4411 1usize,
4412 1u8,
4413 val as u64,
4414 )
4415 }
4416 }
4417 #[inline]
4418 pub fn mIsSteeringDataSet(&self) -> bool {
4419 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4420 }
4421 #[inline]
4422 pub fn set_mIsSteeringDataSet(&mut self, val: bool) {
4423 unsafe {
4424 let val: u8 = ::std::mem::transmute(val);
4425 self._bitfield_1.set(2usize, 1u8, val as u64)
4426 }
4427 }
4428 #[inline]
4429 pub unsafe fn mIsSteeringDataSet_raw(this: *const Self) -> bool {
4430 unsafe {
4431 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4432 ::std::ptr::addr_of!((*this)._bitfield_1),
4433 2usize,
4434 1u8,
4435 ) as u8)
4436 }
4437 }
4438 #[inline]
4439 pub unsafe fn set_mIsSteeringDataSet_raw(this: *mut Self, val: bool) {
4440 unsafe {
4441 let val: u8 = ::std::mem::transmute(val);
4442 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4443 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4444 2usize,
4445 1u8,
4446 val as u64,
4447 )
4448 }
4449 }
4450 #[inline]
4451 pub fn mIsJoinerUdpPortSet(&self) -> bool {
4452 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4453 }
4454 #[inline]
4455 pub fn set_mIsJoinerUdpPortSet(&mut self, val: bool) {
4456 unsafe {
4457 let val: u8 = ::std::mem::transmute(val);
4458 self._bitfield_1.set(3usize, 1u8, val as u64)
4459 }
4460 }
4461 #[inline]
4462 pub unsafe fn mIsJoinerUdpPortSet_raw(this: *const Self) -> bool {
4463 unsafe {
4464 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4465 ::std::ptr::addr_of!((*this)._bitfield_1),
4466 3usize,
4467 1u8,
4468 ) as u8)
4469 }
4470 }
4471 #[inline]
4472 pub unsafe fn set_mIsJoinerUdpPortSet_raw(this: *mut Self, val: bool) {
4473 unsafe {
4474 let val: u8 = ::std::mem::transmute(val);
4475 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4476 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4477 3usize,
4478 1u8,
4479 val as u64,
4480 )
4481 }
4482 }
4483 #[inline]
4484 pub fn mHasExtraTlv(&self) -> bool {
4485 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4486 }
4487 #[inline]
4488 pub fn set_mHasExtraTlv(&mut self, val: bool) {
4489 unsafe {
4490 let val: u8 = ::std::mem::transmute(val);
4491 self._bitfield_1.set(4usize, 1u8, val as u64)
4492 }
4493 }
4494 #[inline]
4495 pub unsafe fn mHasExtraTlv_raw(this: *const Self) -> bool {
4496 unsafe {
4497 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
4498 ::std::ptr::addr_of!((*this)._bitfield_1),
4499 4usize,
4500 1u8,
4501 ) as u8)
4502 }
4503 }
4504 #[inline]
4505 pub unsafe fn set_mHasExtraTlv_raw(this: *mut Self, val: bool) {
4506 unsafe {
4507 let val: u8 = ::std::mem::transmute(val);
4508 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
4509 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4510 4usize,
4511 1u8,
4512 val as u64,
4513 )
4514 }
4515 }
4516 #[inline]
4517 pub fn new_bitfield_1(
4518 mIsLocatorSet: bool,
4519 mIsSessionIdSet: bool,
4520 mIsSteeringDataSet: bool,
4521 mIsJoinerUdpPortSet: bool,
4522 mHasExtraTlv: bool,
4523 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
4524 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
4525 __bindgen_bitfield_unit.set(0usize, 1u8, {
4526 let mIsLocatorSet: u8 = unsafe { ::std::mem::transmute(mIsLocatorSet) };
4527 mIsLocatorSet as u64
4528 });
4529 __bindgen_bitfield_unit.set(1usize, 1u8, {
4530 let mIsSessionIdSet: u8 = unsafe { ::std::mem::transmute(mIsSessionIdSet) };
4531 mIsSessionIdSet as u64
4532 });
4533 __bindgen_bitfield_unit.set(2usize, 1u8, {
4534 let mIsSteeringDataSet: u8 = unsafe { ::std::mem::transmute(mIsSteeringDataSet) };
4535 mIsSteeringDataSet as u64
4536 });
4537 __bindgen_bitfield_unit.set(3usize, 1u8, {
4538 let mIsJoinerUdpPortSet: u8 = unsafe { ::std::mem::transmute(mIsJoinerUdpPortSet) };
4539 mIsJoinerUdpPortSet as u64
4540 });
4541 __bindgen_bitfield_unit.set(4usize, 1u8, {
4542 let mHasExtraTlv: u8 = unsafe { ::std::mem::transmute(mHasExtraTlv) };
4543 mHasExtraTlv as u64
4544 });
4545 __bindgen_bitfield_unit
4546 }
4547}
4548#[doc = " Represents a Joiner PSKd."]
4549#[repr(C)]
4550#[derive(Debug, Copy, Clone)]
4551pub struct otJoinerPskd {
4552 #[doc = "< Char string array (must be null terminated - +1 is for null char)."]
4553 pub m8: [::std::os::raw::c_char; 33usize],
4554}
4555impl Default for otJoinerPskd {
4556 fn default() -> Self {
4557 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4558 unsafe {
4559 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4560 s.assume_init()
4561 }
4562 }
4563}
4564#[doc = "< Accept any Joiner (no EUI64 or Discerner is specified)."]
4565pub const OT_JOINER_INFO_TYPE_ANY: otJoinerInfoType = 0;
4566#[doc = "< Joiner EUI-64 is specified (`mSharedId.mEui64` in `otJoinerInfo`)."]
4567pub const OT_JOINER_INFO_TYPE_EUI64: otJoinerInfoType = 1;
4568#[doc = "< Joiner Discerner is specified (`mSharedId.mDiscerner` in `otJoinerInfo`)."]
4569pub const OT_JOINER_INFO_TYPE_DISCERNER: otJoinerInfoType = 2;
4570#[doc = " Defines a Joiner Info Type."]
4571pub type otJoinerInfoType = ::std::os::raw::c_uint;
4572#[doc = " Represents a Joiner Info."]
4573#[repr(C)]
4574#[derive(Copy, Clone)]
4575pub struct otJoinerInfo {
4576 #[doc = "< Joiner type."]
4577 pub mType: otJoinerInfoType,
4578 #[doc = "< Shared fields"]
4579 pub mSharedId: otJoinerInfo__bindgen_ty_1,
4580 #[doc = "< Joiner PSKd"]
4581 pub mPskd: otJoinerPskd,
4582 #[doc = "< Joiner expiration time in msec"]
4583 pub mExpirationTime: u32,
4584}
4585#[repr(C)]
4586#[derive(Copy, Clone)]
4587pub union otJoinerInfo__bindgen_ty_1 {
4588 #[doc = "< Joiner EUI64 (when `mType` is `OT_JOINER_INFO_TYPE_EUI64`)"]
4589 pub mEui64: otExtAddress,
4590 #[doc = "< Joiner Discerner (when `mType` is `OT_JOINER_INFO_TYPE_DISCERNER`)"]
4591 pub mDiscerner: otJoinerDiscerner,
4592}
4593impl Default for otJoinerInfo__bindgen_ty_1 {
4594 fn default() -> Self {
4595 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4596 unsafe {
4597 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4598 s.assume_init()
4599 }
4600 }
4601}
4602impl Default for otJoinerInfo {
4603 fn default() -> Self {
4604 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4605 unsafe {
4606 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4607 s.assume_init()
4608 }
4609 }
4610}
4611#[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."]
4612pub type otCommissionerStateCallback = ::std::option::Option<
4613 unsafe extern "C" fn(aState: otCommissionerState, aContext: *mut ::std::os::raw::c_void),
4614>;
4615#[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."]
4616pub type otCommissionerJoinerCallback = ::std::option::Option<
4617 unsafe extern "C" fn(
4618 aEvent: otCommissionerJoinerEvent,
4619 aJoinerInfo: *const otJoinerInfo,
4620 aJoinerId: *const otExtAddress,
4621 aContext: *mut ::std::os::raw::c_void,
4622 ),
4623>;
4624unsafe extern "C" {
4625 #[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."]
4626 pub fn otCommissionerStart(
4627 aInstance: *mut otInstance,
4628 aStateCallback: otCommissionerStateCallback,
4629 aJoinerCallback: otCommissionerJoinerCallback,
4630 aCallbackContext: *mut ::std::os::raw::c_void,
4631 ) -> otError;
4632}
4633unsafe extern "C" {
4634 #[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."]
4635 pub fn otCommissionerStop(aInstance: *mut otInstance) -> otError;
4636}
4637unsafe extern "C" {
4638 #[doc = " Returns the Commissioner Id.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Commissioner Id."]
4639 pub fn otCommissionerGetId(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
4640}
4641unsafe extern "C" {
4642 #[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."]
4643 pub fn otCommissionerSetId(
4644 aInstance: *mut otInstance,
4645 aId: *const ::std::os::raw::c_char,
4646 ) -> otError;
4647}
4648unsafe extern "C" {
4649 #[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()."]
4650 pub fn otCommissionerAddJoiner(
4651 aInstance: *mut otInstance,
4652 aEui64: *const otExtAddress,
4653 aPskd: *const ::std::os::raw::c_char,
4654 aTimeout: u32,
4655 ) -> otError;
4656}
4657unsafe extern "C" {
4658 #[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()."]
4659 pub fn otCommissionerAddJoinerWithDiscerner(
4660 aInstance: *mut otInstance,
4661 aDiscerner: *const otJoinerDiscerner,
4662 aPskd: *const ::std::os::raw::c_char,
4663 aTimeout: u32,
4664 ) -> otError;
4665}
4666unsafe extern "C" {
4667 #[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."]
4668 pub fn otCommissionerGetNextJoinerInfo(
4669 aInstance: *mut otInstance,
4670 aIterator: *mut u16,
4671 aJoiner: *mut otJoinerInfo,
4672 ) -> otError;
4673}
4674unsafe extern "C" {
4675 #[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()."]
4676 pub fn otCommissionerRemoveJoiner(
4677 aInstance: *mut otInstance,
4678 aEui64: *const otExtAddress,
4679 ) -> otError;
4680}
4681unsafe extern "C" {
4682 #[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()."]
4683 pub fn otCommissionerRemoveJoinerWithDiscerner(
4684 aInstance: *mut otInstance,
4685 aDiscerner: *const otJoinerDiscerner,
4686 ) -> otError;
4687}
4688unsafe extern "C" {
4689 #[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."]
4690 pub fn otCommissionerGetProvisioningUrl(
4691 aInstance: *mut otInstance,
4692 ) -> *const ::std::os::raw::c_char;
4693}
4694unsafe extern "C" {
4695 #[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)."]
4696 pub fn otCommissionerSetProvisioningUrl(
4697 aInstance: *mut otInstance,
4698 aProvisioningUrl: *const ::std::os::raw::c_char,
4699 ) -> otError;
4700}
4701unsafe extern "C" {
4702 #[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()."]
4703 pub fn otCommissionerAnnounceBegin(
4704 aInstance: *mut otInstance,
4705 aChannelMask: u32,
4706 aCount: u8,
4707 aPeriod: u16,
4708 aAddress: *const otIp6Address,
4709 ) -> otError;
4710}
4711#[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."]
4712pub type otCommissionerEnergyReportCallback = ::std::option::Option<
4713 unsafe extern "C" fn(
4714 aChannelMask: u32,
4715 aEnergyList: *const u8,
4716 aEnergyListLength: u8,
4717 aContext: *mut ::std::os::raw::c_void,
4718 ),
4719>;
4720unsafe extern "C" {
4721 #[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()."]
4722 pub fn otCommissionerEnergyScan(
4723 aInstance: *mut otInstance,
4724 aChannelMask: u32,
4725 aCount: u8,
4726 aPeriod: u16,
4727 aScanDuration: u16,
4728 aAddress: *const otIp6Address,
4729 aCallback: otCommissionerEnergyReportCallback,
4730 aContext: *mut ::std::os::raw::c_void,
4731 ) -> otError;
4732}
4733#[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."]
4734pub type otCommissionerPanIdConflictCallback = ::std::option::Option<
4735 unsafe extern "C" fn(aPanId: u16, aChannelMask: u32, aContext: *mut ::std::os::raw::c_void),
4736>;
4737unsafe extern "C" {
4738 #[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()."]
4739 pub fn otCommissionerPanIdQuery(
4740 aInstance: *mut otInstance,
4741 aPanId: u16,
4742 aChannelMask: u32,
4743 aAddress: *const otIp6Address,
4744 aCallback: otCommissionerPanIdConflictCallback,
4745 aContext: *mut ::std::os::raw::c_void,
4746 ) -> otError;
4747}
4748unsafe extern "C" {
4749 #[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."]
4750 pub fn otCommissionerSendMgmtGet(
4751 aInstance: *mut otInstance,
4752 aTlvs: *const u8,
4753 aLength: u8,
4754 ) -> otError;
4755}
4756unsafe extern "C" {
4757 #[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."]
4758 pub fn otCommissionerSendMgmtSet(
4759 aInstance: *mut otInstance,
4760 aDataset: *const otCommissioningDataset,
4761 aTlvs: *const u8,
4762 aLength: u8,
4763 ) -> otError;
4764}
4765unsafe extern "C" {
4766 #[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."]
4767 pub fn otCommissionerGetSessionId(aInstance: *mut otInstance) -> u16;
4768}
4769unsafe extern "C" {
4770 #[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."]
4771 pub fn otCommissionerGetState(aInstance: *mut otInstance) -> otCommissionerState;
4772}
4773pub type otNetworkDataIterator = u32;
4774#[doc = " Represents a Border Router configuration."]
4775#[repr(C)]
4776#[repr(align(4))]
4777#[derive(Copy, Clone)]
4778pub struct otBorderRouterConfig {
4779 #[doc = "< The IPv6 prefix."]
4780 pub mPrefix: otIp6Prefix,
4781 pub _bitfield_align_1: [u8; 0],
4782 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
4783 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
4784 pub mRloc16: u16,
4785}
4786impl Default for otBorderRouterConfig {
4787 fn default() -> Self {
4788 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
4789 unsafe {
4790 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
4791 s.assume_init()
4792 }
4793 }
4794}
4795impl otBorderRouterConfig {
4796 #[inline]
4797 pub fn mPreference(&self) -> ::std::os::raw::c_int {
4798 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
4799 }
4800 #[inline]
4801 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
4802 unsafe {
4803 let val: u32 = ::std::mem::transmute(val);
4804 self._bitfield_1.set(0usize, 2u8, val as u64)
4805 }
4806 }
4807 #[inline]
4808 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
4809 unsafe {
4810 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4811 ::std::ptr::addr_of!((*this)._bitfield_1),
4812 0usize,
4813 2u8,
4814 ) as u32)
4815 }
4816 }
4817 #[inline]
4818 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
4819 unsafe {
4820 let val: u32 = ::std::mem::transmute(val);
4821 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4822 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4823 0usize,
4824 2u8,
4825 val as u64,
4826 )
4827 }
4828 }
4829 #[inline]
4830 pub fn mPreferred(&self) -> bool {
4831 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
4832 }
4833 #[inline]
4834 pub fn set_mPreferred(&mut self, val: bool) {
4835 unsafe {
4836 let val: u8 = ::std::mem::transmute(val);
4837 self._bitfield_1.set(2usize, 1u8, val as u64)
4838 }
4839 }
4840 #[inline]
4841 pub unsafe fn mPreferred_raw(this: *const Self) -> bool {
4842 unsafe {
4843 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4844 ::std::ptr::addr_of!((*this)._bitfield_1),
4845 2usize,
4846 1u8,
4847 ) as u8)
4848 }
4849 }
4850 #[inline]
4851 pub unsafe fn set_mPreferred_raw(this: *mut Self, val: bool) {
4852 unsafe {
4853 let val: u8 = ::std::mem::transmute(val);
4854 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4855 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4856 2usize,
4857 1u8,
4858 val as u64,
4859 )
4860 }
4861 }
4862 #[inline]
4863 pub fn mSlaac(&self) -> bool {
4864 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
4865 }
4866 #[inline]
4867 pub fn set_mSlaac(&mut self, val: bool) {
4868 unsafe {
4869 let val: u8 = ::std::mem::transmute(val);
4870 self._bitfield_1.set(3usize, 1u8, val as u64)
4871 }
4872 }
4873 #[inline]
4874 pub unsafe fn mSlaac_raw(this: *const Self) -> bool {
4875 unsafe {
4876 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4877 ::std::ptr::addr_of!((*this)._bitfield_1),
4878 3usize,
4879 1u8,
4880 ) as u8)
4881 }
4882 }
4883 #[inline]
4884 pub unsafe fn set_mSlaac_raw(this: *mut Self, val: bool) {
4885 unsafe {
4886 let val: u8 = ::std::mem::transmute(val);
4887 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4888 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4889 3usize,
4890 1u8,
4891 val as u64,
4892 )
4893 }
4894 }
4895 #[inline]
4896 pub fn mDhcp(&self) -> bool {
4897 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
4898 }
4899 #[inline]
4900 pub fn set_mDhcp(&mut self, val: bool) {
4901 unsafe {
4902 let val: u8 = ::std::mem::transmute(val);
4903 self._bitfield_1.set(4usize, 1u8, val as u64)
4904 }
4905 }
4906 #[inline]
4907 pub unsafe fn mDhcp_raw(this: *const Self) -> bool {
4908 unsafe {
4909 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4910 ::std::ptr::addr_of!((*this)._bitfield_1),
4911 4usize,
4912 1u8,
4913 ) as u8)
4914 }
4915 }
4916 #[inline]
4917 pub unsafe fn set_mDhcp_raw(this: *mut Self, val: bool) {
4918 unsafe {
4919 let val: u8 = ::std::mem::transmute(val);
4920 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4921 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4922 4usize,
4923 1u8,
4924 val as u64,
4925 )
4926 }
4927 }
4928 #[inline]
4929 pub fn mConfigure(&self) -> bool {
4930 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
4931 }
4932 #[inline]
4933 pub fn set_mConfigure(&mut self, val: bool) {
4934 unsafe {
4935 let val: u8 = ::std::mem::transmute(val);
4936 self._bitfield_1.set(5usize, 1u8, val as u64)
4937 }
4938 }
4939 #[inline]
4940 pub unsafe fn mConfigure_raw(this: *const Self) -> bool {
4941 unsafe {
4942 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4943 ::std::ptr::addr_of!((*this)._bitfield_1),
4944 5usize,
4945 1u8,
4946 ) as u8)
4947 }
4948 }
4949 #[inline]
4950 pub unsafe fn set_mConfigure_raw(this: *mut Self, val: bool) {
4951 unsafe {
4952 let val: u8 = ::std::mem::transmute(val);
4953 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4954 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4955 5usize,
4956 1u8,
4957 val as u64,
4958 )
4959 }
4960 }
4961 #[inline]
4962 pub fn mDefaultRoute(&self) -> bool {
4963 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
4964 }
4965 #[inline]
4966 pub fn set_mDefaultRoute(&mut self, val: bool) {
4967 unsafe {
4968 let val: u8 = ::std::mem::transmute(val);
4969 self._bitfield_1.set(6usize, 1u8, val as u64)
4970 }
4971 }
4972 #[inline]
4973 pub unsafe fn mDefaultRoute_raw(this: *const Self) -> bool {
4974 unsafe {
4975 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
4976 ::std::ptr::addr_of!((*this)._bitfield_1),
4977 6usize,
4978 1u8,
4979 ) as u8)
4980 }
4981 }
4982 #[inline]
4983 pub unsafe fn set_mDefaultRoute_raw(this: *mut Self, val: bool) {
4984 unsafe {
4985 let val: u8 = ::std::mem::transmute(val);
4986 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
4987 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
4988 6usize,
4989 1u8,
4990 val as u64,
4991 )
4992 }
4993 }
4994 #[inline]
4995 pub fn mOnMesh(&self) -> bool {
4996 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
4997 }
4998 #[inline]
4999 pub fn set_mOnMesh(&mut self, val: bool) {
5000 unsafe {
5001 let val: u8 = ::std::mem::transmute(val);
5002 self._bitfield_1.set(7usize, 1u8, val as u64)
5003 }
5004 }
5005 #[inline]
5006 pub unsafe fn mOnMesh_raw(this: *const Self) -> bool {
5007 unsafe {
5008 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
5009 ::std::ptr::addr_of!((*this)._bitfield_1),
5010 7usize,
5011 1u8,
5012 ) as u8)
5013 }
5014 }
5015 #[inline]
5016 pub unsafe fn set_mOnMesh_raw(this: *mut Self, val: bool) {
5017 unsafe {
5018 let val: u8 = ::std::mem::transmute(val);
5019 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
5020 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5021 7usize,
5022 1u8,
5023 val as u64,
5024 )
5025 }
5026 }
5027 #[inline]
5028 pub fn mStable(&self) -> bool {
5029 unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
5030 }
5031 #[inline]
5032 pub fn set_mStable(&mut self, val: bool) {
5033 unsafe {
5034 let val: u8 = ::std::mem::transmute(val);
5035 self._bitfield_1.set(8usize, 1u8, val as u64)
5036 }
5037 }
5038 #[inline]
5039 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5040 unsafe {
5041 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
5042 ::std::ptr::addr_of!((*this)._bitfield_1),
5043 8usize,
5044 1u8,
5045 ) as u8)
5046 }
5047 }
5048 #[inline]
5049 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5050 unsafe {
5051 let val: u8 = ::std::mem::transmute(val);
5052 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
5053 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5054 8usize,
5055 1u8,
5056 val as u64,
5057 )
5058 }
5059 }
5060 #[inline]
5061 pub fn mNdDns(&self) -> bool {
5062 unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
5063 }
5064 #[inline]
5065 pub fn set_mNdDns(&mut self, val: bool) {
5066 unsafe {
5067 let val: u8 = ::std::mem::transmute(val);
5068 self._bitfield_1.set(9usize, 1u8, val as u64)
5069 }
5070 }
5071 #[inline]
5072 pub unsafe fn mNdDns_raw(this: *const Self) -> bool {
5073 unsafe {
5074 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
5075 ::std::ptr::addr_of!((*this)._bitfield_1),
5076 9usize,
5077 1u8,
5078 ) as u8)
5079 }
5080 }
5081 #[inline]
5082 pub unsafe fn set_mNdDns_raw(this: *mut Self, val: bool) {
5083 unsafe {
5084 let val: u8 = ::std::mem::transmute(val);
5085 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
5086 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5087 9usize,
5088 1u8,
5089 val as u64,
5090 )
5091 }
5092 }
5093 #[inline]
5094 pub fn mDp(&self) -> bool {
5095 unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
5096 }
5097 #[inline]
5098 pub fn set_mDp(&mut self, val: bool) {
5099 unsafe {
5100 let val: u8 = ::std::mem::transmute(val);
5101 self._bitfield_1.set(10usize, 1u8, val as u64)
5102 }
5103 }
5104 #[inline]
5105 pub unsafe fn mDp_raw(this: *const Self) -> bool {
5106 unsafe {
5107 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
5108 ::std::ptr::addr_of!((*this)._bitfield_1),
5109 10usize,
5110 1u8,
5111 ) as u8)
5112 }
5113 }
5114 #[inline]
5115 pub unsafe fn set_mDp_raw(this: *mut Self, val: bool) {
5116 unsafe {
5117 let val: u8 = ::std::mem::transmute(val);
5118 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
5119 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5120 10usize,
5121 1u8,
5122 val as u64,
5123 )
5124 }
5125 }
5126 #[inline]
5127 pub fn new_bitfield_1(
5128 mPreference: ::std::os::raw::c_int,
5129 mPreferred: bool,
5130 mSlaac: bool,
5131 mDhcp: bool,
5132 mConfigure: bool,
5133 mDefaultRoute: bool,
5134 mOnMesh: bool,
5135 mStable: bool,
5136 mNdDns: bool,
5137 mDp: bool,
5138 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
5139 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
5140 __bindgen_bitfield_unit.set(0usize, 2u8, {
5141 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
5142 mPreference as u64
5143 });
5144 __bindgen_bitfield_unit.set(2usize, 1u8, {
5145 let mPreferred: u8 = unsafe { ::std::mem::transmute(mPreferred) };
5146 mPreferred as u64
5147 });
5148 __bindgen_bitfield_unit.set(3usize, 1u8, {
5149 let mSlaac: u8 = unsafe { ::std::mem::transmute(mSlaac) };
5150 mSlaac as u64
5151 });
5152 __bindgen_bitfield_unit.set(4usize, 1u8, {
5153 let mDhcp: u8 = unsafe { ::std::mem::transmute(mDhcp) };
5154 mDhcp as u64
5155 });
5156 __bindgen_bitfield_unit.set(5usize, 1u8, {
5157 let mConfigure: u8 = unsafe { ::std::mem::transmute(mConfigure) };
5158 mConfigure as u64
5159 });
5160 __bindgen_bitfield_unit.set(6usize, 1u8, {
5161 let mDefaultRoute: u8 = unsafe { ::std::mem::transmute(mDefaultRoute) };
5162 mDefaultRoute as u64
5163 });
5164 __bindgen_bitfield_unit.set(7usize, 1u8, {
5165 let mOnMesh: u8 = unsafe { ::std::mem::transmute(mOnMesh) };
5166 mOnMesh as u64
5167 });
5168 __bindgen_bitfield_unit.set(8usize, 1u8, {
5169 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5170 mStable as u64
5171 });
5172 __bindgen_bitfield_unit.set(9usize, 1u8, {
5173 let mNdDns: u8 = unsafe { ::std::mem::transmute(mNdDns) };
5174 mNdDns as u64
5175 });
5176 __bindgen_bitfield_unit.set(10usize, 1u8, {
5177 let mDp: u8 = unsafe { ::std::mem::transmute(mDp) };
5178 mDp as u64
5179 });
5180 __bindgen_bitfield_unit
5181 }
5182}
5183#[doc = " Represents 6LoWPAN Context ID information associated with a prefix in Network Data."]
5184#[repr(C)]
5185#[derive(Copy, Clone)]
5186pub struct otLowpanContextInfo {
5187 #[doc = "< The 6LoWPAN Context ID."]
5188 pub mContextId: u8,
5189 #[doc = "< The compress flag."]
5190 pub mCompressFlag: bool,
5191 #[doc = "< The associated IPv6 prefix."]
5192 pub mPrefix: otIp6Prefix,
5193}
5194impl Default for otLowpanContextInfo {
5195 fn default() -> Self {
5196 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5197 unsafe {
5198 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5199 s.assume_init()
5200 }
5201 }
5202}
5203#[doc = " Represents an External Route configuration."]
5204#[repr(C)]
5205#[repr(align(4))]
5206#[derive(Copy, Clone)]
5207pub struct otExternalRouteConfig {
5208 #[doc = "< The IPv6 prefix."]
5209 pub mPrefix: otIp6Prefix,
5210 #[doc = "< The border router's RLOC16 (value ignored on config add)."]
5211 pub mRloc16: u16,
5212 pub _bitfield_align_1: [u8; 0],
5213 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5214 pub __bindgen_padding_0: [u8; 3usize],
5215}
5216impl Default for otExternalRouteConfig {
5217 fn default() -> Self {
5218 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5219 unsafe {
5220 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5221 s.assume_init()
5222 }
5223 }
5224}
5225impl otExternalRouteConfig {
5226 #[inline]
5227 pub fn mPreference(&self) -> ::std::os::raw::c_int {
5228 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
5229 }
5230 #[inline]
5231 pub fn set_mPreference(&mut self, val: ::std::os::raw::c_int) {
5232 unsafe {
5233 let val: u32 = ::std::mem::transmute(val);
5234 self._bitfield_1.set(0usize, 2u8, val as u64)
5235 }
5236 }
5237 #[inline]
5238 pub unsafe fn mPreference_raw(this: *const Self) -> ::std::os::raw::c_int {
5239 unsafe {
5240 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5241 ::std::ptr::addr_of!((*this)._bitfield_1),
5242 0usize,
5243 2u8,
5244 ) as u32)
5245 }
5246 }
5247 #[inline]
5248 pub unsafe fn set_mPreference_raw(this: *mut Self, val: ::std::os::raw::c_int) {
5249 unsafe {
5250 let val: u32 = ::std::mem::transmute(val);
5251 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5252 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5253 0usize,
5254 2u8,
5255 val as u64,
5256 )
5257 }
5258 }
5259 #[inline]
5260 pub fn mNat64(&self) -> bool {
5261 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
5262 }
5263 #[inline]
5264 pub fn set_mNat64(&mut self, val: bool) {
5265 unsafe {
5266 let val: u8 = ::std::mem::transmute(val);
5267 self._bitfield_1.set(2usize, 1u8, val as u64)
5268 }
5269 }
5270 #[inline]
5271 pub unsafe fn mNat64_raw(this: *const Self) -> bool {
5272 unsafe {
5273 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5274 ::std::ptr::addr_of!((*this)._bitfield_1),
5275 2usize,
5276 1u8,
5277 ) as u8)
5278 }
5279 }
5280 #[inline]
5281 pub unsafe fn set_mNat64_raw(this: *mut Self, val: bool) {
5282 unsafe {
5283 let val: u8 = ::std::mem::transmute(val);
5284 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5285 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5286 2usize,
5287 1u8,
5288 val as u64,
5289 )
5290 }
5291 }
5292 #[inline]
5293 pub fn mStable(&self) -> bool {
5294 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
5295 }
5296 #[inline]
5297 pub fn set_mStable(&mut self, val: bool) {
5298 unsafe {
5299 let val: u8 = ::std::mem::transmute(val);
5300 self._bitfield_1.set(3usize, 1u8, val as u64)
5301 }
5302 }
5303 #[inline]
5304 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5305 unsafe {
5306 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5307 ::std::ptr::addr_of!((*this)._bitfield_1),
5308 3usize,
5309 1u8,
5310 ) as u8)
5311 }
5312 }
5313 #[inline]
5314 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5315 unsafe {
5316 let val: u8 = ::std::mem::transmute(val);
5317 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5318 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5319 3usize,
5320 1u8,
5321 val as u64,
5322 )
5323 }
5324 }
5325 #[inline]
5326 pub fn mNextHopIsThisDevice(&self) -> bool {
5327 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
5328 }
5329 #[inline]
5330 pub fn set_mNextHopIsThisDevice(&mut self, val: bool) {
5331 unsafe {
5332 let val: u8 = ::std::mem::transmute(val);
5333 self._bitfield_1.set(4usize, 1u8, val as u64)
5334 }
5335 }
5336 #[inline]
5337 pub unsafe fn mNextHopIsThisDevice_raw(this: *const Self) -> bool {
5338 unsafe {
5339 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5340 ::std::ptr::addr_of!((*this)._bitfield_1),
5341 4usize,
5342 1u8,
5343 ) as u8)
5344 }
5345 }
5346 #[inline]
5347 pub unsafe fn set_mNextHopIsThisDevice_raw(this: *mut Self, val: bool) {
5348 unsafe {
5349 let val: u8 = ::std::mem::transmute(val);
5350 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5351 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5352 4usize,
5353 1u8,
5354 val as u64,
5355 )
5356 }
5357 }
5358 #[inline]
5359 pub fn mAdvPio(&self) -> bool {
5360 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
5361 }
5362 #[inline]
5363 pub fn set_mAdvPio(&mut self, val: bool) {
5364 unsafe {
5365 let val: u8 = ::std::mem::transmute(val);
5366 self._bitfield_1.set(5usize, 1u8, val as u64)
5367 }
5368 }
5369 #[inline]
5370 pub unsafe fn mAdvPio_raw(this: *const Self) -> bool {
5371 unsafe {
5372 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5373 ::std::ptr::addr_of!((*this)._bitfield_1),
5374 5usize,
5375 1u8,
5376 ) as u8)
5377 }
5378 }
5379 #[inline]
5380 pub unsafe fn set_mAdvPio_raw(this: *mut Self, val: bool) {
5381 unsafe {
5382 let val: u8 = ::std::mem::transmute(val);
5383 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5384 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5385 5usize,
5386 1u8,
5387 val as u64,
5388 )
5389 }
5390 }
5391 #[inline]
5392 pub fn new_bitfield_1(
5393 mPreference: ::std::os::raw::c_int,
5394 mNat64: bool,
5395 mStable: bool,
5396 mNextHopIsThisDevice: bool,
5397 mAdvPio: bool,
5398 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5399 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5400 __bindgen_bitfield_unit.set(0usize, 2u8, {
5401 let mPreference: u32 = unsafe { ::std::mem::transmute(mPreference) };
5402 mPreference as u64
5403 });
5404 __bindgen_bitfield_unit.set(2usize, 1u8, {
5405 let mNat64: u8 = unsafe { ::std::mem::transmute(mNat64) };
5406 mNat64 as u64
5407 });
5408 __bindgen_bitfield_unit.set(3usize, 1u8, {
5409 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5410 mStable as u64
5411 });
5412 __bindgen_bitfield_unit.set(4usize, 1u8, {
5413 let mNextHopIsThisDevice: u8 = unsafe { ::std::mem::transmute(mNextHopIsThisDevice) };
5414 mNextHopIsThisDevice as u64
5415 });
5416 __bindgen_bitfield_unit.set(5usize, 1u8, {
5417 let mAdvPio: u8 = unsafe { ::std::mem::transmute(mAdvPio) };
5418 mAdvPio as u64
5419 });
5420 __bindgen_bitfield_unit
5421 }
5422}
5423#[doc = "< Low route preference."]
5424pub const OT_ROUTE_PREFERENCE_LOW: otRoutePreference = -1;
5425#[doc = "< Medium route preference."]
5426pub const OT_ROUTE_PREFERENCE_MED: otRoutePreference = 0;
5427#[doc = "< High route preference."]
5428pub const OT_ROUTE_PREFERENCE_HIGH: otRoutePreference = 1;
5429#[doc = " Defines valid values for `mPreference` in `otExternalRouteConfig` and `otBorderRouterConfig`."]
5430pub type otRoutePreference = ::std::os::raw::c_int;
5431#[doc = " Represents a Server configuration."]
5432#[repr(C)]
5433#[derive(Debug, Copy, Clone)]
5434pub struct otServerConfig {
5435 pub _bitfield_align_1: [u8; 0],
5436 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
5437 #[doc = "< Length of server data."]
5438 pub mServerDataLength: u8,
5439 #[doc = "< Server data bytes."]
5440 pub mServerData: [u8; 248usize],
5441 #[doc = "< The Server RLOC16."]
5442 pub mRloc16: u16,
5443}
5444impl Default for otServerConfig {
5445 fn default() -> Self {
5446 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5447 unsafe {
5448 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5449 s.assume_init()
5450 }
5451 }
5452}
5453impl otServerConfig {
5454 #[inline]
5455 pub fn mStable(&self) -> bool {
5456 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
5457 }
5458 #[inline]
5459 pub fn set_mStable(&mut self, val: bool) {
5460 unsafe {
5461 let val: u8 = ::std::mem::transmute(val);
5462 self._bitfield_1.set(0usize, 1u8, val as u64)
5463 }
5464 }
5465 #[inline]
5466 pub unsafe fn mStable_raw(this: *const Self) -> bool {
5467 unsafe {
5468 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
5469 ::std::ptr::addr_of!((*this)._bitfield_1),
5470 0usize,
5471 1u8,
5472 ) as u8)
5473 }
5474 }
5475 #[inline]
5476 pub unsafe fn set_mStable_raw(this: *mut Self, val: bool) {
5477 unsafe {
5478 let val: u8 = ::std::mem::transmute(val);
5479 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
5480 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
5481 0usize,
5482 1u8,
5483 val as u64,
5484 )
5485 }
5486 }
5487 #[inline]
5488 pub fn new_bitfield_1(mStable: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
5489 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
5490 __bindgen_bitfield_unit.set(0usize, 1u8, {
5491 let mStable: u8 = unsafe { ::std::mem::transmute(mStable) };
5492 mStable as u64
5493 });
5494 __bindgen_bitfield_unit
5495 }
5496}
5497#[doc = " Represents a Service configuration."]
5498#[repr(C)]
5499#[derive(Debug, Copy, Clone)]
5500pub struct otServiceConfig {
5501 #[doc = "< Service ID (when iterating over the Network Data)."]
5502 pub mServiceId: u8,
5503 #[doc = "< IANA Enterprise Number."]
5504 pub mEnterpriseNumber: u32,
5505 #[doc = "< Length of service data."]
5506 pub mServiceDataLength: u8,
5507 #[doc = "< Service data bytes."]
5508 pub mServiceData: [u8; 252usize],
5509 #[doc = "< The Server configuration."]
5510 pub mServerConfig: otServerConfig,
5511}
5512impl Default for otServiceConfig {
5513 fn default() -> Self {
5514 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5515 unsafe {
5516 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5517 s.assume_init()
5518 }
5519 }
5520}
5521unsafe extern "C" {
5522 #[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."]
5523 pub fn otNetDataGet(
5524 aInstance: *mut otInstance,
5525 aStable: bool,
5526 aData: *mut u8,
5527 aDataLength: *mut u8,
5528 ) -> otError;
5529}
5530unsafe extern "C" {
5531 #[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."]
5532 pub fn otNetDataGetLength(aInstance: *mut otInstance) -> u8;
5533}
5534unsafe extern "C" {
5535 #[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)."]
5536 pub fn otNetDataGetMaxLength(aInstance: *mut otInstance) -> u8;
5537}
5538unsafe extern "C" {
5539 #[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"]
5540 pub fn otNetDataResetMaxLength(aInstance: *mut otInstance);
5541}
5542unsafe extern "C" {
5543 #[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."]
5544 pub fn otNetDataGetNextOnMeshPrefix(
5545 aInstance: *mut otInstance,
5546 aIterator: *mut otNetworkDataIterator,
5547 aConfig: *mut otBorderRouterConfig,
5548 ) -> otError;
5549}
5550unsafe extern "C" {
5551 #[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."]
5552 pub fn otNetDataGetNextRoute(
5553 aInstance: *mut otInstance,
5554 aIterator: *mut otNetworkDataIterator,
5555 aConfig: *mut otExternalRouteConfig,
5556 ) -> otError;
5557}
5558unsafe extern "C" {
5559 #[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."]
5560 pub fn otNetDataGetNextService(
5561 aInstance: *mut otInstance,
5562 aIterator: *mut otNetworkDataIterator,
5563 aConfig: *mut otServiceConfig,
5564 ) -> otError;
5565}
5566unsafe extern "C" {
5567 #[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."]
5568 pub fn otNetDataGetNextLowpanContextInfo(
5569 aInstance: *mut otInstance,
5570 aIterator: *mut otNetworkDataIterator,
5571 aContextInfo: *mut otLowpanContextInfo,
5572 ) -> otError;
5573}
5574unsafe extern "C" {
5575 #[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."]
5576 pub fn otNetDataGetCommissioningDataset(
5577 aInstance: *mut otInstance,
5578 aDataset: *mut otCommissioningDataset,
5579 );
5580}
5581unsafe extern "C" {
5582 #[doc = " Get the Network Data Version.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Network Data Version."]
5583 pub fn otNetDataGetVersion(aInstance: *mut otInstance) -> u8;
5584}
5585unsafe extern "C" {
5586 #[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."]
5587 pub fn otNetDataGetStableVersion(aInstance: *mut otInstance) -> u8;
5588}
5589unsafe extern "C" {
5590 #[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."]
5591 pub fn otNetDataSteeringDataCheckJoiner(
5592 aInstance: *mut otInstance,
5593 aEui64: *const otExtAddress,
5594 ) -> otError;
5595}
5596unsafe extern "C" {
5597 #[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."]
5598 pub fn otNetDataSteeringDataCheckJoinerWithDiscerner(
5599 aInstance: *mut otInstance,
5600 aDiscerner: *const otJoinerDiscerner,
5601 ) -> otError;
5602}
5603unsafe extern "C" {
5604 #[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."]
5605 pub fn otNetDataContainsOmrPrefix(
5606 aInstance: *mut otInstance,
5607 aPrefix: *const otIp6Prefix,
5608 ) -> bool;
5609}
5610#[doc = "< Backbone function is disabled."]
5611pub const OT_BACKBONE_ROUTER_STATE_DISABLED: otBackboneRouterState = 0;
5612#[doc = "< Secondary Backbone Router."]
5613pub const OT_BACKBONE_ROUTER_STATE_SECONDARY: otBackboneRouterState = 1;
5614#[doc = "< The Primary Backbone Router."]
5615pub const OT_BACKBONE_ROUTER_STATE_PRIMARY: otBackboneRouterState = 2;
5616#[doc = " Represents the Backbone Router Status."]
5617pub type otBackboneRouterState = ::std::os::raw::c_uint;
5618unsafe extern "C" {
5619 #[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"]
5620 pub fn otBackboneRouterSetEnabled(aInstance: *mut otInstance, aEnable: bool);
5621}
5622unsafe extern "C" {
5623 #[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"]
5624 pub fn otBackboneRouterGetState(aInstance: *mut otInstance) -> otBackboneRouterState;
5625}
5626unsafe extern "C" {
5627 #[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"]
5628 pub fn otBackboneRouterGetConfig(
5629 aInstance: *mut otInstance,
5630 aConfig: *mut otBackboneRouterConfig,
5631 );
5632}
5633unsafe extern "C" {
5634 #[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"]
5635 pub fn otBackboneRouterSetConfig(
5636 aInstance: *mut otInstance,
5637 aConfig: *const otBackboneRouterConfig,
5638 ) -> otError;
5639}
5640unsafe extern "C" {
5641 #[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"]
5642 pub fn otBackboneRouterRegister(aInstance: *mut otInstance) -> otError;
5643}
5644unsafe extern "C" {
5645 #[doc = " Returns the Backbone Router registration jitter value.\n\n @returns The Backbone Router registration jitter value.\n\n @sa otBackboneRouterSetRegistrationJitter"]
5646 pub fn otBackboneRouterGetRegistrationJitter(aInstance: *mut otInstance) -> u8;
5647}
5648unsafe extern "C" {
5649 #[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"]
5650 pub fn otBackboneRouterSetRegistrationJitter(aInstance: *mut otInstance, aJitter: u8);
5651}
5652unsafe extern "C" {
5653 #[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."]
5654 pub fn otBackboneRouterGetDomainPrefix(
5655 aInstance: *mut otInstance,
5656 aConfig: *mut otBorderRouterConfig,
5657 ) -> otError;
5658}
5659unsafe extern "C" {
5660 #[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."]
5661 pub fn otBackboneRouterConfigNextDuaRegistrationResponse(
5662 aInstance: *mut otInstance,
5663 aMlIid: *const otIp6InterfaceIdentifier,
5664 aStatus: u8,
5665 );
5666}
5667unsafe extern "C" {
5668 #[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."]
5669 pub fn otBackboneRouterConfigNextMulticastListenerRegistrationResponse(
5670 aInstance: *mut otInstance,
5671 aStatus: u8,
5672 );
5673}
5674#[doc = "< Multicast Listener was added."]
5675pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_ADDED: otBackboneRouterMulticastListenerEvent = 0;
5676#[doc = "< Multicast Listener was removed or expired."]
5677pub const OT_BACKBONE_ROUTER_MULTICAST_LISTENER_REMOVED: otBackboneRouterMulticastListenerEvent = 1;
5678#[doc = " Represents the Multicast Listener events."]
5679pub type otBackboneRouterMulticastListenerEvent = ::std::os::raw::c_uint;
5680#[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."]
5681pub type otBackboneRouterMulticastListenerCallback = ::std::option::Option<
5682 unsafe extern "C" fn(
5683 aContext: *mut ::std::os::raw::c_void,
5684 aEvent: otBackboneRouterMulticastListenerEvent,
5685 aAddress: *const otIp6Address,
5686 ),
5687>;
5688unsafe extern "C" {
5689 #[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."]
5690 pub fn otBackboneRouterSetMulticastListenerCallback(
5691 aInstance: *mut otInstance,
5692 aCallback: otBackboneRouterMulticastListenerCallback,
5693 aContext: *mut ::std::os::raw::c_void,
5694 );
5695}
5696unsafe extern "C" {
5697 #[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"]
5698 pub fn otBackboneRouterMulticastListenerClear(aInstance: *mut otInstance);
5699}
5700unsafe extern "C" {
5701 #[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"]
5702 pub fn otBackboneRouterMulticastListenerAdd(
5703 aInstance: *mut otInstance,
5704 aAddress: *const otIp6Address,
5705 aTimeout: u32,
5706 ) -> otError;
5707}
5708pub type otBackboneRouterMulticastListenerIterator = u16;
5709#[doc = " Represents a Backbone Router Multicast Listener info."]
5710#[repr(C)]
5711#[derive(Copy, Clone)]
5712pub struct otBackboneRouterMulticastListenerInfo {
5713 pub mAddress: otIp6Address,
5714 pub mTimeout: u32,
5715}
5716impl Default for otBackboneRouterMulticastListenerInfo {
5717 fn default() -> Self {
5718 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5719 unsafe {
5720 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5721 s.assume_init()
5722 }
5723 }
5724}
5725unsafe extern "C" {
5726 #[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"]
5727 pub fn otBackboneRouterMulticastListenerGetNext(
5728 aInstance: *mut otInstance,
5729 aIterator: *mut otBackboneRouterMulticastListenerIterator,
5730 aListenerInfo: *mut otBackboneRouterMulticastListenerInfo,
5731 ) -> otError;
5732}
5733#[doc = "< ND Proxy was added."]
5734pub const OT_BACKBONE_ROUTER_NDPROXY_ADDED: otBackboneRouterNdProxyEvent = 0;
5735#[doc = "< ND Proxy was removed."]
5736pub const OT_BACKBONE_ROUTER_NDPROXY_REMOVED: otBackboneRouterNdProxyEvent = 1;
5737#[doc = "< ND Proxy was renewed."]
5738pub const OT_BACKBONE_ROUTER_NDPROXY_RENEWED: otBackboneRouterNdProxyEvent = 2;
5739#[doc = "< All ND Proxies were cleared."]
5740pub const OT_BACKBONE_ROUTER_NDPROXY_CLEARED: otBackboneRouterNdProxyEvent = 3;
5741#[doc = " Represents the ND Proxy events."]
5742pub type otBackboneRouterNdProxyEvent = ::std::os::raw::c_uint;
5743#[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 `nullptr` if @p aEvent is\n `OT_BACKBONE_ROUTER_NDPROXY_CLEARED`."]
5744pub type otBackboneRouterNdProxyCallback = ::std::option::Option<
5745 unsafe extern "C" fn(
5746 aContext: *mut ::std::os::raw::c_void,
5747 aEvent: otBackboneRouterNdProxyEvent,
5748 aDua: *const otIp6Address,
5749 ),
5750>;
5751unsafe extern "C" {
5752 #[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."]
5753 pub fn otBackboneRouterSetNdProxyCallback(
5754 aInstance: *mut otInstance,
5755 aCallback: otBackboneRouterNdProxyCallback,
5756 aContext: *mut ::std::os::raw::c_void,
5757 );
5758}
5759#[doc = " Represents the Backbone Router ND Proxy info."]
5760#[repr(C)]
5761#[derive(Debug, Copy, Clone)]
5762pub struct otBackboneRouterNdProxyInfo {
5763 #[doc = "< Mesh-local IID"]
5764 pub mMeshLocalIid: *mut otIp6InterfaceIdentifier,
5765 #[doc = "< Time since last transaction (Seconds)"]
5766 pub mTimeSinceLastTransaction: u32,
5767 #[doc = "< RLOC16"]
5768 pub mRloc16: u16,
5769}
5770impl Default for otBackboneRouterNdProxyInfo {
5771 fn default() -> Self {
5772 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5773 unsafe {
5774 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5775 s.assume_init()
5776 }
5777 }
5778}
5779unsafe extern "C" {
5780 #[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."]
5781 pub fn otBackboneRouterGetNdProxyInfo(
5782 aInstance: *mut otInstance,
5783 aDua: *const otIp6Address,
5784 aNdProxyInfo: *mut otBackboneRouterNdProxyInfo,
5785 ) -> otError;
5786}
5787#[doc = "< Domain Prefix was added."]
5788pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_ADDED: otBackboneRouterDomainPrefixEvent = 0;
5789#[doc = "< Domain Prefix was removed."]
5790pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_REMOVED: otBackboneRouterDomainPrefixEvent = 1;
5791#[doc = "< Domain Prefix was changed."]
5792pub const OT_BACKBONE_ROUTER_DOMAIN_PREFIX_CHANGED: otBackboneRouterDomainPrefixEvent = 2;
5793#[doc = " Represents the Domain Prefix events."]
5794pub type otBackboneRouterDomainPrefixEvent = ::std::os::raw::c_uint;
5795#[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, nullptr otherwise."]
5796pub type otBackboneRouterDomainPrefixCallback = ::std::option::Option<
5797 unsafe extern "C" fn(
5798 aContext: *mut ::std::os::raw::c_void,
5799 aEvent: otBackboneRouterDomainPrefixEvent,
5800 aDomainPrefix: *const otIp6Prefix,
5801 ),
5802>;
5803unsafe extern "C" {
5804 #[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."]
5805 pub fn otBackboneRouterSetDomainPrefixCallback(
5806 aInstance: *mut otInstance,
5807 aCallback: otBackboneRouterDomainPrefixCallback,
5808 aContext: *mut ::std::os::raw::c_void,
5809 );
5810}
5811#[doc = " Represents a Border Agent Identifier."]
5812#[repr(C)]
5813#[derive(Debug, Default, Copy, Clone)]
5814pub struct otBorderAgentId {
5815 #[doc = "< Border Agent ID bytes."]
5816 pub mId: [u8; 16usize],
5817}
5818#[doc = " Defines Border Agent counters.\n\n The `mEpskc` related counters require `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`."]
5819#[repr(C)]
5820#[derive(Debug, Default, Copy, Clone)]
5821pub struct otBorderAgentCounters {
5822 #[doc = "< The number of ePSKc activations"]
5823 pub mEpskcActivations: u32,
5824 #[doc = "< The number of ePSKc deactivations via API"]
5825 pub mEpskcDeactivationClears: u32,
5826 #[doc = "< The number of ePSKc deactivations due to timeout"]
5827 pub mEpskcDeactivationTimeouts: u32,
5828 #[doc = "< The number of ePSKc deactivations due to reached max attempts"]
5829 pub mEpskcDeactivationMaxAttempts: u32,
5830 #[doc = "< The number of ePSKc deactivations due to commissioner disconnected"]
5831 pub mEpskcDeactivationDisconnects: u32,
5832 #[doc = "< The number of invalid border agent state errors at ePSKc activation"]
5833 pub mEpskcInvalidBaStateErrors: u32,
5834 #[doc = "< The number of invalid args errors at ePSKc activation"]
5835 pub mEpskcInvalidArgsErrors: u32,
5836 #[doc = "< The number of start secure session errors at ePSKc activation"]
5837 pub mEpskcStartSecureSessionErrors: u32,
5838 #[doc = "< The number of established secure sessions with ePSKc"]
5839 pub mEpskcSecureSessionSuccesses: u32,
5840 #[doc = "< The number of failed secure sessions with ePSKc"]
5841 pub mEpskcSecureSessionFailures: u32,
5842 #[doc = "< The number of successful commissioner petitions with ePSKc"]
5843 pub mEpskcCommissionerPetitions: u32,
5844 #[doc = "< The number of established secure sessions with PSKc"]
5845 pub mPskcSecureSessionSuccesses: u32,
5846 #[doc = "< The number of failed secure sessions with PSKc"]
5847 pub mPskcSecureSessionFailures: u32,
5848 #[doc = "< The number of successful commissioner petitions with PSKc"]
5849 pub mPskcCommissionerPetitions: u32,
5850 #[doc = "< The number of MGMT_ACTIVE_GET.req sent over secure sessions"]
5851 pub mMgmtActiveGets: u32,
5852 #[doc = "< The number of MGMT_PENDING_GET.req sent over secure sessions"]
5853 pub mMgmtPendingGets: u32,
5854}
5855#[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."]
5856#[repr(C)]
5857#[derive(Copy, Clone)]
5858pub struct otBorderAgentSessionInfo {
5859 #[doc = "< Socket address (IPv6 address and port number) of session peer."]
5860 pub mPeerSockAddr: otSockAddr,
5861 #[doc = "< Indicates whether the session is connected."]
5862 pub mIsConnected: bool,
5863 #[doc = "< Indicates whether the session is accepted as full commissioner."]
5864 pub mIsCommissioner: bool,
5865 #[doc = "< Milliseconds since the session was first established."]
5866 pub mLifetime: u64,
5867}
5868impl Default for otBorderAgentSessionInfo {
5869 fn default() -> Self {
5870 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5871 unsafe {
5872 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5873 s.assume_init()
5874 }
5875 }
5876}
5877#[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."]
5878#[repr(C)]
5879#[derive(Debug, Copy, Clone)]
5880pub struct otBorderAgentSessionIterator {
5881 pub mPtr: *mut ::std::os::raw::c_void,
5882 pub mData: u64,
5883}
5884impl Default for otBorderAgentSessionIterator {
5885 fn default() -> Self {
5886 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
5887 unsafe {
5888 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
5889 s.assume_init()
5890 }
5891 }
5892}
5893unsafe extern "C" {
5894 #[doc = " Indicates whether or not the Border Agent service is active and running.\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."]
5895 pub fn otBorderAgentIsActive(aInstance: *mut otInstance) -> bool;
5896}
5897unsafe extern "C" {
5898 #[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."]
5899 pub fn otBorderAgentGetUdpPort(aInstance: *mut otInstance) -> u16;
5900}
5901#[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] aTxtData A pointer to the encoded MeshCoP TXT data originated from the Thread network.\n @param[in] aLength The length of the encoded TXT data.\n @param[in] aContext A pointer to application-specific context."]
5902pub type otBorderAgentMeshCoPServiceChangedCallback = ::std::option::Option<
5903 unsafe extern "C" fn(aTxtData: *const u8, aLength: u16, aContext: *mut ::std::os::raw::c_void),
5904>;
5905unsafe extern "C" {
5906 #[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."]
5907 pub fn otBorderAgentSetMeshCoPServiceChangedCallback(
5908 aInstance: *mut otInstance,
5909 aCallback: otBorderAgentMeshCoPServiceChangedCallback,
5910 aContext: *mut ::std::os::raw::c_void,
5911 );
5912}
5913unsafe extern "C" {
5914 #[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"]
5915 pub fn otBorderAgentGetId(aInstance: *mut otInstance, aId: *mut otBorderAgentId) -> otError;
5916}
5917unsafe extern "C" {
5918 #[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"]
5919 pub fn otBorderAgentSetId(aInstance: *mut otInstance, aId: *const otBorderAgentId) -> otError;
5920}
5921unsafe extern "C" {
5922 #[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."]
5923 pub fn otBorderAgentInitSessionIterator(
5924 aInstance: *mut otInstance,
5925 aIterator: *mut otBorderAgentSessionIterator,
5926 );
5927}
5928unsafe extern "C" {
5929 #[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."]
5930 pub fn otBorderAgentGetNextSessionInfo(
5931 aIterator: *mut otBorderAgentSessionIterator,
5932 aSessionInfo: *mut otBorderAgentSessionInfo,
5933 ) -> otError;
5934}
5935unsafe extern "C" {
5936 #[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."]
5937 pub fn otBorderAgentGetCounters(aInstance: *mut otInstance) -> *const otBorderAgentCounters;
5938}
5939#[doc = "< Ephemeral Key Manager is disabled."]
5940pub const OT_BORDER_AGENT_STATE_DISABLED: otBorderAgentEphemeralKeyState = 0;
5941#[doc = "< Enabled, but no ephemeral key is in use (not set or started)."]
5942pub const OT_BORDER_AGENT_STATE_STOPPED: otBorderAgentEphemeralKeyState = 1;
5943#[doc = "< Ephemeral key is set. Listening to accept secure connections."]
5944pub const OT_BORDER_AGENT_STATE_STARTED: otBorderAgentEphemeralKeyState = 2;
5945#[doc = "< Session is established with an external commissioner candidate."]
5946pub const OT_BORDER_AGENT_STATE_CONNECTED: otBorderAgentEphemeralKeyState = 3;
5947#[doc = "< Session is established and candidate is accepted as full commissioner."]
5948pub const OT_BORDER_AGENT_STATE_ACCEPTED: otBorderAgentEphemeralKeyState = 4;
5949#[doc = " Represents Border Agent's Ephemeral Key Manager state."]
5950pub type otBorderAgentEphemeralKeyState = ::std::os::raw::c_uint;
5951unsafe extern "C" {
5952 #[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."]
5953 pub fn otBorderAgentEphemeralKeyGetState(
5954 aInstance: *mut otInstance,
5955 ) -> otBorderAgentEphemeralKeyState;
5956}
5957unsafe extern "C" {
5958 #[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."]
5959 pub fn otBorderAgentEphemeralKeySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
5960}
5961unsafe extern "C" {
5962 #[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)."]
5963 pub fn otBorderAgentEphemeralKeyStart(
5964 aInstance: *mut otInstance,
5965 aKeyString: *const ::std::os::raw::c_char,
5966 aTimeout: u32,
5967 aUdpPort: u16,
5968 ) -> otError;
5969}
5970unsafe extern "C" {
5971 #[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."]
5972 pub fn otBorderAgentEphemeralKeyStop(aInstance: *mut otInstance);
5973}
5974unsafe extern "C" {
5975 #[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)."]
5976 pub fn otBorderAgentEphemeralKeyGetUdpPort(aInstance: *mut otInstance) -> u16;
5977}
5978#[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)."]
5979pub type otBorderAgentEphemeralKeyCallback =
5980 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
5981unsafe extern "C" {
5982 #[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."]
5983 pub fn otBorderAgentEphemeralKeySetCallback(
5984 aInstance: *mut otInstance,
5985 aCallback: otBorderAgentEphemeralKeyCallback,
5986 aContext: *mut ::std::os::raw::c_void,
5987 );
5988}
5989unsafe extern "C" {
5990 #[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."]
5991 pub fn otBorderAgentEphemeralKeyStateToString(
5992 aState: otBorderAgentEphemeralKeyState,
5993 ) -> *const ::std::os::raw::c_char;
5994}
5995#[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()`."]
5996#[repr(C)]
5997#[derive(Debug, Copy, Clone)]
5998pub struct otBorderRoutingPrefixTableIterator {
5999 pub mPtr1: *const ::std::os::raw::c_void,
6000 pub mPtr2: *const ::std::os::raw::c_void,
6001 pub mData0: u32,
6002 pub mData1: u32,
6003 pub mData2: u8,
6004 pub mData3: u8,
6005}
6006impl Default for otBorderRoutingPrefixTableIterator {
6007 fn default() -> Self {
6008 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6009 unsafe {
6010 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6011 s.assume_init()
6012 }
6013 }
6014}
6015#[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."]
6016#[repr(C)]
6017#[derive(Copy, Clone)]
6018pub struct otBorderRoutingRouterEntry {
6019 #[doc = "< IPv6 address of the router."]
6020 pub mAddress: otIp6Address,
6021 #[doc = "< Milliseconds since last update (any message rx) from this router."]
6022 pub mMsecSinceLastUpdate: u32,
6023 #[doc = "< The router's age in seconds (duration since its first discovery)."]
6024 pub mAge: u32,
6025 pub _bitfield_align_1: [u8; 0],
6026 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
6027 pub __bindgen_padding_0: [u8; 3usize],
6028}
6029impl Default for otBorderRoutingRouterEntry {
6030 fn default() -> Self {
6031 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6032 unsafe {
6033 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6034 s.assume_init()
6035 }
6036 }
6037}
6038impl otBorderRoutingRouterEntry {
6039 #[inline]
6040 pub fn mManagedAddressConfigFlag(&self) -> bool {
6041 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
6042 }
6043 #[inline]
6044 pub fn set_mManagedAddressConfigFlag(&mut self, val: bool) {
6045 unsafe {
6046 let val: u8 = ::std::mem::transmute(val);
6047 self._bitfield_1.set(0usize, 1u8, val as u64)
6048 }
6049 }
6050 #[inline]
6051 pub unsafe fn mManagedAddressConfigFlag_raw(this: *const Self) -> bool {
6052 unsafe {
6053 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6054 ::std::ptr::addr_of!((*this)._bitfield_1),
6055 0usize,
6056 1u8,
6057 ) as u8)
6058 }
6059 }
6060 #[inline]
6061 pub unsafe fn set_mManagedAddressConfigFlag_raw(this: *mut Self, val: bool) {
6062 unsafe {
6063 let val: u8 = ::std::mem::transmute(val);
6064 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6065 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6066 0usize,
6067 1u8,
6068 val as u64,
6069 )
6070 }
6071 }
6072 #[inline]
6073 pub fn mOtherConfigFlag(&self) -> bool {
6074 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
6075 }
6076 #[inline]
6077 pub fn set_mOtherConfigFlag(&mut self, val: bool) {
6078 unsafe {
6079 let val: u8 = ::std::mem::transmute(val);
6080 self._bitfield_1.set(1usize, 1u8, val as u64)
6081 }
6082 }
6083 #[inline]
6084 pub unsafe fn mOtherConfigFlag_raw(this: *const Self) -> bool {
6085 unsafe {
6086 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6087 ::std::ptr::addr_of!((*this)._bitfield_1),
6088 1usize,
6089 1u8,
6090 ) as u8)
6091 }
6092 }
6093 #[inline]
6094 pub unsafe fn set_mOtherConfigFlag_raw(this: *mut Self, val: bool) {
6095 unsafe {
6096 let val: u8 = ::std::mem::transmute(val);
6097 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6098 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6099 1usize,
6100 1u8,
6101 val as u64,
6102 )
6103 }
6104 }
6105 #[inline]
6106 pub fn mSnacRouterFlag(&self) -> bool {
6107 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
6108 }
6109 #[inline]
6110 pub fn set_mSnacRouterFlag(&mut self, val: bool) {
6111 unsafe {
6112 let val: u8 = ::std::mem::transmute(val);
6113 self._bitfield_1.set(2usize, 1u8, val as u64)
6114 }
6115 }
6116 #[inline]
6117 pub unsafe fn mSnacRouterFlag_raw(this: *const Self) -> bool {
6118 unsafe {
6119 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6120 ::std::ptr::addr_of!((*this)._bitfield_1),
6121 2usize,
6122 1u8,
6123 ) as u8)
6124 }
6125 }
6126 #[inline]
6127 pub unsafe fn set_mSnacRouterFlag_raw(this: *mut Self, val: bool) {
6128 unsafe {
6129 let val: u8 = ::std::mem::transmute(val);
6130 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6131 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6132 2usize,
6133 1u8,
6134 val as u64,
6135 )
6136 }
6137 }
6138 #[inline]
6139 pub fn mIsLocalDevice(&self) -> bool {
6140 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
6141 }
6142 #[inline]
6143 pub fn set_mIsLocalDevice(&mut self, val: bool) {
6144 unsafe {
6145 let val: u8 = ::std::mem::transmute(val);
6146 self._bitfield_1.set(3usize, 1u8, val as u64)
6147 }
6148 }
6149 #[inline]
6150 pub unsafe fn mIsLocalDevice_raw(this: *const Self) -> bool {
6151 unsafe {
6152 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6153 ::std::ptr::addr_of!((*this)._bitfield_1),
6154 3usize,
6155 1u8,
6156 ) as u8)
6157 }
6158 }
6159 #[inline]
6160 pub unsafe fn set_mIsLocalDevice_raw(this: *mut Self, val: bool) {
6161 unsafe {
6162 let val: u8 = ::std::mem::transmute(val);
6163 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6164 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6165 3usize,
6166 1u8,
6167 val as u64,
6168 )
6169 }
6170 }
6171 #[inline]
6172 pub fn mIsReachable(&self) -> bool {
6173 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
6174 }
6175 #[inline]
6176 pub fn set_mIsReachable(&mut self, val: bool) {
6177 unsafe {
6178 let val: u8 = ::std::mem::transmute(val);
6179 self._bitfield_1.set(4usize, 1u8, val as u64)
6180 }
6181 }
6182 #[inline]
6183 pub unsafe fn mIsReachable_raw(this: *const Self) -> bool {
6184 unsafe {
6185 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6186 ::std::ptr::addr_of!((*this)._bitfield_1),
6187 4usize,
6188 1u8,
6189 ) as u8)
6190 }
6191 }
6192 #[inline]
6193 pub unsafe fn set_mIsReachable_raw(this: *mut Self, val: bool) {
6194 unsafe {
6195 let val: u8 = ::std::mem::transmute(val);
6196 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6197 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6198 4usize,
6199 1u8,
6200 val as u64,
6201 )
6202 }
6203 }
6204 #[inline]
6205 pub fn mIsPeerBr(&self) -> bool {
6206 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
6207 }
6208 #[inline]
6209 pub fn set_mIsPeerBr(&mut self, val: bool) {
6210 unsafe {
6211 let val: u8 = ::std::mem::transmute(val);
6212 self._bitfield_1.set(5usize, 1u8, val as u64)
6213 }
6214 }
6215 #[inline]
6216 pub unsafe fn mIsPeerBr_raw(this: *const Self) -> bool {
6217 unsafe {
6218 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
6219 ::std::ptr::addr_of!((*this)._bitfield_1),
6220 5usize,
6221 1u8,
6222 ) as u8)
6223 }
6224 }
6225 #[inline]
6226 pub unsafe fn set_mIsPeerBr_raw(this: *mut Self, val: bool) {
6227 unsafe {
6228 let val: u8 = ::std::mem::transmute(val);
6229 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
6230 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
6231 5usize,
6232 1u8,
6233 val as u64,
6234 )
6235 }
6236 }
6237 #[inline]
6238 pub fn new_bitfield_1(
6239 mManagedAddressConfigFlag: bool,
6240 mOtherConfigFlag: bool,
6241 mSnacRouterFlag: bool,
6242 mIsLocalDevice: bool,
6243 mIsReachable: bool,
6244 mIsPeerBr: bool,
6245 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
6246 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
6247 __bindgen_bitfield_unit.set(0usize, 1u8, {
6248 let mManagedAddressConfigFlag: u8 =
6249 unsafe { ::std::mem::transmute(mManagedAddressConfigFlag) };
6250 mManagedAddressConfigFlag as u64
6251 });
6252 __bindgen_bitfield_unit.set(1usize, 1u8, {
6253 let mOtherConfigFlag: u8 = unsafe { ::std::mem::transmute(mOtherConfigFlag) };
6254 mOtherConfigFlag as u64
6255 });
6256 __bindgen_bitfield_unit.set(2usize, 1u8, {
6257 let mSnacRouterFlag: u8 = unsafe { ::std::mem::transmute(mSnacRouterFlag) };
6258 mSnacRouterFlag as u64
6259 });
6260 __bindgen_bitfield_unit.set(3usize, 1u8, {
6261 let mIsLocalDevice: u8 = unsafe { ::std::mem::transmute(mIsLocalDevice) };
6262 mIsLocalDevice as u64
6263 });
6264 __bindgen_bitfield_unit.set(4usize, 1u8, {
6265 let mIsReachable: u8 = unsafe { ::std::mem::transmute(mIsReachable) };
6266 mIsReachable as u64
6267 });
6268 __bindgen_bitfield_unit.set(5usize, 1u8, {
6269 let mIsPeerBr: u8 = unsafe { ::std::mem::transmute(mIsPeerBr) };
6270 mIsPeerBr as u64
6271 });
6272 __bindgen_bitfield_unit
6273 }
6274}
6275#[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."]
6276#[repr(C)]
6277#[derive(Copy, Clone)]
6278pub struct otBorderRoutingPrefixTableEntry {
6279 #[doc = "< Information about the router advertising this prefix."]
6280 pub mRouter: otBorderRoutingRouterEntry,
6281 #[doc = "< The discovered IPv6 prefix."]
6282 pub mPrefix: otIp6Prefix,
6283 #[doc = "< Indicates whether the prefix is on-link or route prefix."]
6284 pub mIsOnLink: bool,
6285 #[doc = "< Milliseconds since last update of this prefix."]
6286 pub mMsecSinceLastUpdate: u32,
6287 #[doc = "< Valid lifetime of the prefix (in seconds)."]
6288 pub mValidLifetime: u32,
6289 #[doc = "< Route preference when `mIsOnlink` is false."]
6290 pub mRoutePreference: otRoutePreference,
6291 #[doc = "< Preferred lifetime of the on-link prefix when `mIsOnLink`."]
6292 pub mPreferredLifetime: u32,
6293}
6294impl Default for otBorderRoutingPrefixTableEntry {
6295 fn default() -> Self {
6296 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6297 unsafe {
6298 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6299 s.assume_init()
6300 }
6301 }
6302}
6303#[doc = " Represents information about a peer Border Router found in the Network Data."]
6304#[repr(C)]
6305#[derive(Debug, Default, Copy, Clone)]
6306pub struct otBorderRoutingPeerBorderRouterEntry {
6307 #[doc = "< The RLOC16 of BR."]
6308 pub mRloc16: u16,
6309 #[doc = "< Seconds since the BR appeared in the Network Data."]
6310 pub mAge: u32,
6311}
6312#[doc = " Represents a group of data of platform-generated RA messages processed."]
6313#[repr(C)]
6314#[derive(Debug, Default, Copy, Clone)]
6315pub struct otPdProcessedRaInfo {
6316 #[doc = "< The number of platform generated RA handled by ProcessPlatformGeneratedRa."]
6317 pub mNumPlatformRaReceived: u32,
6318 #[doc = "< The number of PIO processed for adding OMR prefixes."]
6319 pub mNumPlatformPioProcessed: u32,
6320 #[doc = "< The timestamp of last processed RA message."]
6321 pub mLastPlatformRaMsec: u32,
6322}
6323#[doc = "< Routing Manager is uninitialized."]
6324pub const OT_BORDER_ROUTING_STATE_UNINITIALIZED: otBorderRoutingState = 0;
6325#[doc = "< Routing Manager is initialized but disabled."]
6326pub const OT_BORDER_ROUTING_STATE_DISABLED: otBorderRoutingState = 1;
6327#[doc = "< Routing Manager in initialized and enabled but currently stopped."]
6328pub const OT_BORDER_ROUTING_STATE_STOPPED: otBorderRoutingState = 2;
6329#[doc = "< Routing Manager is initialized, enabled, and running."]
6330pub const OT_BORDER_ROUTING_STATE_RUNNING: otBorderRoutingState = 3;
6331#[doc = " Represents the state of Border Routing Manager."]
6332pub type otBorderRoutingState = ::std::os::raw::c_uint;
6333#[doc = "< DHCPv6 PD is disabled on the border router."]
6334pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_DISABLED: otBorderRoutingDhcp6PdState = 0;
6335#[doc = "< DHCPv6 PD in enabled but won't try to request and publish a prefix."]
6336pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_STOPPED: otBorderRoutingDhcp6PdState = 1;
6337#[doc = "< DHCPv6 PD is enabled and will try to request and publish a prefix."]
6338pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_RUNNING: otBorderRoutingDhcp6PdState = 2;
6339#[doc = "< DHCPv6 PD is idle; Higher-prf prefix published by other BRs."]
6340pub const OT_BORDER_ROUTING_DHCP6_PD_STATE_IDLE: otBorderRoutingDhcp6PdState = 3;
6341#[doc = " This enumeration represents the state of DHCPv6 Prefix Delegation State."]
6342pub type otBorderRoutingDhcp6PdState = ::std::os::raw::c_uint;
6343unsafe extern "C" {
6344 #[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."]
6345 pub fn otBorderRoutingInit(
6346 aInstance: *mut otInstance,
6347 aInfraIfIndex: u32,
6348 aInfraIfIsRunning: bool,
6349 ) -> otError;
6350}
6351unsafe extern "C" {
6352 #[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."]
6353 pub fn otBorderRoutingSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
6354}
6355unsafe extern "C" {
6356 #[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."]
6357 pub fn otBorderRoutingGetState(aInstance: *mut otInstance) -> otBorderRoutingState;
6358}
6359unsafe extern "C" {
6360 #[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."]
6361 pub fn otBorderRoutingGetRouteInfoOptionPreference(
6362 aInstance: *mut otInstance,
6363 ) -> otRoutePreference;
6364}
6365unsafe extern "C" {
6366 #[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."]
6367 pub fn otBorderRoutingSetRouteInfoOptionPreference(
6368 aInstance: *mut otInstance,
6369 aPreference: otRoutePreference,
6370 );
6371}
6372unsafe extern "C" {
6373 #[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."]
6374 pub fn otBorderRoutingClearRouteInfoOptionPreference(aInstance: *mut otInstance);
6375}
6376unsafe extern "C" {
6377 #[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."]
6378 pub fn otBorderRoutingSetExtraRouterAdvertOptions(
6379 aInstance: *mut otInstance,
6380 aOptions: *const u8,
6381 aLength: u16,
6382 ) -> otError;
6383}
6384unsafe extern "C" {
6385 #[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."]
6386 pub fn otBorderRoutingGetRoutePreference(aInstance: *mut otInstance) -> otRoutePreference;
6387}
6388unsafe extern "C" {
6389 #[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."]
6390 pub fn otBorderRoutingSetRoutePreference(
6391 aInstance: *mut otInstance,
6392 aPreference: otRoutePreference,
6393 );
6394}
6395unsafe extern "C" {
6396 #[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."]
6397 pub fn otBorderRoutingClearRoutePreference(aInstance: *mut otInstance);
6398}
6399unsafe extern "C" {
6400 #[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"]
6401 pub fn otBorderRoutingGetOmrPrefix(
6402 aInstance: *mut otInstance,
6403 aPrefix: *mut otIp6Prefix,
6404 ) -> otError;
6405}
6406unsafe extern "C" {
6407 #[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"]
6408 pub fn otBorderRoutingGetPdOmrPrefix(
6409 aInstance: *mut otInstance,
6410 aPrefixInfo: *mut otBorderRoutingPrefixTableEntry,
6411 ) -> otError;
6412}
6413unsafe extern "C" {
6414 #[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."]
6415 pub fn otBorderRoutingGetPdProcessedRaInfo(
6416 aInstance: *mut otInstance,
6417 aPdProcessedRaInfo: *mut otPdProcessedRaInfo,
6418 ) -> otError;
6419}
6420unsafe extern "C" {
6421 #[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."]
6422 pub fn otBorderRoutingGetFavoredOmrPrefix(
6423 aInstance: *mut otInstance,
6424 aPrefix: *mut otIp6Prefix,
6425 aPreference: *mut otRoutePreference,
6426 ) -> otError;
6427}
6428unsafe extern "C" {
6429 #[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."]
6430 pub fn otBorderRoutingGetOnLinkPrefix(
6431 aInstance: *mut otInstance,
6432 aPrefix: *mut otIp6Prefix,
6433 ) -> otError;
6434}
6435unsafe extern "C" {
6436 #[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."]
6437 pub fn otBorderRoutingGetFavoredOnLinkPrefix(
6438 aInstance: *mut otInstance,
6439 aPrefix: *mut otIp6Prefix,
6440 ) -> otError;
6441}
6442unsafe extern "C" {
6443 #[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."]
6444 pub fn otBorderRoutingGetNat64Prefix(
6445 aInstance: *mut otInstance,
6446 aPrefix: *mut otIp6Prefix,
6447 ) -> otError;
6448}
6449unsafe extern "C" {
6450 #[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."]
6451 pub fn otBorderRoutingGetFavoredNat64Prefix(
6452 aInstance: *mut otInstance,
6453 aPrefix: *mut otIp6Prefix,
6454 aPreference: *mut otRoutePreference,
6455 ) -> otError;
6456}
6457unsafe extern "C" {
6458 #[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."]
6459 pub fn otBorderRoutingPrefixTableInitIterator(
6460 aInstance: *mut otInstance,
6461 aIterator: *mut otBorderRoutingPrefixTableIterator,
6462 );
6463}
6464unsafe extern "C" {
6465 #[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."]
6466 pub fn otBorderRoutingGetNextPrefixTableEntry(
6467 aInstance: *mut otInstance,
6468 aIterator: *mut otBorderRoutingPrefixTableIterator,
6469 aEntry: *mut otBorderRoutingPrefixTableEntry,
6470 ) -> otError;
6471}
6472unsafe extern "C" {
6473 #[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."]
6474 pub fn otBorderRoutingGetNextRouterEntry(
6475 aInstance: *mut otInstance,
6476 aIterator: *mut otBorderRoutingPrefixTableIterator,
6477 aEntry: *mut otBorderRoutingRouterEntry,
6478 ) -> otError;
6479}
6480unsafe extern "C" {
6481 #[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."]
6482 pub fn otBorderRoutingGetNextPeerBrEntry(
6483 aInstance: *mut otInstance,
6484 aIterator: *mut otBorderRoutingPrefixTableIterator,
6485 aEntry: *mut otBorderRoutingPeerBorderRouterEntry,
6486 ) -> otError;
6487}
6488unsafe extern "C" {
6489 #[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."]
6490 pub fn otBorderRoutingCountPeerBrs(aInstance: *mut otInstance, aMinAge: *mut u32) -> u16;
6491}
6492unsafe extern "C" {
6493 #[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."]
6494 pub fn otBorderRoutingDhcp6PdSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
6495}
6496unsafe extern "C" {
6497 #[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."]
6498 pub fn otBorderRoutingDhcp6PdGetState(
6499 aInstance: *mut otInstance,
6500 ) -> otBorderRoutingDhcp6PdState;
6501}
6502#[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."]
6503pub type otBorderRoutingRequestDhcp6PdCallback = ::std::option::Option<
6504 unsafe extern "C" fn(
6505 aState: otBorderRoutingDhcp6PdState,
6506 aContext: *mut ::std::os::raw::c_void,
6507 ),
6508>;
6509unsafe extern "C" {
6510 #[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."]
6511 pub fn otBorderRoutingDhcp6PdSetRequestCallback(
6512 aInstance: *mut otInstance,
6513 aCallback: otBorderRoutingRequestDhcp6PdCallback,
6514 aContext: *mut ::std::os::raw::c_void,
6515 );
6516}
6517unsafe extern "C" {
6518 #[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."]
6519 pub fn otBorderRoutingSetOnLinkPrefix(aInstance: *mut otInstance, aPrefix: *const otIp6Prefix);
6520}
6521unsafe extern "C" {
6522 #[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."]
6523 pub fn otBorderRouterGetNetData(
6524 aInstance: *mut otInstance,
6525 aStable: bool,
6526 aData: *mut u8,
6527 aDataLength: *mut u8,
6528 ) -> otError;
6529}
6530unsafe extern "C" {
6531 #[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"]
6532 pub fn otBorderRouterAddOnMeshPrefix(
6533 aInstance: *mut otInstance,
6534 aConfig: *const otBorderRouterConfig,
6535 ) -> otError;
6536}
6537unsafe extern "C" {
6538 #[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"]
6539 pub fn otBorderRouterRemoveOnMeshPrefix(
6540 aInstance: *mut otInstance,
6541 aPrefix: *const otIp6Prefix,
6542 ) -> otError;
6543}
6544unsafe extern "C" {
6545 #[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."]
6546 pub fn otBorderRouterGetNextOnMeshPrefix(
6547 aInstance: *mut otInstance,
6548 aIterator: *mut otNetworkDataIterator,
6549 aConfig: *mut otBorderRouterConfig,
6550 ) -> otError;
6551}
6552unsafe extern "C" {
6553 #[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"]
6554 pub fn otBorderRouterAddRoute(
6555 aInstance: *mut otInstance,
6556 aConfig: *const otExternalRouteConfig,
6557 ) -> otError;
6558}
6559unsafe extern "C" {
6560 #[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"]
6561 pub fn otBorderRouterRemoveRoute(
6562 aInstance: *mut otInstance,
6563 aPrefix: *const otIp6Prefix,
6564 ) -> otError;
6565}
6566unsafe extern "C" {
6567 #[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."]
6568 pub fn otBorderRouterGetNextRoute(
6569 aInstance: *mut otInstance,
6570 aIterator: *mut otNetworkDataIterator,
6571 aConfig: *mut otExternalRouteConfig,
6572 ) -> otError;
6573}
6574unsafe extern "C" {
6575 #[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"]
6576 pub fn otBorderRouterRegister(aInstance: *mut otInstance) -> otError;
6577}
6578#[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."]
6579pub type otBorderRouterNetDataFullCallback =
6580 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
6581unsafe extern "C" {
6582 #[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."]
6583 pub fn otBorderRouterSetNetDataFullCallback(
6584 aInstance: *mut otInstance,
6585 aCallback: otBorderRouterNetDataFullCallback,
6586 aContext: *mut ::std::os::raw::c_void,
6587 );
6588}
6589unsafe extern "C" {
6590 #[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."]
6591 pub fn otChannelManagerRequestChannelChange(aInstance: *mut otInstance, aChannel: u8);
6592}
6593unsafe extern "C" {
6594 #[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."]
6595 pub fn otChannelManagerGetRequestedChannel(aInstance: *mut otInstance) -> u8;
6596}
6597unsafe extern "C" {
6598 #[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."]
6599 pub fn otChannelManagerGetDelay(aInstance: *mut otInstance) -> u16;
6600}
6601unsafe extern "C" {
6602 #[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."]
6603 pub fn otChannelManagerSetDelay(aInstance: *mut otInstance, aDelay: u16) -> otError;
6604}
6605unsafe extern "C" {
6606 #[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."]
6607 pub fn otChannelManagerRequestChannelSelect(
6608 aInstance: *mut otInstance,
6609 aSkipQualityCheck: bool,
6610 ) -> otError;
6611}
6612unsafe extern "C" {
6613 #[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."]
6614 pub fn otChannelManagerRequestCslChannelSelect(
6615 aInstance: *mut otInstance,
6616 aSkipQualityCheck: bool,
6617 ) -> otError;
6618}
6619unsafe extern "C" {
6620 #[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."]
6621 pub fn otChannelManagerSetAutoChannelSelectionEnabled(
6622 aInstance: *mut otInstance,
6623 aEnabled: bool,
6624 );
6625}
6626unsafe extern "C" {
6627 #[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."]
6628 pub fn otChannelManagerGetAutoChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
6629}
6630unsafe extern "C" {
6631 #[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."]
6632 pub fn otChannelManagerSetAutoCslChannelSelectionEnabled(
6633 aInstance: *mut otInstance,
6634 aEnabled: bool,
6635 );
6636}
6637unsafe extern "C" {
6638 #[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."]
6639 pub fn otChannelManagerGetAutoCslChannelSelectionEnabled(aInstance: *mut otInstance) -> bool;
6640}
6641unsafe extern "C" {
6642 #[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)."]
6643 pub fn otChannelManagerSetAutoChannelSelectionInterval(
6644 aInstance: *mut otInstance,
6645 aInterval: u32,
6646 ) -> otError;
6647}
6648unsafe extern "C" {
6649 #[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."]
6650 pub fn otChannelManagerGetAutoChannelSelectionInterval(aInstance: *mut otInstance) -> u32;
6651}
6652unsafe extern "C" {
6653 #[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."]
6654 pub fn otChannelManagerGetSupportedChannels(aInstance: *mut otInstance) -> u32;
6655}
6656unsafe extern "C" {
6657 #[doc = " Sets the supported channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
6658 pub fn otChannelManagerSetSupportedChannels(aInstance: *mut otInstance, aChannelMask: u32);
6659}
6660unsafe extern "C" {
6661 #[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."]
6662 pub fn otChannelManagerGetFavoredChannels(aInstance: *mut otInstance) -> u32;
6663}
6664unsafe extern "C" {
6665 #[doc = " Sets the favored channel mask.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aChannelMask A channel mask."]
6666 pub fn otChannelManagerSetFavoredChannels(aInstance: *mut otInstance, aChannelMask: u32);
6667}
6668unsafe extern "C" {
6669 #[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%."]
6670 pub fn otChannelManagerGetCcaFailureRateThreshold(aInstance: *mut otInstance) -> u16;
6671}
6672unsafe extern "C" {
6673 #[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%."]
6674 pub fn otChannelManagerSetCcaFailureRateThreshold(aInstance: *mut otInstance, aThreshold: u16);
6675}
6676unsafe extern "C" {
6677 #[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."]
6678 pub fn otChannelMonitorSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
6679}
6680unsafe extern "C" {
6681 #[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."]
6682 pub fn otChannelMonitorIsEnabled(aInstance: *mut otInstance) -> bool;
6683}
6684unsafe extern "C" {
6685 #[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."]
6686 pub fn otChannelMonitorGetSampleInterval(aInstance: *mut otInstance) -> u32;
6687}
6688unsafe extern "C" {
6689 #[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."]
6690 pub fn otChannelMonitorGetRssiThreshold(aInstance: *mut otInstance) -> i8;
6691}
6692unsafe extern "C" {
6693 #[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."]
6694 pub fn otChannelMonitorGetSampleWindow(aInstance: *mut otInstance) -> u32;
6695}
6696unsafe extern "C" {
6697 #[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."]
6698 pub fn otChannelMonitorGetSampleCount(aInstance: *mut otInstance) -> u32;
6699}
6700unsafe extern "C" {
6701 #[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."]
6702 pub fn otChannelMonitorGetChannelOccupancy(aInstance: *mut otInstance, aChannel: u8) -> u16;
6703}
6704unsafe extern "C" {
6705 #[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."]
6706 pub fn otChildSupervisionGetInterval(aInstance: *mut otInstance) -> u16;
6707}
6708unsafe extern "C" {
6709 #[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."]
6710 pub fn otChildSupervisionSetInterval(aInstance: *mut otInstance, aInterval: u16);
6711}
6712unsafe extern "C" {
6713 #[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."]
6714 pub fn otChildSupervisionGetCheckTimeout(aInstance: *mut otInstance) -> u16;
6715}
6716unsafe extern "C" {
6717 #[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."]
6718 pub fn otChildSupervisionSetCheckTimeout(aInstance: *mut otInstance, aTimeout: u16);
6719}
6720unsafe extern "C" {
6721 #[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."]
6722 pub fn otChildSupervisionGetCheckFailureCounter(aInstance: *mut otInstance) -> u16;
6723}
6724unsafe extern "C" {
6725 #[doc = " Reset the supervision check timeout failure counter to zero."]
6726 pub fn otChildSupervisionResetCheckFailureCounter(aInstance: *mut otInstance);
6727}
6728#[doc = " Represents a CLI command."]
6729#[repr(C)]
6730#[derive(Debug, Copy, Clone)]
6731pub struct otCliCommand {
6732 #[doc = "< A pointer to the command string."]
6733 pub mName: *const ::std::os::raw::c_char,
6734 pub mCommand: ::std::option::Option<
6735 unsafe extern "C" fn(
6736 aContext: *mut ::std::os::raw::c_void,
6737 aArgsLength: u8,
6738 aArgs: *mut *mut ::std::os::raw::c_char,
6739 ) -> otError,
6740 >,
6741}
6742impl Default for otCliCommand {
6743 fn default() -> Self {
6744 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6745 unsafe {
6746 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6747 s.assume_init()
6748 }
6749 }
6750}
6751#[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."]
6752pub type otCliOutputCallback = ::std::option::Option<
6753 unsafe extern "C" fn(
6754 aContext: *mut ::std::os::raw::c_void,
6755 aFormat: *const ::std::os::raw::c_char,
6756 aArguments: *mut __va_list_tag,
6757 ) -> ::std::os::raw::c_int,
6758>;
6759unsafe extern "C" {
6760 #[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."]
6761 pub fn otCliInit(
6762 aInstance: *mut otInstance,
6763 aCallback: otCliOutputCallback,
6764 aContext: *mut ::std::os::raw::c_void,
6765 );
6766}
6767unsafe extern "C" {
6768 #[doc = " Is called to feed in a console input line.\n\n @param[in] aBuf A pointer to a null-terminated string."]
6769 pub fn otCliInputLine(aBuf: *mut ::std::os::raw::c_char);
6770}
6771unsafe extern "C" {
6772 #[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."]
6773 pub fn otCliSetUserCommands(
6774 aUserCommands: *const otCliCommand,
6775 aLength: u8,
6776 aContext: *mut ::std::os::raw::c_void,
6777 ) -> otError;
6778}
6779unsafe extern "C" {
6780 #[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."]
6781 pub fn otCliOutputBytes(aBytes: *const u8, aLength: u8);
6782}
6783unsafe extern "C" {
6784 #[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."]
6785 pub fn otCliOutputFormat(aFmt: *const ::std::os::raw::c_char, ...);
6786}
6787unsafe extern "C" {
6788 #[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."]
6789 pub fn otCliAppendResult(aError: otError);
6790}
6791unsafe extern "C" {
6792 #[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."]
6793 pub fn otCliPlatLogv(
6794 aLogLevel: otLogLevel,
6795 aLogRegion: otLogRegion,
6796 aFormat: *const ::std::os::raw::c_char,
6797 aArgs: *mut __va_list_tag,
6798 );
6799}
6800unsafe extern "C" {
6801 #[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."]
6802 pub fn otCliVendorSetUserCommands();
6803}
6804#[doc = "< Confirmable"]
6805pub const OT_COAP_TYPE_CONFIRMABLE: otCoapType = 0;
6806#[doc = "< Non-confirmable"]
6807pub const OT_COAP_TYPE_NON_CONFIRMABLE: otCoapType = 1;
6808#[doc = "< Acknowledgment"]
6809pub const OT_COAP_TYPE_ACKNOWLEDGMENT: otCoapType = 2;
6810#[doc = "< Reset"]
6811pub const OT_COAP_TYPE_RESET: otCoapType = 3;
6812#[doc = " CoAP Type values (2 bit unsigned integer)."]
6813pub type otCoapType = ::std::os::raw::c_uint;
6814#[doc = "< Empty message code"]
6815pub const OT_COAP_CODE_EMPTY: otCoapCode = 0;
6816#[doc = "< Get"]
6817pub const OT_COAP_CODE_GET: otCoapCode = 1;
6818#[doc = "< Post"]
6819pub const OT_COAP_CODE_POST: otCoapCode = 2;
6820#[doc = "< Put"]
6821pub const OT_COAP_CODE_PUT: otCoapCode = 3;
6822#[doc = "< Delete"]
6823pub const OT_COAP_CODE_DELETE: otCoapCode = 4;
6824#[doc = "< 2.00"]
6825pub const OT_COAP_CODE_RESPONSE_MIN: otCoapCode = 64;
6826#[doc = "< Created"]
6827pub const OT_COAP_CODE_CREATED: otCoapCode = 65;
6828#[doc = "< Deleted"]
6829pub const OT_COAP_CODE_DELETED: otCoapCode = 66;
6830#[doc = "< Valid"]
6831pub const OT_COAP_CODE_VALID: otCoapCode = 67;
6832#[doc = "< Changed"]
6833pub const OT_COAP_CODE_CHANGED: otCoapCode = 68;
6834#[doc = "< Content"]
6835pub const OT_COAP_CODE_CONTENT: otCoapCode = 69;
6836#[doc = "< RFC7959 Continue"]
6837pub const OT_COAP_CODE_CONTINUE: otCoapCode = 95;
6838#[doc = "< Bad Request"]
6839pub const OT_COAP_CODE_BAD_REQUEST: otCoapCode = 128;
6840#[doc = "< Unauthorized"]
6841pub const OT_COAP_CODE_UNAUTHORIZED: otCoapCode = 129;
6842#[doc = "< Bad Option"]
6843pub const OT_COAP_CODE_BAD_OPTION: otCoapCode = 130;
6844#[doc = "< Forbidden"]
6845pub const OT_COAP_CODE_FORBIDDEN: otCoapCode = 131;
6846#[doc = "< Not Found"]
6847pub const OT_COAP_CODE_NOT_FOUND: otCoapCode = 132;
6848#[doc = "< Method Not Allowed"]
6849pub const OT_COAP_CODE_METHOD_NOT_ALLOWED: otCoapCode = 133;
6850#[doc = "< Not Acceptable"]
6851pub const OT_COAP_CODE_NOT_ACCEPTABLE: otCoapCode = 134;
6852#[doc = "< RFC7959 Request Entity Incomplete"]
6853pub const OT_COAP_CODE_REQUEST_INCOMPLETE: otCoapCode = 136;
6854#[doc = "< Precondition Failed"]
6855pub const OT_COAP_CODE_PRECONDITION_FAILED: otCoapCode = 140;
6856#[doc = "< Request Entity Too Large"]
6857pub const OT_COAP_CODE_REQUEST_TOO_LARGE: otCoapCode = 141;
6858#[doc = "< Unsupported Content-Format"]
6859pub const OT_COAP_CODE_UNSUPPORTED_FORMAT: otCoapCode = 143;
6860#[doc = "< Internal Server Error"]
6861pub const OT_COAP_CODE_INTERNAL_ERROR: otCoapCode = 160;
6862#[doc = "< Not Implemented"]
6863pub const OT_COAP_CODE_NOT_IMPLEMENTED: otCoapCode = 161;
6864#[doc = "< Bad Gateway"]
6865pub const OT_COAP_CODE_BAD_GATEWAY: otCoapCode = 162;
6866#[doc = "< Service Unavailable"]
6867pub const OT_COAP_CODE_SERVICE_UNAVAILABLE: otCoapCode = 163;
6868#[doc = "< Gateway Timeout"]
6869pub const OT_COAP_CODE_GATEWAY_TIMEOUT: otCoapCode = 164;
6870#[doc = "< Proxying Not Supported"]
6871pub const OT_COAP_CODE_PROXY_NOT_SUPPORTED: otCoapCode = 165;
6872#[doc = " CoAP Code values."]
6873pub type otCoapCode = ::std::os::raw::c_uint;
6874#[doc = "< If-Match"]
6875pub const OT_COAP_OPTION_IF_MATCH: otCoapOptionType = 1;
6876#[doc = "< Uri-Host"]
6877pub const OT_COAP_OPTION_URI_HOST: otCoapOptionType = 3;
6878#[doc = "< ETag"]
6879pub const OT_COAP_OPTION_E_TAG: otCoapOptionType = 4;
6880#[doc = "< If-None-Match"]
6881pub const OT_COAP_OPTION_IF_NONE_MATCH: otCoapOptionType = 5;
6882#[doc = "< Observe [RFC7641]"]
6883pub const OT_COAP_OPTION_OBSERVE: otCoapOptionType = 6;
6884#[doc = "< Uri-Port"]
6885pub const OT_COAP_OPTION_URI_PORT: otCoapOptionType = 7;
6886#[doc = "< Location-Path"]
6887pub const OT_COAP_OPTION_LOCATION_PATH: otCoapOptionType = 8;
6888#[doc = "< Uri-Path"]
6889pub const OT_COAP_OPTION_URI_PATH: otCoapOptionType = 11;
6890#[doc = "< Content-Format"]
6891pub const OT_COAP_OPTION_CONTENT_FORMAT: otCoapOptionType = 12;
6892#[doc = "< Max-Age"]
6893pub const OT_COAP_OPTION_MAX_AGE: otCoapOptionType = 14;
6894#[doc = "< Uri-Query"]
6895pub const OT_COAP_OPTION_URI_QUERY: otCoapOptionType = 15;
6896#[doc = "< Accept"]
6897pub const OT_COAP_OPTION_ACCEPT: otCoapOptionType = 17;
6898#[doc = "< Location-Query"]
6899pub const OT_COAP_OPTION_LOCATION_QUERY: otCoapOptionType = 20;
6900#[doc = "< Block2 (RFC7959)"]
6901pub const OT_COAP_OPTION_BLOCK2: otCoapOptionType = 23;
6902#[doc = "< Block1 (RFC7959)"]
6903pub const OT_COAP_OPTION_BLOCK1: otCoapOptionType = 27;
6904#[doc = "< Size2 (RFC7959)"]
6905pub const OT_COAP_OPTION_SIZE2: otCoapOptionType = 28;
6906#[doc = "< Proxy-Uri"]
6907pub const OT_COAP_OPTION_PROXY_URI: otCoapOptionType = 35;
6908#[doc = "< Proxy-Scheme"]
6909pub const OT_COAP_OPTION_PROXY_SCHEME: otCoapOptionType = 39;
6910#[doc = "< Size1"]
6911pub const OT_COAP_OPTION_SIZE1: otCoapOptionType = 60;
6912#[doc = " CoAP Option Numbers"]
6913pub type otCoapOptionType = ::std::os::raw::c_uint;
6914#[doc = " Represents a CoAP option."]
6915#[repr(C)]
6916#[derive(Debug, Default, Copy, Clone)]
6917pub struct otCoapOption {
6918 #[doc = "< Option Number"]
6919 pub mNumber: u16,
6920 #[doc = "< Option Length"]
6921 pub mLength: u16,
6922}
6923#[doc = " Acts as an iterator for CoAP options"]
6924#[repr(C)]
6925#[derive(Debug, Copy, Clone)]
6926pub struct otCoapOptionIterator {
6927 #[doc = "< CoAP message"]
6928 pub mMessage: *const otMessage,
6929 #[doc = "< CoAP message option"]
6930 pub mOption: otCoapOption,
6931 #[doc = "< Byte offset of next option"]
6932 pub mNextOptionOffset: u16,
6933}
6934impl Default for otCoapOptionIterator {
6935 fn default() -> Self {
6936 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
6937 unsafe {
6938 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
6939 s.assume_init()
6940 }
6941 }
6942}
6943#[doc = " text/plain; charset=utf-8: [RFC2046][RFC3676][RFC5147]"]
6944pub const OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN: otCoapOptionContentFormat = 0;
6945#[doc = " application/cose; cose-type=\"cose-encrypt0\": [RFC8152]"]
6946pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0: otCoapOptionContentFormat = 16;
6947#[doc = " application/cose; cose-type=\"cose-mac0\": [RFC8152]"]
6948pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0: otCoapOptionContentFormat = 17;
6949#[doc = " application/cose; cose-type=\"cose-sign1\": [RFC8152]"]
6950pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1: otCoapOptionContentFormat = 18;
6951#[doc = " application/link-format: [RFC6690]"]
6952pub const OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT: otCoapOptionContentFormat = 40;
6953#[doc = " application/xml: [RFC3023]"]
6954pub const OT_COAP_OPTION_CONTENT_FORMAT_XML: otCoapOptionContentFormat = 41;
6955#[doc = " application/octet-stream: [RFC2045][RFC2046]"]
6956pub const OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM: otCoapOptionContentFormat = 42;
6957#[doc = " application/exi:\n [\"Efficient XML Interchange (EXI) Format 1.0 (Second Edition)\", February 2014]"]
6958pub const OT_COAP_OPTION_CONTENT_FORMAT_EXI: otCoapOptionContentFormat = 47;
6959#[doc = " application/json: [RFC7159]"]
6960pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON: otCoapOptionContentFormat = 50;
6961#[doc = " application/json-patch+json: [RFC6902]"]
6962pub const OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON: otCoapOptionContentFormat = 51;
6963#[doc = " application/merge-patch+json: [RFC7396]"]
6964pub const OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON: otCoapOptionContentFormat = 52;
6965#[doc = " application/cbor: [RFC7049]"]
6966pub const OT_COAP_OPTION_CONTENT_FORMAT_CBOR: otCoapOptionContentFormat = 60;
6967#[doc = " application/cwt: [RFC8392]"]
6968pub const OT_COAP_OPTION_CONTENT_FORMAT_CWT: otCoapOptionContentFormat = 61;
6969#[doc = " application/cose; cose-type=\"cose-encrypt\": [RFC8152]"]
6970pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT: otCoapOptionContentFormat = 96;
6971#[doc = " application/cose; cose-type=\"cose-mac\": [RFC8152]"]
6972pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC: otCoapOptionContentFormat = 97;
6973#[doc = " application/cose; cose-type=\"cose-sign\": [RFC8152]"]
6974pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN: otCoapOptionContentFormat = 98;
6975#[doc = " application/cose-key: [RFC8152]"]
6976pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY: otCoapOptionContentFormat = 101;
6977#[doc = " application/cose-key-set: [RFC8152]"]
6978pub const OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET: otCoapOptionContentFormat = 102;
6979#[doc = " application/senml+json: [RFC8428]"]
6980pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON: otCoapOptionContentFormat = 110;
6981#[doc = " application/sensml+json: [RFC8428]"]
6982pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON: otCoapOptionContentFormat = 111;
6983#[doc = " application/senml+cbor: [RFC8428]"]
6984pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR: otCoapOptionContentFormat = 112;
6985#[doc = " application/sensml+cbor: [RFC8428]"]
6986pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR: otCoapOptionContentFormat = 113;
6987#[doc = " application/senml-exi: [RFC8428]"]
6988pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI: otCoapOptionContentFormat = 114;
6989#[doc = " application/sensml-exi: [RFC8428]"]
6990pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI: otCoapOptionContentFormat = 115;
6991#[doc = " application/coap-group+json: [RFC7390]"]
6992pub const OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON: otCoapOptionContentFormat = 256;
6993#[doc = " application/senml+xml: [RFC8428]"]
6994pub const OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML: otCoapOptionContentFormat = 310;
6995#[doc = " application/sensml+xml: [RFC8428]"]
6996pub const OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML: otCoapOptionContentFormat = 311;
6997#[doc = " CoAP Content Format codes. The full list is documented at\n https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats"]
6998pub type otCoapOptionContentFormat = ::std::os::raw::c_uint;
6999pub const OT_COAP_OPTION_BLOCK_SZX_16: otCoapBlockSzx = 0;
7000pub const OT_COAP_OPTION_BLOCK_SZX_32: otCoapBlockSzx = 1;
7001pub const OT_COAP_OPTION_BLOCK_SZX_64: otCoapBlockSzx = 2;
7002pub const OT_COAP_OPTION_BLOCK_SZX_128: otCoapBlockSzx = 3;
7003pub const OT_COAP_OPTION_BLOCK_SZX_256: otCoapBlockSzx = 4;
7004pub const OT_COAP_OPTION_BLOCK_SZX_512: otCoapBlockSzx = 5;
7005pub const OT_COAP_OPTION_BLOCK_SZX_1024: otCoapBlockSzx = 6;
7006#[doc = " CoAP Block Size Exponents"]
7007pub type otCoapBlockSzx = ::std::os::raw::c_uint;
7008#[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."]
7009pub type otCoapResponseHandler = ::std::option::Option<
7010 unsafe extern "C" fn(
7011 aContext: *mut ::std::os::raw::c_void,
7012 aMessage: *mut otMessage,
7013 aMessageInfo: *const otMessageInfo,
7014 aResult: otError,
7015 ),
7016>;
7017#[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."]
7018pub type otCoapRequestHandler = ::std::option::Option<
7019 unsafe extern "C" fn(
7020 aContext: *mut ::std::os::raw::c_void,
7021 aMessage: *mut otMessage,
7022 aMessageInfo: *const otMessageInfo,
7023 ),
7024>;
7025#[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."]
7026pub type otCoapBlockwiseReceiveHook = ::std::option::Option<
7027 unsafe extern "C" fn(
7028 aContext: *mut ::std::os::raw::c_void,
7029 aBlock: *const u8,
7030 aPosition: u32,
7031 aBlockLength: u16,
7032 aMore: bool,
7033 aTotalLength: u32,
7034 ) -> otError,
7035>;
7036#[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."]
7037pub type otCoapBlockwiseTransmitHook = ::std::option::Option<
7038 unsafe extern "C" fn(
7039 aContext: *mut ::std::os::raw::c_void,
7040 aBlock: *mut u8,
7041 aPosition: u32,
7042 aBlockLength: *mut u16,
7043 aMore: *mut bool,
7044 ) -> otError,
7045>;
7046#[doc = " Represents a CoAP resource."]
7047#[repr(C)]
7048#[derive(Debug, Copy, Clone)]
7049pub struct otCoapResource {
7050 #[doc = "< The URI Path string"]
7051 pub mUriPath: *const ::std::os::raw::c_char,
7052 #[doc = "< The callback for handling a received request"]
7053 pub mHandler: otCoapRequestHandler,
7054 #[doc = "< Application-specific context"]
7055 pub mContext: *mut ::std::os::raw::c_void,
7056 #[doc = "< The next CoAP resource in the list"]
7057 pub mNext: *mut otCoapResource,
7058}
7059impl Default for otCoapResource {
7060 fn default() -> Self {
7061 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7062 unsafe {
7063 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7064 s.assume_init()
7065 }
7066 }
7067}
7068#[doc = " Represents a CoAP resource with block-wise transfer."]
7069#[repr(C)]
7070#[derive(Debug, Copy, Clone)]
7071pub struct otCoapBlockwiseResource {
7072 #[doc = "< The URI Path string"]
7073 pub mUriPath: *const ::std::os::raw::c_char,
7074 #[doc = "< The callback for handling a received request"]
7075 pub mHandler: otCoapRequestHandler,
7076 #[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."]
7077 pub mReceiveHook: otCoapBlockwiseReceiveHook,
7078 #[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."]
7079 pub mTransmitHook: otCoapBlockwiseTransmitHook,
7080 #[doc = "< Application-specific context"]
7081 pub mContext: *mut ::std::os::raw::c_void,
7082 #[doc = "< The next CoAP resource in the list"]
7083 pub mNext: *mut otCoapBlockwiseResource,
7084}
7085impl Default for otCoapBlockwiseResource {
7086 fn default() -> Self {
7087 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7088 unsafe {
7089 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7090 s.assume_init()
7091 }
7092 }
7093}
7094#[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."]
7095#[repr(C)]
7096#[derive(Debug, Default, Copy, Clone)]
7097pub struct otCoapTxParameters {
7098 #[doc = " Minimum spacing before first retransmission when ACK is not received, in milliseconds (RFC7252 default value is\n 2000ms)."]
7099 pub mAckTimeout: u32,
7100 #[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)."]
7101 pub mAckRandomFactorNumerator: u8,
7102 #[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)."]
7103 pub mAckRandomFactorDenominator: u8,
7104 #[doc = " Maximum number of retransmissions for CoAP Confirmable messages (RFC7252 default value is 4)."]
7105 pub mMaxRetransmit: u8,
7106}
7107unsafe extern "C" {
7108 #[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."]
7109 pub fn otCoapMessageInit(aMessage: *mut otMessage, aType: otCoapType, aCode: otCoapCode);
7110}
7111unsafe extern "C" {
7112 #[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."]
7113 pub fn otCoapMessageInitResponse(
7114 aResponse: *mut otMessage,
7115 aRequest: *const otMessage,
7116 aType: otCoapType,
7117 aCode: otCoapCode,
7118 ) -> otError;
7119}
7120unsafe extern "C" {
7121 #[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."]
7122 pub fn otCoapMessageSetToken(
7123 aMessage: *mut otMessage,
7124 aToken: *const u8,
7125 aTokenLength: u8,
7126 ) -> otError;
7127}
7128unsafe extern "C" {
7129 #[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."]
7130 pub fn otCoapMessageGenerateToken(aMessage: *mut otMessage, aTokenLength: u8);
7131}
7132unsafe extern "C" {
7133 #[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."]
7134 pub fn otCoapMessageAppendContentFormatOption(
7135 aMessage: *mut otMessage,
7136 aContentFormat: otCoapOptionContentFormat,
7137 ) -> otError;
7138}
7139unsafe extern "C" {
7140 #[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."]
7141 pub fn otCoapMessageAppendOption(
7142 aMessage: *mut otMessage,
7143 aNumber: u16,
7144 aLength: u16,
7145 aValue: *const ::std::os::raw::c_void,
7146 ) -> otError;
7147}
7148unsafe extern "C" {
7149 #[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"]
7150 pub fn otCoapMessageAppendUintOption(
7151 aMessage: *mut otMessage,
7152 aNumber: u16,
7153 aValue: u32,
7154 ) -> otError;
7155}
7156unsafe extern "C" {
7157 #[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."]
7158 pub fn otCoapMessageAppendObserveOption(aMessage: *mut otMessage, aObserve: u32) -> otError;
7159}
7160unsafe extern "C" {
7161 #[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."]
7162 pub fn otCoapMessageAppendUriPathOptions(
7163 aMessage: *mut otMessage,
7164 aUriPath: *const ::std::os::raw::c_char,
7165 ) -> otError;
7166}
7167unsafe extern "C" {
7168 #[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."]
7169 pub fn otCoapMessageAppendUriQueryOptions(
7170 aMessage: *mut otMessage,
7171 aUriQuery: *const ::std::os::raw::c_char,
7172 ) -> otError;
7173}
7174unsafe extern "C" {
7175 #[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."]
7176 pub fn otCoapBlockSizeFromExponent(aSize: otCoapBlockSzx) -> u16;
7177}
7178unsafe extern "C" {
7179 #[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."]
7180 pub fn otCoapMessageAppendBlock2Option(
7181 aMessage: *mut otMessage,
7182 aNum: u32,
7183 aMore: bool,
7184 aSize: otCoapBlockSzx,
7185 ) -> otError;
7186}
7187unsafe extern "C" {
7188 #[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."]
7189 pub fn otCoapMessageAppendBlock1Option(
7190 aMessage: *mut otMessage,
7191 aNum: u32,
7192 aMore: bool,
7193 aSize: otCoapBlockSzx,
7194 ) -> otError;
7195}
7196unsafe extern "C" {
7197 #[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."]
7198 pub fn otCoapMessageAppendProxyUriOption(
7199 aMessage: *mut otMessage,
7200 aUriPath: *const ::std::os::raw::c_char,
7201 ) -> otError;
7202}
7203unsafe extern "C" {
7204 #[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."]
7205 pub fn otCoapMessageAppendMaxAgeOption(aMessage: *mut otMessage, aMaxAge: u32) -> otError;
7206}
7207unsafe extern "C" {
7208 #[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."]
7209 pub fn otCoapMessageAppendUriQueryOption(
7210 aMessage: *mut otMessage,
7211 aUriQuery: *const ::std::os::raw::c_char,
7212 ) -> otError;
7213}
7214unsafe extern "C" {
7215 #[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."]
7216 pub fn otCoapMessageSetPayloadMarker(aMessage: *mut otMessage) -> otError;
7217}
7218unsafe extern "C" {
7219 #[doc = " Returns the Type value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Type value."]
7220 pub fn otCoapMessageGetType(aMessage: *const otMessage) -> otCoapType;
7221}
7222unsafe extern "C" {
7223 #[doc = " Returns the Code value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Code value."]
7224 pub fn otCoapMessageGetCode(aMessage: *const otMessage) -> otCoapCode;
7225}
7226unsafe extern "C" {
7227 #[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."]
7228 pub fn otCoapMessageSetCode(aMessage: *mut otMessage, aCode: otCoapCode);
7229}
7230unsafe extern "C" {
7231 #[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."]
7232 pub fn otCoapMessageCodeToString(aMessage: *const otMessage) -> *const ::std::os::raw::c_char;
7233}
7234unsafe extern "C" {
7235 #[doc = " Returns the Message ID value.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Message ID value."]
7236 pub fn otCoapMessageGetMessageId(aMessage: *const otMessage) -> u16;
7237}
7238unsafe extern "C" {
7239 #[doc = " Returns the Token length.\n\n @param[in] aMessage A pointer to the CoAP message.\n\n @returns The Token length."]
7240 pub fn otCoapMessageGetTokenLength(aMessage: *const otMessage) -> u8;
7241}
7242unsafe extern "C" {
7243 #[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."]
7244 pub fn otCoapMessageGetToken(aMessage: *const otMessage) -> *const u8;
7245}
7246unsafe extern "C" {
7247 #[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."]
7248 pub fn otCoapOptionIteratorInit(
7249 aIterator: *mut otCoapOptionIterator,
7250 aMessage: *const otMessage,
7251 ) -> otError;
7252}
7253unsafe extern "C" {
7254 #[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."]
7255 pub fn otCoapOptionIteratorGetFirstOptionMatching(
7256 aIterator: *mut otCoapOptionIterator,
7257 aOption: u16,
7258 ) -> *const otCoapOption;
7259}
7260unsafe extern "C" {
7261 #[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."]
7262 pub fn otCoapOptionIteratorGetFirstOption(
7263 aIterator: *mut otCoapOptionIterator,
7264 ) -> *const otCoapOption;
7265}
7266unsafe extern "C" {
7267 #[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."]
7268 pub fn otCoapOptionIteratorGetNextOptionMatching(
7269 aIterator: *mut otCoapOptionIterator,
7270 aOption: u16,
7271 ) -> *const otCoapOption;
7272}
7273unsafe extern "C" {
7274 #[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."]
7275 pub fn otCoapOptionIteratorGetNextOption(
7276 aIterator: *mut otCoapOptionIterator,
7277 ) -> *const otCoapOption;
7278}
7279unsafe extern "C" {
7280 #[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"]
7281 pub fn otCoapOptionIteratorGetOptionUintValue(
7282 aIterator: *mut otCoapOptionIterator,
7283 aValue: *mut u64,
7284 ) -> otError;
7285}
7286unsafe extern "C" {
7287 #[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."]
7288 pub fn otCoapOptionIteratorGetOptionValue(
7289 aIterator: *mut otCoapOptionIterator,
7290 aValue: *mut ::std::os::raw::c_void,
7291 ) -> otError;
7292}
7293unsafe extern "C" {
7294 #[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."]
7295 pub fn otCoapNewMessage(
7296 aInstance: *mut otInstance,
7297 aSettings: *const otMessageSettings,
7298 ) -> *mut otMessage;
7299}
7300unsafe extern "C" {
7301 #[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."]
7302 pub fn otCoapSendRequestWithParameters(
7303 aInstance: *mut otInstance,
7304 aMessage: *mut otMessage,
7305 aMessageInfo: *const otMessageInfo,
7306 aHandler: otCoapResponseHandler,
7307 aContext: *mut ::std::os::raw::c_void,
7308 aTxParameters: *const otCoapTxParameters,
7309 ) -> otError;
7310}
7311unsafe extern "C" {
7312 #[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."]
7313 pub fn otCoapSendRequestBlockWiseWithParameters(
7314 aInstance: *mut otInstance,
7315 aMessage: *mut otMessage,
7316 aMessageInfo: *const otMessageInfo,
7317 aHandler: otCoapResponseHandler,
7318 aContext: *mut ::std::os::raw::c_void,
7319 aTxParameters: *const otCoapTxParameters,
7320 aTransmitHook: otCoapBlockwiseTransmitHook,
7321 aReceiveHook: otCoapBlockwiseReceiveHook,
7322 ) -> otError;
7323}
7324unsafe extern "C" {
7325 #[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."]
7326 pub fn otCoapStart(aInstance: *mut otInstance, aPort: u16) -> otError;
7327}
7328unsafe extern "C" {
7329 #[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."]
7330 pub fn otCoapStop(aInstance: *mut otInstance) -> otError;
7331}
7332unsafe extern "C" {
7333 #[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."]
7334 pub fn otCoapAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
7335}
7336unsafe extern "C" {
7337 #[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."]
7338 pub fn otCoapRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
7339}
7340unsafe extern "C" {
7341 #[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."]
7342 pub fn otCoapAddBlockWiseResource(
7343 aInstance: *mut otInstance,
7344 aResource: *mut otCoapBlockwiseResource,
7345 );
7346}
7347unsafe extern "C" {
7348 #[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."]
7349 pub fn otCoapRemoveBlockWiseResource(
7350 aInstance: *mut otInstance,
7351 aResource: *mut otCoapBlockwiseResource,
7352 );
7353}
7354unsafe extern "C" {
7355 #[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."]
7356 pub fn otCoapSetDefaultHandler(
7357 aInstance: *mut otInstance,
7358 aHandler: otCoapRequestHandler,
7359 aContext: *mut ::std::os::raw::c_void,
7360 );
7361}
7362unsafe extern "C" {
7363 #[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."]
7364 pub fn otCoapSendResponseWithParameters(
7365 aInstance: *mut otInstance,
7366 aMessage: *mut otMessage,
7367 aMessageInfo: *const otMessageInfo,
7368 aTxParameters: *const otCoapTxParameters,
7369 ) -> otError;
7370}
7371unsafe extern "C" {
7372 #[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."]
7373 pub fn otCoapSendResponseBlockWiseWithParameters(
7374 aInstance: *mut otInstance,
7375 aMessage: *mut otMessage,
7376 aMessageInfo: *const otMessageInfo,
7377 aTxParameters: *const otCoapTxParameters,
7378 aContext: *mut ::std::os::raw::c_void,
7379 aTransmitHook: otCoapBlockwiseTransmitHook,
7380 ) -> otError;
7381}
7382#[doc = "< Connection established"]
7383pub const OT_COAP_SECURE_CONNECTED: otCoapSecureConnectEvent = 0;
7384#[doc = "< Disconnected by peer"]
7385pub const OT_COAP_SECURE_DISCONNECTED_PEER_CLOSED: otCoapSecureConnectEvent = 1;
7386#[doc = "< Disconnected locally"]
7387pub const OT_COAP_SECURE_DISCONNECTED_LOCAL_CLOSED: otCoapSecureConnectEvent = 2;
7388#[doc = "< Disconnected due to reaching the max connection attempts"]
7389pub const OT_COAP_SECURE_DISCONNECTED_MAX_ATTEMPTS: otCoapSecureConnectEvent = 3;
7390#[doc = "< Disconnected due to an error"]
7391pub const OT_COAP_SECURE_DISCONNECTED_ERROR: otCoapSecureConnectEvent = 4;
7392#[doc = " CoAP secure connection event types."]
7393pub type otCoapSecureConnectEvent = ::std::os::raw::c_uint;
7394#[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."]
7395pub type otHandleCoapSecureClientConnect = ::std::option::Option<
7396 unsafe extern "C" fn(aEvent: otCoapSecureConnectEvent, aContext: *mut ::std::os::raw::c_void),
7397>;
7398#[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."]
7399pub type otCoapSecureAutoStopCallback =
7400 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
7401unsafe extern "C" {
7402 #[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."]
7403 pub fn otCoapSecureStart(aInstance: *mut otInstance, aPort: u16) -> otError;
7404}
7405unsafe extern "C" {
7406 #[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."]
7407 pub fn otCoapSecureStartWithMaxConnAttempts(
7408 aInstance: *mut otInstance,
7409 aPort: u16,
7410 aMaxAttempts: u16,
7411 aCallback: otCoapSecureAutoStopCallback,
7412 aContext: *mut ::std::os::raw::c_void,
7413 ) -> otError;
7414}
7415unsafe extern "C" {
7416 #[doc = " Stops the CoAP Secure server.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
7417 pub fn otCoapSecureStop(aInstance: *mut otInstance);
7418}
7419unsafe extern "C" {
7420 #[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."]
7421 pub fn otCoapSecureSetPsk(
7422 aInstance: *mut otInstance,
7423 aPsk: *const u8,
7424 aPskLength: u16,
7425 aPskIdentity: *const u8,
7426 aPskIdLength: u16,
7427 );
7428}
7429unsafe extern "C" {
7430 #[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."]
7431 pub fn otCoapSecureGetPeerCertificateBase64(
7432 aInstance: *mut otInstance,
7433 aPeerCert: *mut ::std::os::raw::c_uchar,
7434 aCertLength: *mut usize,
7435 aCertBufferSize: usize,
7436 ) -> otError;
7437}
7438unsafe extern "C" {
7439 #[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."]
7440 pub fn otCoapSecureSetSslAuthMode(aInstance: *mut otInstance, aVerifyPeerCertificate: bool);
7441}
7442unsafe extern "C" {
7443 #[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."]
7444 pub fn otCoapSecureSetCertificate(
7445 aInstance: *mut otInstance,
7446 aX509Cert: *const u8,
7447 aX509Length: u32,
7448 aPrivateKey: *const u8,
7449 aPrivateKeyLength: u32,
7450 );
7451}
7452unsafe extern "C" {
7453 #[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."]
7454 pub fn otCoapSecureSetCaCertificateChain(
7455 aInstance: *mut otInstance,
7456 aX509CaCertificateChain: *const u8,
7457 aX509CaCertChainLength: u32,
7458 );
7459}
7460unsafe extern "C" {
7461 #[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."]
7462 pub fn otCoapSecureConnect(
7463 aInstance: *mut otInstance,
7464 aSockAddr: *const otSockAddr,
7465 aHandler: otHandleCoapSecureClientConnect,
7466 aContext: *mut ::std::os::raw::c_void,
7467 ) -> otError;
7468}
7469unsafe extern "C" {
7470 #[doc = " Stops the DTLS connection.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
7471 pub fn otCoapSecureDisconnect(aInstance: *mut otInstance);
7472}
7473unsafe extern "C" {
7474 #[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."]
7475 pub fn otCoapSecureIsConnected(aInstance: *mut otInstance) -> bool;
7476}
7477unsafe extern "C" {
7478 #[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."]
7479 pub fn otCoapSecureIsConnectionActive(aInstance: *mut otInstance) -> bool;
7480}
7481unsafe extern "C" {
7482 #[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."]
7483 pub fn otCoapSecureIsClosed(aInstance: *mut otInstance) -> bool;
7484}
7485unsafe extern "C" {
7486 #[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."]
7487 pub fn otCoapSecureSendRequestBlockWise(
7488 aInstance: *mut otInstance,
7489 aMessage: *mut otMessage,
7490 aHandler: otCoapResponseHandler,
7491 aContext: *mut ::std::os::raw::c_void,
7492 aTransmitHook: otCoapBlockwiseTransmitHook,
7493 aReceiveHook: otCoapBlockwiseReceiveHook,
7494 ) -> otError;
7495}
7496unsafe extern "C" {
7497 #[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."]
7498 pub fn otCoapSecureSendRequest(
7499 aInstance: *mut otInstance,
7500 aMessage: *mut otMessage,
7501 aHandler: otCoapResponseHandler,
7502 aContext: *mut ::std::os::raw::c_void,
7503 ) -> otError;
7504}
7505unsafe extern "C" {
7506 #[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."]
7507 pub fn otCoapSecureAddResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
7508}
7509unsafe extern "C" {
7510 #[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."]
7511 pub fn otCoapSecureRemoveResource(aInstance: *mut otInstance, aResource: *mut otCoapResource);
7512}
7513unsafe extern "C" {
7514 #[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."]
7515 pub fn otCoapSecureAddBlockWiseResource(
7516 aInstance: *mut otInstance,
7517 aResource: *mut otCoapBlockwiseResource,
7518 );
7519}
7520unsafe extern "C" {
7521 #[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."]
7522 pub fn otCoapSecureRemoveBlockWiseResource(
7523 aInstance: *mut otInstance,
7524 aResource: *mut otCoapBlockwiseResource,
7525 );
7526}
7527unsafe extern "C" {
7528 #[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."]
7529 pub fn otCoapSecureSetDefaultHandler(
7530 aInstance: *mut otInstance,
7531 aHandler: otCoapRequestHandler,
7532 aContext: *mut ::std::os::raw::c_void,
7533 );
7534}
7535unsafe extern "C" {
7536 #[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."]
7537 pub fn otCoapSecureSetClientConnectEventCallback(
7538 aInstance: *mut otInstance,
7539 aHandler: otHandleCoapSecureClientConnect,
7540 aContext: *mut ::std::os::raw::c_void,
7541 );
7542}
7543unsafe extern "C" {
7544 #[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."]
7545 pub fn otCoapSecureSendResponseBlockWise(
7546 aInstance: *mut otInstance,
7547 aMessage: *mut otMessage,
7548 aMessageInfo: *const otMessageInfo,
7549 aContext: *mut ::std::os::raw::c_void,
7550 aTransmitHook: otCoapBlockwiseTransmitHook,
7551 ) -> otError;
7552}
7553unsafe extern "C" {
7554 #[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."]
7555 pub fn otCoapSecureSendResponse(
7556 aInstance: *mut otInstance,
7557 aMessage: *mut otMessage,
7558 aMessageInfo: *const otMessageInfo,
7559 ) -> otError;
7560}
7561unsafe extern "C" {
7562 #[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."]
7563 pub fn otDatasetCreateNewNetwork(
7564 aInstance: *mut otInstance,
7565 aDataset: *mut otOperationalDataset,
7566 ) -> otError;
7567}
7568unsafe extern "C" {
7569 #[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)."]
7570 pub fn otDatasetGetDelayTimerMinimal(aInstance: *mut otInstance) -> u32;
7571}
7572unsafe extern "C" {
7573 #[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."]
7574 pub fn otDatasetSetDelayTimerMinimal(
7575 aInstance: *mut otInstance,
7576 aDelayTimerMinimal: u32,
7577 ) -> otError;
7578}
7579#[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()`)."]
7580pub type otDatasetUpdaterCallback = ::std::option::Option<
7581 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
7582>;
7583unsafe extern "C" {
7584 #[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."]
7585 pub fn otDatasetUpdaterRequestUpdate(
7586 aInstance: *mut otInstance,
7587 aDataset: *const otOperationalDataset,
7588 aCallback: otDatasetUpdaterCallback,
7589 aContext: *mut ::std::os::raw::c_void,
7590 ) -> otError;
7591}
7592unsafe extern "C" {
7593 #[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."]
7594 pub fn otDatasetUpdaterCancelUpdate(aInstance: *mut otInstance);
7595}
7596unsafe extern "C" {
7597 #[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."]
7598 pub fn otDatasetUpdaterIsUpdateOngoing(aInstance: *mut otInstance) -> bool;
7599}
7600#[doc = "< Input mode without pull resistor."]
7601pub const OT_GPIO_MODE_INPUT: otGpioMode = 0;
7602#[doc = "< Output mode."]
7603pub const OT_GPIO_MODE_OUTPUT: otGpioMode = 1;
7604#[doc = " Defines the gpio modes."]
7605pub type otGpioMode = ::std::os::raw::c_uint;
7606#[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."]
7607pub type otPlatDiagOutputCallback = ::std::option::Option<
7608 unsafe extern "C" fn(
7609 aFormat: *const ::std::os::raw::c_char,
7610 aArguments: *mut __va_list_tag,
7611 aContext: *mut ::std::os::raw::c_void,
7612 ),
7613>;
7614unsafe extern "C" {
7615 #[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."]
7616 pub fn otPlatDiagSetOutputCallback(
7617 aInstance: *mut otInstance,
7618 aCallback: otPlatDiagOutputCallback,
7619 aContext: *mut ::std::os::raw::c_void,
7620 );
7621}
7622unsafe extern "C" {
7623 #[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."]
7624 pub fn otPlatDiagProcess(
7625 aInstance: *mut otInstance,
7626 aArgsLength: u8,
7627 aArgs: *mut *mut ::std::os::raw::c_char,
7628 ) -> otError;
7629}
7630unsafe extern "C" {
7631 #[doc = " Enables/disables the factory diagnostics mode.\n\n @param[in] aMode TRUE to enable diagnostics mode, FALSE otherwise."]
7632 pub fn otPlatDiagModeSet(aMode: bool);
7633}
7634unsafe extern "C" {
7635 #[doc = " Indicates whether or not factory diagnostics mode is enabled.\n\n @returns TRUE if factory diagnostics mode is enabled, FALSE otherwise."]
7636 pub fn otPlatDiagModeGet() -> bool;
7637}
7638unsafe extern "C" {
7639 #[doc = " Sets the channel to use for factory diagnostics.\n\n @param[in] aChannel The channel value."]
7640 pub fn otPlatDiagChannelSet(aChannel: u8);
7641}
7642unsafe extern "C" {
7643 #[doc = " Sets the transmit power to use for factory diagnostics.\n\n @param[in] aTxPower The transmit power value."]
7644 pub fn otPlatDiagTxPowerSet(aTxPower: i8);
7645}
7646unsafe extern "C" {
7647 #[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."]
7648 pub fn otPlatDiagRadioReceived(
7649 aInstance: *mut otInstance,
7650 aFrame: *mut otRadioFrame,
7651 aError: otError,
7652 );
7653}
7654unsafe extern "C" {
7655 #[doc = " Processes the alarm event.\n\n @param[in] aInstance The OpenThread instance for current request."]
7656 pub fn otPlatDiagAlarmCallback(aInstance: *mut otInstance);
7657}
7658unsafe extern "C" {
7659 #[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."]
7660 pub fn otPlatDiagGpioSet(aGpio: u32, aValue: bool) -> otError;
7661}
7662unsafe extern "C" {
7663 #[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."]
7664 pub fn otPlatDiagGpioGet(aGpio: u32, aValue: *mut bool) -> otError;
7665}
7666unsafe extern "C" {
7667 #[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."]
7668 pub fn otPlatDiagGpioSetMode(aGpio: u32, aMode: otGpioMode) -> otError;
7669}
7670unsafe extern "C" {
7671 #[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."]
7672 pub fn otPlatDiagGpioGetMode(aGpio: u32, aMode: *mut otGpioMode) -> otError;
7673}
7674unsafe extern "C" {
7675 #[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."]
7676 pub fn otPlatDiagRadioSetRawPowerSetting(
7677 aInstance: *mut otInstance,
7678 aRawPowerSetting: *const u8,
7679 aRawPowerSettingLength: u16,
7680 ) -> otError;
7681}
7682unsafe extern "C" {
7683 #[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."]
7684 pub fn otPlatDiagRadioGetRawPowerSetting(
7685 aInstance: *mut otInstance,
7686 aRawPowerSetting: *mut u8,
7687 aRawPowerSettingLength: *mut u16,
7688 ) -> otError;
7689}
7690unsafe extern "C" {
7691 #[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."]
7692 pub fn otPlatDiagRadioRawPowerSettingEnable(
7693 aInstance: *mut otInstance,
7694 aEnable: bool,
7695 ) -> otError;
7696}
7697unsafe extern "C" {
7698 #[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."]
7699 pub fn otPlatDiagRadioTransmitCarrier(aInstance: *mut otInstance, aEnable: bool) -> otError;
7700}
7701unsafe extern "C" {
7702 #[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."]
7703 pub fn otPlatDiagRadioTransmitStream(aInstance: *mut otInstance, aEnable: bool) -> otError;
7704}
7705unsafe extern "C" {
7706 #[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."]
7707 pub fn otPlatDiagRadioGetPowerSettings(
7708 aInstance: *mut otInstance,
7709 aChannel: u8,
7710 aTargetPower: *mut i16,
7711 aActualPower: *mut i16,
7712 aRawPowerSetting: *mut u8,
7713 aRawPowerSettingLength: *mut u16,
7714 ) -> otError;
7715}
7716#[doc = " @addtogroup api-factory-diagnostics\n\n @brief\n This module includes functions that control the Thread stack's execution.\n\n @{"]
7717pub type otDiagOutputCallback = otPlatDiagOutputCallback;
7718unsafe extern "C" {
7719 #[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."]
7720 pub fn otDiagSetOutputCallback(
7721 aInstance: *mut otInstance,
7722 aCallback: otDiagOutputCallback,
7723 aContext: *mut ::std::os::raw::c_void,
7724 );
7725}
7726unsafe extern "C" {
7727 #[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."]
7728 pub fn otDiagProcessCmd(
7729 aInstance: *mut otInstance,
7730 aArgsLength: u8,
7731 aArgs: *mut *mut ::std::os::raw::c_char,
7732 ) -> otError;
7733}
7734unsafe extern "C" {
7735 #[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."]
7736 pub fn otDiagProcessCmdLine(
7737 aInstance: *mut otInstance,
7738 aString: *const ::std::os::raw::c_char,
7739 ) -> otError;
7740}
7741unsafe extern "C" {
7742 #[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."]
7743 pub fn otDiagIsEnabled(aInstance: *mut otInstance) -> bool;
7744}
7745#[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)."]
7746#[repr(C)]
7747#[derive(Debug, Copy, Clone)]
7748pub struct otDnsTxtEntry {
7749 #[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."]
7750 pub mKey: *const ::std::os::raw::c_char,
7751 #[doc = "< The TXT record value or already encoded TXT-DATA (depending on `mKey`)."]
7752 pub mValue: *const u8,
7753 #[doc = "< Number of bytes in `mValue` buffer."]
7754 pub mValueLength: u16,
7755}
7756impl Default for otDnsTxtEntry {
7757 fn default() -> Self {
7758 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7759 unsafe {
7760 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7761 s.assume_init()
7762 }
7763 }
7764}
7765#[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."]
7766#[repr(C)]
7767#[derive(Debug, Copy, Clone)]
7768pub struct otDnsTxtEntryIterator {
7769 pub mPtr: *const ::std::os::raw::c_void,
7770 pub mData: [u16; 2usize],
7771 pub mChar: [::std::os::raw::c_char; 65usize],
7772}
7773impl Default for otDnsTxtEntryIterator {
7774 fn default() -> Self {
7775 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7776 unsafe {
7777 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7778 s.assume_init()
7779 }
7780 }
7781}
7782unsafe extern "C" {
7783 #[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."]
7784 pub fn otDnsInitTxtEntryIterator(
7785 aIterator: *mut otDnsTxtEntryIterator,
7786 aTxtData: *const u8,
7787 aTxtDataLength: u16,
7788 );
7789}
7790unsafe extern "C" {
7791 #[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."]
7792 pub fn otDnsGetNextTxtEntry(
7793 aIterator: *mut otDnsTxtEntryIterator,
7794 aEntry: *mut otDnsTxtEntry,
7795 ) -> otError;
7796}
7797unsafe extern "C" {
7798 #[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."]
7799 pub fn otDnsEncodeTxtData(
7800 aTxtEntries: *const otDnsTxtEntry,
7801 aNumTxtEntries: u16,
7802 aTxtData: *mut u8,
7803 aTxtDataLength: *mut u16,
7804 ) -> otError;
7805}
7806unsafe extern "C" {
7807 #[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."]
7808 pub fn otDnsSetNameCompressionEnabled(aEnabled: bool);
7809}
7810unsafe extern "C" {
7811 #[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."]
7812 pub fn otDnsIsNameCompressionEnabled() -> bool;
7813}
7814#[doc = "< Indicates the flag is not specified."]
7815pub const OT_DNS_FLAG_UNSPECIFIED: otDnsRecursionFlag = 0;
7816#[doc = "< Indicates DNS name server can resolve the query recursively."]
7817pub const OT_DNS_FLAG_RECURSION_DESIRED: otDnsRecursionFlag = 1;
7818#[doc = "< Indicates DNS name server can not resolve the query recursively."]
7819pub const OT_DNS_FLAG_NO_RECURSION: otDnsRecursionFlag = 2;
7820#[doc = " Type represents the \"Recursion Desired\" (RD) flag in an `otDnsQueryConfig`."]
7821pub type otDnsRecursionFlag = ::std::os::raw::c_uint;
7822#[doc = "< NAT64 mode is not specified. Use default NAT64 mode."]
7823pub const OT_DNS_NAT64_UNSPECIFIED: otDnsNat64Mode = 0;
7824#[doc = "< Allow NAT64 address translation during DNS client address resolution."]
7825pub const OT_DNS_NAT64_ALLOW: otDnsNat64Mode = 1;
7826#[doc = "< Do not allow NAT64 address translation during DNS client address resolution."]
7827pub const OT_DNS_NAT64_DISALLOW: otDnsNat64Mode = 2;
7828#[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."]
7829pub type otDnsNat64Mode = ::std::os::raw::c_uint;
7830#[doc = "< Mode is not specified. Use default service mode."]
7831pub const OT_DNS_SERVICE_MODE_UNSPECIFIED: otDnsServiceMode = 0;
7832#[doc = "< Query for SRV record only."]
7833pub const OT_DNS_SERVICE_MODE_SRV: otDnsServiceMode = 1;
7834#[doc = "< Query for TXT record only."]
7835pub const OT_DNS_SERVICE_MODE_TXT: otDnsServiceMode = 2;
7836#[doc = "< Query for both SRV and TXT records in same message."]
7837pub const OT_DNS_SERVICE_MODE_SRV_TXT: otDnsServiceMode = 3;
7838#[doc = "< Query in parallel for SRV and TXT using separate messages."]
7839pub const OT_DNS_SERVICE_MODE_SRV_TXT_SEPARATE: otDnsServiceMode = 4;
7840#[doc = "< Query for TXT/SRV together first, if fails then query separately."]
7841pub const OT_DNS_SERVICE_MODE_SRV_TXT_OPTIMIZE: otDnsServiceMode = 5;
7842#[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."]
7843pub type otDnsServiceMode = ::std::os::raw::c_uint;
7844pub const OT_DNS_TRANSPORT_UNSPECIFIED: otDnsTransportProto = 0;
7845#[doc = " DNS transport is unspecified."]
7846pub const OT_DNS_TRANSPORT_UDP: otDnsTransportProto = 1;
7847#[doc = " DNS query should be sent via UDP."]
7848pub const OT_DNS_TRANSPORT_TCP: otDnsTransportProto = 2;
7849#[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."]
7850pub type otDnsTransportProto = ::std::os::raw::c_uint;
7851#[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`."]
7852#[repr(C)]
7853#[derive(Copy, Clone)]
7854pub struct otDnsQueryConfig {
7855 #[doc = "< Server address (IPv6 addr/port). All zero or zero port for unspecified."]
7856 pub mServerSockAddr: otSockAddr,
7857 #[doc = "< Wait time (in msec) to rx response. Zero indicates unspecified value."]
7858 pub mResponseTimeout: u32,
7859 #[doc = "< Maximum tx attempts before reporting failure. Zero for unspecified value."]
7860 pub mMaxTxAttempts: u8,
7861 #[doc = "< Indicates whether the server can resolve the query recursively or not."]
7862 pub mRecursionFlag: otDnsRecursionFlag,
7863 #[doc = "< Allow/Disallow NAT64 address translation during address resolution."]
7864 pub mNat64Mode: otDnsNat64Mode,
7865 #[doc = "< Determines which records to query during service resolution."]
7866 pub mServiceMode: otDnsServiceMode,
7867 #[doc = "< Select default transport protocol."]
7868 pub mTransportProto: otDnsTransportProto,
7869}
7870impl Default for otDnsQueryConfig {
7871 fn default() -> Self {
7872 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7873 unsafe {
7874 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7875 s.assume_init()
7876 }
7877 }
7878}
7879unsafe extern "C" {
7880 #[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."]
7881 pub fn otDnsClientGetDefaultConfig(aInstance: *mut otInstance) -> *const otDnsQueryConfig;
7882}
7883unsafe extern "C" {
7884 #[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."]
7885 pub fn otDnsClientSetDefaultConfig(
7886 aInstance: *mut otInstance,
7887 aConfig: *const otDnsQueryConfig,
7888 );
7889}
7890#[repr(C)]
7891#[derive(Debug, Copy, Clone)]
7892pub struct otDnsAddressResponse {
7893 _unused: [u8; 0],
7894}
7895#[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"]
7896pub type otDnsAddressCallback = ::std::option::Option<
7897 unsafe extern "C" fn(
7898 aError: otError,
7899 aResponse: *const otDnsAddressResponse,
7900 aContext: *mut ::std::os::raw::c_void,
7901 ),
7902>;
7903unsafe extern "C" {
7904 #[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."]
7905 pub fn otDnsClientResolveAddress(
7906 aInstance: *mut otInstance,
7907 aHostName: *const ::std::os::raw::c_char,
7908 aCallback: otDnsAddressCallback,
7909 aContext: *mut ::std::os::raw::c_void,
7910 aConfig: *const otDnsQueryConfig,
7911 ) -> otError;
7912}
7913unsafe extern "C" {
7914 #[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."]
7915 pub fn otDnsClientResolveIp4Address(
7916 aInstance: *mut otInstance,
7917 aHostName: *const ::std::os::raw::c_char,
7918 aCallback: otDnsAddressCallback,
7919 aContext: *mut ::std::os::raw::c_void,
7920 aConfig: *const otDnsQueryConfig,
7921 ) -> otError;
7922}
7923unsafe extern "C" {
7924 #[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."]
7925 pub fn otDnsAddressResponseGetHostName(
7926 aResponse: *const otDnsAddressResponse,
7927 aNameBuffer: *mut ::std::os::raw::c_char,
7928 aNameBufferSize: u16,
7929 ) -> otError;
7930}
7931unsafe extern "C" {
7932 #[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)."]
7933 pub fn otDnsAddressResponseGetAddress(
7934 aResponse: *const otDnsAddressResponse,
7935 aIndex: u16,
7936 aAddress: *mut otIp6Address,
7937 aTtl: *mut u32,
7938 ) -> otError;
7939}
7940#[repr(C)]
7941#[derive(Debug, Copy, Clone)]
7942pub struct otDnsBrowseResponse {
7943 _unused: [u8; 0],
7944}
7945#[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()`."]
7946pub type otDnsBrowseCallback = ::std::option::Option<
7947 unsafe extern "C" fn(
7948 aError: otError,
7949 aResponse: *const otDnsBrowseResponse,
7950 aContext: *mut ::std::os::raw::c_void,
7951 ),
7952>;
7953#[doc = " Provides info for a DNS service instance."]
7954#[repr(C)]
7955#[derive(Copy, Clone)]
7956pub struct otDnsServiceInfo {
7957 #[doc = "< Service record TTL (in seconds)."]
7958 pub mTtl: u32,
7959 #[doc = "< Service port number."]
7960 pub mPort: u16,
7961 #[doc = "< Service priority."]
7962 pub mPriority: u16,
7963 #[doc = "< Service weight."]
7964 pub mWeight: u16,
7965 #[doc = "< Buffer to output the service host name (can be NULL if not needed)."]
7966 pub mHostNameBuffer: *mut ::std::os::raw::c_char,
7967 #[doc = "< Size of `mHostNameBuffer`."]
7968 pub mHostNameBufferSize: u16,
7969 #[doc = "< The host IPv6 address. Set to all zero if not available."]
7970 pub mHostAddress: otIp6Address,
7971 #[doc = "< The host address TTL."]
7972 pub mHostAddressTtl: u32,
7973 #[doc = "< Buffer to output TXT data (can be NULL if not needed)."]
7974 pub mTxtData: *mut u8,
7975 #[doc = "< On input, size of `mTxtData` buffer. On output number bytes written."]
7976 pub mTxtDataSize: u16,
7977 #[doc = "< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated."]
7978 pub mTxtDataTruncated: bool,
7979 #[doc = "< The TXT data TTL."]
7980 pub mTxtDataTtl: u32,
7981}
7982impl Default for otDnsServiceInfo {
7983 fn default() -> Self {
7984 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
7985 unsafe {
7986 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
7987 s.assume_init()
7988 }
7989 }
7990}
7991unsafe extern "C" {
7992 #[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."]
7993 pub fn otDnsClientBrowse(
7994 aInstance: *mut otInstance,
7995 aServiceName: *const ::std::os::raw::c_char,
7996 aCallback: otDnsBrowseCallback,
7997 aContext: *mut ::std::os::raw::c_void,
7998 aConfig: *const otDnsQueryConfig,
7999 ) -> otError;
8000}
8001unsafe extern "C" {
8002 #[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."]
8003 pub fn otDnsBrowseResponseGetServiceName(
8004 aResponse: *const otDnsBrowseResponse,
8005 aNameBuffer: *mut ::std::os::raw::c_char,
8006 aNameBufferSize: u16,
8007 ) -> otError;
8008}
8009unsafe extern "C" {
8010 #[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."]
8011 pub fn otDnsBrowseResponseGetServiceInstance(
8012 aResponse: *const otDnsBrowseResponse,
8013 aIndex: u16,
8014 aLabelBuffer: *mut ::std::os::raw::c_char,
8015 aLabelBufferSize: u8,
8016 ) -> otError;
8017}
8018unsafe extern "C" {
8019 #[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."]
8020 pub fn otDnsBrowseResponseGetServiceInfo(
8021 aResponse: *const otDnsBrowseResponse,
8022 aInstanceLabel: *const ::std::os::raw::c_char,
8023 aServiceInfo: *mut otDnsServiceInfo,
8024 ) -> otError;
8025}
8026unsafe extern "C" {
8027 #[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."]
8028 pub fn otDnsBrowseResponseGetHostAddress(
8029 aResponse: *const otDnsBrowseResponse,
8030 aHostName: *const ::std::os::raw::c_char,
8031 aIndex: u16,
8032 aAddress: *mut otIp6Address,
8033 aTtl: *mut u32,
8034 ) -> otError;
8035}
8036#[repr(C)]
8037#[derive(Debug, Copy, Clone)]
8038pub struct otDnsServiceResponse {
8039 _unused: [u8; 0],
8040}
8041#[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()`."]
8042pub type otDnsServiceCallback = ::std::option::Option<
8043 unsafe extern "C" fn(
8044 aError: otError,
8045 aResponse: *const otDnsServiceResponse,
8046 aContext: *mut ::std::os::raw::c_void,
8047 ),
8048>;
8049unsafe extern "C" {
8050 #[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."]
8051 pub fn otDnsClientResolveService(
8052 aInstance: *mut otInstance,
8053 aInstanceLabel: *const ::std::os::raw::c_char,
8054 aServiceName: *const ::std::os::raw::c_char,
8055 aCallback: otDnsServiceCallback,
8056 aContext: *mut ::std::os::raw::c_void,
8057 aConfig: *const otDnsQueryConfig,
8058 ) -> otError;
8059}
8060unsafe extern "C" {
8061 #[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."]
8062 pub fn otDnsClientResolveServiceAndHostAddress(
8063 aInstance: *mut otInstance,
8064 aInstanceLabel: *const ::std::os::raw::c_char,
8065 aServiceName: *const ::std::os::raw::c_char,
8066 aCallback: otDnsServiceCallback,
8067 aContext: *mut ::std::os::raw::c_void,
8068 aConfig: *const otDnsQueryConfig,
8069 ) -> otError;
8070}
8071unsafe extern "C" {
8072 #[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."]
8073 pub fn otDnsServiceResponseGetServiceName(
8074 aResponse: *const otDnsServiceResponse,
8075 aLabelBuffer: *mut ::std::os::raw::c_char,
8076 aLabelBufferSize: u8,
8077 aNameBuffer: *mut ::std::os::raw::c_char,
8078 aNameBufferSize: u16,
8079 ) -> otError;
8080}
8081unsafe extern "C" {
8082 #[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."]
8083 pub fn otDnsServiceResponseGetServiceInfo(
8084 aResponse: *const otDnsServiceResponse,
8085 aServiceInfo: *mut otDnsServiceInfo,
8086 ) -> otError;
8087}
8088unsafe extern "C" {
8089 #[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."]
8090 pub fn otDnsServiceResponseGetHostAddress(
8091 aResponse: *const otDnsServiceResponse,
8092 aHostName: *const ::std::os::raw::c_char,
8093 aIndex: u16,
8094 aAddress: *mut otIp6Address,
8095 aTtl: *mut u32,
8096 ) -> otError;
8097}
8098#[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"]
8099pub type otDnssdQuerySubscribeCallback = ::std::option::Option<
8100 unsafe extern "C" fn(
8101 aContext: *mut ::std::os::raw::c_void,
8102 aFullName: *const ::std::os::raw::c_char,
8103 ),
8104>;
8105#[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.\")."]
8106pub type otDnssdQueryUnsubscribeCallback = ::std::option::Option<
8107 unsafe extern "C" fn(
8108 aContext: *mut ::std::os::raw::c_void,
8109 aFullName: *const ::std::os::raw::c_char,
8110 ),
8111>;
8112#[doc = " This opaque type represents a DNS-SD query."]
8113pub type otDnssdQuery = ::std::os::raw::c_void;
8114#[doc = " Represents information of a discovered service instance for a DNS-SD query."]
8115#[repr(C)]
8116#[derive(Debug, Copy, Clone)]
8117pub struct otDnssdServiceInstanceInfo {
8118 #[doc = "< Full instance name (e.g. \"OpenThread._ipps._tcp.default.service.arpa.\")."]
8119 pub mFullName: *const ::std::os::raw::c_char,
8120 #[doc = "< Host name (e.g. \"ot-host.default.service.arpa.\")."]
8121 pub mHostName: *const ::std::os::raw::c_char,
8122 #[doc = "< Number of host IPv6 addresses."]
8123 pub mAddressNum: u8,
8124 #[doc = "< Host IPv6 addresses."]
8125 pub mAddresses: *const otIp6Address,
8126 #[doc = "< Service port."]
8127 pub mPort: u16,
8128 #[doc = "< Service priority."]
8129 pub mPriority: u16,
8130 #[doc = "< Service weight."]
8131 pub mWeight: u16,
8132 #[doc = "< Service TXT RDATA length."]
8133 pub mTxtLength: u16,
8134 #[doc = "< Service TXT RDATA."]
8135 pub mTxtData: *const u8,
8136 #[doc = "< Service TTL (in seconds)."]
8137 pub mTtl: u32,
8138}
8139impl Default for otDnssdServiceInstanceInfo {
8140 fn default() -> Self {
8141 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8142 unsafe {
8143 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8144 s.assume_init()
8145 }
8146 }
8147}
8148#[doc = " Represents information of a discovered host for a DNS-SD query."]
8149#[repr(C)]
8150#[derive(Debug, Copy, Clone)]
8151pub struct otDnssdHostInfo {
8152 #[doc = "< Number of host IPv6 addresses."]
8153 pub mAddressNum: u8,
8154 #[doc = "< Host IPv6 addresses."]
8155 pub mAddresses: *const otIp6Address,
8156 #[doc = "< Service TTL (in seconds)."]
8157 pub mTtl: u32,
8158}
8159impl Default for otDnssdHostInfo {
8160 fn default() -> Self {
8161 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8162 unsafe {
8163 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8164 s.assume_init()
8165 }
8166 }
8167}
8168#[doc = "< Service type unspecified."]
8169pub const OT_DNSSD_QUERY_TYPE_NONE: otDnssdQueryType = 0;
8170#[doc = "< Service type browse service."]
8171pub const OT_DNSSD_QUERY_TYPE_BROWSE: otDnssdQueryType = 1;
8172#[doc = "< Service type resolve service instance."]
8173pub const OT_DNSSD_QUERY_TYPE_RESOLVE: otDnssdQueryType = 2;
8174#[doc = "< Service type resolve hostname."]
8175pub const OT_DNSSD_QUERY_TYPE_RESOLVE_HOST: otDnssdQueryType = 3;
8176#[doc = " Specifies a DNS-SD query type."]
8177pub type otDnssdQueryType = ::std::os::raw::c_uint;
8178#[doc = " Represents the count of queries, responses, failures handled by upstream DNS server.\n\n Requires `OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE`."]
8179#[repr(C)]
8180#[derive(Debug, Default, Copy, Clone)]
8181pub struct otUpstreamDnsCounters {
8182 #[doc = "< The number of queries forwarded."]
8183 pub mQueries: u32,
8184 #[doc = "< The number of responses forwarded."]
8185 pub mResponses: u32,
8186 #[doc = "< The number of upstream DNS failures."]
8187 pub mFailures: u32,
8188}
8189#[doc = " Contains the counters of DNS-SD server."]
8190#[repr(C)]
8191#[derive(Debug, Default, Copy, Clone)]
8192pub struct otDnssdCounters {
8193 #[doc = "< The number of successful responses."]
8194 pub mSuccessResponse: u32,
8195 #[doc = "< The number of server failure responses."]
8196 pub mServerFailureResponse: u32,
8197 #[doc = "< The number of format error responses."]
8198 pub mFormatErrorResponse: u32,
8199 #[doc = "< The number of name error responses."]
8200 pub mNameErrorResponse: u32,
8201 #[doc = "< The number of 'not implemented' responses."]
8202 pub mNotImplementedResponse: u32,
8203 #[doc = "< The number of other responses."]
8204 pub mOtherResponse: u32,
8205 #[doc = "< The number of queries resolved by the local SRP server."]
8206 pub mResolvedBySrp: u32,
8207 #[doc = "< The number of queries, responses,\n< failures handled by upstream DNS server."]
8208 pub mUpstreamDnsCounters: otUpstreamDnsCounters,
8209}
8210unsafe extern "C" {
8211 #[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."]
8212 pub fn otDnssdQuerySetCallbacks(
8213 aInstance: *mut otInstance,
8214 aSubscribe: otDnssdQuerySubscribeCallback,
8215 aUnsubscribe: otDnssdQueryUnsubscribeCallback,
8216 aContext: *mut ::std::os::raw::c_void,
8217 );
8218}
8219unsafe extern "C" {
8220 #[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."]
8221 pub fn otDnssdQueryHandleDiscoveredServiceInstance(
8222 aInstance: *mut otInstance,
8223 aServiceFullName: *const ::std::os::raw::c_char,
8224 aInstanceInfo: *mut otDnssdServiceInstanceInfo,
8225 );
8226}
8227unsafe extern "C" {
8228 #[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."]
8229 pub fn otDnssdQueryHandleDiscoveredHost(
8230 aInstance: *mut otInstance,
8231 aHostFullName: *const ::std::os::raw::c_char,
8232 aHostInfo: *mut otDnssdHostInfo,
8233 );
8234}
8235unsafe extern "C" {
8236 #[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."]
8237 pub fn otDnssdGetNextQuery(
8238 aInstance: *mut otInstance,
8239 aQuery: *const otDnssdQuery,
8240 ) -> *const otDnssdQuery;
8241}
8242unsafe extern "C" {
8243 #[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."]
8244 pub fn otDnssdGetQueryTypeAndName(
8245 aQuery: *const otDnssdQuery,
8246 aNameOutput: *mut [::std::os::raw::c_char; 255usize],
8247 ) -> otDnssdQueryType;
8248}
8249unsafe extern "C" {
8250 #[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."]
8251 pub fn otDnssdGetCounters(aInstance: *mut otInstance) -> *const otDnssdCounters;
8252}
8253unsafe extern "C" {
8254 #[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"]
8255 pub fn otDnssdUpstreamQuerySetEnabled(aInstance: *mut otInstance, aEnabled: bool);
8256}
8257unsafe extern "C" {
8258 #[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"]
8259 pub fn otDnssdUpstreamQueryIsEnabled(aInstance: *mut otInstance) -> bool;
8260}
8261unsafe extern "C" {
8262 #[doc = " @note This API is deprecated and use of it is discouraged."]
8263 pub fn otHeapCAlloc(aCount: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
8264}
8265unsafe extern "C" {
8266 #[doc = " @note This API is deprecated and use of it is discouraged."]
8267 pub fn otHeapFree(aPointer: *mut ::std::os::raw::c_void);
8268}
8269#[doc = "< Destination Unreachable"]
8270pub const OT_ICMP6_TYPE_DST_UNREACH: otIcmp6Type = 1;
8271#[doc = "< Packet To Big"]
8272pub const OT_ICMP6_TYPE_PACKET_TO_BIG: otIcmp6Type = 2;
8273#[doc = "< Time Exceeded"]
8274pub const OT_ICMP6_TYPE_TIME_EXCEEDED: otIcmp6Type = 3;
8275#[doc = "< Parameter Problem"]
8276pub const OT_ICMP6_TYPE_PARAMETER_PROBLEM: otIcmp6Type = 4;
8277#[doc = "< Echo Request"]
8278pub const OT_ICMP6_TYPE_ECHO_REQUEST: otIcmp6Type = 128;
8279#[doc = "< Echo Reply"]
8280pub const OT_ICMP6_TYPE_ECHO_REPLY: otIcmp6Type = 129;
8281#[doc = "< Router Solicitation"]
8282pub const OT_ICMP6_TYPE_ROUTER_SOLICIT: otIcmp6Type = 133;
8283#[doc = "< Router Advertisement"]
8284pub const OT_ICMP6_TYPE_ROUTER_ADVERT: otIcmp6Type = 134;
8285#[doc = "< Neighbor Solicitation"]
8286pub const OT_ICMP6_TYPE_NEIGHBOR_SOLICIT: otIcmp6Type = 135;
8287#[doc = "< Neighbor Advertisement"]
8288pub const OT_ICMP6_TYPE_NEIGHBOR_ADVERT: otIcmp6Type = 136;
8289#[doc = " ICMPv6 Message Types"]
8290pub type otIcmp6Type = ::std::os::raw::c_uint;
8291#[doc = "< Destination Unreachable (Type 1) - No Route"]
8292pub const OT_ICMP6_CODE_DST_UNREACH_NO_ROUTE: otIcmp6Code = 0;
8293#[doc = "< Destination Unreachable (Type 1) - Administratively Prohibited"]
8294pub const OT_ICMP6_CODE_DST_UNREACH_PROHIBITED: otIcmp6Code = 1;
8295#[doc = "< Time Exceeded (Type 3) - Fragment Reassembly"]
8296pub const OT_ICMP6_CODE_FRAGM_REAS_TIME_EX: otIcmp6Code = 1;
8297#[doc = " ICMPv6 Message Codes"]
8298pub type otIcmp6Code = ::std::os::raw::c_uint;
8299#[doc = " @struct otIcmp6Header\n\n Represents an ICMPv6 header."]
8300#[repr(C, packed)]
8301#[derive(Copy, Clone)]
8302pub struct otIcmp6Header {
8303 #[doc = "< Type"]
8304 pub mType: u8,
8305 #[doc = "< Code"]
8306 pub mCode: u8,
8307 #[doc = "< Checksum"]
8308 pub mChecksum: u16,
8309 #[doc = "< Message-specific data"]
8310 pub mData: otIcmp6Header__bindgen_ty_1,
8311}
8312#[repr(C, packed)]
8313#[derive(Copy, Clone)]
8314pub union otIcmp6Header__bindgen_ty_1 {
8315 pub m8: [u8; 4usize],
8316 pub m16: [u16; 2usize],
8317 pub m32: [u32; 1usize],
8318}
8319impl Default for otIcmp6Header__bindgen_ty_1 {
8320 fn default() -> Self {
8321 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8322 unsafe {
8323 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8324 s.assume_init()
8325 }
8326 }
8327}
8328impl Default for otIcmp6Header {
8329 fn default() -> Self {
8330 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8331 unsafe {
8332 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8333 s.assume_init()
8334 }
8335 }
8336}
8337#[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."]
8338pub type otIcmp6ReceiveCallback = ::std::option::Option<
8339 unsafe extern "C" fn(
8340 aContext: *mut ::std::os::raw::c_void,
8341 aMessage: *mut otMessage,
8342 aMessageInfo: *const otMessageInfo,
8343 aIcmpHeader: *const otIcmp6Header,
8344 ),
8345>;
8346#[doc = " Implements ICMPv6 message handler."]
8347#[repr(C)]
8348#[derive(Debug, Copy, Clone)]
8349pub struct otIcmp6Handler {
8350 #[doc = "< The ICMPv6 received callback"]
8351 pub mReceiveCallback: otIcmp6ReceiveCallback,
8352 #[doc = "< A pointer to arbitrary context information."]
8353 pub mContext: *mut ::std::os::raw::c_void,
8354 #[doc = "< A pointer to the next handler in the list."]
8355 pub mNext: *mut otIcmp6Handler,
8356}
8357impl Default for otIcmp6Handler {
8358 fn default() -> Self {
8359 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
8360 unsafe {
8361 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
8362 s.assume_init()
8363 }
8364 }
8365}
8366#[doc = "< ICMPv6 Echo processing disabled"]
8367pub const OT_ICMP6_ECHO_HANDLER_DISABLED: otIcmp6EchoMode = 0;
8368#[doc = "< ICMPv6 Echo processing enabled only for unicast requests only"]
8369pub const OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: otIcmp6EchoMode = 1;
8370#[doc = "< ICMPv6 Echo processing enabled only for multicast requests only"]
8371pub const OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: otIcmp6EchoMode = 2;
8372#[doc = "< ICMPv6 Echo processing enabled for unicast and multicast requests"]
8373pub const OT_ICMP6_ECHO_HANDLER_ALL: otIcmp6EchoMode = 3;
8374#[doc = "< ICMPv6 Echo processing enabled for RLOC/ALOC destinations only"]
8375pub const OT_ICMP6_ECHO_HANDLER_RLOC_ALOC_ONLY: otIcmp6EchoMode = 4;
8376#[doc = " ICMPv6 Echo Reply Modes"]
8377pub type otIcmp6EchoMode = ::std::os::raw::c_uint;
8378unsafe extern "C" {
8379 #[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"]
8380 pub fn otIcmp6GetEchoMode(aInstance: *mut otInstance) -> otIcmp6EchoMode;
8381}
8382unsafe extern "C" {
8383 #[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."]
8384 pub fn otIcmp6SetEchoMode(aInstance: *mut otInstance, aMode: otIcmp6EchoMode);
8385}
8386unsafe extern "C" {
8387 #[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."]
8388 pub fn otIcmp6RegisterHandler(
8389 aInstance: *mut otInstance,
8390 aHandler: *mut otIcmp6Handler,
8391 ) -> otError;
8392}
8393unsafe extern "C" {
8394 #[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."]
8395 pub fn otIcmp6SendEchoRequest(
8396 aInstance: *mut otInstance,
8397 aMessage: *mut otMessage,
8398 aMessageInfo: *const otMessageInfo,
8399 aIdentifier: u16,
8400 ) -> otError;
8401}
8402#[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."]
8403pub type otJamDetectionCallback = ::std::option::Option<
8404 unsafe extern "C" fn(aJamState: bool, aContext: *mut ::std::os::raw::c_void),
8405>;
8406unsafe extern "C" {
8407 #[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."]
8408 pub fn otJamDetectionSetRssiThreshold(
8409 aInstance: *mut otInstance,
8410 aRssiThreshold: i8,
8411 ) -> otError;
8412}
8413unsafe extern "C" {
8414 #[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."]
8415 pub fn otJamDetectionGetRssiThreshold(aInstance: *mut otInstance) -> i8;
8416}
8417unsafe extern "C" {
8418 #[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)"]
8419 pub fn otJamDetectionSetWindow(aInstance: *mut otInstance, aWindow: u8) -> otError;
8420}
8421unsafe extern "C" {
8422 #[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."]
8423 pub fn otJamDetectionGetWindow(aInstance: *mut otInstance) -> u8;
8424}
8425unsafe extern "C" {
8426 #[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."]
8427 pub fn otJamDetectionSetBusyPeriod(aInstance: *mut otInstance, aBusyPeriod: u8) -> otError;
8428}
8429unsafe extern "C" {
8430 #[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."]
8431 pub fn otJamDetectionGetBusyPeriod(aInstance: *mut otInstance) -> u8;
8432}
8433unsafe extern "C" {
8434 #[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."]
8435 pub fn otJamDetectionStart(
8436 aInstance: *mut otInstance,
8437 aCallback: otJamDetectionCallback,
8438 aContext: *mut ::std::os::raw::c_void,
8439 ) -> otError;
8440}
8441unsafe extern "C" {
8442 #[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."]
8443 pub fn otJamDetectionStop(aInstance: *mut otInstance) -> otError;
8444}
8445unsafe extern "C" {
8446 #[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)."]
8447 pub fn otJamDetectionIsEnabled(aInstance: *mut otInstance) -> bool;
8448}
8449unsafe extern "C" {
8450 #[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)."]
8451 pub fn otJamDetectionGetState(aInstance: *mut otInstance) -> bool;
8452}
8453unsafe extern "C" {
8454 #[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."]
8455 pub fn otJamDetectionGetHistoryBitmap(aInstance: *mut otInstance) -> u64;
8456}
8457pub type otMacFilterIterator = u8;
8458#[doc = "< Address filter is disabled."]
8459pub const OT_MAC_FILTER_ADDRESS_MODE_DISABLED: otMacFilterAddressMode = 0;
8460#[doc = "< Allowlist address filter mode is enabled."]
8461pub const OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST: otMacFilterAddressMode = 1;
8462#[doc = "< Denylist address filter mode is enabled."]
8463pub const OT_MAC_FILTER_ADDRESS_MODE_DENYLIST: otMacFilterAddressMode = 2;
8464#[doc = " Defines address mode of the mac filter."]
8465pub type otMacFilterAddressMode = ::std::os::raw::c_uint;
8466#[doc = " Represents a Mac Filter entry."]
8467#[repr(C)]
8468#[derive(Debug, Default, Copy, Clone)]
8469pub struct otMacFilterEntry {
8470 #[doc = "< IEEE 802.15.4 Extended Address"]
8471 pub mExtAddress: otExtAddress,
8472 #[doc = "< Received signal strength"]
8473 pub mRssIn: i8,
8474}
8475#[doc = " Represents the MAC layer counters."]
8476#[repr(C)]
8477#[derive(Debug, Default, Copy, Clone)]
8478pub struct otMacCounters {
8479 #[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"]
8480 pub mTxTotal: u32,
8481 #[doc = " The total number of unique unicast MAC frame transmission requests."]
8482 pub mTxUnicast: u32,
8483 #[doc = " The total number of unique broadcast MAC frame transmission requests."]
8484 pub mTxBroadcast: u32,
8485 #[doc = " The total number of unique MAC frame transmission requests with requested acknowledgment."]
8486 pub mTxAckRequested: u32,
8487 #[doc = " The total number of unique MAC frame transmission requests that were acked."]
8488 pub mTxAcked: u32,
8489 #[doc = " The total number of unique MAC frame transmission requests without requested acknowledgment."]
8490 pub mTxNoAckRequested: u32,
8491 #[doc = " The total number of unique MAC Data frame transmission requests."]
8492 pub mTxData: u32,
8493 #[doc = " The total number of unique MAC Data Poll frame transmission requests."]
8494 pub mTxDataPoll: u32,
8495 #[doc = " The total number of unique MAC Beacon frame transmission requests."]
8496 pub mTxBeacon: u32,
8497 #[doc = " The total number of unique MAC Beacon Request frame transmission requests."]
8498 pub mTxBeaconRequest: u32,
8499 #[doc = " The total number of unique other MAC frame transmission requests.\n\n This counter is currently used for counting out-of-band frames."]
8500 pub mTxOther: u32,
8501 #[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."]
8502 pub mTxRetry: u32,
8503 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for direct packets."]
8504 pub mTxDirectMaxRetryExpiry: u32,
8505 #[doc = " The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets."]
8506 pub mTxIndirectMaxRetryExpiry: u32,
8507 #[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)."]
8508 pub mTxErrCca: u32,
8509 #[doc = " The total number of unique MAC transmission request failures cause by an abort error."]
8510 pub mTxErrAbort: u32,
8511 #[doc = " The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail)."]
8512 pub mTxErrBusyChannel: u32,
8513 #[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."]
8514 pub mRxTotal: u32,
8515 #[doc = " The total number of unicast frames received."]
8516 pub mRxUnicast: u32,
8517 #[doc = " The total number of broadcast frames received."]
8518 pub mRxBroadcast: u32,
8519 #[doc = " The total number of MAC Data frames received."]
8520 pub mRxData: u32,
8521 #[doc = " The total number of MAC Data Poll frames received."]
8522 pub mRxDataPoll: u32,
8523 #[doc = " The total number of MAC Beacon frames received."]
8524 pub mRxBeacon: u32,
8525 #[doc = " The total number of MAC Beacon Request frames received."]
8526 pub mRxBeaconRequest: u32,
8527 #[doc = " The total number of other types of frames received."]
8528 pub mRxOther: u32,
8529 #[doc = " The total number of frames dropped by MAC Filter module, for example received from denylisted node."]
8530 pub mRxAddressFiltered: u32,
8531 #[doc = " The total number of frames dropped by destination address check, for example received frame for other node."]
8532 pub mRxDestAddrFiltered: u32,
8533 #[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."]
8534 pub mRxDuplicated: u32,
8535 #[doc = " The total number of frames dropped because of missing or malformed content."]
8536 pub mRxErrNoFrame: u32,
8537 #[doc = " The total number of frames dropped due to unknown neighbor."]
8538 pub mRxErrUnknownNeighbor: u32,
8539 #[doc = " The total number of frames dropped due to invalid source address."]
8540 pub mRxErrInvalidSrcAddr: u32,
8541 #[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."]
8542 pub mRxErrSec: u32,
8543 #[doc = " The total number of frames dropped due to invalid FCS."]
8544 pub mRxErrFcs: u32,
8545 #[doc = " The total number of frames dropped due to other error."]
8546 pub mRxErrOther: u32,
8547}
8548#[doc = " Represents a received IEEE 802.15.4 Beacon."]
8549#[repr(C)]
8550#[repr(align(4))]
8551#[derive(Debug, Default, Copy, Clone)]
8552pub struct otActiveScanResult {
8553 #[doc = "< IEEE 802.15.4 Extended Address"]
8554 pub mExtAddress: otExtAddress,
8555 #[doc = "< Thread Network Name"]
8556 pub mNetworkName: otNetworkName,
8557 #[doc = "< Thread Extended PAN ID"]
8558 pub mExtendedPanId: otExtendedPanId,
8559 #[doc = "< Steering Data"]
8560 pub mSteeringData: otSteeringData,
8561 #[doc = "< IEEE 802.15.4 PAN ID"]
8562 pub mPanId: u16,
8563 #[doc = "< Joiner UDP Port"]
8564 pub mJoinerUdpPort: u16,
8565 #[doc = "< IEEE 802.15.4 Channel"]
8566 pub mChannel: u8,
8567 #[doc = "< RSSI (dBm)"]
8568 pub mRssi: i8,
8569 #[doc = "< LQI"]
8570 pub mLqi: u8,
8571 pub _bitfield_align_1: [u8; 0],
8572 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
8573 pub __bindgen_padding_0: u16,
8574}
8575impl otActiveScanResult {
8576 #[inline]
8577 pub fn mVersion(&self) -> ::std::os::raw::c_uint {
8578 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u32) }
8579 }
8580 #[inline]
8581 pub fn set_mVersion(&mut self, val: ::std::os::raw::c_uint) {
8582 unsafe {
8583 let val: u32 = ::std::mem::transmute(val);
8584 self._bitfield_1.set(0usize, 4u8, val as u64)
8585 }
8586 }
8587 #[inline]
8588 pub unsafe fn mVersion_raw(this: *const Self) -> ::std::os::raw::c_uint {
8589 unsafe {
8590 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8591 ::std::ptr::addr_of!((*this)._bitfield_1),
8592 0usize,
8593 4u8,
8594 ) as u32)
8595 }
8596 }
8597 #[inline]
8598 pub unsafe fn set_mVersion_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
8599 unsafe {
8600 let val: u32 = ::std::mem::transmute(val);
8601 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8602 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8603 0usize,
8604 4u8,
8605 val as u64,
8606 )
8607 }
8608 }
8609 #[inline]
8610 pub fn mIsNative(&self) -> bool {
8611 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
8612 }
8613 #[inline]
8614 pub fn set_mIsNative(&mut self, val: bool) {
8615 unsafe {
8616 let val: u8 = ::std::mem::transmute(val);
8617 self._bitfield_1.set(4usize, 1u8, val as u64)
8618 }
8619 }
8620 #[inline]
8621 pub unsafe fn mIsNative_raw(this: *const Self) -> bool {
8622 unsafe {
8623 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8624 ::std::ptr::addr_of!((*this)._bitfield_1),
8625 4usize,
8626 1u8,
8627 ) as u8)
8628 }
8629 }
8630 #[inline]
8631 pub unsafe fn set_mIsNative_raw(this: *mut Self, val: bool) {
8632 unsafe {
8633 let val: u8 = ::std::mem::transmute(val);
8634 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8635 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8636 4usize,
8637 1u8,
8638 val as u64,
8639 )
8640 }
8641 }
8642 #[inline]
8643 pub fn mDiscover(&self) -> bool {
8644 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
8645 }
8646 #[inline]
8647 pub fn set_mDiscover(&mut self, val: bool) {
8648 unsafe {
8649 let val: u8 = ::std::mem::transmute(val);
8650 self._bitfield_1.set(5usize, 1u8, val as u64)
8651 }
8652 }
8653 #[inline]
8654 pub unsafe fn mDiscover_raw(this: *const Self) -> bool {
8655 unsafe {
8656 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8657 ::std::ptr::addr_of!((*this)._bitfield_1),
8658 5usize,
8659 1u8,
8660 ) as u8)
8661 }
8662 }
8663 #[inline]
8664 pub unsafe fn set_mDiscover_raw(this: *mut Self, val: bool) {
8665 unsafe {
8666 let val: u8 = ::std::mem::transmute(val);
8667 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8668 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8669 5usize,
8670 1u8,
8671 val as u64,
8672 )
8673 }
8674 }
8675 #[inline]
8676 pub fn mIsJoinable(&self) -> bool {
8677 unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
8678 }
8679 #[inline]
8680 pub fn set_mIsJoinable(&mut self, val: bool) {
8681 unsafe {
8682 let val: u8 = ::std::mem::transmute(val);
8683 self._bitfield_1.set(6usize, 1u8, val as u64)
8684 }
8685 }
8686 #[inline]
8687 pub unsafe fn mIsJoinable_raw(this: *const Self) -> bool {
8688 unsafe {
8689 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
8690 ::std::ptr::addr_of!((*this)._bitfield_1),
8691 6usize,
8692 1u8,
8693 ) as u8)
8694 }
8695 }
8696 #[inline]
8697 pub unsafe fn set_mIsJoinable_raw(this: *mut Self, val: bool) {
8698 unsafe {
8699 let val: u8 = ::std::mem::transmute(val);
8700 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
8701 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
8702 6usize,
8703 1u8,
8704 val as u64,
8705 )
8706 }
8707 }
8708 #[inline]
8709 pub fn new_bitfield_1(
8710 mVersion: ::std::os::raw::c_uint,
8711 mIsNative: bool,
8712 mDiscover: bool,
8713 mIsJoinable: bool,
8714 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
8715 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
8716 __bindgen_bitfield_unit.set(0usize, 4u8, {
8717 let mVersion: u32 = unsafe { ::std::mem::transmute(mVersion) };
8718 mVersion as u64
8719 });
8720 __bindgen_bitfield_unit.set(4usize, 1u8, {
8721 let mIsNative: u8 = unsafe { ::std::mem::transmute(mIsNative) };
8722 mIsNative as u64
8723 });
8724 __bindgen_bitfield_unit.set(5usize, 1u8, {
8725 let mDiscover: u8 = unsafe { ::std::mem::transmute(mDiscover) };
8726 mDiscover as u64
8727 });
8728 __bindgen_bitfield_unit.set(6usize, 1u8, {
8729 let mIsJoinable: u8 = unsafe { ::std::mem::transmute(mIsJoinable) };
8730 mIsJoinable as u64
8731 });
8732 __bindgen_bitfield_unit
8733 }
8734}
8735#[doc = " Represents an energy scan result."]
8736#[repr(C)]
8737#[derive(Debug, Default, Copy, Clone)]
8738pub struct otEnergyScanResult {
8739 #[doc = "< IEEE 802.15.4 Channel"]
8740 pub mChannel: u8,
8741 #[doc = "< The max RSSI (dBm)"]
8742 pub mMaxRssi: i8,
8743}
8744#[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."]
8745pub type otHandleActiveScanResult = ::std::option::Option<
8746 unsafe extern "C" fn(aResult: *mut otActiveScanResult, aContext: *mut ::std::os::raw::c_void),
8747>;
8748unsafe extern "C" {
8749 #[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."]
8750 pub fn otLinkActiveScan(
8751 aInstance: *mut otInstance,
8752 aScanChannels: u32,
8753 aScanDuration: u16,
8754 aCallback: otHandleActiveScanResult,
8755 aCallbackContext: *mut ::std::os::raw::c_void,
8756 ) -> otError;
8757}
8758unsafe extern "C" {
8759 #[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."]
8760 pub fn otLinkIsActiveScanInProgress(aInstance: *mut otInstance) -> bool;
8761}
8762#[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."]
8763pub type otHandleEnergyScanResult = ::std::option::Option<
8764 unsafe extern "C" fn(aResult: *mut otEnergyScanResult, aContext: *mut ::std::os::raw::c_void),
8765>;
8766unsafe extern "C" {
8767 #[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."]
8768 pub fn otLinkEnergyScan(
8769 aInstance: *mut otInstance,
8770 aScanChannels: u32,
8771 aScanDuration: u16,
8772 aCallback: otHandleEnergyScanResult,
8773 aCallbackContext: *mut ::std::os::raw::c_void,
8774 ) -> otError;
8775}
8776unsafe extern "C" {
8777 #[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."]
8778 pub fn otLinkIsEnergyScanInProgress(aInstance: *mut otInstance) -> bool;
8779}
8780unsafe extern "C" {
8781 #[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."]
8782 pub fn otLinkSendDataRequest(aInstance: *mut otInstance) -> otError;
8783}
8784unsafe extern "C" {
8785 #[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."]
8786 pub fn otLinkIsInTransmitState(aInstance: *mut otInstance) -> bool;
8787}
8788unsafe extern "C" {
8789 #[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"]
8790 pub fn otLinkGetChannel(aInstance: *mut otInstance) -> u8;
8791}
8792unsafe extern "C" {
8793 #[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"]
8794 pub fn otLinkSetChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
8795}
8796unsafe extern "C" {
8797 #[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."]
8798 pub fn otLinkGetSupportedChannelMask(aInstance: *mut otInstance) -> u32;
8799}
8800unsafe extern "C" {
8801 #[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."]
8802 pub fn otLinkSetSupportedChannelMask(aInstance: *mut otInstance, aChannelMask: u32) -> otError;
8803}
8804unsafe extern "C" {
8805 #[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."]
8806 pub fn otLinkGetExtendedAddress(aInstance: *mut otInstance) -> *const otExtAddress;
8807}
8808unsafe extern "C" {
8809 #[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."]
8810 pub fn otLinkSetExtendedAddress(
8811 aInstance: *mut otInstance,
8812 aExtAddress: *const otExtAddress,
8813 ) -> otError;
8814}
8815unsafe extern "C" {
8816 #[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."]
8817 pub fn otLinkGetFactoryAssignedIeeeEui64(aInstance: *mut otInstance, aEui64: *mut otExtAddress);
8818}
8819unsafe extern "C" {
8820 #[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"]
8821 pub fn otLinkGetPanId(aInstance: *mut otInstance) -> otPanId;
8822}
8823unsafe extern "C" {
8824 #[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"]
8825 pub fn otLinkSetPanId(aInstance: *mut otInstance, aPanId: otPanId) -> otError;
8826}
8827unsafe extern "C" {
8828 #[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"]
8829 pub fn otLinkGetPollPeriod(aInstance: *mut otInstance) -> u32;
8830}
8831unsafe extern "C" {
8832 #[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"]
8833 pub fn otLinkSetPollPeriod(aInstance: *mut otInstance, aPollPeriod: u32) -> otError;
8834}
8835unsafe extern "C" {
8836 #[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."]
8837 pub fn otLinkGetShortAddress(aInstance: *mut otInstance) -> otShortAddress;
8838}
8839unsafe extern "C" {
8840 #[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."]
8841 pub fn otLinkGetAlternateShortAddress(aInstance: *mut otInstance) -> otShortAddress;
8842}
8843unsafe extern "C" {
8844 #[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."]
8845 pub fn otLinkGetMaxFrameRetriesDirect(aInstance: *mut otInstance) -> u8;
8846}
8847unsafe extern "C" {
8848 #[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."]
8849 pub fn otLinkSetMaxFrameRetriesDirect(aInstance: *mut otInstance, aMaxFrameRetriesDirect: u8);
8850}
8851unsafe extern "C" {
8852 #[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."]
8853 pub fn otLinkGetMaxFrameRetriesIndirect(aInstance: *mut otInstance) -> u8;
8854}
8855unsafe extern "C" {
8856 #[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."]
8857 pub fn otLinkSetMaxFrameRetriesIndirect(
8858 aInstance: *mut otInstance,
8859 aMaxFrameRetriesIndirect: u8,
8860 );
8861}
8862unsafe extern "C" {
8863 #[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."]
8864 pub fn otLinkGetFrameCounter(aInstance: *mut otInstance) -> u32;
8865}
8866unsafe extern "C" {
8867 #[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."]
8868 pub fn otLinkFilterGetAddressMode(aInstance: *mut otInstance) -> otMacFilterAddressMode;
8869}
8870unsafe extern "C" {
8871 #[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."]
8872 pub fn otLinkFilterSetAddressMode(aInstance: *mut otInstance, aMode: otMacFilterAddressMode);
8873}
8874unsafe extern "C" {
8875 #[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."]
8876 pub fn otLinkFilterAddAddress(
8877 aInstance: *mut otInstance,
8878 aExtAddress: *const otExtAddress,
8879 ) -> otError;
8880}
8881unsafe extern "C" {
8882 #[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)."]
8883 pub fn otLinkFilterRemoveAddress(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
8884}
8885unsafe extern "C" {
8886 #[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."]
8887 pub fn otLinkFilterClearAddresses(aInstance: *mut otInstance);
8888}
8889unsafe extern "C" {
8890 #[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."]
8891 pub fn otLinkFilterGetNextAddress(
8892 aInstance: *mut otInstance,
8893 aIterator: *mut otMacFilterIterator,
8894 aEntry: *mut otMacFilterEntry,
8895 ) -> otError;
8896}
8897unsafe extern "C" {
8898 #[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."]
8899 pub fn otLinkFilterAddRssIn(
8900 aInstance: *mut otInstance,
8901 aExtAddress: *const otExtAddress,
8902 aRss: i8,
8903 ) -> otError;
8904}
8905unsafe extern "C" {
8906 #[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."]
8907 pub fn otLinkFilterRemoveRssIn(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
8908}
8909unsafe extern "C" {
8910 #[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."]
8911 pub fn otLinkFilterSetDefaultRssIn(aInstance: *mut otInstance, aRss: i8);
8912}
8913unsafe extern "C" {
8914 #[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."]
8915 pub fn otLinkFilterClearDefaultRssIn(aInstance: *mut otInstance);
8916}
8917unsafe extern "C" {
8918 #[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."]
8919 pub fn otLinkFilterClearAllRssIn(aInstance: *mut otInstance);
8920}
8921unsafe extern "C" {
8922 #[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."]
8923 pub fn otLinkFilterGetNextRssIn(
8924 aInstance: *mut otInstance,
8925 aIterator: *mut otMacFilterIterator,
8926 aEntry: *mut otMacFilterEntry,
8927 ) -> otError;
8928}
8929unsafe extern "C" {
8930 #[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"]
8931 pub fn otLinkSetRadioFilterEnabled(aInstance: *mut otInstance, aFilterEnabled: bool);
8932}
8933unsafe extern "C" {
8934 #[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."]
8935 pub fn otLinkIsRadioFilterEnabled(aInstance: *mut otInstance) -> bool;
8936}
8937unsafe extern "C" {
8938 #[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."]
8939 pub fn otLinkConvertRssToLinkQuality(aInstance: *mut otInstance, aRss: i8) -> u8;
8940}
8941unsafe extern "C" {
8942 #[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."]
8943 pub fn otLinkConvertLinkQualityToRss(aInstance: *mut otInstance, aLinkQuality: u8) -> i8;
8944}
8945unsafe extern "C" {
8946 #[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."]
8947 pub fn otLinkGetTxDirectRetrySuccessHistogram(
8948 aInstance: *mut otInstance,
8949 aNumberOfEntries: *mut u8,
8950 ) -> *const u32;
8951}
8952unsafe extern "C" {
8953 #[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."]
8954 pub fn otLinkGetTxIndirectRetrySuccessHistogram(
8955 aInstance: *mut otInstance,
8956 aNumberOfEntries: *mut u8,
8957 ) -> *const u32;
8958}
8959unsafe extern "C" {
8960 #[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."]
8961 pub fn otLinkResetTxRetrySuccessHistogram(aInstance: *mut otInstance);
8962}
8963unsafe extern "C" {
8964 #[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."]
8965 pub fn otLinkGetCounters(aInstance: *mut otInstance) -> *const otMacCounters;
8966}
8967unsafe extern "C" {
8968 #[doc = " Resets the MAC layer counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
8969 pub fn otLinkResetCounters(aInstance: *mut otInstance);
8970}
8971#[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."]
8972pub type otLinkPcapCallback = ::std::option::Option<
8973 unsafe extern "C" fn(
8974 aFrame: *const otRadioFrame,
8975 aIsTx: bool,
8976 aContext: *mut ::std::os::raw::c_void,
8977 ),
8978>;
8979unsafe extern "C" {
8980 #[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."]
8981 pub fn otLinkSetPcapCallback(
8982 aInstance: *mut otInstance,
8983 aPcapCallback: otLinkPcapCallback,
8984 aCallbackContext: *mut ::std::os::raw::c_void,
8985 );
8986}
8987unsafe extern "C" {
8988 #[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."]
8989 pub fn otLinkIsPromiscuous(aInstance: *mut otInstance) -> bool;
8990}
8991unsafe extern "C" {
8992 #[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."]
8993 pub fn otLinkSetPromiscuous(aInstance: *mut otInstance, aPromiscuous: bool) -> otError;
8994}
8995unsafe extern "C" {
8996 #[doc = " Gets the CSL channel.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL channel."]
8997 pub fn otLinkGetCslChannel(aInstance: *mut otInstance) -> u8;
8998}
8999unsafe extern "C" {
9000 #[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."]
9001 pub fn otLinkSetCslChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9002}
9003unsafe extern "C" {
9004 #[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."]
9005 pub fn otLinkGetCslPeriod(aInstance: *mut otInstance) -> u32;
9006}
9007unsafe extern "C" {
9008 #[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"]
9009 pub fn otLinkSetCslPeriod(aInstance: *mut otInstance, aPeriod: u32) -> otError;
9010}
9011unsafe extern "C" {
9012 #[doc = " Gets the CSL timeout.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The CSL timeout in seconds."]
9013 pub fn otLinkGetCslTimeout(aInstance: *mut otInstance) -> u32;
9014}
9015unsafe extern "C" {
9016 #[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."]
9017 pub fn otLinkSetCslTimeout(aInstance: *mut otInstance, aTimeout: u32) -> otError;
9018}
9019unsafe extern "C" {
9020 #[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."]
9021 pub fn otLinkGetCcaFailureRate(aInstance: *mut otInstance) -> u16;
9022}
9023unsafe extern "C" {
9024 #[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."]
9025 pub fn otLinkSetEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9026}
9027unsafe extern "C" {
9028 #[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."]
9029 pub fn otLinkIsEnabled(aInstance: *mut otInstance) -> bool;
9030}
9031unsafe extern "C" {
9032 #[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."]
9033 pub fn otLinkIsCslEnabled(aInstance: *mut otInstance) -> bool;
9034}
9035unsafe extern "C" {
9036 #[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."]
9037 pub fn otLinkIsCslSupported(aInstance: *mut otInstance) -> bool;
9038}
9039unsafe extern "C" {
9040 #[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."]
9041 pub fn otLinkSendEmptyData(aInstance: *mut otInstance) -> otError;
9042}
9043unsafe extern "C" {
9044 #[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."]
9045 pub fn otLinkSetRegion(aInstance: *mut otInstance, aRegionCode: u16) -> otError;
9046}
9047unsafe extern "C" {
9048 #[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 nullptr.\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."]
9049 pub fn otLinkGetRegion(aInstance: *mut otInstance, aRegionCode: *mut u16) -> otError;
9050}
9051unsafe extern "C" {
9052 #[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."]
9053 pub fn otLinkGetWakeupChannel(aInstance: *mut otInstance) -> u8;
9054}
9055unsafe extern "C" {
9056 #[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."]
9057 pub fn otLinkSetWakeupChannel(aInstance: *mut otInstance, aChannel: u8) -> otError;
9058}
9059unsafe extern "C" {
9060 #[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."]
9061 pub fn otLinkSetWakeUpListenEnabled(aInstance: *mut otInstance, aEnable: bool) -> otError;
9062}
9063unsafe extern "C" {
9064 #[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."]
9065 pub fn otLinkIsWakeupListenEnabled(aInstance: *mut otInstance) -> bool;
9066}
9067unsafe extern "C" {
9068 #[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."]
9069 pub fn otLinkGetWakeupListenParameters(
9070 aInstance: *mut otInstance,
9071 aInterval: *mut u32,
9072 aDuration: *mut u32,
9073 );
9074}
9075unsafe extern "C" {
9076 #[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."]
9077 pub fn otLinkSetWakeupListenParameters(
9078 aInstance: *mut otInstance,
9079 aInterval: u32,
9080 aDuration: u32,
9081 ) -> otError;
9082}
9083unsafe extern "C" {
9084 #[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."]
9085 pub fn otLinkSetRxOnWhenIdle(aInstance: *mut otInstance, aRxOnWhenIdle: bool) -> otError;
9086}
9087#[doc = " Represents the result (value) for a Link Metrics query."]
9088#[repr(C)]
9089#[derive(Debug, Default, Copy, Clone)]
9090pub struct otLinkMetricsValues {
9091 #[doc = "< Specifies which metrics values are present/included."]
9092 pub mMetrics: otLinkMetrics,
9093 #[doc = "< The value of Pdu Count."]
9094 pub mPduCountValue: u32,
9095 #[doc = "< The value LQI."]
9096 pub mLqiValue: u8,
9097 #[doc = "< The value of Link Margin."]
9098 pub mLinkMarginValue: u8,
9099 #[doc = "< The value of Rssi."]
9100 pub mRssiValue: i8,
9101}
9102#[doc = " Represents which frames are accounted in a Forward Tracking Series."]
9103#[repr(C)]
9104#[derive(Debug, Default, Copy, Clone)]
9105pub struct otLinkMetricsSeriesFlags {
9106 pub _bitfield_align_1: [u8; 0],
9107 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9108}
9109impl otLinkMetricsSeriesFlags {
9110 #[inline]
9111 pub fn mLinkProbe(&self) -> bool {
9112 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9113 }
9114 #[inline]
9115 pub fn set_mLinkProbe(&mut self, val: bool) {
9116 unsafe {
9117 let val: u8 = ::std::mem::transmute(val);
9118 self._bitfield_1.set(0usize, 1u8, val as u64)
9119 }
9120 }
9121 #[inline]
9122 pub unsafe fn mLinkProbe_raw(this: *const Self) -> bool {
9123 unsafe {
9124 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9125 ::std::ptr::addr_of!((*this)._bitfield_1),
9126 0usize,
9127 1u8,
9128 ) as u8)
9129 }
9130 }
9131 #[inline]
9132 pub unsafe fn set_mLinkProbe_raw(this: *mut Self, val: bool) {
9133 unsafe {
9134 let val: u8 = ::std::mem::transmute(val);
9135 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9136 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9137 0usize,
9138 1u8,
9139 val as u64,
9140 )
9141 }
9142 }
9143 #[inline]
9144 pub fn mMacData(&self) -> bool {
9145 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9146 }
9147 #[inline]
9148 pub fn set_mMacData(&mut self, val: bool) {
9149 unsafe {
9150 let val: u8 = ::std::mem::transmute(val);
9151 self._bitfield_1.set(1usize, 1u8, val as u64)
9152 }
9153 }
9154 #[inline]
9155 pub unsafe fn mMacData_raw(this: *const Self) -> bool {
9156 unsafe {
9157 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9158 ::std::ptr::addr_of!((*this)._bitfield_1),
9159 1usize,
9160 1u8,
9161 ) as u8)
9162 }
9163 }
9164 #[inline]
9165 pub unsafe fn set_mMacData_raw(this: *mut Self, val: bool) {
9166 unsafe {
9167 let val: u8 = ::std::mem::transmute(val);
9168 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9169 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9170 1usize,
9171 1u8,
9172 val as u64,
9173 )
9174 }
9175 }
9176 #[inline]
9177 pub fn mMacDataRequest(&self) -> bool {
9178 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
9179 }
9180 #[inline]
9181 pub fn set_mMacDataRequest(&mut self, val: bool) {
9182 unsafe {
9183 let val: u8 = ::std::mem::transmute(val);
9184 self._bitfield_1.set(2usize, 1u8, val as u64)
9185 }
9186 }
9187 #[inline]
9188 pub unsafe fn mMacDataRequest_raw(this: *const Self) -> bool {
9189 unsafe {
9190 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9191 ::std::ptr::addr_of!((*this)._bitfield_1),
9192 2usize,
9193 1u8,
9194 ) as u8)
9195 }
9196 }
9197 #[inline]
9198 pub unsafe fn set_mMacDataRequest_raw(this: *mut Self, val: bool) {
9199 unsafe {
9200 let val: u8 = ::std::mem::transmute(val);
9201 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9202 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9203 2usize,
9204 1u8,
9205 val as u64,
9206 )
9207 }
9208 }
9209 #[inline]
9210 pub fn mMacAck(&self) -> bool {
9211 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
9212 }
9213 #[inline]
9214 pub fn set_mMacAck(&mut self, val: bool) {
9215 unsafe {
9216 let val: u8 = ::std::mem::transmute(val);
9217 self._bitfield_1.set(3usize, 1u8, val as u64)
9218 }
9219 }
9220 #[inline]
9221 pub unsafe fn mMacAck_raw(this: *const Self) -> bool {
9222 unsafe {
9223 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9224 ::std::ptr::addr_of!((*this)._bitfield_1),
9225 3usize,
9226 1u8,
9227 ) as u8)
9228 }
9229 }
9230 #[inline]
9231 pub unsafe fn set_mMacAck_raw(this: *mut Self, val: bool) {
9232 unsafe {
9233 let val: u8 = ::std::mem::transmute(val);
9234 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9235 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9236 3usize,
9237 1u8,
9238 val as u64,
9239 )
9240 }
9241 }
9242 #[inline]
9243 pub fn new_bitfield_1(
9244 mLinkProbe: bool,
9245 mMacData: bool,
9246 mMacDataRequest: bool,
9247 mMacAck: bool,
9248 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9249 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9250 __bindgen_bitfield_unit.set(0usize, 1u8, {
9251 let mLinkProbe: u8 = unsafe { ::std::mem::transmute(mLinkProbe) };
9252 mLinkProbe as u64
9253 });
9254 __bindgen_bitfield_unit.set(1usize, 1u8, {
9255 let mMacData: u8 = unsafe { ::std::mem::transmute(mMacData) };
9256 mMacData as u64
9257 });
9258 __bindgen_bitfield_unit.set(2usize, 1u8, {
9259 let mMacDataRequest: u8 = unsafe { ::std::mem::transmute(mMacDataRequest) };
9260 mMacDataRequest as u64
9261 });
9262 __bindgen_bitfield_unit.set(3usize, 1u8, {
9263 let mMacAck: u8 = unsafe { ::std::mem::transmute(mMacAck) };
9264 mMacAck as u64
9265 });
9266 __bindgen_bitfield_unit
9267 }
9268}
9269#[doc = "< Clear."]
9270pub const OT_LINK_METRICS_ENH_ACK_CLEAR: otLinkMetricsEnhAckFlags = 0;
9271#[doc = "< Register."]
9272pub const OT_LINK_METRICS_ENH_ACK_REGISTER: otLinkMetricsEnhAckFlags = 1;
9273#[doc = " Enhanced-ACK Flags.\n\n These are used in Enhanced-ACK Based Probing to indicate whether to register or clear the probing."]
9274pub type otLinkMetricsEnhAckFlags = ::std::os::raw::c_uint;
9275pub const OT_LINK_METRICS_STATUS_SUCCESS: otLinkMetricsStatus = 0;
9276pub const OT_LINK_METRICS_STATUS_CANNOT_SUPPORT_NEW_SERIES: otLinkMetricsStatus = 1;
9277pub const OT_LINK_METRICS_STATUS_SERIESID_ALREADY_REGISTERED: otLinkMetricsStatus = 2;
9278pub const OT_LINK_METRICS_STATUS_SERIESID_NOT_RECOGNIZED: otLinkMetricsStatus = 3;
9279pub const OT_LINK_METRICS_STATUS_NO_MATCHING_FRAMES_RECEIVED: otLinkMetricsStatus = 4;
9280pub const OT_LINK_METRICS_STATUS_OTHER_ERROR: otLinkMetricsStatus = 254;
9281#[doc = " Link Metrics Status values."]
9282pub type otLinkMetricsStatus = ::std::os::raw::c_uint;
9283#[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."]
9284pub type otLinkMetricsReportCallback = ::std::option::Option<
9285 unsafe extern "C" fn(
9286 aSource: *const otIp6Address,
9287 aMetricsValues: *const otLinkMetricsValues,
9288 aStatus: otLinkMetricsStatus,
9289 aContext: *mut ::std::os::raw::c_void,
9290 ),
9291>;
9292#[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."]
9293pub type otLinkMetricsMgmtResponseCallback = ::std::option::Option<
9294 unsafe extern "C" fn(
9295 aSource: *const otIp6Address,
9296 aStatus: otLinkMetricsStatus,
9297 aContext: *mut ::std::os::raw::c_void,
9298 ),
9299>;
9300#[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."]
9301pub type otLinkMetricsEnhAckProbingIeReportCallback = ::std::option::Option<
9302 unsafe extern "C" fn(
9303 aShortAddress: otShortAddress,
9304 aExtAddress: *const otExtAddress,
9305 aMetricsValues: *const otLinkMetricsValues,
9306 aContext: *mut ::std::os::raw::c_void,
9307 ),
9308>;
9309unsafe extern "C" {
9310 #[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."]
9311 pub fn otLinkMetricsQuery(
9312 aInstance: *mut otInstance,
9313 aDestination: *const otIp6Address,
9314 aSeriesId: u8,
9315 aLinkMetricsFlags: *const otLinkMetrics,
9316 aCallback: otLinkMetricsReportCallback,
9317 aCallbackContext: *mut ::std::os::raw::c_void,
9318 ) -> otError;
9319}
9320unsafe extern "C" {
9321 #[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."]
9322 pub fn otLinkMetricsConfigForwardTrackingSeries(
9323 aInstance: *mut otInstance,
9324 aDestination: *const otIp6Address,
9325 aSeriesId: u8,
9326 aSeriesFlags: otLinkMetricsSeriesFlags,
9327 aLinkMetricsFlags: *const otLinkMetrics,
9328 aCallback: otLinkMetricsMgmtResponseCallback,
9329 aCallbackContext: *mut ::std::os::raw::c_void,
9330 ) -> otError;
9331}
9332unsafe extern "C" {
9333 #[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."]
9334 pub fn otLinkMetricsConfigEnhAckProbing(
9335 aInstance: *mut otInstance,
9336 aDestination: *const otIp6Address,
9337 aEnhAckFlags: otLinkMetricsEnhAckFlags,
9338 aLinkMetricsFlags: *const otLinkMetrics,
9339 aCallback: otLinkMetricsMgmtResponseCallback,
9340 aCallbackContext: *mut ::std::os::raw::c_void,
9341 aEnhAckCallback: otLinkMetricsEnhAckProbingIeReportCallback,
9342 aEnhAckCallbackContext: *mut ::std::os::raw::c_void,
9343 ) -> otError;
9344}
9345unsafe extern "C" {
9346 #[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."]
9347 pub fn otLinkMetricsSendLinkProbe(
9348 aInstance: *mut otInstance,
9349 aDestination: *const otIp6Address,
9350 aSeriesId: u8,
9351 aLength: u8,
9352 ) -> otError;
9353}
9354unsafe extern "C" {
9355 #[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."]
9356 pub fn otLinkMetricsManagerIsEnabled(aInstance: *mut otInstance) -> bool;
9357}
9358unsafe extern "C" {
9359 #[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."]
9360 pub fn otLinkMetricsManagerSetEnabled(aInstance: *mut otInstance, aEnable: bool);
9361}
9362unsafe extern "C" {
9363 #[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."]
9364 pub fn otLinkMetricsManagerGetMetricsValueByExtAddr(
9365 aInstance: *mut otInstance,
9366 aExtAddress: *const otExtAddress,
9367 aLinkMetricsValues: *mut otLinkMetricsValues,
9368 ) -> otError;
9369}
9370#[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."]
9371pub type otLinkRawReceiveDone = ::std::option::Option<
9372 unsafe extern "C" fn(aInstance: *mut otInstance, aFrame: *mut otRadioFrame, aError: otError),
9373>;
9374unsafe extern "C" {
9375 #[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."]
9376 pub fn otLinkRawSetReceiveDone(
9377 aInstance: *mut otInstance,
9378 aCallback: otLinkRawReceiveDone,
9379 ) -> otError;
9380}
9381unsafe extern "C" {
9382 #[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."]
9383 pub fn otLinkRawIsEnabled(aInstance: *mut otInstance) -> bool;
9384}
9385unsafe extern "C" {
9386 #[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."]
9387 pub fn otLinkRawGetPromiscuous(aInstance: *mut otInstance) -> bool;
9388}
9389unsafe extern "C" {
9390 #[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."]
9391 pub fn otLinkRawSetPromiscuous(aInstance: *mut otInstance, aEnable: bool) -> otError;
9392}
9393unsafe extern "C" {
9394 #[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."]
9395 pub fn otLinkRawSetShortAddress(aInstance: *mut otInstance, aShortAddress: u16) -> otError;
9396}
9397unsafe extern "C" {
9398 #[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."]
9399 pub fn otLinkRawSetAlternateShortAddress(
9400 aInstance: *mut otInstance,
9401 aShortAddress: otShortAddress,
9402 ) -> otError;
9403}
9404unsafe extern "C" {
9405 #[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"]
9406 pub fn otLinkRawSleep(aInstance: *mut otInstance) -> otError;
9407}
9408unsafe extern "C" {
9409 #[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."]
9410 pub fn otLinkRawReceive(aInstance: *mut otInstance) -> otError;
9411}
9412unsafe extern "C" {
9413 #[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."]
9414 pub fn otLinkRawGetTransmitBuffer(aInstance: *mut otInstance) -> *mut otRadioFrame;
9415}
9416#[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."]
9417pub type otLinkRawTransmitDone = ::std::option::Option<
9418 unsafe extern "C" fn(
9419 aInstance: *mut otInstance,
9420 aFrame: *mut otRadioFrame,
9421 aAckFrame: *mut otRadioFrame,
9422 aError: otError,
9423 ),
9424>;
9425unsafe extern "C" {
9426 #[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."]
9427 pub fn otLinkRawTransmit(
9428 aInstance: *mut otInstance,
9429 aCallback: otLinkRawTransmitDone,
9430 ) -> otError;
9431}
9432unsafe extern "C" {
9433 #[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."]
9434 pub fn otLinkRawGetRssi(aInstance: *mut otInstance) -> i8;
9435}
9436unsafe extern "C" {
9437 #[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."]
9438 pub fn otLinkRawGetCaps(aInstance: *mut otInstance) -> otRadioCaps;
9439}
9440#[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."]
9441pub type otLinkRawEnergyScanDone =
9442 ::std::option::Option<unsafe extern "C" fn(aInstance: *mut otInstance, aEnergyScanMaxRssi: i8)>;
9443unsafe extern "C" {
9444 #[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."]
9445 pub fn otLinkRawEnergyScan(
9446 aInstance: *mut otInstance,
9447 aScanChannel: u8,
9448 aScanDuration: u16,
9449 aCallback: otLinkRawEnergyScanDone,
9450 ) -> otError;
9451}
9452unsafe extern "C" {
9453 #[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."]
9454 pub fn otLinkRawSrcMatchEnable(aInstance: *mut otInstance, aEnable: bool) -> otError;
9455}
9456unsafe extern "C" {
9457 #[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."]
9458 pub fn otLinkRawSrcMatchAddShortEntry(
9459 aInstance: *mut otInstance,
9460 aShortAddress: u16,
9461 ) -> otError;
9462}
9463unsafe extern "C" {
9464 #[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."]
9465 pub fn otLinkRawSrcMatchAddExtEntry(
9466 aInstance: *mut otInstance,
9467 aExtAddress: *const otExtAddress,
9468 ) -> otError;
9469}
9470unsafe extern "C" {
9471 #[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."]
9472 pub fn otLinkRawSrcMatchClearShortEntry(
9473 aInstance: *mut otInstance,
9474 aShortAddress: u16,
9475 ) -> otError;
9476}
9477unsafe extern "C" {
9478 #[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."]
9479 pub fn otLinkRawSrcMatchClearExtEntry(
9480 aInstance: *mut otInstance,
9481 aExtAddress: *const otExtAddress,
9482 ) -> otError;
9483}
9484unsafe extern "C" {
9485 #[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."]
9486 pub fn otLinkRawSrcMatchClearShortEntries(aInstance: *mut otInstance) -> otError;
9487}
9488unsafe extern "C" {
9489 #[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."]
9490 pub fn otLinkRawSrcMatchClearExtEntries(aInstance: *mut otInstance) -> otError;
9491}
9492unsafe extern "C" {
9493 #[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."]
9494 pub fn otLinkRawSetMacKey(
9495 aInstance: *mut otInstance,
9496 aKeyIdMode: u8,
9497 aKeyId: u8,
9498 aPrevKey: *const otMacKey,
9499 aCurrKey: *const otMacKey,
9500 aNextKey: *const otMacKey,
9501 ) -> otError;
9502}
9503unsafe extern "C" {
9504 #[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."]
9505 pub fn otLinkRawSetMacFrameCounter(
9506 aInstance: *mut otInstance,
9507 aMacFrameCounter: u32,
9508 ) -> otError;
9509}
9510unsafe extern "C" {
9511 #[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."]
9512 pub fn otLinkRawSetMacFrameCounterIfLarger(
9513 aInstance: *mut otInstance,
9514 aMacFrameCounter: u32,
9515 ) -> otError;
9516}
9517unsafe extern "C" {
9518 #[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."]
9519 pub fn otLinkRawGetRadioTime(aInstance: *mut otInstance) -> u64;
9520}
9521unsafe extern "C" {
9522 #[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."]
9523 pub fn otLoggingGetLevel() -> otLogLevel;
9524}
9525unsafe extern "C" {
9526 #[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."]
9527 pub fn otLoggingSetLevel(aLogLevel: otLogLevel) -> otError;
9528}
9529unsafe extern "C" {
9530 #[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."]
9531 pub fn otLogCritPlat(aFormat: *const ::std::os::raw::c_char, ...);
9532}
9533unsafe extern "C" {
9534 #[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."]
9535 pub fn otLogWarnPlat(aFormat: *const ::std::os::raw::c_char, ...);
9536}
9537unsafe extern "C" {
9538 #[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."]
9539 pub fn otLogNotePlat(aFormat: *const ::std::os::raw::c_char, ...);
9540}
9541unsafe extern "C" {
9542 #[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."]
9543 pub fn otLogInfoPlat(aFormat: *const ::std::os::raw::c_char, ...);
9544}
9545unsafe extern "C" {
9546 #[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."]
9547 pub fn otLogDebgPlat(aFormat: *const ::std::os::raw::c_char, ...);
9548}
9549unsafe extern "C" {
9550 #[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."]
9551 pub fn otDumpCritPlat(
9552 aText: *const ::std::os::raw::c_char,
9553 aData: *const ::std::os::raw::c_void,
9554 aDataLength: u16,
9555 );
9556}
9557unsafe extern "C" {
9558 #[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."]
9559 pub fn otDumpWarnPlat(
9560 aText: *const ::std::os::raw::c_char,
9561 aData: *const ::std::os::raw::c_void,
9562 aDataLength: u16,
9563 );
9564}
9565unsafe extern "C" {
9566 #[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."]
9567 pub fn otDumpNotePlat(
9568 aText: *const ::std::os::raw::c_char,
9569 aData: *const ::std::os::raw::c_void,
9570 aDataLength: u16,
9571 );
9572}
9573unsafe extern "C" {
9574 #[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."]
9575 pub fn otDumpInfoPlat(
9576 aText: *const ::std::os::raw::c_char,
9577 aData: *const ::std::os::raw::c_void,
9578 aDataLength: u16,
9579 );
9580}
9581unsafe extern "C" {
9582 #[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."]
9583 pub fn otDumpDebgPlat(
9584 aText: *const ::std::os::raw::c_char,
9585 aData: *const ::std::os::raw::c_void,
9586 aDataLength: u16,
9587 );
9588}
9589unsafe extern "C" {
9590 #[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."]
9591 pub fn otLogPlat(
9592 aLogLevel: otLogLevel,
9593 aPlatModuleName: *const ::std::os::raw::c_char,
9594 aFormat: *const ::std::os::raw::c_char,
9595 ...
9596 );
9597}
9598unsafe extern "C" {
9599 #[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."]
9600 pub fn otLogPlatArgs(
9601 aLogLevel: otLogLevel,
9602 aPlatModuleName: *const ::std::os::raw::c_char,
9603 aFormat: *const ::std::os::raw::c_char,
9604 aArgs: *mut __va_list_tag,
9605 );
9606}
9607unsafe extern "C" {
9608 #[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."]
9609 pub fn otLogCli(aLogLevel: otLogLevel, aFormat: *const ::std::os::raw::c_char, ...);
9610}
9611#[doc = " Represents information used for generating hex dump output."]
9612#[repr(C)]
9613#[derive(Debug, Copy, Clone)]
9614pub struct otLogHexDumpInfo {
9615 #[doc = "< The data byes."]
9616 pub mDataBytes: *const u8,
9617 #[doc = "< The data length (number of bytes in @p mDataBytes)"]
9618 pub mDataLength: u16,
9619 #[doc = "< Title string to add table header (MUST NOT be `NULL`)."]
9620 pub mTitle: *const ::std::os::raw::c_char,
9621 #[doc = "< Buffer to output one line of generated hex dump."]
9622 pub mLine: [::std::os::raw::c_char; 73usize],
9623 #[doc = "< Iterator used by OT stack. MUST be initialized to zero."]
9624 pub mIterator: u16,
9625}
9626impl Default for otLogHexDumpInfo {
9627 fn default() -> Self {
9628 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9629 unsafe {
9630 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9631 s.assume_init()
9632 }
9633 }
9634}
9635unsafe extern "C" {
9636 #[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."]
9637 pub fn otLogGenerateNextHexDumpLine(aInfo: *mut otLogHexDumpInfo) -> otError;
9638}
9639#[doc = " Represents information associated with a radio link."]
9640#[repr(C)]
9641#[derive(Debug, Default, Copy, Clone)]
9642pub struct otRadioLinkInfo {
9643 #[doc = "< Preference level of radio link"]
9644 pub mPreference: u8,
9645}
9646#[doc = " Represents multi radio link information associated with a neighbor."]
9647#[repr(C)]
9648#[derive(Debug, Default, Copy, Clone)]
9649pub struct otMultiRadioNeighborInfo {
9650 pub _bitfield_align_1: [u8; 0],
9651 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
9652 #[doc = "< Additional info for 15.4 radio link (applicable when supported)."]
9653 pub mIeee802154Info: otRadioLinkInfo,
9654 #[doc = "< Additional info for TREL radio link (applicable when supported)."]
9655 pub mTrelUdp6Info: otRadioLinkInfo,
9656}
9657impl otMultiRadioNeighborInfo {
9658 #[inline]
9659 pub fn mSupportsIeee802154(&self) -> bool {
9660 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
9661 }
9662 #[inline]
9663 pub fn set_mSupportsIeee802154(&mut self, val: bool) {
9664 unsafe {
9665 let val: u8 = ::std::mem::transmute(val);
9666 self._bitfield_1.set(0usize, 1u8, val as u64)
9667 }
9668 }
9669 #[inline]
9670 pub unsafe fn mSupportsIeee802154_raw(this: *const Self) -> bool {
9671 unsafe {
9672 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9673 ::std::ptr::addr_of!((*this)._bitfield_1),
9674 0usize,
9675 1u8,
9676 ) as u8)
9677 }
9678 }
9679 #[inline]
9680 pub unsafe fn set_mSupportsIeee802154_raw(this: *mut Self, val: bool) {
9681 unsafe {
9682 let val: u8 = ::std::mem::transmute(val);
9683 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9684 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9685 0usize,
9686 1u8,
9687 val as u64,
9688 )
9689 }
9690 }
9691 #[inline]
9692 pub fn mSupportsTrelUdp6(&self) -> bool {
9693 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
9694 }
9695 #[inline]
9696 pub fn set_mSupportsTrelUdp6(&mut self, val: bool) {
9697 unsafe {
9698 let val: u8 = ::std::mem::transmute(val);
9699 self._bitfield_1.set(1usize, 1u8, val as u64)
9700 }
9701 }
9702 #[inline]
9703 pub unsafe fn mSupportsTrelUdp6_raw(this: *const Self) -> bool {
9704 unsafe {
9705 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
9706 ::std::ptr::addr_of!((*this)._bitfield_1),
9707 1usize,
9708 1u8,
9709 ) as u8)
9710 }
9711 }
9712 #[inline]
9713 pub unsafe fn set_mSupportsTrelUdp6_raw(this: *mut Self, val: bool) {
9714 unsafe {
9715 let val: u8 = ::std::mem::transmute(val);
9716 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
9717 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
9718 1usize,
9719 1u8,
9720 val as u64,
9721 )
9722 }
9723 }
9724 #[inline]
9725 pub fn new_bitfield_1(
9726 mSupportsIeee802154: bool,
9727 mSupportsTrelUdp6: bool,
9728 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
9729 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
9730 __bindgen_bitfield_unit.set(0usize, 1u8, {
9731 let mSupportsIeee802154: u8 = unsafe { ::std::mem::transmute(mSupportsIeee802154) };
9732 mSupportsIeee802154 as u64
9733 });
9734 __bindgen_bitfield_unit.set(1usize, 1u8, {
9735 let mSupportsTrelUdp6: u8 = unsafe { ::std::mem::transmute(mSupportsTrelUdp6) };
9736 mSupportsTrelUdp6 as u64
9737 });
9738 __bindgen_bitfield_unit
9739 }
9740}
9741unsafe extern "C" {
9742 #[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."]
9743 pub fn otMultiRadioGetNeighborInfo(
9744 aInstance: *mut otInstance,
9745 aExtAddress: *const otExtAddress,
9746 aNeighborInfo: *mut otMultiRadioNeighborInfo,
9747 ) -> otError;
9748}
9749#[doc = " @struct otIp4Address\n\n Represents an IPv4 address."]
9750#[repr(C, packed)]
9751#[derive(Copy, Clone)]
9752pub struct otIp4Address {
9753 pub mFields: otIp4Address__bindgen_ty_1,
9754}
9755#[repr(C, packed)]
9756#[derive(Copy, Clone)]
9757pub union otIp4Address__bindgen_ty_1 {
9758 #[doc = "< 8-bit fields"]
9759 pub m8: [u8; 4usize],
9760 #[doc = "< 32-bit representation"]
9761 pub m32: u32,
9762}
9763impl Default for otIp4Address__bindgen_ty_1 {
9764 fn default() -> Self {
9765 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9766 unsafe {
9767 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9768 s.assume_init()
9769 }
9770 }
9771}
9772impl Default for otIp4Address {
9773 fn default() -> Self {
9774 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9775 unsafe {
9776 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9777 s.assume_init()
9778 }
9779 }
9780}
9781#[doc = " @struct otIp4Cidr\n\n Represents an IPv4 CIDR block."]
9782#[repr(C)]
9783#[derive(Copy, Clone)]
9784pub struct otIp4Cidr {
9785 pub mAddress: otIp4Address,
9786 pub mLength: u8,
9787}
9788impl Default for otIp4Cidr {
9789 fn default() -> Self {
9790 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9791 unsafe {
9792 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9793 s.assume_init()
9794 }
9795 }
9796}
9797#[doc = " Represents the counters for NAT64."]
9798#[repr(C)]
9799#[derive(Debug, Default, Copy, Clone)]
9800pub struct otNat64Counters {
9801 #[doc = "< Number of packets translated from IPv4 to IPv6."]
9802 pub m4To6Packets: u64,
9803 #[doc = "< Sum of size of packets translated from IPv4 to IPv6."]
9804 pub m4To6Bytes: u64,
9805 #[doc = "< Number of packets translated from IPv6 to IPv4."]
9806 pub m6To4Packets: u64,
9807 #[doc = "< Sum of size of packets translated from IPv6 to IPv4."]
9808 pub m6To4Bytes: u64,
9809}
9810#[doc = " Represents the counters for the protocols supported by NAT64."]
9811#[repr(C)]
9812#[derive(Debug, Default, Copy, Clone)]
9813pub struct otNat64ProtocolCounters {
9814 #[doc = "< Counters for sum of all protocols."]
9815 pub mTotal: otNat64Counters,
9816 #[doc = "< Counters for ICMP and ICMPv6."]
9817 pub mIcmp: otNat64Counters,
9818 #[doc = "< Counters for UDP."]
9819 pub mUdp: otNat64Counters,
9820 #[doc = "< Counters for TCP."]
9821 pub mTcp: otNat64Counters,
9822}
9823#[doc = "< Packet drop for unknown reasons."]
9824pub const OT_NAT64_DROP_REASON_UNKNOWN: otNat64DropReason = 0;
9825#[doc = "< Packet drop due to failed to parse the datagram."]
9826pub const OT_NAT64_DROP_REASON_ILLEGAL_PACKET: otNat64DropReason = 1;
9827#[doc = "< Packet drop due to unsupported IP protocol."]
9828pub const OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO: otNat64DropReason = 2;
9829#[doc = "< Packet drop due to no mappings found or mapping pool exhausted."]
9830pub const OT_NAT64_DROP_REASON_NO_MAPPING: otNat64DropReason = 3;
9831pub const OT_NAT64_DROP_REASON_COUNT: otNat64DropReason = 4;
9832#[doc = " Packet drop reasons."]
9833pub type otNat64DropReason = ::std::os::raw::c_uint;
9834#[doc = " Represents the counters of dropped packets due to errors when handling NAT64 packets."]
9835#[repr(C)]
9836#[derive(Debug, Default, Copy, Clone)]
9837pub struct otNat64ErrorCounters {
9838 #[doc = "< Errors translating IPv4 packets."]
9839 pub mCount4To6: [u64; 4usize],
9840 #[doc = "< Errors translating IPv6 packets."]
9841 pub mCount6To4: [u64; 4usize],
9842}
9843unsafe extern "C" {
9844 #[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."]
9845 pub fn otNat64GetCounters(aInstance: *mut otInstance, aCounters: *mut otNat64ProtocolCounters);
9846}
9847unsafe extern "C" {
9848 #[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."]
9849 pub fn otNat64GetErrorCounters(
9850 aInstance: *mut otInstance,
9851 aCounters: *mut otNat64ErrorCounters,
9852 );
9853}
9854#[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."]
9855#[repr(C)]
9856#[derive(Copy, Clone)]
9857pub struct otNat64AddressMapping {
9858 #[doc = "< The unique id for a mapping session."]
9859 pub mId: u64,
9860 #[doc = "< The IPv4 address of the mapping."]
9861 pub mIp4: otIp4Address,
9862 #[doc = "< The IPv6 address of the mapping."]
9863 pub mIp6: otIp6Address,
9864 #[doc = " The source port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
9865 pub mSrcPortOrId: u16,
9866 #[doc = " The translated port or ICMP ID of the mapping. Used when\n OPENTHREAD_CONFIG_NAT64_PORT_TRANSLATION_ENABLE is true."]
9867 pub mTranslatedPortOrId: u16,
9868 #[doc = "< Remaining time before expiry in milliseconds."]
9869 pub mRemainingTimeMs: u32,
9870 pub mCounters: otNat64ProtocolCounters,
9871}
9872impl Default for otNat64AddressMapping {
9873 fn default() -> Self {
9874 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9875 unsafe {
9876 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9877 s.assume_init()
9878 }
9879 }
9880}
9881#[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 `otNat64AddressMappingIteratorInit()`."]
9882#[repr(C)]
9883#[derive(Debug, Copy, Clone)]
9884pub struct otNat64AddressMappingIterator {
9885 pub mPtr: *mut ::std::os::raw::c_void,
9886}
9887impl Default for otNat64AddressMappingIterator {
9888 fn default() -> Self {
9889 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
9890 unsafe {
9891 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
9892 s.assume_init()
9893 }
9894 }
9895}
9896unsafe extern "C" {
9897 #[doc = " Initializes an `otNat64AddressMappingIterator`.\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 mapping info.\n\n @param[in] aInstance The OpenThread instance.\n @param[out] aIterator A pointer to the iterator to initialize."]
9898 pub fn otNat64InitAddressMappingIterator(
9899 aInstance: *mut otInstance,
9900 aIterator: *mut otNat64AddressMappingIterator,
9901 );
9902}
9903unsafe extern "C" {
9904 #[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. To get the first entry the iterator should be set to\n OT_NAT64_ADDRESS_MAPPING_ITERATOR_INIT.\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."]
9905 pub fn otNat64GetNextAddressMapping(
9906 aInstance: *mut otInstance,
9907 aIterator: *mut otNat64AddressMappingIterator,
9908 aMapping: *mut otNat64AddressMapping,
9909 ) -> otError;
9910}
9911#[doc = "< NAT64 is disabled."]
9912pub const OT_NAT64_STATE_DISABLED: otNat64State = 0;
9913#[doc = "< NAT64 is enabled, but one or more dependencies of NAT64 are not running."]
9914pub const OT_NAT64_STATE_NOT_RUNNING: otNat64State = 1;
9915#[doc = "< NAT64 is enabled, but this BR is not an active NAT64 BR."]
9916pub const OT_NAT64_STATE_IDLE: otNat64State = 2;
9917#[doc = "< The BR is publishing a NAT64 prefix and/or translating packets."]
9918pub const OT_NAT64_STATE_ACTIVE: otNat64State = 3;
9919#[doc = " States of NAT64."]
9920pub type otNat64State = ::std::os::raw::c_uint;
9921unsafe extern "C" {
9922 #[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."]
9923 pub fn otNat64GetTranslatorState(aInstance: *mut otInstance) -> otNat64State;
9924}
9925unsafe extern "C" {
9926 #[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."]
9927 pub fn otNat64GetPrefixManagerState(aInstance: *mut otInstance) -> otNat64State;
9928}
9929unsafe extern "C" {
9930 #[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"]
9931 pub fn otNat64SetEnabled(aInstance: *mut otInstance, aEnabled: bool);
9932}
9933unsafe extern "C" {
9934 #[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"]
9935 pub fn otIp4NewMessage(
9936 aInstance: *mut otInstance,
9937 aSettings: *const otMessageSettings,
9938 ) -> *mut otMessage;
9939}
9940unsafe extern "C" {
9941 #[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"]
9942 pub fn otNat64SetIp4Cidr(aInstance: *mut otInstance, aCidr: *const otIp4Cidr) -> otError;
9943}
9944unsafe extern "C" {
9945 #[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"]
9946 pub fn otNat64ClearIp4Cidr(aInstance: *mut otInstance);
9947}
9948unsafe extern "C" {
9949 #[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."]
9950 pub fn otNat64Send(aInstance: *mut otInstance, aMessage: *mut otMessage) -> otError;
9951}
9952#[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."]
9953pub type otNat64ReceiveIp4Callback = ::std::option::Option<
9954 unsafe extern "C" fn(aMessage: *mut otMessage, aContext: *mut ::std::os::raw::c_void),
9955>;
9956unsafe extern "C" {
9957 #[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."]
9958 pub fn otNat64SetReceiveIp4Callback(
9959 aInstance: *mut otInstance,
9960 aCallback: otNat64ReceiveIp4Callback,
9961 aContext: *mut ::std::os::raw::c_void,
9962 );
9963}
9964unsafe extern "C" {
9965 #[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."]
9966 pub fn otNat64GetCidr(aInstance: *mut otInstance, aCidr: *mut otIp4Cidr) -> otError;
9967}
9968unsafe extern "C" {
9969 #[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."]
9970 pub fn otIp4IsAddressEqual(aFirst: *const otIp4Address, aSecond: *const otIp4Address) -> bool;
9971}
9972unsafe extern "C" {
9973 #[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."]
9974 pub fn otIp4ExtractFromIp6Address(
9975 aPrefixLength: u8,
9976 aIp6Address: *const otIp6Address,
9977 aIp4Address: *mut otIp4Address,
9978 );
9979}
9980unsafe extern "C" {
9981 #[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."]
9982 pub fn otIp4FromIp4MappedIp6Address(
9983 aIp6Address: *const otIp6Address,
9984 aIp4Address: *mut otIp4Address,
9985 ) -> otError;
9986}
9987unsafe extern "C" {
9988 #[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."]
9989 pub fn otIp4ToIp4MappedIp6Address(
9990 aIp4Address: *const otIp4Address,
9991 aIp6Address: *mut otIp6Address,
9992 );
9993}
9994unsafe extern "C" {
9995 #[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 `nullptr`).\n @param[in] aSize The size of @p aBuffer (in bytes)."]
9996 pub fn otIp4AddressToString(
9997 aAddress: *const otIp4Address,
9998 aBuffer: *mut ::std::os::raw::c_char,
9999 aSize: u16,
10000 );
10001}
10002unsafe extern "C" {
10003 #[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."]
10004 pub fn otIp4CidrFromString(
10005 aString: *const ::std::os::raw::c_char,
10006 aCidr: *mut otIp4Cidr,
10007 ) -> otError;
10008}
10009unsafe extern "C" {
10010 #[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 `nullptr`).\n @param[in] aSize The size of @p aBuffer (in bytes)."]
10011 pub fn otIp4CidrToString(
10012 aCidr: *const otIp4Cidr,
10013 aBuffer: *mut ::std::os::raw::c_char,
10014 aSize: u16,
10015 );
10016}
10017unsafe extern "C" {
10018 #[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."]
10019 pub fn otIp4AddressFromString(
10020 aString: *const ::std::os::raw::c_char,
10021 aAddress: *mut otIp4Address,
10022 ) -> otError;
10023}
10024unsafe extern "C" {
10025 #[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."]
10026 pub fn otNat64SynthesizeIp6Address(
10027 aInstance: *mut otInstance,
10028 aIp4Address: *const otIp4Address,
10029 aIp6Address: *mut otIp6Address,
10030 ) -> otError;
10031}
10032#[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."]
10033pub type otNcpHdlcSendCallback = ::std::option::Option<
10034 unsafe extern "C" fn(aBuf: *const u8, aBufLength: u16) -> ::std::os::raw::c_int,
10035>;
10036unsafe extern "C" {
10037 #[doc = " Is called after NCP send finished."]
10038 pub fn otNcpHdlcSendDone();
10039}
10040unsafe extern "C" {
10041 #[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."]
10042 pub fn otNcpHdlcReceive(aBuf: *const u8, aBufLength: u16);
10043}
10044unsafe extern "C" {
10045 #[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."]
10046 pub fn otNcpHdlcInit(aInstance: *mut otInstance, aSendCallback: otNcpHdlcSendCallback);
10047}
10048unsafe extern "C" {
10049 #[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."]
10050 pub fn otNcpHdlcInitMulti(
10051 aInstance: *mut *mut otInstance,
10052 aCount: u8,
10053 aSendCallback: otNcpHdlcSendCallback,
10054 );
10055}
10056unsafe extern "C" {
10057 #[doc = " Initialize the NCP based on SPI framing.\n\n @param[in] aInstance The OpenThread instance structure."]
10058 pub fn otNcpSpiInit(aInstance: *mut otInstance);
10059}
10060unsafe extern "C" {
10061 #[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."]
10062 pub fn otNcpStreamWrite(
10063 aStreamId: ::std::os::raw::c_int,
10064 aDataPtr: *const u8,
10065 aDataLen: ::std::os::raw::c_int,
10066 ) -> otError;
10067}
10068unsafe extern "C" {
10069 #[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."]
10070 pub fn otNcpPlatLogv(
10071 aLogLevel: otLogLevel,
10072 aLogRegion: otLogRegion,
10073 aFormat: *const ::std::os::raw::c_char,
10074 aArgs: *mut __va_list_tag,
10075 );
10076}
10077#[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."]
10078pub type otNcpDelegateAllowPeekPoke =
10079 ::std::option::Option<unsafe extern "C" fn(aAddress: u32, aCount: u16) -> bool>;
10080unsafe extern "C" {
10081 #[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."]
10082 pub fn otNcpRegisterPeekPokeDelegates(
10083 aAllowPeekDelegate: otNcpDelegateAllowPeekPoke,
10084 aAllowPokeDelegate: otNcpDelegateAllowPeekPoke,
10085 );
10086}
10087#[doc = "< The Thread stack is disabled."]
10088pub const OT_DEVICE_ROLE_DISABLED: otDeviceRole = 0;
10089#[doc = "< Not currently participating in a Thread network/partition."]
10090pub const OT_DEVICE_ROLE_DETACHED: otDeviceRole = 1;
10091#[doc = "< The Thread Child role."]
10092pub const OT_DEVICE_ROLE_CHILD: otDeviceRole = 2;
10093#[doc = "< The Thread Router role."]
10094pub const OT_DEVICE_ROLE_ROUTER: otDeviceRole = 3;
10095#[doc = "< The Thread Leader role."]
10096pub const OT_DEVICE_ROLE_LEADER: otDeviceRole = 4;
10097#[doc = " Represents a Thread device role."]
10098pub type otDeviceRole = ::std::os::raw::c_uint;
10099#[doc = " Represents an MLE Link Mode configuration."]
10100#[repr(C)]
10101#[derive(Debug, Default, Copy, Clone)]
10102pub struct otLinkModeConfig {
10103 pub _bitfield_align_1: [u8; 0],
10104 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10105}
10106impl otLinkModeConfig {
10107 #[inline]
10108 pub fn mRxOnWhenIdle(&self) -> bool {
10109 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10110 }
10111 #[inline]
10112 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
10113 unsafe {
10114 let val: u8 = ::std::mem::transmute(val);
10115 self._bitfield_1.set(0usize, 1u8, val as u64)
10116 }
10117 }
10118 #[inline]
10119 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
10120 unsafe {
10121 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10122 ::std::ptr::addr_of!((*this)._bitfield_1),
10123 0usize,
10124 1u8,
10125 ) as u8)
10126 }
10127 }
10128 #[inline]
10129 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
10130 unsafe {
10131 let val: u8 = ::std::mem::transmute(val);
10132 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10133 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10134 0usize,
10135 1u8,
10136 val as u64,
10137 )
10138 }
10139 }
10140 #[inline]
10141 pub fn mDeviceType(&self) -> bool {
10142 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10143 }
10144 #[inline]
10145 pub fn set_mDeviceType(&mut self, val: bool) {
10146 unsafe {
10147 let val: u8 = ::std::mem::transmute(val);
10148 self._bitfield_1.set(1usize, 1u8, val as u64)
10149 }
10150 }
10151 #[inline]
10152 pub unsafe fn mDeviceType_raw(this: *const Self) -> bool {
10153 unsafe {
10154 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10155 ::std::ptr::addr_of!((*this)._bitfield_1),
10156 1usize,
10157 1u8,
10158 ) as u8)
10159 }
10160 }
10161 #[inline]
10162 pub unsafe fn set_mDeviceType_raw(this: *mut Self, val: bool) {
10163 unsafe {
10164 let val: u8 = ::std::mem::transmute(val);
10165 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10166 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10167 1usize,
10168 1u8,
10169 val as u64,
10170 )
10171 }
10172 }
10173 #[inline]
10174 pub fn mNetworkData(&self) -> bool {
10175 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
10176 }
10177 #[inline]
10178 pub fn set_mNetworkData(&mut self, val: bool) {
10179 unsafe {
10180 let val: u8 = ::std::mem::transmute(val);
10181 self._bitfield_1.set(2usize, 1u8, val as u64)
10182 }
10183 }
10184 #[inline]
10185 pub unsafe fn mNetworkData_raw(this: *const Self) -> bool {
10186 unsafe {
10187 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10188 ::std::ptr::addr_of!((*this)._bitfield_1),
10189 2usize,
10190 1u8,
10191 ) as u8)
10192 }
10193 }
10194 #[inline]
10195 pub unsafe fn set_mNetworkData_raw(this: *mut Self, val: bool) {
10196 unsafe {
10197 let val: u8 = ::std::mem::transmute(val);
10198 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10199 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10200 2usize,
10201 1u8,
10202 val as u64,
10203 )
10204 }
10205 }
10206 #[inline]
10207 pub fn new_bitfield_1(
10208 mRxOnWhenIdle: bool,
10209 mDeviceType: bool,
10210 mNetworkData: bool,
10211 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10212 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10213 __bindgen_bitfield_unit.set(0usize, 1u8, {
10214 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
10215 mRxOnWhenIdle as u64
10216 });
10217 __bindgen_bitfield_unit.set(1usize, 1u8, {
10218 let mDeviceType: u8 = unsafe { ::std::mem::transmute(mDeviceType) };
10219 mDeviceType as u64
10220 });
10221 __bindgen_bitfield_unit.set(2usize, 1u8, {
10222 let mNetworkData: u8 = unsafe { ::std::mem::transmute(mNetworkData) };
10223 mNetworkData as u64
10224 });
10225 __bindgen_bitfield_unit
10226 }
10227}
10228#[doc = " Holds diagnostic information for a neighboring Thread node"]
10229#[repr(C)]
10230#[derive(Debug, Default, Copy, Clone)]
10231pub struct otNeighborInfo {
10232 #[doc = "< IEEE 802.15.4 Extended Address"]
10233 pub mExtAddress: otExtAddress,
10234 #[doc = "< Seconds since last heard"]
10235 pub mAge: u32,
10236 #[doc = "< Seconds since link establishment (requires `CONFIG_UPTIME_ENABLE`)"]
10237 pub mConnectionTime: u32,
10238 #[doc = "< RLOC16"]
10239 pub mRloc16: u16,
10240 #[doc = "< Link Frame Counter"]
10241 pub mLinkFrameCounter: u32,
10242 #[doc = "< MLE Frame Counter"]
10243 pub mMleFrameCounter: u32,
10244 #[doc = "< Link Quality In"]
10245 pub mLinkQualityIn: u8,
10246 #[doc = "< Average RSSI"]
10247 pub mAverageRssi: i8,
10248 #[doc = "< Last observed RSSI"]
10249 pub mLastRssi: i8,
10250 #[doc = "< Link Margin"]
10251 pub mLinkMargin: u8,
10252 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
10253 pub mFrameErrorRate: u16,
10254 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
10255 pub mMessageErrorRate: u16,
10256 #[doc = "< Thread version of the neighbor"]
10257 pub mVersion: u16,
10258 pub _bitfield_align_1: [u8; 0],
10259 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10260 pub __bindgen_padding_0: u8,
10261}
10262impl otNeighborInfo {
10263 #[inline]
10264 pub fn mRxOnWhenIdle(&self) -> bool {
10265 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10266 }
10267 #[inline]
10268 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
10269 unsafe {
10270 let val: u8 = ::std::mem::transmute(val);
10271 self._bitfield_1.set(0usize, 1u8, val as u64)
10272 }
10273 }
10274 #[inline]
10275 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
10276 unsafe {
10277 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10278 ::std::ptr::addr_of!((*this)._bitfield_1),
10279 0usize,
10280 1u8,
10281 ) as u8)
10282 }
10283 }
10284 #[inline]
10285 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
10286 unsafe {
10287 let val: u8 = ::std::mem::transmute(val);
10288 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10289 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10290 0usize,
10291 1u8,
10292 val as u64,
10293 )
10294 }
10295 }
10296 #[inline]
10297 pub fn mFullThreadDevice(&self) -> bool {
10298 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10299 }
10300 #[inline]
10301 pub fn set_mFullThreadDevice(&mut self, val: bool) {
10302 unsafe {
10303 let val: u8 = ::std::mem::transmute(val);
10304 self._bitfield_1.set(1usize, 1u8, val as u64)
10305 }
10306 }
10307 #[inline]
10308 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
10309 unsafe {
10310 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10311 ::std::ptr::addr_of!((*this)._bitfield_1),
10312 1usize,
10313 1u8,
10314 ) as u8)
10315 }
10316 }
10317 #[inline]
10318 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
10319 unsafe {
10320 let val: u8 = ::std::mem::transmute(val);
10321 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10322 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10323 1usize,
10324 1u8,
10325 val as u64,
10326 )
10327 }
10328 }
10329 #[inline]
10330 pub fn mFullNetworkData(&self) -> bool {
10331 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
10332 }
10333 #[inline]
10334 pub fn set_mFullNetworkData(&mut self, val: bool) {
10335 unsafe {
10336 let val: u8 = ::std::mem::transmute(val);
10337 self._bitfield_1.set(2usize, 1u8, val as u64)
10338 }
10339 }
10340 #[inline]
10341 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
10342 unsafe {
10343 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10344 ::std::ptr::addr_of!((*this)._bitfield_1),
10345 2usize,
10346 1u8,
10347 ) as u8)
10348 }
10349 }
10350 #[inline]
10351 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
10352 unsafe {
10353 let val: u8 = ::std::mem::transmute(val);
10354 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10355 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10356 2usize,
10357 1u8,
10358 val as u64,
10359 )
10360 }
10361 }
10362 #[inline]
10363 pub fn mIsChild(&self) -> bool {
10364 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
10365 }
10366 #[inline]
10367 pub fn set_mIsChild(&mut self, val: bool) {
10368 unsafe {
10369 let val: u8 = ::std::mem::transmute(val);
10370 self._bitfield_1.set(3usize, 1u8, val as u64)
10371 }
10372 }
10373 #[inline]
10374 pub unsafe fn mIsChild_raw(this: *const Self) -> bool {
10375 unsafe {
10376 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10377 ::std::ptr::addr_of!((*this)._bitfield_1),
10378 3usize,
10379 1u8,
10380 ) as u8)
10381 }
10382 }
10383 #[inline]
10384 pub unsafe fn set_mIsChild_raw(this: *mut Self, val: bool) {
10385 unsafe {
10386 let val: u8 = ::std::mem::transmute(val);
10387 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10388 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10389 3usize,
10390 1u8,
10391 val as u64,
10392 )
10393 }
10394 }
10395 #[inline]
10396 pub fn new_bitfield_1(
10397 mRxOnWhenIdle: bool,
10398 mFullThreadDevice: bool,
10399 mFullNetworkData: bool,
10400 mIsChild: bool,
10401 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10402 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10403 __bindgen_bitfield_unit.set(0usize, 1u8, {
10404 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
10405 mRxOnWhenIdle as u64
10406 });
10407 __bindgen_bitfield_unit.set(1usize, 1u8, {
10408 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
10409 mFullThreadDevice as u64
10410 });
10411 __bindgen_bitfield_unit.set(2usize, 1u8, {
10412 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
10413 mFullNetworkData as u64
10414 });
10415 __bindgen_bitfield_unit.set(3usize, 1u8, {
10416 let mIsChild: u8 = unsafe { ::std::mem::transmute(mIsChild) };
10417 mIsChild as u64
10418 });
10419 __bindgen_bitfield_unit
10420 }
10421}
10422pub type otNeighborInfoIterator = i16;
10423#[doc = " Represents the Thread Leader Data."]
10424#[repr(C)]
10425#[derive(Debug, Default, Copy, Clone)]
10426pub struct otLeaderData {
10427 #[doc = "< Partition ID"]
10428 pub mPartitionId: u32,
10429 #[doc = "< Leader Weight"]
10430 pub mWeighting: u8,
10431 #[doc = "< Full Network Data Version"]
10432 pub mDataVersion: u8,
10433 #[doc = "< Stable Network Data Version"]
10434 pub mStableDataVersion: u8,
10435 #[doc = "< Leader Router ID"]
10436 pub mLeaderRouterId: u8,
10437}
10438#[doc = " Holds diagnostic information for a Thread Router"]
10439#[repr(C)]
10440#[derive(Debug, Default, Copy, Clone)]
10441pub struct otRouterInfo {
10442 #[doc = "< IEEE 802.15.4 Extended Address"]
10443 pub mExtAddress: otExtAddress,
10444 #[doc = "< RLOC16"]
10445 pub mRloc16: u16,
10446 #[doc = "< Router ID"]
10447 pub mRouterId: u8,
10448 #[doc = "< Next hop to router"]
10449 pub mNextHop: u8,
10450 #[doc = "< Path cost to router"]
10451 pub mPathCost: u8,
10452 #[doc = "< Link Quality In"]
10453 pub mLinkQualityIn: u8,
10454 #[doc = "< Link Quality Out"]
10455 pub mLinkQualityOut: u8,
10456 #[doc = "< Time last heard"]
10457 pub mAge: u8,
10458 pub _bitfield_align_1: [u8; 0],
10459 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10460 #[doc = "< Thread version"]
10461 pub mVersion: u8,
10462 #[doc = "< CSL clock accuracy, in ± ppm"]
10463 pub mCslClockAccuracy: u8,
10464 #[doc = "< CSL uncertainty, in ±10 us"]
10465 pub mCslUncertainty: u8,
10466}
10467impl otRouterInfo {
10468 #[inline]
10469 pub fn mAllocated(&self) -> bool {
10470 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
10471 }
10472 #[inline]
10473 pub fn set_mAllocated(&mut self, val: bool) {
10474 unsafe {
10475 let val: u8 = ::std::mem::transmute(val);
10476 self._bitfield_1.set(0usize, 1u8, val as u64)
10477 }
10478 }
10479 #[inline]
10480 pub unsafe fn mAllocated_raw(this: *const Self) -> bool {
10481 unsafe {
10482 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10483 ::std::ptr::addr_of!((*this)._bitfield_1),
10484 0usize,
10485 1u8,
10486 ) as u8)
10487 }
10488 }
10489 #[inline]
10490 pub unsafe fn set_mAllocated_raw(this: *mut Self, val: bool) {
10491 unsafe {
10492 let val: u8 = ::std::mem::transmute(val);
10493 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10494 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10495 0usize,
10496 1u8,
10497 val as u64,
10498 )
10499 }
10500 }
10501 #[inline]
10502 pub fn mLinkEstablished(&self) -> bool {
10503 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
10504 }
10505 #[inline]
10506 pub fn set_mLinkEstablished(&mut self, val: bool) {
10507 unsafe {
10508 let val: u8 = ::std::mem::transmute(val);
10509 self._bitfield_1.set(1usize, 1u8, val as u64)
10510 }
10511 }
10512 #[inline]
10513 pub unsafe fn mLinkEstablished_raw(this: *const Self) -> bool {
10514 unsafe {
10515 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10516 ::std::ptr::addr_of!((*this)._bitfield_1),
10517 1usize,
10518 1u8,
10519 ) as u8)
10520 }
10521 }
10522 #[inline]
10523 pub unsafe fn set_mLinkEstablished_raw(this: *mut Self, val: bool) {
10524 unsafe {
10525 let val: u8 = ::std::mem::transmute(val);
10526 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10527 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10528 1usize,
10529 1u8,
10530 val as u64,
10531 )
10532 }
10533 }
10534 #[inline]
10535 pub fn new_bitfield_1(
10536 mAllocated: bool,
10537 mLinkEstablished: bool,
10538 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
10539 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
10540 __bindgen_bitfield_unit.set(0usize, 1u8, {
10541 let mAllocated: u8 = unsafe { ::std::mem::transmute(mAllocated) };
10542 mAllocated as u64
10543 });
10544 __bindgen_bitfield_unit.set(1usize, 1u8, {
10545 let mLinkEstablished: u8 = unsafe { ::std::mem::transmute(mLinkEstablished) };
10546 mLinkEstablished as u64
10547 });
10548 __bindgen_bitfield_unit
10549 }
10550}
10551#[doc = " Represents the IP level counters."]
10552#[repr(C)]
10553#[derive(Debug, Default, Copy, Clone)]
10554pub struct otIpCounters {
10555 #[doc = "< The number of IPv6 packets successfully transmitted."]
10556 pub mTxSuccess: u32,
10557 #[doc = "< The number of IPv6 packets successfully received."]
10558 pub mRxSuccess: u32,
10559 #[doc = "< The number of IPv6 packets failed to transmit."]
10560 pub mTxFailure: u32,
10561 #[doc = "< The number of IPv6 packets failed to receive."]
10562 pub mRxFailure: u32,
10563}
10564#[doc = " Represents the Thread MLE counters."]
10565#[repr(C)]
10566#[derive(Debug, Default, Copy, Clone)]
10567pub struct otMleCounters {
10568 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DISABLED role."]
10569 pub mDisabledRole: u16,
10570 #[doc = "< Number of times device entered OT_DEVICE_ROLE_DETACHED role."]
10571 pub mDetachedRole: u16,
10572 #[doc = "< Number of times device entered OT_DEVICE_ROLE_CHILD role."]
10573 pub mChildRole: u16,
10574 #[doc = "< Number of times device entered OT_DEVICE_ROLE_ROUTER role."]
10575 pub mRouterRole: u16,
10576 #[doc = "< Number of times device entered OT_DEVICE_ROLE_LEADER role."]
10577 pub mLeaderRole: u16,
10578 #[doc = "< Number of attach attempts while device was detached."]
10579 pub mAttachAttempts: u16,
10580 #[doc = "< Number of changes to partition ID."]
10581 pub mPartitionIdChanges: u16,
10582 #[doc = "< Number of attempts to attach to a better partition."]
10583 pub mBetterPartitionAttachAttempts: u16,
10584 #[doc = "< Number of attempts to attach to find a better parent (parent search)."]
10585 pub mBetterParentAttachAttempts: u16,
10586 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role."]
10587 pub mDisabledTime: u64,
10588 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role."]
10589 pub mDetachedTime: u64,
10590 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role."]
10591 pub mChildTime: u64,
10592 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role."]
10593 pub mRouterTime: u64,
10594 #[doc = "< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role."]
10595 pub mLeaderTime: u64,
10596 #[doc = "< Number of milliseconds tracked by previous counters."]
10597 pub mTrackedTime: u64,
10598 #[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)."]
10599 pub mParentChanges: u16,
10600}
10601#[doc = " Represents the MLE Parent Response data."]
10602#[repr(C)]
10603#[derive(Debug, Default, Copy, Clone)]
10604pub struct otThreadParentResponseInfo {
10605 #[doc = "< IEEE 802.15.4 Extended Address of the Parent"]
10606 pub mExtAddr: otExtAddress,
10607 #[doc = "< Short address of the Parent"]
10608 pub mRloc16: u16,
10609 #[doc = "< Rssi of the Parent"]
10610 pub mRssi: i8,
10611 #[doc = "< Parent priority"]
10612 pub mPriority: i8,
10613 #[doc = "< Parent Link Quality 3"]
10614 pub mLinkQuality3: u8,
10615 #[doc = "< Parent Link Quality 2"]
10616 pub mLinkQuality2: u8,
10617 #[doc = "< Parent Link Quality 1"]
10618 pub mLinkQuality1: u8,
10619 #[doc = "< Is the node receiving parent response attached"]
10620 pub mIsAttached: bool,
10621}
10622#[doc = " This callback informs the application that the detaching process has finished.\n\n @param[in] aContext A pointer to application-specific context."]
10623pub type otDetachGracefullyCallback =
10624 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
10625#[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."]
10626pub type otWakeupCallback = ::std::option::Option<
10627 unsafe extern "C" fn(aError: otError, aContext: *mut ::std::os::raw::c_void),
10628>;
10629unsafe extern "C" {
10630 #[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."]
10631 pub fn otThreadSetEnabled(aInstance: *mut otInstance, aEnabled: bool) -> otError;
10632}
10633unsafe extern "C" {
10634 #[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."]
10635 pub fn otThreadGetVersion() -> u16;
10636}
10637unsafe extern "C" {
10638 #[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."]
10639 pub fn otThreadIsSingleton(aInstance: *mut otInstance) -> bool;
10640}
10641unsafe extern "C" {
10642 #[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."]
10643 pub fn otThreadDiscover(
10644 aInstance: *mut otInstance,
10645 aScanChannels: u32,
10646 aPanId: u16,
10647 aJoiner: bool,
10648 aEnableEui64Filtering: bool,
10649 aCallback: otHandleActiveScanResult,
10650 aCallbackContext: *mut ::std::os::raw::c_void,
10651 ) -> otError;
10652}
10653unsafe extern "C" {
10654 #[doc = " Determines if an MLE Thread Discovery is currently in progress.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10655 pub fn otThreadIsDiscoverInProgress(aInstance: *mut otInstance) -> bool;
10656}
10657unsafe extern "C" {
10658 #[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."]
10659 pub fn otThreadSetJoinerAdvertisement(
10660 aInstance: *mut otInstance,
10661 aOui: u32,
10662 aAdvData: *const u8,
10663 aAdvDataLength: u8,
10664 ) -> otError;
10665}
10666unsafe extern "C" {
10667 #[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"]
10668 pub fn otThreadGetChildTimeout(aInstance: *mut otInstance) -> u32;
10669}
10670unsafe extern "C" {
10671 #[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"]
10672 pub fn otThreadSetChildTimeout(aInstance: *mut otInstance, aTimeout: u32);
10673}
10674unsafe extern "C" {
10675 #[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"]
10676 pub fn otThreadGetExtendedPanId(aInstance: *mut otInstance) -> *const otExtendedPanId;
10677}
10678unsafe extern "C" {
10679 #[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"]
10680 pub fn otThreadSetExtendedPanId(
10681 aInstance: *mut otInstance,
10682 aExtendedPanId: *const otExtendedPanId,
10683 ) -> otError;
10684}
10685unsafe extern "C" {
10686 #[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."]
10687 pub fn otThreadGetLeaderRloc(
10688 aInstance: *mut otInstance,
10689 aLeaderRloc: *mut otIp6Address,
10690 ) -> otError;
10691}
10692unsafe extern "C" {
10693 #[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"]
10694 pub fn otThreadGetLinkMode(aInstance: *mut otInstance) -> otLinkModeConfig;
10695}
10696unsafe extern "C" {
10697 #[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"]
10698 pub fn otThreadSetLinkMode(aInstance: *mut otInstance, aConfig: otLinkModeConfig) -> otError;
10699}
10700unsafe extern "C" {
10701 #[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"]
10702 pub fn otThreadGetNetworkKey(aInstance: *mut otInstance, aNetworkKey: *mut otNetworkKey);
10703}
10704unsafe extern "C" {
10705 #[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"]
10706 pub fn otThreadGetNetworkKeyRef(aInstance: *mut otInstance) -> otNetworkKeyRef;
10707}
10708unsafe extern "C" {
10709 #[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"]
10710 pub fn otThreadSetNetworkKey(aInstance: *mut otInstance, aKey: *const otNetworkKey) -> otError;
10711}
10712unsafe extern "C" {
10713 #[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"]
10714 pub fn otThreadSetNetworkKeyRef(
10715 aInstance: *mut otInstance,
10716 aKeyRef: otNetworkKeyRef,
10717 ) -> otError;
10718}
10719unsafe extern "C" {
10720 #[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."]
10721 pub fn otThreadGetRloc(aInstance: *mut otInstance) -> *const otIp6Address;
10722}
10723unsafe extern "C" {
10724 #[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."]
10725 pub fn otThreadGetMeshLocalEid(aInstance: *mut otInstance) -> *const otIp6Address;
10726}
10727unsafe extern "C" {
10728 #[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."]
10729 pub fn otThreadGetMeshLocalPrefix(aInstance: *mut otInstance) -> *const otMeshLocalPrefix;
10730}
10731unsafe extern "C" {
10732 #[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."]
10733 pub fn otThreadSetMeshLocalPrefix(
10734 aInstance: *mut otInstance,
10735 aMeshLocalPrefix: *const otMeshLocalPrefix,
10736 ) -> otError;
10737}
10738unsafe extern "C" {
10739 #[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."]
10740 pub fn otThreadGetLinkLocalIp6Address(aInstance: *mut otInstance) -> *const otIp6Address;
10741}
10742unsafe extern "C" {
10743 #[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."]
10744 pub fn otThreadGetLinkLocalAllThreadNodesMulticastAddress(
10745 aInstance: *mut otInstance,
10746 ) -> *const otIp6Address;
10747}
10748unsafe extern "C" {
10749 #[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."]
10750 pub fn otThreadGetRealmLocalAllThreadNodesMulticastAddress(
10751 aInstance: *mut otInstance,
10752 ) -> *const otIp6Address;
10753}
10754unsafe extern "C" {
10755 #[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."]
10756 pub fn otThreadGetServiceAloc(
10757 aInstance: *mut otInstance,
10758 aServiceId: u8,
10759 aServiceAloc: *mut otIp6Address,
10760 ) -> otError;
10761}
10762unsafe extern "C" {
10763 #[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"]
10764 pub fn otThreadGetNetworkName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10765}
10766unsafe extern "C" {
10767 #[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"]
10768 pub fn otThreadSetNetworkName(
10769 aInstance: *mut otInstance,
10770 aNetworkName: *const ::std::os::raw::c_char,
10771 ) -> otError;
10772}
10773unsafe extern "C" {
10774 #[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"]
10775 pub fn otThreadGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
10776}
10777unsafe extern "C" {
10778 #[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"]
10779 pub fn otThreadSetDomainName(
10780 aInstance: *mut otInstance,
10781 aDomainName: *const ::std::os::raw::c_char,
10782 ) -> otError;
10783}
10784unsafe extern "C" {
10785 #[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"]
10786 pub fn otThreadSetFixedDuaInterfaceIdentifier(
10787 aInstance: *mut otInstance,
10788 aIid: *const otIp6InterfaceIdentifier,
10789 ) -> otError;
10790}
10791unsafe extern "C" {
10792 #[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"]
10793 pub fn otThreadGetFixedDuaInterfaceIdentifier(
10794 aInstance: *mut otInstance,
10795 ) -> *const otIp6InterfaceIdentifier;
10796}
10797unsafe extern "C" {
10798 #[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"]
10799 pub fn otThreadGetKeySequenceCounter(aInstance: *mut otInstance) -> u32;
10800}
10801unsafe extern "C" {
10802 #[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"]
10803 pub fn otThreadSetKeySequenceCounter(aInstance: *mut otInstance, aKeySequenceCounter: u32);
10804}
10805unsafe extern "C" {
10806 #[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"]
10807 pub fn otThreadGetKeySwitchGuardTime(aInstance: *mut otInstance) -> u16;
10808}
10809unsafe extern "C" {
10810 #[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"]
10811 pub fn otThreadSetKeySwitchGuardTime(aInstance: *mut otInstance, aKeySwitchGuardTime: u16);
10812}
10813unsafe extern "C" {
10814 #[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."]
10815 pub fn otThreadBecomeDetached(aInstance: *mut otInstance) -> otError;
10816}
10817unsafe extern "C" {
10818 #[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."]
10819 pub fn otThreadBecomeChild(aInstance: *mut otInstance) -> otError;
10820}
10821unsafe extern "C" {
10822 #[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."]
10823 pub fn otThreadGetNextNeighborInfo(
10824 aInstance: *mut otInstance,
10825 aIterator: *mut otNeighborInfoIterator,
10826 aInfo: *mut otNeighborInfo,
10827 ) -> otError;
10828}
10829unsafe extern "C" {
10830 #[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."]
10831 pub fn otThreadGetDeviceRole(aInstance: *mut otInstance) -> otDeviceRole;
10832}
10833unsafe extern "C" {
10834 #[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."]
10835 pub fn otThreadDeviceRoleToString(aRole: otDeviceRole) -> *const ::std::os::raw::c_char;
10836}
10837unsafe extern "C" {
10838 #[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."]
10839 pub fn otThreadGetLeaderData(
10840 aInstance: *mut otInstance,
10841 aLeaderData: *mut otLeaderData,
10842 ) -> otError;
10843}
10844unsafe extern "C" {
10845 #[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."]
10846 pub fn otThreadGetLeaderRouterId(aInstance: *mut otInstance) -> u8;
10847}
10848unsafe extern "C" {
10849 #[doc = " Get the Leader's Weight.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Leader's Weight."]
10850 pub fn otThreadGetLeaderWeight(aInstance: *mut otInstance) -> u8;
10851}
10852unsafe extern "C" {
10853 #[doc = " Get the Partition ID.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The Partition ID."]
10854 pub fn otThreadGetPartitionId(aInstance: *mut otInstance) -> u32;
10855}
10856unsafe extern "C" {
10857 #[doc = " Get the RLOC16.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The RLOC16."]
10858 pub fn otThreadGetRloc16(aInstance: *mut otInstance) -> u16;
10859}
10860unsafe extern "C" {
10861 #[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."]
10862 pub fn otThreadGetParentInfo(
10863 aInstance: *mut otInstance,
10864 aParentInfo: *mut otRouterInfo,
10865 ) -> otError;
10866}
10867unsafe extern "C" {
10868 #[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."]
10869 pub fn otThreadGetParentAverageRssi(
10870 aInstance: *mut otInstance,
10871 aParentRssi: *mut i8,
10872 ) -> otError;
10873}
10874unsafe extern "C" {
10875 #[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."]
10876 pub fn otThreadGetParentLastRssi(aInstance: *mut otInstance, aLastRssi: *mut i8) -> otError;
10877}
10878unsafe extern "C" {
10879 #[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."]
10880 pub fn otThreadSearchForBetterParent(aInstance: *mut otInstance) -> otError;
10881}
10882unsafe extern "C" {
10883 #[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."]
10884 pub fn otThreadGetIp6Counters(aInstance: *mut otInstance) -> *const otIpCounters;
10885}
10886unsafe extern "C" {
10887 #[doc = " Resets the IPv6 counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10888 pub fn otThreadResetIp6Counters(aInstance: *mut otInstance);
10889}
10890unsafe extern "C" {
10891 #[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."]
10892 pub fn otThreadGetTimeInQueueHistogram(
10893 aInstance: *mut otInstance,
10894 aNumBins: *mut u16,
10895 aBinInterval: *mut u32,
10896 ) -> *const u32;
10897}
10898unsafe extern "C" {
10899 #[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)."]
10900 pub fn otThreadGetMaxTimeInQueue(aInstance: *mut otInstance) -> u32;
10901}
10902unsafe extern "C" {
10903 #[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."]
10904 pub fn otThreadResetTimeInQueueStat(aInstance: *mut otInstance);
10905}
10906unsafe extern "C" {
10907 #[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."]
10908 pub fn otThreadGetMleCounters(aInstance: *mut otInstance) -> *const otMleCounters;
10909}
10910unsafe extern "C" {
10911 #[doc = " Resets the Thread MLE counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
10912 pub fn otThreadResetMleCounters(aInstance: *mut otInstance);
10913}
10914unsafe extern "C" {
10915 #[doc = " Gets the current attach duration (number of seconds since the device last attached).\n\n Requires the `OPENTHREAD_CONFIG_UPTIME_ENABLE` feature.\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."]
10916 pub fn otThreadGetCurrentAttachDuration(aInstance: *mut otInstance) -> u32;
10917}
10918#[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."]
10919pub type otThreadParentResponseCallback = ::std::option::Option<
10920 unsafe extern "C" fn(
10921 aInfo: *mut otThreadParentResponseInfo,
10922 aContext: *mut ::std::os::raw::c_void,
10923 ),
10924>;
10925unsafe extern "C" {
10926 #[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."]
10927 pub fn otThreadRegisterParentResponseCallback(
10928 aInstance: *mut otInstance,
10929 aCallback: otThreadParentResponseCallback,
10930 aContext: *mut ::std::os::raw::c_void,
10931 );
10932}
10933#[doc = " Represents the Thread Discovery Request data."]
10934#[repr(C)]
10935#[derive(Debug, Default, Copy, Clone)]
10936pub struct otThreadDiscoveryRequestInfo {
10937 #[doc = "< IEEE 802.15.4 Extended Address of the requester"]
10938 pub mExtAddress: otExtAddress,
10939 pub _bitfield_align_1: [u8; 0],
10940 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
10941}
10942impl otThreadDiscoveryRequestInfo {
10943 #[inline]
10944 pub fn mVersion(&self) -> u8 {
10945 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) }
10946 }
10947 #[inline]
10948 pub fn set_mVersion(&mut self, val: u8) {
10949 unsafe {
10950 let val: u8 = ::std::mem::transmute(val);
10951 self._bitfield_1.set(0usize, 4u8, val as u64)
10952 }
10953 }
10954 #[inline]
10955 pub unsafe fn mVersion_raw(this: *const Self) -> u8 {
10956 unsafe {
10957 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10958 ::std::ptr::addr_of!((*this)._bitfield_1),
10959 0usize,
10960 4u8,
10961 ) as u8)
10962 }
10963 }
10964 #[inline]
10965 pub unsafe fn set_mVersion_raw(this: *mut Self, val: u8) {
10966 unsafe {
10967 let val: u8 = ::std::mem::transmute(val);
10968 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
10969 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
10970 0usize,
10971 4u8,
10972 val as u64,
10973 )
10974 }
10975 }
10976 #[inline]
10977 pub fn mIsJoiner(&self) -> bool {
10978 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
10979 }
10980 #[inline]
10981 pub fn set_mIsJoiner(&mut self, val: bool) {
10982 unsafe {
10983 let val: u8 = ::std::mem::transmute(val);
10984 self._bitfield_1.set(4usize, 1u8, val as u64)
10985 }
10986 }
10987 #[inline]
10988 pub unsafe fn mIsJoiner_raw(this: *const Self) -> bool {
10989 unsafe {
10990 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
10991 ::std::ptr::addr_of!((*this)._bitfield_1),
10992 4usize,
10993 1u8,
10994 ) as u8)
10995 }
10996 }
10997 #[inline]
10998 pub unsafe fn set_mIsJoiner_raw(this: *mut Self, val: bool) {
10999 unsafe {
11000 let val: u8 = ::std::mem::transmute(val);
11001 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11002 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11003 4usize,
11004 1u8,
11005 val as u64,
11006 )
11007 }
11008 }
11009 #[inline]
11010 pub fn new_bitfield_1(mVersion: u8, mIsJoiner: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11011 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11012 __bindgen_bitfield_unit.set(0usize, 4u8, {
11013 let mVersion: u8 = unsafe { ::std::mem::transmute(mVersion) };
11014 mVersion as u64
11015 });
11016 __bindgen_bitfield_unit.set(4usize, 1u8, {
11017 let mIsJoiner: u8 = unsafe { ::std::mem::transmute(mIsJoiner) };
11018 mIsJoiner as u64
11019 });
11020 __bindgen_bitfield_unit
11021 }
11022}
11023#[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."]
11024pub type otThreadDiscoveryRequestCallback = ::std::option::Option<
11025 unsafe extern "C" fn(
11026 aInfo: *const otThreadDiscoveryRequestInfo,
11027 aContext: *mut ::std::os::raw::c_void,
11028 ),
11029>;
11030unsafe extern "C" {
11031 #[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."]
11032 pub fn otThreadSetDiscoveryRequestCallback(
11033 aInstance: *mut otInstance,
11034 aCallback: otThreadDiscoveryRequestCallback,
11035 aContext: *mut ::std::os::raw::c_void,
11036 );
11037}
11038#[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)."]
11039pub type otThreadAnycastLocatorCallback = ::std::option::Option<
11040 unsafe extern "C" fn(
11041 aContext: *mut ::std::os::raw::c_void,
11042 aError: otError,
11043 aMeshLocalAddress: *const otIp6Address,
11044 aRloc16: u16,
11045 ),
11046>;
11047unsafe extern "C" {
11048 #[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."]
11049 pub fn otThreadLocateAnycastDestination(
11050 aInstance: *mut otInstance,
11051 aAnycastAddress: *const otIp6Address,
11052 aCallback: otThreadAnycastLocatorCallback,
11053 aContext: *mut ::std::os::raw::c_void,
11054 ) -> otError;
11055}
11056unsafe extern "C" {
11057 #[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."]
11058 pub fn otThreadIsAnycastLocateInProgress(aInstance: *mut otInstance) -> bool;
11059}
11060unsafe extern "C" {
11061 #[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."]
11062 pub fn otThreadSendAddressNotification(
11063 aInstance: *mut otInstance,
11064 aDestination: *mut otIp6Address,
11065 aTarget: *mut otIp6Address,
11066 aMlIid: *mut otIp6InterfaceIdentifier,
11067 );
11068}
11069unsafe extern "C" {
11070 #[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."]
11071 pub fn otThreadSendProactiveBackboneNotification(
11072 aInstance: *mut otInstance,
11073 aTarget: *mut otIp6Address,
11074 aMlIid: *mut otIp6InterfaceIdentifier,
11075 aTimeSinceLastTransaction: u32,
11076 ) -> otError;
11077}
11078unsafe extern "C" {
11079 #[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."]
11080 pub fn otThreadDetachGracefully(
11081 aInstance: *mut otInstance,
11082 aCallback: otDetachGracefullyCallback,
11083 aContext: *mut ::std::os::raw::c_void,
11084 ) -> otError;
11085}
11086unsafe extern "C" {
11087 #[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`."]
11088 pub fn otConvertDurationInSecondsToString(
11089 aDuration: u32,
11090 aBuffer: *mut ::std::os::raw::c_char,
11091 aSize: u16,
11092 );
11093}
11094unsafe extern "C" {
11095 #[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."]
11096 pub fn otThreadSetStoreFrameCounterAhead(
11097 aInstance: *mut otInstance,
11098 aStoreFrameCounterAhead: u32,
11099 );
11100}
11101unsafe extern "C" {
11102 #[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."]
11103 pub fn otThreadGetStoreFrameCounterAhead(aInstance: *mut otInstance) -> u32;
11104}
11105unsafe extern "C" {
11106 #[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."]
11107 pub fn otThreadWakeup(
11108 aInstance: *mut otInstance,
11109 aWedAddress: *const otExtAddress,
11110 aWakeupIntervalUs: u16,
11111 aWakeupDurationMs: u16,
11112 aCallback: otWakeupCallback,
11113 aCallbackContext: *mut ::std::os::raw::c_void,
11114 ) -> otError;
11115}
11116pub type otNetworkDiagIterator = u16;
11117#[doc = " Represents a Network Diagnostic Connectivity value."]
11118#[repr(C)]
11119#[derive(Debug, Default, Copy, Clone)]
11120pub struct otNetworkDiagConnectivity {
11121 #[doc = "< The priority of the sender as a parent."]
11122 pub mParentPriority: i8,
11123 #[doc = "< Number of neighbors with link of quality 3."]
11124 pub mLinkQuality3: u8,
11125 #[doc = "< Number of neighbors with link of quality 2."]
11126 pub mLinkQuality2: u8,
11127 #[doc = "< Number of neighbors with link of quality 1."]
11128 pub mLinkQuality1: u8,
11129 #[doc = "< Cost to the Leader."]
11130 pub mLeaderCost: u8,
11131 #[doc = "< Most recent received ID seq number."]
11132 pub mIdSequence: u8,
11133 #[doc = "< Number of active routers."]
11134 pub mActiveRouters: u8,
11135 #[doc = "< Buffer capacity in bytes for SEDs. Optional."]
11136 pub mSedBufferSize: u16,
11137 #[doc = "< Queue capacity (number of IPv6 datagrams) per SED. Optional."]
11138 pub mSedDatagramCount: u8,
11139}
11140#[doc = " Represents a Network Diagnostic Route data."]
11141#[repr(C)]
11142#[derive(Debug, Default, Copy, Clone)]
11143pub struct otNetworkDiagRouteData {
11144 #[doc = "< The Assigned Router ID."]
11145 pub mRouterId: u8,
11146 pub _bitfield_align_1: [u8; 0],
11147 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
11148}
11149impl otNetworkDiagRouteData {
11150 #[inline]
11151 pub fn mLinkQualityOut(&self) -> u8 {
11152 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u8) }
11153 }
11154 #[inline]
11155 pub fn set_mLinkQualityOut(&mut self, val: u8) {
11156 unsafe {
11157 let val: u8 = ::std::mem::transmute(val);
11158 self._bitfield_1.set(0usize, 2u8, val as u64)
11159 }
11160 }
11161 #[inline]
11162 pub unsafe fn mLinkQualityOut_raw(this: *const Self) -> u8 {
11163 unsafe {
11164 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11165 ::std::ptr::addr_of!((*this)._bitfield_1),
11166 0usize,
11167 2u8,
11168 ) as u8)
11169 }
11170 }
11171 #[inline]
11172 pub unsafe fn set_mLinkQualityOut_raw(this: *mut Self, val: u8) {
11173 unsafe {
11174 let val: u8 = ::std::mem::transmute(val);
11175 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11176 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11177 0usize,
11178 2u8,
11179 val as u64,
11180 )
11181 }
11182 }
11183 #[inline]
11184 pub fn mLinkQualityIn(&self) -> u8 {
11185 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u8) }
11186 }
11187 #[inline]
11188 pub fn set_mLinkQualityIn(&mut self, val: u8) {
11189 unsafe {
11190 let val: u8 = ::std::mem::transmute(val);
11191 self._bitfield_1.set(2usize, 2u8, val as u64)
11192 }
11193 }
11194 #[inline]
11195 pub unsafe fn mLinkQualityIn_raw(this: *const Self) -> u8 {
11196 unsafe {
11197 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11198 ::std::ptr::addr_of!((*this)._bitfield_1),
11199 2usize,
11200 2u8,
11201 ) as u8)
11202 }
11203 }
11204 #[inline]
11205 pub unsafe fn set_mLinkQualityIn_raw(this: *mut Self, val: u8) {
11206 unsafe {
11207 let val: u8 = ::std::mem::transmute(val);
11208 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11209 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11210 2usize,
11211 2u8,
11212 val as u64,
11213 )
11214 }
11215 }
11216 #[inline]
11217 pub fn mRouteCost(&self) -> u8 {
11218 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) }
11219 }
11220 #[inline]
11221 pub fn set_mRouteCost(&mut self, val: u8) {
11222 unsafe {
11223 let val: u8 = ::std::mem::transmute(val);
11224 self._bitfield_1.set(4usize, 4u8, val as u64)
11225 }
11226 }
11227 #[inline]
11228 pub unsafe fn mRouteCost_raw(this: *const Self) -> u8 {
11229 unsafe {
11230 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
11231 ::std::ptr::addr_of!((*this)._bitfield_1),
11232 4usize,
11233 4u8,
11234 ) as u8)
11235 }
11236 }
11237 #[inline]
11238 pub unsafe fn set_mRouteCost_raw(this: *mut Self, val: u8) {
11239 unsafe {
11240 let val: u8 = ::std::mem::transmute(val);
11241 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
11242 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11243 4usize,
11244 4u8,
11245 val as u64,
11246 )
11247 }
11248 }
11249 #[inline]
11250 pub fn new_bitfield_1(
11251 mLinkQualityOut: u8,
11252 mLinkQualityIn: u8,
11253 mRouteCost: u8,
11254 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
11255 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
11256 __bindgen_bitfield_unit.set(0usize, 2u8, {
11257 let mLinkQualityOut: u8 = unsafe { ::std::mem::transmute(mLinkQualityOut) };
11258 mLinkQualityOut as u64
11259 });
11260 __bindgen_bitfield_unit.set(2usize, 2u8, {
11261 let mLinkQualityIn: u8 = unsafe { ::std::mem::transmute(mLinkQualityIn) };
11262 mLinkQualityIn as u64
11263 });
11264 __bindgen_bitfield_unit.set(4usize, 4u8, {
11265 let mRouteCost: u8 = unsafe { ::std::mem::transmute(mRouteCost) };
11266 mRouteCost as u64
11267 });
11268 __bindgen_bitfield_unit
11269 }
11270}
11271#[doc = " Represents a Network Diagnostic Route64 TLV value."]
11272#[repr(C)]
11273#[derive(Debug, Copy, Clone)]
11274pub struct otNetworkDiagRoute {
11275 #[doc = "< Sequence number for Router ID assignments."]
11276 pub mIdSequence: u8,
11277 #[doc = "< Number of routes."]
11278 pub mRouteCount: u8,
11279 #[doc = "< Link Quality and Routing Cost data."]
11280 pub mRouteData: [otNetworkDiagRouteData; 63usize],
11281}
11282impl Default for otNetworkDiagRoute {
11283 fn default() -> Self {
11284 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11285 unsafe {
11286 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11287 s.assume_init()
11288 }
11289 }
11290}
11291#[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."]
11292#[repr(C)]
11293#[derive(Debug, Default, Copy, Clone)]
11294pub struct otNetworkDiagMacCounters {
11295 pub mIfInUnknownProtos: u32,
11296 pub mIfInErrors: u32,
11297 pub mIfOutErrors: u32,
11298 pub mIfInUcastPkts: u32,
11299 pub mIfInBroadcastPkts: u32,
11300 pub mIfInDiscards: u32,
11301 pub mIfOutUcastPkts: u32,
11302 pub mIfOutBroadcastPkts: u32,
11303 pub mIfOutDiscards: u32,
11304}
11305#[doc = " Represents a Network Diagnostics MLE Counters value."]
11306#[repr(C)]
11307#[derive(Debug, Default, Copy, Clone)]
11308pub struct otNetworkDiagMleCounters {
11309 #[doc = "< Number of times device entered disabled role."]
11310 pub mDisabledRole: u16,
11311 #[doc = "< Number of times device entered detached role."]
11312 pub mDetachedRole: u16,
11313 #[doc = "< Number of times device entered child role."]
11314 pub mChildRole: u16,
11315 #[doc = "< Number of times device entered router role."]
11316 pub mRouterRole: u16,
11317 #[doc = "< Number of times device entered leader role."]
11318 pub mLeaderRole: u16,
11319 #[doc = "< Number of attach attempts while device was detached."]
11320 pub mAttachAttempts: u16,
11321 #[doc = "< Number of changes to partition ID."]
11322 pub mPartitionIdChanges: u16,
11323 #[doc = "< Number of attempts to attach to a better partition."]
11324 pub mBetterPartitionAttachAttempts: u16,
11325 #[doc = "< Number of time device changed its parent."]
11326 pub mParentChanges: u16,
11327 #[doc = "< Milliseconds tracked by next counters (zero if not supported)."]
11328 pub mTrackedTime: u64,
11329 #[doc = "< Milliseconds device has been in disabled role."]
11330 pub mDisabledTime: u64,
11331 #[doc = "< Milliseconds device has been in detached role."]
11332 pub mDetachedTime: u64,
11333 #[doc = "< Milliseconds device has been in child role."]
11334 pub mChildTime: u64,
11335 #[doc = "< Milliseconds device has been in router role."]
11336 pub mRouterTime: u64,
11337 #[doc = "< Milliseconds device has been in leader role."]
11338 pub mLeaderTime: u64,
11339}
11340#[doc = " Represents a Network Diagnostic Child Table Entry."]
11341#[repr(C)]
11342#[derive(Debug, Default, Copy, Clone)]
11343pub struct otNetworkDiagChildEntry {
11344 pub _bitfield_align_1: [u16; 0],
11345 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
11346 #[doc = "< Link mode."]
11347 pub mMode: otLinkModeConfig,
11348}
11349impl otNetworkDiagChildEntry {
11350 #[inline]
11351 pub fn mTimeout(&self) -> u16 {
11352 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 5u8) as u16) }
11353 }
11354 #[inline]
11355 pub fn set_mTimeout(&mut self, val: u16) {
11356 unsafe {
11357 let val: u16 = ::std::mem::transmute(val);
11358 self._bitfield_1.set(0usize, 5u8, val as u64)
11359 }
11360 }
11361 #[inline]
11362 pub unsafe fn mTimeout_raw(this: *const Self) -> u16 {
11363 unsafe {
11364 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11365 ::std::ptr::addr_of!((*this)._bitfield_1),
11366 0usize,
11367 5u8,
11368 ) as u16)
11369 }
11370 }
11371 #[inline]
11372 pub unsafe fn set_mTimeout_raw(this: *mut Self, val: u16) {
11373 unsafe {
11374 let val: u16 = ::std::mem::transmute(val);
11375 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11376 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11377 0usize,
11378 5u8,
11379 val as u64,
11380 )
11381 }
11382 }
11383 #[inline]
11384 pub fn mLinkQuality(&self) -> u8 {
11385 unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u8) }
11386 }
11387 #[inline]
11388 pub fn set_mLinkQuality(&mut self, val: u8) {
11389 unsafe {
11390 let val: u8 = ::std::mem::transmute(val);
11391 self._bitfield_1.set(5usize, 2u8, val as u64)
11392 }
11393 }
11394 #[inline]
11395 pub unsafe fn mLinkQuality_raw(this: *const Self) -> u8 {
11396 unsafe {
11397 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11398 ::std::ptr::addr_of!((*this)._bitfield_1),
11399 5usize,
11400 2u8,
11401 ) as u8)
11402 }
11403 }
11404 #[inline]
11405 pub unsafe fn set_mLinkQuality_raw(this: *mut Self, val: u8) {
11406 unsafe {
11407 let val: u8 = ::std::mem::transmute(val);
11408 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11409 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11410 5usize,
11411 2u8,
11412 val as u64,
11413 )
11414 }
11415 }
11416 #[inline]
11417 pub fn mChildId(&self) -> u16 {
11418 unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 9u8) as u16) }
11419 }
11420 #[inline]
11421 pub fn set_mChildId(&mut self, val: u16) {
11422 unsafe {
11423 let val: u16 = ::std::mem::transmute(val);
11424 self._bitfield_1.set(7usize, 9u8, val as u64)
11425 }
11426 }
11427 #[inline]
11428 pub unsafe fn mChildId_raw(this: *const Self) -> u16 {
11429 unsafe {
11430 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
11431 ::std::ptr::addr_of!((*this)._bitfield_1),
11432 7usize,
11433 9u8,
11434 ) as u16)
11435 }
11436 }
11437 #[inline]
11438 pub unsafe fn set_mChildId_raw(this: *mut Self, val: u16) {
11439 unsafe {
11440 let val: u16 = ::std::mem::transmute(val);
11441 <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
11442 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
11443 7usize,
11444 9u8,
11445 val as u64,
11446 )
11447 }
11448 }
11449 #[inline]
11450 pub fn new_bitfield_1(
11451 mTimeout: u16,
11452 mLinkQuality: u8,
11453 mChildId: u16,
11454 ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
11455 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
11456 __bindgen_bitfield_unit.set(0usize, 5u8, {
11457 let mTimeout: u16 = unsafe { ::std::mem::transmute(mTimeout) };
11458 mTimeout as u64
11459 });
11460 __bindgen_bitfield_unit.set(5usize, 2u8, {
11461 let mLinkQuality: u8 = unsafe { ::std::mem::transmute(mLinkQuality) };
11462 mLinkQuality as u64
11463 });
11464 __bindgen_bitfield_unit.set(7usize, 9u8, {
11465 let mChildId: u16 = unsafe { ::std::mem::transmute(mChildId) };
11466 mChildId as u64
11467 });
11468 __bindgen_bitfield_unit
11469 }
11470}
11471#[doc = " Represents a Network Diagnostic TLV."]
11472#[repr(C)]
11473#[derive(Copy, Clone)]
11474pub struct otNetworkDiagTlv {
11475 #[doc = "< The Network Diagnostic TLV type."]
11476 pub mType: u8,
11477 pub mData: otNetworkDiagTlv__bindgen_ty_1,
11478}
11479#[repr(C)]
11480#[derive(Copy, Clone)]
11481pub union otNetworkDiagTlv__bindgen_ty_1 {
11482 pub mExtAddress: otExtAddress,
11483 pub mEui64: otExtAddress,
11484 pub mAddr16: u16,
11485 pub mMode: otLinkModeConfig,
11486 pub mTimeout: u32,
11487 pub mConnectivity: otNetworkDiagConnectivity,
11488 pub mRoute: otNetworkDiagRoute,
11489 pub mLeaderData: otLeaderData,
11490 pub mMacCounters: otNetworkDiagMacCounters,
11491 pub mMleCounters: otNetworkDiagMleCounters,
11492 pub mBatteryLevel: u8,
11493 pub mSupplyVoltage: u16,
11494 pub mMaxChildTimeout: u32,
11495 pub mVersion: u16,
11496 pub mVendorName: [::std::os::raw::c_char; 33usize],
11497 pub mVendorModel: [::std::os::raw::c_char; 33usize],
11498 pub mVendorSwVersion: [::std::os::raw::c_char; 17usize],
11499 pub mThreadStackVersion: [::std::os::raw::c_char; 65usize],
11500 pub mVendorAppUrl: [::std::os::raw::c_char; 97usize],
11501 pub mNetworkData: otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_1,
11502 pub mIp6AddrList: otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_2,
11503 pub mChildTable: otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_3,
11504 pub mChannelPages: otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_4,
11505}
11506#[repr(C)]
11507#[derive(Debug, Copy, Clone)]
11508pub struct otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_1 {
11509 pub mCount: u8,
11510 pub m8: [u8; 254usize],
11511}
11512impl Default for otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_1 {
11513 fn default() -> Self {
11514 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11515 unsafe {
11516 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11517 s.assume_init()
11518 }
11519 }
11520}
11521#[repr(C)]
11522#[derive(Copy, Clone)]
11523pub struct otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_2 {
11524 pub mCount: u8,
11525 pub mList: [otIp6Address; 15usize],
11526}
11527impl Default for otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_2 {
11528 fn default() -> Self {
11529 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11530 unsafe {
11531 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11532 s.assume_init()
11533 }
11534 }
11535}
11536#[repr(C)]
11537#[derive(Debug, Copy, Clone)]
11538pub struct otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_3 {
11539 pub mCount: u8,
11540 pub mTable: [otNetworkDiagChildEntry; 63usize],
11541}
11542impl Default for otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_3 {
11543 fn default() -> Self {
11544 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11545 unsafe {
11546 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11547 s.assume_init()
11548 }
11549 }
11550}
11551#[repr(C)]
11552#[derive(Debug, Copy, Clone)]
11553pub struct otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_4 {
11554 pub mCount: u8,
11555 pub m8: [u8; 254usize],
11556}
11557impl Default for otNetworkDiagTlv__bindgen_ty_1__bindgen_ty_4 {
11558 fn default() -> Self {
11559 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11560 unsafe {
11561 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11562 s.assume_init()
11563 }
11564 }
11565}
11566impl Default for otNetworkDiagTlv__bindgen_ty_1 {
11567 fn default() -> Self {
11568 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11569 unsafe {
11570 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11571 s.assume_init()
11572 }
11573 }
11574}
11575impl Default for otNetworkDiagTlv {
11576 fn default() -> Self {
11577 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11578 unsafe {
11579 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11580 s.assume_init()
11581 }
11582 }
11583}
11584unsafe extern "C" {
11585 #[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."]
11586 pub fn otThreadGetNextDiagnosticTlv(
11587 aMessage: *const otMessage,
11588 aIterator: *mut otNetworkDiagIterator,
11589 aNetworkDiagTlv: *mut otNetworkDiagTlv,
11590 ) -> otError;
11591}
11592#[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."]
11593pub type otReceiveDiagnosticGetCallback = ::std::option::Option<
11594 unsafe extern "C" fn(
11595 aError: otError,
11596 aMessage: *mut otMessage,
11597 aMessageInfo: *const otMessageInfo,
11598 aContext: *mut ::std::os::raw::c_void,
11599 ),
11600>;
11601unsafe extern "C" {
11602 #[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."]
11603 pub fn otThreadSendDiagnosticGet(
11604 aInstance: *mut otInstance,
11605 aDestination: *const otIp6Address,
11606 aTlvTypes: *const u8,
11607 aCount: u8,
11608 aCallback: otReceiveDiagnosticGetCallback,
11609 aCallbackContext: *mut ::std::os::raw::c_void,
11610 ) -> otError;
11611}
11612unsafe extern "C" {
11613 #[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."]
11614 pub fn otThreadSendDiagnosticReset(
11615 aInstance: *mut otInstance,
11616 aDestination: *const otIp6Address,
11617 aTlvTypes: *const u8,
11618 aCount: u8,
11619 ) -> otError;
11620}
11621unsafe extern "C" {
11622 #[doc = " Get the vendor name string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor name string."]
11623 pub fn otThreadGetVendorName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11624}
11625unsafe extern "C" {
11626 #[doc = " Get the vendor model string.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n\n @returns The vendor model string."]
11627 pub fn otThreadGetVendorModel(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11628}
11629unsafe extern "C" {
11630 #[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."]
11631 pub fn otThreadGetVendorSwVersion(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11632}
11633unsafe extern "C" {
11634 #[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."]
11635 pub fn otThreadGetVendorAppUrl(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
11636}
11637unsafe extern "C" {
11638 #[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)."]
11639 pub fn otThreadSetVendorName(
11640 aInstance: *mut otInstance,
11641 aVendorName: *const ::std::os::raw::c_char,
11642 ) -> otError;
11643}
11644unsafe extern "C" {
11645 #[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)."]
11646 pub fn otThreadSetVendorModel(
11647 aInstance: *mut otInstance,
11648 aVendorModel: *const ::std::os::raw::c_char,
11649 ) -> otError;
11650}
11651unsafe extern "C" {
11652 #[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)."]
11653 pub fn otThreadSetVendorSwVersion(
11654 aInstance: *mut otInstance,
11655 aVendorSwVersion: *const ::std::os::raw::c_char,
11656 ) -> otError;
11657}
11658unsafe extern "C" {
11659 #[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)."]
11660 pub fn otThreadSetVendorAppUrl(
11661 aInstance: *mut otInstance,
11662 aVendorAppUrl: *const ::std::os::raw::c_char,
11663 ) -> otError;
11664}
11665#[doc = "< The device hasn't attached to a network."]
11666pub const OT_NETWORK_TIME_UNSYNCHRONIZED: otNetworkTimeStatus = -1;
11667#[doc = "< The device hasn’t received time sync for more than two periods time."]
11668pub const OT_NETWORK_TIME_RESYNC_NEEDED: otNetworkTimeStatus = 0;
11669#[doc = "< The device network time is synchronized."]
11670pub const OT_NETWORK_TIME_SYNCHRONIZED: otNetworkTimeStatus = 1;
11671#[doc = " Represents OpenThread time synchronization status."]
11672pub type otNetworkTimeStatus = ::std::os::raw::c_int;
11673#[doc = " Pointer is called when a network time sync or status change occurs."]
11674pub type otNetworkTimeSyncCallbackFn =
11675 ::std::option::Option<unsafe extern "C" fn(aCallbackContext: *mut ::std::os::raw::c_void)>;
11676unsafe extern "C" {
11677 #[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."]
11678 pub fn otNetworkTimeGet(
11679 aInstance: *mut otInstance,
11680 aNetworkTime: *mut u64,
11681 ) -> otNetworkTimeStatus;
11682}
11683unsafe extern "C" {
11684 #[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."]
11685 pub fn otNetworkTimeSetSyncPeriod(aInstance: *mut otInstance, aTimeSyncPeriod: u16) -> otError;
11686}
11687unsafe extern "C" {
11688 #[doc = " Get the time synchronization period.\n\n @param[in] aInstance The OpenThread instance structure.\n\n @returns The time synchronization period."]
11689 pub fn otNetworkTimeGetSyncPeriod(aInstance: *mut otInstance) -> u16;
11690}
11691unsafe extern "C" {
11692 #[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."]
11693 pub fn otNetworkTimeSetXtalThreshold(
11694 aInstance: *mut otInstance,
11695 aXTALThreshold: u16,
11696 ) -> otError;
11697}
11698unsafe extern "C" {
11699 #[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."]
11700 pub fn otNetworkTimeGetXtalThreshold(aInstance: *mut otInstance) -> u16;
11701}
11702unsafe extern "C" {
11703 #[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"]
11704 pub fn otNetworkTimeSyncSetCallback(
11705 aInstance: *mut otInstance,
11706 aCallbackFn: otNetworkTimeSyncCallbackFn,
11707 aCallbackContext: *mut ::std::os::raw::c_void,
11708 );
11709}
11710#[doc = " Represents a ping reply."]
11711#[repr(C)]
11712#[derive(Copy, Clone)]
11713pub struct otPingSenderReply {
11714 #[doc = "< Sender IPv6 address (address from which ping reply was received)."]
11715 pub mSenderAddress: otIp6Address,
11716 #[doc = "< Round trip time in msec."]
11717 pub mRoundTripTime: u16,
11718 #[doc = "< Data size (number of bytes) in reply (excluding IPv6 and ICMP6 headers)."]
11719 pub mSize: u16,
11720 #[doc = "< Sequence number."]
11721 pub mSequenceNumber: u16,
11722 #[doc = "< Hop limit."]
11723 pub mHopLimit: u8,
11724}
11725impl Default for otPingSenderReply {
11726 fn default() -> Self {
11727 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11728 unsafe {
11729 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11730 s.assume_init()
11731 }
11732 }
11733}
11734#[doc = " Represents statistics of a ping request."]
11735#[repr(C)]
11736#[derive(Debug, Default, Copy, Clone)]
11737pub struct otPingSenderStatistics {
11738 #[doc = "< The number of ping requests already sent."]
11739 pub mSentCount: u16,
11740 #[doc = "< The number of ping replies received."]
11741 pub mReceivedCount: u16,
11742 #[doc = "< The total round trip time of ping requests."]
11743 pub mTotalRoundTripTime: u32,
11744 #[doc = "< The min round trip time among ping requests."]
11745 pub mMinRoundTripTime: u16,
11746 #[doc = "< The max round trip time among ping requests."]
11747 pub mMaxRoundTripTime: u16,
11748 #[doc = "< Whether this is a multicast ping request."]
11749 pub mIsMulticast: bool,
11750}
11751#[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."]
11752pub type otPingSenderReplyCallback = ::std::option::Option<
11753 unsafe extern "C" fn(aReply: *const otPingSenderReply, aContext: *mut ::std::os::raw::c_void),
11754>;
11755#[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."]
11756pub type otPingSenderStatisticsCallback = ::std::option::Option<
11757 unsafe extern "C" fn(
11758 aStatistics: *const otPingSenderStatistics,
11759 aContext: *mut ::std::os::raw::c_void,
11760 ),
11761>;
11762#[doc = " Represents a ping request configuration."]
11763#[repr(C)]
11764#[derive(Copy, Clone)]
11765pub struct otPingSenderConfig {
11766 #[doc = "< Source address of the ping."]
11767 pub mSource: otIp6Address,
11768 #[doc = "< Destination address to ping."]
11769 pub mDestination: otIp6Address,
11770 #[doc = "< Callback function to report replies (can be NULL if not needed)."]
11771 pub mReplyCallback: otPingSenderReplyCallback,
11772 #[doc = "< Callback function to report statistics (can be NULL if not needed)."]
11773 pub mStatisticsCallback: otPingSenderStatisticsCallback,
11774 #[doc = "< A pointer to the callback application-specific context."]
11775 pub mCallbackContext: *mut ::std::os::raw::c_void,
11776 #[doc = "< Data size (# of bytes) excludes IPv6/ICMPv6 header. Zero for default."]
11777 pub mSize: u16,
11778 #[doc = "< Number of ping messages to send. Zero to use default."]
11779 pub mCount: u16,
11780 #[doc = "< Ping tx interval in milliseconds. Zero to use default."]
11781 pub mInterval: u32,
11782 #[doc = "< Time in milliseconds to wait for final reply after sending final request.\n< Zero to use default."]
11783 pub mTimeout: u16,
11784 #[doc = "< Hop limit (used if `mAllowZeroHopLimit` is false). Zero for default."]
11785 pub mHopLimit: u8,
11786 #[doc = "< Indicates whether hop limit is zero."]
11787 pub mAllowZeroHopLimit: bool,
11788 #[doc = "< Allow looping back pings to multicast address that device is subscribed to."]
11789 pub mMulticastLoop: bool,
11790}
11791impl Default for otPingSenderConfig {
11792 fn default() -> Self {
11793 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
11794 unsafe {
11795 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
11796 s.assume_init()
11797 }
11798 }
11799}
11800unsafe extern "C" {
11801 #[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"]
11802 pub fn otPingSenderPing(
11803 aInstance: *mut otInstance,
11804 aConfig: *const otPingSenderConfig,
11805 ) -> otError;
11806}
11807unsafe extern "C" {
11808 #[doc = " Stops an ongoing ping.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
11809 pub fn otPingSenderStop(aInstance: *mut otInstance);
11810}
11811unsafe extern "C" {
11812 #[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."]
11813 pub fn otPlatAlarmMicroStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
11814}
11815unsafe extern "C" {
11816 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
11817 pub fn otPlatAlarmMicroStop(aInstance: *mut otInstance);
11818}
11819unsafe extern "C" {
11820 #[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."]
11821 pub fn otPlatAlarmMicroGetNow() -> u32;
11822}
11823unsafe extern "C" {
11824 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11825 pub fn otPlatAlarmMicroFired(aInstance: *mut otInstance);
11826}
11827unsafe extern "C" {
11828 #[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."]
11829 pub fn otPlatAlarmMilliStartAt(aInstance: *mut otInstance, aT0: u32, aDt: u32);
11830}
11831unsafe extern "C" {
11832 #[doc = " Stop the alarm.\n\n @param[in] aInstance The OpenThread instance structure."]
11833 pub fn otPlatAlarmMilliStop(aInstance: *mut otInstance);
11834}
11835unsafe extern "C" {
11836 #[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."]
11837 pub fn otPlatAlarmMilliGetNow() -> u32;
11838}
11839unsafe extern "C" {
11840 #[doc = " Signal that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11841 pub fn otPlatAlarmMilliFired(aInstance: *mut otInstance);
11842}
11843unsafe extern "C" {
11844 #[doc = " Signal diagnostics module that the alarm has fired.\n\n @param[in] aInstance The OpenThread instance structure."]
11845 pub fn otPlatDiagAlarmFired(aInstance: *mut otInstance);
11846}
11847unsafe extern "C" {
11848 #[doc = " Handles ICMP6 RA messages received on the Thread interface on the platform.\n\n The `aMessage` should point to a buffer of a valid ICMPv6 message (without IP headers) with router advertisement as\n the value of type field of the message.\n\n When DHCPv6 PD is disabled, the message will be dropped silently.\n\n Note: RA messages will not be forwarded into Thread networks, while for many platforms, RA messages is the way of\n distributing a prefix and other infomations to the downstream network. The typical usecase of this function is to\n handle the router advertisement messages sent by the platform as a result of DHCPv6 Prefix Delegation.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aMessage A pointer to an ICMPv6 RouterAdvertisement message.\n @param[in] aLength The length of ICMPv6 RouterAdvertisement message."]
11849 pub fn otPlatBorderRoutingProcessIcmp6Ra(
11850 aInstance: *mut otInstance,
11851 aMessage: *const u8,
11852 aLength: u16,
11853 );
11854}
11855unsafe extern "C" {
11856 #[doc = " Process a prefix received from the DHCPv6 PD Server. The prefix is received on\n the DHCPv6 PD client callback and provided to the Routing Manager via this\n API.\n\n The prefix lifetime can be updated by calling the function again with updated time values.\n If the preferred lifetime of the prefix is set to 0, the prefix becomes deprecated.\n When this function is called multiple times, the smallest prefix is preferred as this rule allows\n choosing a GUA instead of a ULA.\n\n Requires `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE`.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aPrefixInfo A pointer to the prefix information structure"]
11857 pub fn otPlatBorderRoutingProcessDhcp6PdPrefix(
11858 aInstance: *mut otInstance,
11859 aPrefixInfo: *const otBorderRoutingPrefixTableEntry,
11860 );
11861}
11862unsafe extern "C" {
11863 #[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."]
11864 pub fn otPlatDebugUart_printf(fmt: *const ::std::os::raw::c_char, ...);
11865}
11866unsafe extern "C" {
11867 #[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."]
11868 pub fn otPlatDebugUart_vprintf(fmt: *const ::std::os::raw::c_char, ap: *mut __va_list_tag);
11869}
11870unsafe extern "C" {
11871 #[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"]
11872 pub fn otPlatDebugUart_putchar_raw(c: ::std::os::raw::c_int);
11873}
11874unsafe extern "C" {
11875 #[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."]
11876 pub fn otPlatDebugUart_kbhit() -> ::std::os::raw::c_int;
11877}
11878unsafe extern "C" {
11879 #[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"]
11880 pub fn otPlatDebugUart_getc() -> ::std::os::raw::c_int;
11881}
11882unsafe extern "C" {
11883 #[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"]
11884 pub fn otPlatDebugUart_putchar(c: ::std::os::raw::c_int);
11885}
11886unsafe extern "C" {
11887 #[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"]
11888 pub fn otPlatDebugUart_puts(s: *const ::std::os::raw::c_char);
11889}
11890unsafe extern "C" {
11891 #[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."]
11892 pub fn otPlatDebugUart_write_bytes(pBytes: *const u8, nBytes: ::std::os::raw::c_int);
11893}
11894unsafe extern "C" {
11895 #[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()"]
11896 pub fn otPlatDebugUart_puts_no_nl(s: *const ::std::os::raw::c_char);
11897}
11898unsafe extern "C" {
11899 #[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."]
11900 pub fn otPlatDebugUart_logfile(filename: *const ::std::os::raw::c_char) -> otError;
11901}
11902#[repr(C)]
11903#[derive(Debug, Copy, Clone)]
11904pub struct otPlatDnsUpstreamQuery {
11905 _unused: [u8; 0],
11906}
11907unsafe extern "C" {
11908 #[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."]
11909 pub fn otPlatDnsStartUpstreamQuery(
11910 aInstance: *mut otInstance,
11911 aTxn: *mut otPlatDnsUpstreamQuery,
11912 aQuery: *const otMessage,
11913 );
11914}
11915unsafe extern "C" {
11916 #[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."]
11917 pub fn otPlatDnsCancelUpstreamQuery(
11918 aInstance: *mut otInstance,
11919 aTxn: *mut otPlatDnsUpstreamQuery,
11920 );
11921}
11922unsafe extern "C" {
11923 #[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 a nullptr 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 `nullptr` to close a transaction without a\n response."]
11924 pub fn otPlatDnsUpstreamQueryDone(
11925 aInstance: *mut otInstance,
11926 aTxn: *mut otPlatDnsUpstreamQuery,
11927 aResponse: *mut otMessage,
11928 );
11929}
11930unsafe extern "C" {
11931 #[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."]
11932 pub fn otPlatEntropyGet(aOutput: *mut u8, aOutputLength: u16) -> otError;
11933}
11934unsafe extern "C" {
11935 #[doc = " Initializes the flash driver.\n\n @param[in] aInstance The OpenThread instance structure."]
11936 pub fn otPlatFlashInit(aInstance: *mut otInstance);
11937}
11938unsafe extern "C" {
11939 #[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."]
11940 pub fn otPlatFlashGetSwapSize(aInstance: *mut otInstance) -> u32;
11941}
11942unsafe extern "C" {
11943 #[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."]
11944 pub fn otPlatFlashErase(aInstance: *mut otInstance, aSwapIndex: u8);
11945}
11946unsafe extern "C" {
11947 #[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."]
11948 pub fn otPlatFlashRead(
11949 aInstance: *mut otInstance,
11950 aSwapIndex: u8,
11951 aOffset: u32,
11952 aData: *mut ::std::os::raw::c_void,
11953 aSize: u32,
11954 );
11955}
11956unsafe extern "C" {
11957 #[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."]
11958 pub fn otPlatFlashWrite(
11959 aInstance: *mut otInstance,
11960 aSwapIndex: u8,
11961 aOffset: u32,
11962 aData: *const ::std::os::raw::c_void,
11963 aSize: u32,
11964 );
11965}
11966#[doc = " Represents an InfraIf Link-Layer Address."]
11967#[repr(C)]
11968#[derive(Debug, Default, Copy, Clone)]
11969pub struct otPlatInfraIfLinkLayerAddress {
11970 #[doc = "< The link-layer address bytes."]
11971 pub mAddress: [u8; 16usize],
11972 #[doc = "< The address length (number of bytes)."]
11973 pub mLength: u8,
11974}
11975unsafe extern "C" {
11976 #[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."]
11977 pub fn otPlatInfraIfHasAddress(aInfraIfIndex: u32, aAddress: *const otIp6Address) -> bool;
11978}
11979unsafe extern "C" {
11980 #[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."]
11981 pub fn otPlatInfraIfSendIcmp6Nd(
11982 aInfraIfIndex: u32,
11983 aDestAddress: *const otIp6Address,
11984 aBuffer: *const u8,
11985 aBufferLength: u16,
11986 ) -> otError;
11987}
11988unsafe extern "C" {
11989 #[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."]
11990 pub fn otPlatInfraIfRecvIcmp6Nd(
11991 aInstance: *mut otInstance,
11992 aInfraIfIndex: u32,
11993 aSrcAddress: *const otIp6Address,
11994 aBuffer: *const u8,
11995 aBufferLength: u16,
11996 );
11997}
11998unsafe extern "C" {
11999 #[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."]
12000 pub fn otPlatInfraIfStateChanged(
12001 aInstance: *mut otInstance,
12002 aInfraIfIndex: u32,
12003 aIsRunning: bool,
12004 ) -> otError;
12005}
12006unsafe extern "C" {
12007 #[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."]
12008 pub fn otPlatInfraIfDiscoverNat64Prefix(aInfraIfIndex: u32) -> otError;
12009}
12010unsafe extern "C" {
12011 #[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."]
12012 pub fn otPlatInfraIfDiscoverNat64PrefixDone(
12013 aInstance: *mut otInstance,
12014 aInfraIfIndex: u32,
12015 aIp6Prefix: *const otIp6Prefix,
12016 );
12017}
12018unsafe extern "C" {
12019 #[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."]
12020 pub fn otPlatGetInfraIfLinkLayerAddress(
12021 aInstance: *mut otInstance,
12022 aIfIndex: u32,
12023 aInfraIfLinkLayerAddress: *mut otPlatInfraIfLinkLayerAddress,
12024 ) -> otError;
12025}
12026unsafe extern "C" {
12027 #[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."]
12028 pub fn otPlatCAlloc(aNum: usize, aSize: usize) -> *mut ::std::os::raw::c_void;
12029}
12030unsafe extern "C" {
12031 #[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."]
12032 pub fn otPlatFree(aPtr: *mut ::std::os::raw::c_void);
12033}
12034#[doc = " Represents an OpenThread message buffer."]
12035#[repr(C)]
12036#[derive(Debug, Copy, Clone)]
12037pub struct otMessageBuffer {
12038 #[doc = "< Pointer to the next buffer."]
12039 pub mNext: *mut otMessageBuffer,
12040}
12041impl Default for otMessageBuffer {
12042 fn default() -> Self {
12043 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12044 unsafe {
12045 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12046 s.assume_init()
12047 }
12048 }
12049}
12050unsafe extern "C" {
12051 #[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."]
12052 pub fn otPlatMessagePoolInit(
12053 aInstance: *mut otInstance,
12054 aMinNumFreeBuffers: u16,
12055 aBufferSize: usize,
12056 );
12057}
12058unsafe extern "C" {
12059 #[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."]
12060 pub fn otPlatMessagePoolNew(aInstance: *mut otInstance) -> *mut otMessageBuffer;
12061}
12062unsafe extern "C" {
12063 #[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."]
12064 pub fn otPlatMessagePoolFree(aInstance: *mut otInstance, aBuffer: *mut otMessageBuffer);
12065}
12066unsafe extern "C" {
12067 #[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."]
12068 pub fn otPlatMessagePoolNumFreeBuffers(aInstance: *mut otInstance) -> u16;
12069}
12070unsafe extern "C" {
12071 #[doc = " Performs a software reset on the platform, if supported.\n\n @param[in] aInstance The OpenThread instance structure."]
12072 pub fn otPlatReset(aInstance: *mut otInstance);
12073}
12074unsafe extern "C" {
12075 #[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."]
12076 pub fn otPlatResetToBootloader(aInstance: *mut otInstance) -> otError;
12077}
12078pub const OT_PLAT_RESET_REASON_POWER_ON: otPlatResetReason = 0;
12079pub const OT_PLAT_RESET_REASON_EXTERNAL: otPlatResetReason = 1;
12080pub const OT_PLAT_RESET_REASON_SOFTWARE: otPlatResetReason = 2;
12081pub const OT_PLAT_RESET_REASON_FAULT: otPlatResetReason = 3;
12082pub const OT_PLAT_RESET_REASON_CRASH: otPlatResetReason = 4;
12083pub const OT_PLAT_RESET_REASON_ASSERT: otPlatResetReason = 5;
12084pub const OT_PLAT_RESET_REASON_OTHER: otPlatResetReason = 6;
12085pub const OT_PLAT_RESET_REASON_UNKNOWN: otPlatResetReason = 7;
12086pub const OT_PLAT_RESET_REASON_WATCHDOG: otPlatResetReason = 8;
12087pub const OT_PLAT_RESET_REASON_COUNT: otPlatResetReason = 9;
12088#[doc = " Enumeration of possible reset reason codes.\n\n These are in the same order as the Spinel reset reason codes."]
12089pub type otPlatResetReason = ::std::os::raw::c_uint;
12090unsafe extern "C" {
12091 #[doc = " Returns the reason for the last platform reset.\n\n @param[in] aInstance The OpenThread instance structure."]
12092 pub fn otPlatGetResetReason(aInstance: *mut otInstance) -> otPlatResetReason;
12093}
12094unsafe extern "C" {
12095 #[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."]
12096 pub fn otPlatAssertFail(
12097 aFilename: *const ::std::os::raw::c_char,
12098 aLineNumber: ::std::os::raw::c_int,
12099 );
12100}
12101unsafe extern "C" {
12102 #[doc = " Performs a platform specific operation to wake the host MCU.\n This is used only for NCP configurations."]
12103 pub fn otPlatWakeHost();
12104}
12105#[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."]
12106pub const OT_PLAT_MCU_POWER_STATE_ON: otPlatMcuPowerState = 0;
12107#[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."]
12108pub const OT_PLAT_MCU_POWER_STATE_LOW_POWER: otPlatMcuPowerState = 1;
12109#[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."]
12110pub const OT_PLAT_MCU_POWER_STATE_OFF: otPlatMcuPowerState = 2;
12111#[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`."]
12112pub type otPlatMcuPowerState = ::std::os::raw::c_uint;
12113unsafe extern "C" {
12114 #[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."]
12115 pub fn otPlatSetMcuPowerState(
12116 aInstance: *mut otInstance,
12117 aState: otPlatMcuPowerState,
12118 ) -> otError;
12119}
12120unsafe extern "C" {
12121 #[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."]
12122 pub fn otPlatGetMcuPowerState(aInstance: *mut otInstance) -> otPlatMcuPowerState;
12123}
12124unsafe extern "C" {
12125 #[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"]
12126 pub fn otPlatLogCrashDump() -> otError;
12127}
12128unsafe extern "C" {
12129 #[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."]
12130 pub fn otPlatOtnsStatus(aStatus: *const ::std::os::raw::c_char);
12131}
12132#[doc = "< Active Operational Dataset."]
12133pub const OT_SETTINGS_KEY_ACTIVE_DATASET: _bindgen_ty_10 = 1;
12134#[doc = "< Pending Operational Dataset."]
12135pub const OT_SETTINGS_KEY_PENDING_DATASET: _bindgen_ty_10 = 2;
12136#[doc = "< Thread network information."]
12137pub const OT_SETTINGS_KEY_NETWORK_INFO: _bindgen_ty_10 = 3;
12138#[doc = "< Parent information."]
12139pub const OT_SETTINGS_KEY_PARENT_INFO: _bindgen_ty_10 = 4;
12140#[doc = "< Child information."]
12141pub const OT_SETTINGS_KEY_CHILD_INFO: _bindgen_ty_10 = 5;
12142#[doc = "< SLAAC key to generate semantically opaque IID."]
12143pub const OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY: _bindgen_ty_10 = 7;
12144#[doc = "< Duplicate Address Detection (DAD) information."]
12145pub const OT_SETTINGS_KEY_DAD_INFO: _bindgen_ty_10 = 8;
12146#[doc = "< SRP client ECDSA public/private key pair."]
12147pub const OT_SETTINGS_KEY_SRP_ECDSA_KEY: _bindgen_ty_10 = 11;
12148#[doc = "< The SRP client info (selected SRP server address)."]
12149pub const OT_SETTINGS_KEY_SRP_CLIENT_INFO: _bindgen_ty_10 = 12;
12150#[doc = "< The SRP server info (UDP port)."]
12151pub const OT_SETTINGS_KEY_SRP_SERVER_INFO: _bindgen_ty_10 = 13;
12152#[doc = "< BR ULA prefix."]
12153pub const OT_SETTINGS_KEY_BR_ULA_PREFIX: _bindgen_ty_10 = 15;
12154#[doc = "< BR local on-link prefixes."]
12155pub const OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES: _bindgen_ty_10 = 16;
12156#[doc = "< Unique Border Agent/Router ID."]
12157pub const OT_SETTINGS_KEY_BORDER_AGENT_ID: _bindgen_ty_10 = 17;
12158#[doc = "< TCAT Commissioner certificate"]
12159pub const OT_SETTINGS_KEY_TCAT_COMMR_CERT: _bindgen_ty_10 = 18;
12160pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MIN: _bindgen_ty_10 = 32768;
12161pub const OT_SETTINGS_KEY_VENDOR_RESERVED_MAX: _bindgen_ty_10 = 65535;
12162#[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()`."]
12163pub type _bindgen_ty_10 = ::std::os::raw::c_uint;
12164unsafe extern "C" {
12165 #[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."]
12166 pub fn otPlatSettingsInit(
12167 aInstance: *mut otInstance,
12168 aSensitiveKeys: *const u16,
12169 aSensitiveKeysLength: u16,
12170 );
12171}
12172unsafe extern "C" {
12173 #[doc = " Performs any de-initialization for the settings subsystem, if necessary.\n\n @param[in] aInstance The OpenThread instance structure."]
12174 pub fn otPlatSettingsDeinit(aInstance: *mut otInstance);
12175}
12176unsafe extern "C" {
12177 #[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."]
12178 pub fn otPlatSettingsGet(
12179 aInstance: *mut otInstance,
12180 aKey: u16,
12181 aIndex: ::std::os::raw::c_int,
12182 aValue: *mut u8,
12183 aValueLength: *mut u16,
12184 ) -> otError;
12185}
12186unsafe extern "C" {
12187 #[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."]
12188 pub fn otPlatSettingsSet(
12189 aInstance: *mut otInstance,
12190 aKey: u16,
12191 aValue: *const u8,
12192 aValueLength: u16,
12193 ) -> otError;
12194}
12195unsafe extern "C" {
12196 #[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."]
12197 pub fn otPlatSettingsAdd(
12198 aInstance: *mut otInstance,
12199 aKey: u16,
12200 aValue: *const u8,
12201 aValueLength: u16,
12202 ) -> otError;
12203}
12204unsafe extern "C" {
12205 #[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."]
12206 pub fn otPlatSettingsDelete(
12207 aInstance: *mut otInstance,
12208 aKey: u16,
12209 aIndex: ::std::os::raw::c_int,
12210 ) -> otError;
12211}
12212unsafe extern "C" {
12213 #[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."]
12214 pub fn otPlatSettingsWipe(aInstance: *mut otInstance);
12215}
12216#[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."]
12217pub type otPlatSpiSlaveTransactionCompleteCallback = ::std::option::Option<
12218 unsafe extern "C" fn(
12219 aContext: *mut ::std::os::raw::c_void,
12220 aOutputBuf: *mut u8,
12221 aOutputBufLen: u16,
12222 aInputBuf: *mut u8,
12223 aInputBufLen: u16,
12224 aTransactionLength: u16,
12225 ) -> bool,
12226>;
12227#[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()`."]
12228pub type otPlatSpiSlaveTransactionProcessCallback =
12229 ::std::option::Option<unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void)>;
12230unsafe extern "C" {
12231 #[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."]
12232 pub fn otPlatSpiSlaveEnable(
12233 aCompleteCallback: otPlatSpiSlaveTransactionCompleteCallback,
12234 aProcessCallback: otPlatSpiSlaveTransactionProcessCallback,
12235 aContext: *mut ::std::os::raw::c_void,
12236 ) -> otError;
12237}
12238unsafe extern "C" {
12239 #[doc = " Shutdown and disable the SPI slave interface."]
12240 pub fn otPlatSpiSlaveDisable();
12241}
12242unsafe extern "C" {
12243 #[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."]
12244 pub fn otPlatSpiSlavePrepareTransaction(
12245 aOutputBuf: *mut u8,
12246 aOutputBufLen: u16,
12247 aInputBuf: *mut u8,
12248 aInputBufLen: u16,
12249 aRequestTransactionFlag: bool,
12250 ) -> otError;
12251}
12252unsafe extern "C" {
12253 #[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."]
12254 pub fn otPlatTimeGet() -> u64;
12255}
12256unsafe extern "C" {
12257 #[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."]
12258 pub fn otPlatTimeGetXtalAccuracy() -> u16;
12259}
12260unsafe extern "C" {
12261 #[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) Platform layer MUST initiate an ongoing DNS-SD browse on the service name \"_trel._udp\" within the local browsing\n domain to discover other devices supporting TREL. The ongoing browse will produce two different types of events:\n \"add\" events and \"remove\" events. When the browse is started, it should produce an \"add\" event for every TREL peer\n currently present on the network. Whenever a TREL peer goes offline, a \"remove\" event should be produced. \"remove\"\n events are not guaranteed, however. When a TREL service instance is discovered, a new ongoing DNS-SD query for an\n AAAA record should be started on the hostname indicated in the SRV record of the discovered instance. If multiple\n host IPv6 addressees are discovered for a peer, one with highest scope among all addresses MUST be reported (if\n there are multiple address at same scope, one must be selected randomly).\n\n TREL platform MUST signal back the discovered peer info using `otPlatTrelHandleDiscoveredPeerInfo()` callback. This\n callback MUST be invoked when a new peer is discovered, when there is a change in an existing entry (e.g., new\n TXT record or new port number or new IPv6 address), or when the 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."]
12262 pub fn otPlatTrelEnable(aInstance: *mut otInstance, aUdpPort: *mut u16);
12263}
12264unsafe extern "C" {
12265 #[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."]
12266 pub fn otPlatTrelDisable(aInstance: *mut otInstance);
12267}
12268#[doc = " Represents a TREL peer info discovered using DNS-SD browse on the service name \"_trel._udp\"."]
12269#[repr(C)]
12270#[derive(Copy, Clone)]
12271pub struct otPlatTrelPeerInfo {
12272 #[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."]
12273 pub mRemoved: bool,
12274 #[doc = " The TXT record data (encoded as specified by DNS-SD) from the SRV record of the discovered TREL peer service\n instance."]
12275 pub mTxtData: *const u8,
12276 #[doc = "< Number of bytes in @p mTxtData buffer."]
12277 pub mTxtLength: u16,
12278 #[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."]
12279 pub mSockAddr: otSockAddr,
12280}
12281impl Default for otPlatTrelPeerInfo {
12282 fn default() -> Self {
12283 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12284 unsafe {
12285 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12286 s.assume_init()
12287 }
12288 }
12289}
12290unsafe extern "C" {
12291 #[doc = " This is a callback function from platform layer to report a discovered TREL peer info.\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."]
12292 pub fn otPlatTrelHandleDiscoveredPeerInfo(
12293 aInstance: *mut otInstance,
12294 aInfo: *const otPlatTrelPeerInfo,
12295 );
12296}
12297unsafe extern "C" {
12298 #[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 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)."]
12299 pub fn otPlatTrelNotifyPeerSocketAddressDifference(
12300 aInstance: *mut otInstance,
12301 aPeerSockAddr: *const otSockAddr,
12302 aRxSockAddr: *const otSockAddr,
12303 );
12304}
12305unsafe extern "C" {
12306 #[doc = " Registers a new service to be advertised using DNS-SD [RFC6763].\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)."]
12307 pub fn otPlatTrelRegisterService(
12308 aInstance: *mut otInstance,
12309 aPort: u16,
12310 aTxtData: *const u8,
12311 aTxtLength: u8,
12312 );
12313}
12314unsafe extern "C" {
12315 #[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."]
12316 pub fn otPlatTrelSend(
12317 aInstance: *mut otInstance,
12318 aUdpPayload: *const u8,
12319 aUdpPayloadLen: u16,
12320 aDestSockAddr: *const otSockAddr,
12321 );
12322}
12323unsafe extern "C" {
12324 #[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."]
12325 pub fn otPlatTrelHandleReceived(
12326 aInstance: *mut otInstance,
12327 aBuffer: *mut u8,
12328 aLength: u16,
12329 aSenderAddr: *const otSockAddr,
12330 );
12331}
12332#[doc = " Represents a group of TREL related counters in the platform layer."]
12333#[repr(C)]
12334#[derive(Debug, Default, Copy, Clone)]
12335pub struct otPlatTrelCounters {
12336 #[doc = "< Number of packets successfully transmitted through TREL."]
12337 pub mTxPackets: u64,
12338 #[doc = "< Sum of size of packets successfully transmitted through TREL."]
12339 pub mTxBytes: u64,
12340 #[doc = "< Number of packet transmission failures through TREL."]
12341 pub mTxFailure: u64,
12342 #[doc = "< Number of packets received through TREL."]
12343 pub mRxPackets: u64,
12344 #[doc = "< Sum of size of packets received through TREL."]
12345 pub mRxBytes: u64,
12346}
12347unsafe extern "C" {
12348 #[doc = " Gets the pointer to the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
12349 pub fn otPlatTrelGetCounters(aInstance: *mut otInstance) -> *const otPlatTrelCounters;
12350}
12351unsafe extern "C" {
12352 #[doc = " Resets the TREL counters in the platform layer.\n\n @param[in] aInstance The OpenThread instance structure."]
12353 pub fn otPlatTrelResetCounters(aInstance: *mut otInstance);
12354}
12355#[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."]
12356pub type otUdpHandler = ::std::option::Option<
12357 unsafe extern "C" fn(
12358 aContext: *mut ::std::os::raw::c_void,
12359 aMessage: *const otMessage,
12360 aMessageInfo: *const otMessageInfo,
12361 ) -> bool,
12362>;
12363#[doc = " Represents a UDP receiver."]
12364#[repr(C)]
12365#[derive(Debug, Copy, Clone)]
12366pub struct otUdpReceiver {
12367 #[doc = "< A pointer to the next UDP receiver (internal use only)."]
12368 pub mNext: *mut otUdpReceiver,
12369 #[doc = "< A function pointer to the receiver callback."]
12370 pub mHandler: otUdpHandler,
12371 #[doc = "< A pointer to application-specific context."]
12372 pub mContext: *mut ::std::os::raw::c_void,
12373}
12374impl Default for otUdpReceiver {
12375 fn default() -> Self {
12376 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12377 unsafe {
12378 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12379 s.assume_init()
12380 }
12381 }
12382}
12383unsafe extern "C" {
12384 #[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."]
12385 pub fn otUdpAddReceiver(
12386 aInstance: *mut otInstance,
12387 aUdpReceiver: *mut otUdpReceiver,
12388 ) -> otError;
12389}
12390unsafe extern "C" {
12391 #[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."]
12392 pub fn otUdpRemoveReceiver(
12393 aInstance: *mut otInstance,
12394 aUdpReceiver: *mut otUdpReceiver,
12395 ) -> otError;
12396}
12397unsafe extern "C" {
12398 #[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."]
12399 pub fn otUdpSendDatagram(
12400 aInstance: *mut otInstance,
12401 aMessage: *mut otMessage,
12402 aMessageInfo: *mut otMessageInfo,
12403 ) -> otError;
12404}
12405#[doc = " This callback allows OpenThread to inform the application of a received UDP message."]
12406pub type otUdpReceive = ::std::option::Option<
12407 unsafe extern "C" fn(
12408 aContext: *mut ::std::os::raw::c_void,
12409 aMessage: *mut otMessage,
12410 aMessageInfo: *const otMessageInfo,
12411 ),
12412>;
12413#[doc = "< Unspecified network interface."]
12414pub const OT_NETIF_UNSPECIFIED: otNetifIdentifier = 0;
12415#[doc = "< The host Thread interface - allow use of platform UDP."]
12416pub const OT_NETIF_THREAD_HOST: otNetifIdentifier = 1;
12417#[doc = "< The internal Thread interface (within OpenThread) - do not use platform UDP."]
12418pub const OT_NETIF_THREAD_INTERNAL: otNetifIdentifier = 2;
12419#[doc = "< The Backbone interface."]
12420pub const OT_NETIF_BACKBONE: otNetifIdentifier = 3;
12421#[doc = " Defines the OpenThread network interface identifiers."]
12422pub type otNetifIdentifier = ::std::os::raw::c_uint;
12423#[doc = " Represents a UDP socket."]
12424#[repr(C)]
12425#[derive(Copy, Clone)]
12426pub struct otUdpSocket {
12427 #[doc = "< The local IPv6 socket address."]
12428 pub mSockName: otSockAddr,
12429 #[doc = "< The peer IPv6 socket address."]
12430 pub mPeerName: otSockAddr,
12431 #[doc = "< A function pointer to the application callback."]
12432 pub mHandler: otUdpReceive,
12433 #[doc = "< A pointer to application-specific context."]
12434 pub mContext: *mut ::std::os::raw::c_void,
12435 #[doc = "< A handle to platform's UDP."]
12436 pub mHandle: *mut ::std::os::raw::c_void,
12437 #[doc = "< A pointer to the next UDP socket (internal use only)."]
12438 pub mNext: *mut otUdpSocket,
12439 #[doc = "< The network interface identifier."]
12440 pub mNetifId: otNetifIdentifier,
12441}
12442impl Default for otUdpSocket {
12443 fn default() -> Self {
12444 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12445 unsafe {
12446 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12447 s.assume_init()
12448 }
12449 }
12450}
12451unsafe extern "C" {
12452 #[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"]
12453 pub fn otUdpNewMessage(
12454 aInstance: *mut otInstance,
12455 aSettings: *const otMessageSettings,
12456 ) -> *mut otMessage;
12457}
12458unsafe extern "C" {
12459 #[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."]
12460 pub fn otUdpOpen(
12461 aInstance: *mut otInstance,
12462 aSocket: *mut otUdpSocket,
12463 aCallback: otUdpReceive,
12464 aContext: *mut ::std::os::raw::c_void,
12465 ) -> otError;
12466}
12467unsafe extern "C" {
12468 #[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."]
12469 pub fn otUdpIsOpen(aInstance: *mut otInstance, aSocket: *const otUdpSocket) -> bool;
12470}
12471unsafe extern "C" {
12472 #[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."]
12473 pub fn otUdpClose(aInstance: *mut otInstance, aSocket: *mut otUdpSocket) -> otError;
12474}
12475unsafe extern "C" {
12476 #[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."]
12477 pub fn otUdpBind(
12478 aInstance: *mut otInstance,
12479 aSocket: *mut otUdpSocket,
12480 aSockName: *const otSockAddr,
12481 aNetif: otNetifIdentifier,
12482 ) -> otError;
12483}
12484unsafe extern "C" {
12485 #[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."]
12486 pub fn otUdpConnect(
12487 aInstance: *mut otInstance,
12488 aSocket: *mut otUdpSocket,
12489 aSockName: *const otSockAddr,
12490 ) -> otError;
12491}
12492unsafe extern "C" {
12493 #[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."]
12494 pub fn otUdpSend(
12495 aInstance: *mut otInstance,
12496 aSocket: *mut otUdpSocket,
12497 aMessage: *mut otMessage,
12498 aMessageInfo: *const otMessageInfo,
12499 ) -> otError;
12500}
12501unsafe extern "C" {
12502 #[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."]
12503 pub fn otUdpGetSockets(aInstance: *mut otInstance) -> *mut otUdpSocket;
12504}
12505#[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."]
12506pub type otUdpForwarder = ::std::option::Option<
12507 unsafe extern "C" fn(
12508 aMessage: *mut otMessage,
12509 aPeerPort: u16,
12510 aPeerAddr: *mut otIp6Address,
12511 aSockPort: u16,
12512 aContext: *mut ::std::os::raw::c_void,
12513 ),
12514>;
12515unsafe extern "C" {
12516 #[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."]
12517 pub fn otUdpForwardSetForwarder(
12518 aInstance: *mut otInstance,
12519 aForwarder: otUdpForwarder,
12520 aContext: *mut ::std::os::raw::c_void,
12521 );
12522}
12523unsafe extern "C" {
12524 #[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."]
12525 pub fn otUdpForwardReceive(
12526 aInstance: *mut otInstance,
12527 aMessage: *mut otMessage,
12528 aPeerPort: u16,
12529 aPeerAddr: *const otIp6Address,
12530 aSockPort: u16,
12531 );
12532}
12533unsafe extern "C" {
12534 #[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)."]
12535 pub fn otUdpIsPortInUse(aInstance: *mut otInstance, port: u16) -> bool;
12536}
12537unsafe extern "C" {
12538 #[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."]
12539 pub fn otPlatUdpSocket(aUdpSocket: *mut otUdpSocket) -> otError;
12540}
12541unsafe extern "C" {
12542 #[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."]
12543 pub fn otPlatUdpClose(aUdpSocket: *mut otUdpSocket) -> otError;
12544}
12545unsafe extern "C" {
12546 #[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."]
12547 pub fn otPlatUdpBind(aUdpSocket: *mut otUdpSocket) -> otError;
12548}
12549unsafe extern "C" {
12550 #[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."]
12551 pub fn otPlatUdpBindToNetif(
12552 aUdpSocket: *mut otUdpSocket,
12553 aNetifIdentifier: otNetifIdentifier,
12554 ) -> otError;
12555}
12556unsafe extern "C" {
12557 #[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."]
12558 pub fn otPlatUdpConnect(aUdpSocket: *mut otUdpSocket) -> otError;
12559}
12560unsafe extern "C" {
12561 #[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."]
12562 pub fn otPlatUdpSend(
12563 aUdpSocket: *mut otUdpSocket,
12564 aMessage: *mut otMessage,
12565 aMessageInfo: *const otMessageInfo,
12566 ) -> otError;
12567}
12568unsafe extern "C" {
12569 #[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."]
12570 pub fn otPlatUdpJoinMulticastGroup(
12571 aUdpSocket: *mut otUdpSocket,
12572 aNetifIdentifier: otNetifIdentifier,
12573 aAddress: *const otIp6Address,
12574 ) -> otError;
12575}
12576unsafe extern "C" {
12577 #[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."]
12578 pub fn otPlatUdpLeaveMulticastGroup(
12579 aUdpSocket: *mut otUdpSocket,
12580 aNetifIdentifier: otNetifIdentifier,
12581 aAddress: *const otIp6Address,
12582 ) -> otError;
12583}
12584unsafe extern "C" {
12585 #[doc = " Generates and returns a random `uint32_t` value.\n\n @returns A random `uint32_t` value."]
12586 pub fn otRandomNonCryptoGetUint32() -> u32;
12587}
12588unsafe extern "C" {
12589 #[doc = " Generates and returns a random byte.\n\n @returns A random `uint8_t` value."]
12590 pub fn otRandomNonCryptoGetUint8() -> u8;
12591}
12592unsafe extern "C" {
12593 #[doc = " Generates and returns a random `uint16_t` value.\n\n @returns A random `uint16_t` value."]
12594 pub fn otRandomNonCryptoGetUint16() -> u16;
12595}
12596unsafe extern "C" {
12597 #[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)."]
12598 pub fn otRandomNonCryptoGetUint8InRange(aMin: u8, aMax: u8) -> u8;
12599}
12600unsafe extern "C" {
12601 #[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)."]
12602 pub fn otRandomNonCryptoGetUint16InRange(aMin: u16, aMax: u16) -> u16;
12603}
12604unsafe extern "C" {
12605 #[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)."]
12606 pub fn otRandomNonCryptoGetUint32InRange(aMin: u32, aMax: u32) -> u32;
12607}
12608unsafe extern "C" {
12609 #[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)."]
12610 pub fn otRandomNonCryptoFillBuffer(aBuffer: *mut u8, aSize: u16);
12611}
12612unsafe extern "C" {
12613 #[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."]
12614 pub fn otRandomNonCryptoAddJitter(aValue: u32, aJitter: u16) -> u32;
12615}
12616unsafe extern "C" {
12617 #[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."]
12618 pub fn otServerGetNetDataLocal(
12619 aInstance: *mut otInstance,
12620 aStable: bool,
12621 aData: *mut u8,
12622 aDataLength: *mut u8,
12623 ) -> otError;
12624}
12625unsafe extern "C" {
12626 #[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"]
12627 pub fn otServerAddService(
12628 aInstance: *mut otInstance,
12629 aConfig: *const otServiceConfig,
12630 ) -> otError;
12631}
12632unsafe extern "C" {
12633 #[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"]
12634 pub fn otServerRemoveService(
12635 aInstance: *mut otInstance,
12636 aEnterpriseNumber: u32,
12637 aServiceData: *const u8,
12638 aServiceDataLength: u8,
12639 ) -> otError;
12640}
12641unsafe extern "C" {
12642 #[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."]
12643 pub fn otServerGetNextService(
12644 aInstance: *mut otInstance,
12645 aIterator: *mut otNetworkDataIterator,
12646 aConfig: *mut otServiceConfig,
12647 ) -> otError;
12648}
12649unsafe extern "C" {
12650 #[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"]
12651 pub fn otServerRegister(aInstance: *mut otInstance) -> otError;
12652}
12653#[doc = " Implements SNTP Query parameters."]
12654#[repr(C)]
12655#[derive(Debug, Copy, Clone)]
12656pub struct otSntpQuery {
12657 #[doc = "< A reference to the message info related with SNTP Server."]
12658 pub mMessageInfo: *const otMessageInfo,
12659}
12660impl Default for otSntpQuery {
12661 fn default() -> Self {
12662 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12663 unsafe {
12664 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12665 s.assume_init()
12666 }
12667 }
12668}
12669#[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."]
12670pub type otSntpResponseHandler = ::std::option::Option<
12671 unsafe extern "C" fn(aContext: *mut ::std::os::raw::c_void, aTime: u64, aResult: otError),
12672>;
12673unsafe extern "C" {
12674 #[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."]
12675 pub fn otSntpClientQuery(
12676 aInstance: *mut otInstance,
12677 aQuery: *const otSntpQuery,
12678 aHandler: otSntpResponseHandler,
12679 aContext: *mut ::std::os::raw::c_void,
12680 ) -> otError;
12681}
12682unsafe extern "C" {
12683 #[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."]
12684 pub fn otSntpClientSetUnixEra(aInstance: *mut otInstance, aUnixEra: u32);
12685}
12686#[doc = "< Item to be added/registered."]
12687pub const OT_SRP_CLIENT_ITEM_STATE_TO_ADD: otSrpClientItemState = 0;
12688#[doc = "< Item is being added/registered."]
12689pub const OT_SRP_CLIENT_ITEM_STATE_ADDING: otSrpClientItemState = 1;
12690#[doc = "< Item to be refreshed (re-register to renew lease)."]
12691pub const OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: otSrpClientItemState = 2;
12692#[doc = "< Item is being refreshed."]
12693pub const OT_SRP_CLIENT_ITEM_STATE_REFRESHING: otSrpClientItemState = 3;
12694#[doc = "< Item to be removed."]
12695pub const OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: otSrpClientItemState = 4;
12696#[doc = "< Item is being removed."]
12697pub const OT_SRP_CLIENT_ITEM_STATE_REMOVING: otSrpClientItemState = 5;
12698#[doc = "< Item is registered with server."]
12699pub const OT_SRP_CLIENT_ITEM_STATE_REGISTERED: otSrpClientItemState = 6;
12700#[doc = "< Item is removed."]
12701pub const OT_SRP_CLIENT_ITEM_STATE_REMOVED: otSrpClientItemState = 7;
12702#[doc = " Specifies an SRP client item (service or host info) state."]
12703pub type otSrpClientItemState = ::std::os::raw::c_uint;
12704#[doc = " Represents an SRP client host info."]
12705#[repr(C)]
12706#[derive(Debug, Copy, Clone)]
12707pub struct otSrpClientHostInfo {
12708 #[doc = "< Host name (label) string (NULL if not yet set)."]
12709 pub mName: *const ::std::os::raw::c_char,
12710 #[doc = "< Array of host IPv6 addresses (NULL if not set or auto address is enabled)."]
12711 pub mAddresses: *const otIp6Address,
12712 #[doc = "< Number of IPv6 addresses in `mAddresses` array."]
12713 pub mNumAddresses: u8,
12714 #[doc = "< Indicates whether auto address mode is enabled or not."]
12715 pub mAutoAddress: bool,
12716 #[doc = "< Host info state."]
12717 pub mState: otSrpClientItemState,
12718}
12719impl Default for otSrpClientHostInfo {
12720 fn default() -> Self {
12721 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12722 unsafe {
12723 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12724 s.assume_init()
12725 }
12726 }
12727}
12728#[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."]
12729#[repr(C)]
12730#[derive(Debug, Copy, Clone)]
12731pub struct otSrpClientService {
12732 #[doc = "< The service labels (e.g., \"_mt._udp\", not the full domain name)."]
12733 pub mName: *const ::std::os::raw::c_char,
12734 #[doc = "< The service instance name label (not the full name)."]
12735 pub mInstanceName: *const ::std::os::raw::c_char,
12736 #[doc = "< Array of sub-type labels (must end with `NULL` or can be `NULL`)."]
12737 pub mSubTypeLabels: *const *const ::std::os::raw::c_char,
12738 #[doc = "< Array of TXT entries (`mNumTxtEntries` gives num of entries)."]
12739 pub mTxtEntries: *const otDnsTxtEntry,
12740 #[doc = "< The service port number."]
12741 pub mPort: u16,
12742 #[doc = "< The service priority."]
12743 pub mPriority: u16,
12744 #[doc = "< The service weight."]
12745 pub mWeight: u16,
12746 #[doc = "< Number of entries in the `mTxtEntries` array."]
12747 pub mNumTxtEntries: u8,
12748 #[doc = "< Service state (managed by OT core)."]
12749 pub mState: otSrpClientItemState,
12750 #[doc = "< Internal data (used by OT core)."]
12751 pub mData: u32,
12752 #[doc = "< Pointer to next entry in a linked-list (managed by OT core)."]
12753 pub mNext: *mut otSrpClientService,
12754 #[doc = "< Desired lease interval in sec - zero to use default."]
12755 pub mLease: u32,
12756 #[doc = "< Desired key lease interval in sec - zero to use default."]
12757 pub mKeyLease: u32,
12758}
12759impl Default for otSrpClientService {
12760 fn default() -> Self {
12761 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12762 unsafe {
12763 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12764 s.assume_init()
12765 }
12766 }
12767}
12768#[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)."]
12769pub type otSrpClientCallback = ::std::option::Option<
12770 unsafe extern "C" fn(
12771 aError: otError,
12772 aHostInfo: *const otSrpClientHostInfo,
12773 aServices: *const otSrpClientService,
12774 aRemovedServices: *const otSrpClientService,
12775 aContext: *mut ::std::os::raw::c_void,
12776 ),
12777>;
12778#[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)."]
12779pub type otSrpClientAutoStartCallback = ::std::option::Option<
12780 unsafe extern "C" fn(aServerSockAddr: *const otSockAddr, aContext: *mut ::std::os::raw::c_void),
12781>;
12782unsafe extern "C" {
12783 #[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."]
12784 pub fn otSrpClientStart(
12785 aInstance: *mut otInstance,
12786 aServerSockAddr: *const otSockAddr,
12787 ) -> otError;
12788}
12789unsafe extern "C" {
12790 #[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."]
12791 pub fn otSrpClientStop(aInstance: *mut otInstance);
12792}
12793unsafe extern "C" {
12794 #[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."]
12795 pub fn otSrpClientIsRunning(aInstance: *mut otInstance) -> bool;
12796}
12797unsafe extern "C" {
12798 #[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)."]
12799 pub fn otSrpClientGetServerAddress(aInstance: *mut otInstance) -> *const otSockAddr;
12800}
12801unsafe extern "C" {
12802 #[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."]
12803 pub fn otSrpClientSetCallback(
12804 aInstance: *mut otInstance,
12805 aCallback: otSrpClientCallback,
12806 aContext: *mut ::std::os::raw::c_void,
12807 );
12808}
12809unsafe extern "C" {
12810 #[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."]
12811 pub fn otSrpClientEnableAutoStartMode(
12812 aInstance: *mut otInstance,
12813 aCallback: otSrpClientAutoStartCallback,
12814 aContext: *mut ::std::os::raw::c_void,
12815 );
12816}
12817unsafe extern "C" {
12818 #[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."]
12819 pub fn otSrpClientDisableAutoStartMode(aInstance: *mut otInstance);
12820}
12821unsafe extern "C" {
12822 #[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."]
12823 pub fn otSrpClientIsAutoStartModeEnabled(aInstance: *mut otInstance) -> bool;
12824}
12825unsafe extern "C" {
12826 #[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)."]
12827 pub fn otSrpClientGetTtl(aInstance: *mut otInstance) -> u32;
12828}
12829unsafe extern "C" {
12830 #[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."]
12831 pub fn otSrpClientSetTtl(aInstance: *mut otInstance, aTtl: u32);
12832}
12833unsafe extern "C" {
12834 #[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)."]
12835 pub fn otSrpClientGetLeaseInterval(aInstance: *mut otInstance) -> u32;
12836}
12837unsafe extern "C" {
12838 #[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."]
12839 pub fn otSrpClientSetLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
12840}
12841unsafe extern "C" {
12842 #[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)."]
12843 pub fn otSrpClientGetKeyLeaseInterval(aInstance: *mut otInstance) -> u32;
12844}
12845unsafe extern "C" {
12846 #[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."]
12847 pub fn otSrpClientSetKeyLeaseInterval(aInstance: *mut otInstance, aInterval: u32);
12848}
12849unsafe extern "C" {
12850 #[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."]
12851 pub fn otSrpClientGetHostInfo(aInstance: *mut otInstance) -> *const otSrpClientHostInfo;
12852}
12853unsafe extern "C" {
12854 #[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."]
12855 pub fn otSrpClientSetHostName(
12856 aInstance: *mut otInstance,
12857 aName: *const ::std::os::raw::c_char,
12858 ) -> otError;
12859}
12860unsafe extern "C" {
12861 #[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."]
12862 pub fn otSrpClientEnableAutoHostAddress(aInstance: *mut otInstance) -> otError;
12863}
12864unsafe extern "C" {
12865 #[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."]
12866 pub fn otSrpClientSetHostAddresses(
12867 aInstance: *mut otInstance,
12868 aIp6Addresses: *const otIp6Address,
12869 aNumAddresses: u8,
12870 ) -> otError;
12871}
12872unsafe extern "C" {
12873 #[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`)."]
12874 pub fn otSrpClientAddService(
12875 aInstance: *mut otInstance,
12876 aService: *mut otSrpClientService,
12877 ) -> otError;
12878}
12879unsafe extern "C" {
12880 #[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."]
12881 pub fn otSrpClientRemoveService(
12882 aInstance: *mut otInstance,
12883 aService: *mut otSrpClientService,
12884 ) -> otError;
12885}
12886unsafe extern "C" {
12887 #[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."]
12888 pub fn otSrpClientClearService(
12889 aInstance: *mut otInstance,
12890 aService: *mut otSrpClientService,
12891 ) -> otError;
12892}
12893unsafe extern "C" {
12894 #[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."]
12895 pub fn otSrpClientGetServices(aInstance: *mut otInstance) -> *const otSrpClientService;
12896}
12897unsafe extern "C" {
12898 #[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."]
12899 pub fn otSrpClientRemoveHostAndServices(
12900 aInstance: *mut otInstance,
12901 aRemoveKeyLease: bool,
12902 aSendUnregToServer: bool,
12903 ) -> otError;
12904}
12905unsafe extern "C" {
12906 #[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."]
12907 pub fn otSrpClientClearHostAndServices(aInstance: *mut otInstance);
12908}
12909unsafe extern "C" {
12910 #[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."]
12911 pub fn otSrpClientGetDomainName(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
12912}
12913unsafe extern "C" {
12914 #[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."]
12915 pub fn otSrpClientSetDomainName(
12916 aInstance: *mut otInstance,
12917 aName: *const ::std::os::raw::c_char,
12918 ) -> otError;
12919}
12920unsafe extern "C" {
12921 #[doc = " Converts a `otSrpClientItemState` to a string.\n\n @param[in] aItemState An item state.\n\n @returns A string representation of @p aItemState."]
12922 pub fn otSrpClientItemStateToString(
12923 aItemState: otSrpClientItemState,
12924 ) -> *const ::std::os::raw::c_char;
12925}
12926unsafe extern "C" {
12927 #[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."]
12928 pub fn otSrpClientSetServiceKeyRecordEnabled(aInstance: *mut otInstance, aEnabled: bool);
12929}
12930unsafe extern "C" {
12931 #[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."]
12932 pub fn otSrpClientIsServiceKeyRecordEnabled(aInstance: *mut otInstance) -> bool;
12933}
12934#[doc = " Represents a SRP client service pool entry."]
12935#[repr(C)]
12936#[derive(Debug, Copy, Clone)]
12937pub struct otSrpClientBuffersServiceEntry {
12938 #[doc = "< The SRP client service structure."]
12939 pub mService: otSrpClientService,
12940 #[doc = "< The SRP client TXT entry."]
12941 pub mTxtEntry: otDnsTxtEntry,
12942}
12943impl Default for otSrpClientBuffersServiceEntry {
12944 fn default() -> Self {
12945 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
12946 unsafe {
12947 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
12948 s.assume_init()
12949 }
12950 }
12951}
12952unsafe extern "C" {
12953 #[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."]
12954 pub fn otSrpClientBuffersGetHostNameString(
12955 aInstance: *mut otInstance,
12956 aSize: *mut u16,
12957 ) -> *mut ::std::os::raw::c_char;
12958}
12959unsafe extern "C" {
12960 #[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)."]
12961 pub fn otSrpClientBuffersGetHostAddressesArray(
12962 aInstance: *mut otInstance,
12963 aArrayLength: *mut u8,
12964 ) -> *mut otIp6Address;
12965}
12966unsafe extern "C" {
12967 #[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."]
12968 pub fn otSrpClientBuffersAllocateService(
12969 aInstance: *mut otInstance,
12970 ) -> *mut otSrpClientBuffersServiceEntry;
12971}
12972unsafe extern "C" {
12973 #[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)."]
12974 pub fn otSrpClientBuffersFreeService(
12975 aInstance: *mut otInstance,
12976 aService: *mut otSrpClientBuffersServiceEntry,
12977 );
12978}
12979unsafe extern "C" {
12980 #[doc = " Frees all previously allocated service entries.\n\n @param[in] aInstance A pointer to the OpenThread instance."]
12981 pub fn otSrpClientBuffersFreeAllServices(aInstance: *mut otInstance);
12982}
12983unsafe extern "C" {
12984 #[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."]
12985 pub fn otSrpClientBuffersGetServiceEntryServiceNameString(
12986 aEntry: *mut otSrpClientBuffersServiceEntry,
12987 aSize: *mut u16,
12988 ) -> *mut ::std::os::raw::c_char;
12989}
12990unsafe extern "C" {
12991 #[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."]
12992 pub fn otSrpClientBuffersGetServiceEntryInstanceNameString(
12993 aEntry: *mut otSrpClientBuffersServiceEntry,
12994 aSize: *mut u16,
12995 ) -> *mut ::std::os::raw::c_char;
12996}
12997unsafe extern "C" {
12998 #[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."]
12999 pub fn otSrpClientBuffersGetServiceEntryTxtBuffer(
13000 aEntry: *mut otSrpClientBuffersServiceEntry,
13001 aSize: *mut u16,
13002 ) -> *mut u8;
13003}
13004unsafe extern "C" {
13005 #[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."]
13006 pub fn otSrpClientBuffersGetSubTypeLabelsArray(
13007 aEntry: *mut otSrpClientBuffersServiceEntry,
13008 aArrayLength: *mut u16,
13009 ) -> *mut *const ::std::os::raw::c_char;
13010}
13011#[repr(C)]
13012#[derive(Debug, Copy, Clone)]
13013pub struct otSrpServerHost {
13014 _unused: [u8; 0],
13015}
13016#[repr(C)]
13017#[derive(Debug, Copy, Clone)]
13018pub struct otSrpServerService {
13019 _unused: [u8; 0],
13020}
13021#[doc = " The ID of a SRP service update transaction on the SRP Server."]
13022pub type otSrpServerServiceUpdateId = u32;
13023#[doc = "< The SRP server is disabled."]
13024pub const OT_SRP_SERVER_STATE_DISABLED: otSrpServerState = 0;
13025#[doc = "< The SRP server is enabled and running."]
13026pub const OT_SRP_SERVER_STATE_RUNNING: otSrpServerState = 1;
13027#[doc = "< The SRP server is enabled but stopped."]
13028pub const OT_SRP_SERVER_STATE_STOPPED: otSrpServerState = 2;
13029#[doc = " Represents the state of the SRP server."]
13030pub type otSrpServerState = ::std::os::raw::c_uint;
13031#[doc = "< Unicast address mode."]
13032pub const OT_SRP_SERVER_ADDRESS_MODE_UNICAST: otSrpServerAddressMode = 0;
13033#[doc = "< Anycast address mode."]
13034pub const OT_SRP_SERVER_ADDRESS_MODE_ANYCAST: otSrpServerAddressMode = 1;
13035#[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."]
13036pub type otSrpServerAddressMode = ::std::os::raw::c_uint;
13037#[doc = " Includes SRP server TTL configurations."]
13038#[repr(C)]
13039#[derive(Debug, Default, Copy, Clone)]
13040pub struct otSrpServerTtlConfig {
13041 #[doc = "< The minimum TTL in seconds."]
13042 pub mMinTtl: u32,
13043 #[doc = "< The maximum TTL in seconds."]
13044 pub mMaxTtl: u32,
13045}
13046#[doc = " Includes SRP server LEASE and KEY-LEASE configurations."]
13047#[repr(C)]
13048#[derive(Debug, Default, Copy, Clone)]
13049pub struct otSrpServerLeaseConfig {
13050 #[doc = "< The minimum LEASE interval in seconds."]
13051 pub mMinLease: u32,
13052 #[doc = "< The maximum LEASE interval in seconds."]
13053 pub mMaxLease: u32,
13054 #[doc = "< The minimum KEY-LEASE interval in seconds."]
13055 pub mMinKeyLease: u32,
13056 #[doc = "< The maximum KEY-LEASE interval in seconds."]
13057 pub mMaxKeyLease: u32,
13058}
13059#[doc = " Includes SRP server lease information of a host/service."]
13060#[repr(C)]
13061#[derive(Debug, Default, Copy, Clone)]
13062pub struct otSrpServerLeaseInfo {
13063 #[doc = "< The lease time of a host/service in milliseconds."]
13064 pub mLease: u32,
13065 #[doc = "< The key lease time of a host/service in milliseconds."]
13066 pub mKeyLease: u32,
13067 #[doc = "< The remaining lease time of the host/service in milliseconds."]
13068 pub mRemainingLease: u32,
13069 #[doc = "< The remaining key lease time of a host/service in milliseconds."]
13070 pub mRemainingKeyLease: u32,
13071}
13072#[doc = " Includes the statistics of SRP server responses."]
13073#[repr(C)]
13074#[derive(Debug, Default, Copy, Clone)]
13075pub struct otSrpServerResponseCounters {
13076 #[doc = "< The number of successful responses."]
13077 pub mSuccess: u32,
13078 #[doc = "< The number of server failure responses."]
13079 pub mServerFailure: u32,
13080 #[doc = "< The number of format error responses."]
13081 pub mFormatError: u32,
13082 #[doc = "< The number of 'name exists' responses."]
13083 pub mNameExists: u32,
13084 #[doc = "< The number of refused responses."]
13085 pub mRefused: u32,
13086 #[doc = "< The number of other responses."]
13087 pub mOther: u32,
13088}
13089unsafe extern "C" {
13090 #[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."]
13091 pub fn otSrpServerGetDomain(aInstance: *mut otInstance) -> *const ::std::os::raw::c_char;
13092}
13093unsafe extern "C" {
13094 #[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."]
13095 pub fn otSrpServerSetDomain(
13096 aInstance: *mut otInstance,
13097 aDomain: *const ::std::os::raw::c_char,
13098 ) -> otError;
13099}
13100unsafe extern "C" {
13101 #[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."]
13102 pub fn otSrpServerGetState(aInstance: *mut otInstance) -> otSrpServerState;
13103}
13104unsafe extern "C" {
13105 #[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."]
13106 pub fn otSrpServerGetPort(aInstance: *mut otInstance) -> u16;
13107}
13108unsafe extern "C" {
13109 #[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."]
13110 pub fn otSrpServerGetAddressMode(aInstance: *mut otInstance) -> otSrpServerAddressMode;
13111}
13112unsafe extern "C" {
13113 #[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."]
13114 pub fn otSrpServerSetAddressMode(
13115 aInstance: *mut otInstance,
13116 aMode: otSrpServerAddressMode,
13117 ) -> otError;
13118}
13119unsafe extern "C" {
13120 #[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."]
13121 pub fn otSrpServerGetAnycastModeSequenceNumber(aInstance: *mut otInstance) -> u8;
13122}
13123unsafe extern "C" {
13124 #[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."]
13125 pub fn otSrpServerSetAnycastModeSequenceNumber(
13126 aInstance: *mut otInstance,
13127 aSequenceNumber: u8,
13128 ) -> otError;
13129}
13130unsafe extern "C" {
13131 #[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."]
13132 pub fn otSrpServerSetEnabled(aInstance: *mut otInstance, aEnabled: bool);
13133}
13134unsafe extern "C" {
13135 #[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."]
13136 pub fn otSrpServerSetAutoEnableMode(aInstance: *mut otInstance, aEnabled: bool);
13137}
13138unsafe extern "C" {
13139 #[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."]
13140 pub fn otSrpServerIsAutoEnableMode(aInstance: *mut otInstance) -> bool;
13141}
13142unsafe extern "C" {
13143 #[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."]
13144 pub fn otSrpServerGetTtlConfig(
13145 aInstance: *mut otInstance,
13146 aTtlConfig: *mut otSrpServerTtlConfig,
13147 );
13148}
13149unsafe extern "C" {
13150 #[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."]
13151 pub fn otSrpServerSetTtlConfig(
13152 aInstance: *mut otInstance,
13153 aTtlConfig: *const otSrpServerTtlConfig,
13154 ) -> otError;
13155}
13156unsafe extern "C" {
13157 #[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."]
13158 pub fn otSrpServerGetLeaseConfig(
13159 aInstance: *mut otInstance,
13160 aLeaseConfig: *mut otSrpServerLeaseConfig,
13161 );
13162}
13163unsafe extern "C" {
13164 #[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."]
13165 pub fn otSrpServerSetLeaseConfig(
13166 aInstance: *mut otInstance,
13167 aLeaseConfig: *const otSrpServerLeaseConfig,
13168 ) -> otError;
13169}
13170#[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"]
13171pub type otSrpServerServiceUpdateHandler = ::std::option::Option<
13172 unsafe extern "C" fn(
13173 aId: otSrpServerServiceUpdateId,
13174 aHost: *const otSrpServerHost,
13175 aTimeout: u32,
13176 aContext: *mut ::std::os::raw::c_void,
13177 ),
13178>;
13179unsafe extern "C" {
13180 #[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."]
13181 pub fn otSrpServerSetServiceUpdateHandler(
13182 aInstance: *mut otInstance,
13183 aServiceHandler: otSrpServerServiceUpdateHandler,
13184 aContext: *mut ::std::os::raw::c_void,
13185 );
13186}
13187unsafe extern "C" {
13188 #[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."]
13189 pub fn otSrpServerHandleServiceUpdateResult(
13190 aInstance: *mut otInstance,
13191 aId: otSrpServerServiceUpdateId,
13192 aError: otError,
13193 );
13194}
13195unsafe extern "C" {
13196 #[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."]
13197 pub fn otSrpServerGetNextHost(
13198 aInstance: *mut otInstance,
13199 aHost: *const otSrpServerHost,
13200 ) -> *const otSrpServerHost;
13201}
13202unsafe extern "C" {
13203 #[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."]
13204 pub fn otSrpServerGetResponseCounters(
13205 aInstance: *mut otInstance,
13206 ) -> *const otSrpServerResponseCounters;
13207}
13208unsafe extern "C" {
13209 #[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."]
13210 pub fn otSrpServerHostIsDeleted(aHost: *const otSrpServerHost) -> bool;
13211}
13212unsafe extern "C" {
13213 #[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."]
13214 pub fn otSrpServerHostGetFullName(
13215 aHost: *const otSrpServerHost,
13216 ) -> *const ::std::os::raw::c_char;
13217}
13218unsafe extern "C" {
13219 #[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."]
13220 pub fn otSrpServerHostMatchesFullName(
13221 aHost: *const otSrpServerHost,
13222 aFullName: *const ::std::os::raw::c_char,
13223 ) -> bool;
13224}
13225unsafe extern "C" {
13226 #[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."]
13227 pub fn otSrpServerHostGetAddresses(
13228 aHost: *const otSrpServerHost,
13229 aAddressesNum: *mut u8,
13230 ) -> *const otIp6Address;
13231}
13232unsafe extern "C" {
13233 #[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."]
13234 pub fn otSrpServerHostGetLeaseInfo(
13235 aHost: *const otSrpServerHost,
13236 aLeaseInfo: *mut otSrpServerLeaseInfo,
13237 );
13238}
13239unsafe extern "C" {
13240 #[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."]
13241 pub fn otSrpServerHostGetNextService(
13242 aHost: *const otSrpServerHost,
13243 aService: *const otSrpServerService,
13244 ) -> *const otSrpServerService;
13245}
13246unsafe extern "C" {
13247 #[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."]
13248 pub fn otSrpServerServiceIsDeleted(aService: *const otSrpServerService) -> bool;
13249}
13250unsafe extern "C" {
13251 #[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."]
13252 pub fn otSrpServerServiceGetInstanceName(
13253 aService: *const otSrpServerService,
13254 ) -> *const ::std::os::raw::c_char;
13255}
13256unsafe extern "C" {
13257 #[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."]
13258 pub fn otSrpServerServiceMatchesInstanceName(
13259 aService: *const otSrpServerService,
13260 aInstanceName: *const ::std::os::raw::c_char,
13261 ) -> bool;
13262}
13263unsafe extern "C" {
13264 #[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.."]
13265 pub fn otSrpServerServiceGetInstanceLabel(
13266 aService: *const otSrpServerService,
13267 ) -> *const ::std::os::raw::c_char;
13268}
13269unsafe extern "C" {
13270 #[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."]
13271 pub fn otSrpServerServiceGetServiceName(
13272 aService: *const otSrpServerService,
13273 ) -> *const ::std::os::raw::c_char;
13274}
13275unsafe extern "C" {
13276 #[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."]
13277 pub fn otSrpServerServiceMatchesServiceName(
13278 aService: *const otSrpServerService,
13279 aServiceName: *const ::std::os::raw::c_char,
13280 ) -> bool;
13281}
13282unsafe extern "C" {
13283 #[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."]
13284 pub fn otSrpServerServiceGetNumberOfSubTypes(aService: *const otSrpServerService) -> u16;
13285}
13286unsafe extern "C" {
13287 #[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."]
13288 pub fn otSrpServerServiceGetSubTypeServiceNameAt(
13289 aService: *const otSrpServerService,
13290 aIndex: u16,
13291 ) -> *const ::std::os::raw::c_char;
13292}
13293unsafe extern "C" {
13294 #[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."]
13295 pub fn otSrpServerServiceHasSubTypeServiceName(
13296 aService: *const otSrpServerService,
13297 aSubTypeServiceName: *const ::std::os::raw::c_char,
13298 ) -> bool;
13299}
13300unsafe extern "C" {
13301 #[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."]
13302 pub fn otSrpServerParseSubTypeServiceName(
13303 aSubTypeServiceName: *const ::std::os::raw::c_char,
13304 aLabel: *mut ::std::os::raw::c_char,
13305 aLabelSize: u8,
13306 ) -> otError;
13307}
13308unsafe extern "C" {
13309 #[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."]
13310 pub fn otSrpServerServiceGetPort(aService: *const otSrpServerService) -> u16;
13311}
13312unsafe extern "C" {
13313 #[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."]
13314 pub fn otSrpServerServiceGetWeight(aService: *const otSrpServerService) -> u16;
13315}
13316unsafe extern "C" {
13317 #[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."]
13318 pub fn otSrpServerServiceGetPriority(aService: *const otSrpServerService) -> u16;
13319}
13320unsafe extern "C" {
13321 #[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.."]
13322 pub fn otSrpServerServiceGetTtl(aService: *const otSrpServerService) -> u32;
13323}
13324unsafe extern "C" {
13325 #[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)."]
13326 pub fn otSrpServerServiceGetTxtData(
13327 aService: *const otSrpServerService,
13328 aDataLength: *mut u16,
13329 ) -> *const u8;
13330}
13331unsafe extern "C" {
13332 #[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."]
13333 pub fn otSrpServerServiceGetHost(aService: *const otSrpServerService)
13334 -> *const otSrpServerHost;
13335}
13336unsafe extern "C" {
13337 #[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."]
13338 pub fn otSrpServerServiceGetLeaseInfo(
13339 aService: *const otSrpServerService,
13340 aLeaseInfo: *mut otSrpServerLeaseInfo,
13341 );
13342}
13343unsafe extern "C" {
13344 #[doc = " Run all queued OpenThread tasklets at the time this is called.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
13345 pub fn otTaskletsProcess(aInstance: *mut otInstance);
13346}
13347unsafe extern "C" {
13348 #[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."]
13349 pub fn otTaskletsArePending(aInstance: *mut otInstance) -> bool;
13350}
13351unsafe extern "C" {
13352 #[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."]
13353 pub fn otTaskletsSignalPending(aInstance: *mut otInstance);
13354}
13355#[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."]
13356#[repr(C)]
13357#[derive(Debug, Copy, Clone)]
13358pub struct otLinkedBuffer {
13359 #[doc = "< Pointer to the next linked buffer in the chain, or NULL if it is the end."]
13360 pub mNext: *mut otLinkedBuffer,
13361 #[doc = "< Pointer to data referenced by this linked buffer."]
13362 pub mData: *const u8,
13363 #[doc = "< Length of this linked buffer (number of bytes)."]
13364 pub mLength: usize,
13365}
13366impl Default for otLinkedBuffer {
13367 fn default() -> Self {
13368 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13369 unsafe {
13370 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13371 s.assume_init()
13372 }
13373 }
13374}
13375#[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."]
13376pub type otTcpEstablished =
13377 ::std::option::Option<unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint)>;
13378#[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."]
13379pub type otTcpSendDone = ::std::option::Option<
13380 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aData: *mut otLinkedBuffer),
13381>;
13382#[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)."]
13383pub type otTcpForwardProgress = ::std::option::Option<
13384 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aInSendBuffer: usize, aBacklog: usize),
13385>;
13386#[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."]
13387pub type otTcpReceiveAvailable = ::std::option::Option<
13388 unsafe extern "C" fn(
13389 aEndpoint: *mut otTcpEndpoint,
13390 aBytesAvailable: usize,
13391 aEndOfStream: bool,
13392 aBytesRemaining: usize,
13393 ),
13394>;
13395pub const OT_TCP_DISCONNECTED_REASON_NORMAL: otTcpDisconnectedReason = 0;
13396pub const OT_TCP_DISCONNECTED_REASON_REFUSED: otTcpDisconnectedReason = 1;
13397pub const OT_TCP_DISCONNECTED_REASON_RESET: otTcpDisconnectedReason = 2;
13398pub const OT_TCP_DISCONNECTED_REASON_TIME_WAIT: otTcpDisconnectedReason = 3;
13399pub const OT_TCP_DISCONNECTED_REASON_TIMED_OUT: otTcpDisconnectedReason = 4;
13400pub type otTcpDisconnectedReason = ::std::os::raw::c_uint;
13401#[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."]
13402pub type otTcpDisconnected = ::std::option::Option<
13403 unsafe extern "C" fn(aEndpoint: *mut otTcpEndpoint, aReason: otTcpDisconnectedReason),
13404>;
13405#[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."]
13406#[repr(C)]
13407#[derive(Copy, Clone)]
13408pub struct otTcpEndpoint {
13409 pub mTcb: otTcpEndpoint__bindgen_ty_1,
13410 #[doc = "< A pointer to the next TCP endpoint (internal use only)"]
13411 pub mNext: *mut otTcpEndpoint,
13412 #[doc = "< A pointer to application-specific context"]
13413 pub mContext: *mut ::std::os::raw::c_void,
13414 #[doc = "< \"Established\" callback function"]
13415 pub mEstablishedCallback: otTcpEstablished,
13416 #[doc = "< \"Send done\" callback function"]
13417 pub mSendDoneCallback: otTcpSendDone,
13418 #[doc = "< \"Forward progress\" callback function"]
13419 pub mForwardProgressCallback: otTcpForwardProgress,
13420 #[doc = "< \"Receive available\" callback function"]
13421 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
13422 #[doc = "< \"Disconnected\" callback function"]
13423 pub mDisconnectedCallback: otTcpDisconnected,
13424 pub mTimers: [u32; 4usize],
13425 pub mReceiveLinks: [otLinkedBuffer; 2usize],
13426 pub mSockAddr: otSockAddr,
13427 pub mPendingCallbacks: u8,
13428}
13429#[repr(C)]
13430#[derive(Copy, Clone)]
13431pub union otTcpEndpoint__bindgen_ty_1 {
13432 pub mSize: [u8; 680usize],
13433 pub mAlign: u64,
13434}
13435impl Default for otTcpEndpoint__bindgen_ty_1 {
13436 fn default() -> Self {
13437 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13438 unsafe {
13439 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13440 s.assume_init()
13441 }
13442 }
13443}
13444impl Default for otTcpEndpoint {
13445 fn default() -> Self {
13446 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13447 unsafe {
13448 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13449 s.assume_init()
13450 }
13451 }
13452}
13453#[doc = " Contains arguments to the otTcpEndpointInitialize() function."]
13454#[repr(C)]
13455#[derive(Debug, Copy, Clone)]
13456pub struct otTcpEndpointInitializeArgs {
13457 #[doc = "< Pointer to application-specific context"]
13458 pub mContext: *mut ::std::os::raw::c_void,
13459 #[doc = "< \"Established\" callback function"]
13460 pub mEstablishedCallback: otTcpEstablished,
13461 #[doc = "< \"Send done\" callback function"]
13462 pub mSendDoneCallback: otTcpSendDone,
13463 #[doc = "< \"Forward progress\" callback function"]
13464 pub mForwardProgressCallback: otTcpForwardProgress,
13465 #[doc = "< \"Receive available\" callback function"]
13466 pub mReceiveAvailableCallback: otTcpReceiveAvailable,
13467 #[doc = "< \"Disconnected\" callback function"]
13468 pub mDisconnectedCallback: otTcpDisconnected,
13469 #[doc = "< Pointer to memory provided to the system for the TCP receive buffer"]
13470 pub mReceiveBuffer: *mut ::std::os::raw::c_void,
13471 #[doc = "< Size of memory provided to the system for the TCP receive buffer"]
13472 pub mReceiveBufferSize: usize,
13473}
13474impl Default for otTcpEndpointInitializeArgs {
13475 fn default() -> Self {
13476 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13477 unsafe {
13478 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13479 s.assume_init()
13480 }
13481 }
13482}
13483unsafe extern "C" {
13484 #[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."]
13485 pub fn otTcpEndpointInitialize(
13486 aInstance: *mut otInstance,
13487 aEndpoint: *mut otTcpEndpoint,
13488 aArgs: *const otTcpEndpointInitializeArgs,
13489 ) -> otError;
13490}
13491unsafe extern "C" {
13492 #[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."]
13493 pub fn otTcpEndpointGetInstance(aEndpoint: *mut otTcpEndpoint) -> *mut otInstance;
13494}
13495unsafe extern "C" {
13496 #[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."]
13497 pub fn otTcpEndpointGetContext(aEndpoint: *mut otTcpEndpoint) -> *mut ::std::os::raw::c_void;
13498}
13499unsafe extern "C" {
13500 #[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."]
13501 pub fn otTcpGetLocalAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
13502}
13503unsafe extern "C" {
13504 #[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."]
13505 pub fn otTcpGetPeerAddress(aEndpoint: *const otTcpEndpoint) -> *const otSockAddr;
13506}
13507unsafe extern "C" {
13508 #[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."]
13509 pub fn otTcpBind(aEndpoint: *mut otTcpEndpoint, aSockName: *const otSockAddr) -> otError;
13510}
13511pub const OT_TCP_CONNECT_NO_FAST_OPEN: _bindgen_ty_11 = 1;
13512#[doc = " Defines flags passed to otTcpConnect()."]
13513pub type _bindgen_ty_11 = ::std::os::raw::c_uint;
13514unsafe extern "C" {
13515 #[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."]
13516 pub fn otTcpConnect(
13517 aEndpoint: *mut otTcpEndpoint,
13518 aSockName: *const otSockAddr,
13519 aFlags: u32,
13520 ) -> otError;
13521}
13522pub const OT_TCP_SEND_MORE_TO_COME: _bindgen_ty_12 = 1;
13523#[doc = " Defines flags passed to @p otTcpSendByReference."]
13524pub type _bindgen_ty_12 = ::std::os::raw::c_uint;
13525unsafe extern "C" {
13526 #[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."]
13527 pub fn otTcpSendByReference(
13528 aEndpoint: *mut otTcpEndpoint,
13529 aBuffer: *mut otLinkedBuffer,
13530 aFlags: u32,
13531 ) -> otError;
13532}
13533unsafe extern "C" {
13534 #[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."]
13535 pub fn otTcpSendByExtension(
13536 aEndpoint: *mut otTcpEndpoint,
13537 aNumBytes: usize,
13538 aFlags: u32,
13539 ) -> otError;
13540}
13541unsafe extern "C" {
13542 #[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."]
13543 pub fn otTcpReceiveByReference(
13544 aEndpoint: *mut otTcpEndpoint,
13545 aBuffer: *mut *const otLinkedBuffer,
13546 ) -> otError;
13547}
13548unsafe extern "C" {
13549 #[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."]
13550 pub fn otTcpReceiveContiguify(aEndpoint: *mut otTcpEndpoint) -> otError;
13551}
13552unsafe extern "C" {
13553 #[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."]
13554 pub fn otTcpCommitReceive(
13555 aEndpoint: *mut otTcpEndpoint,
13556 aNumBytes: usize,
13557 aFlags: u32,
13558 ) -> otError;
13559}
13560unsafe extern "C" {
13561 #[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."]
13562 pub fn otTcpSendEndOfStream(aEndpoint: *mut otTcpEndpoint) -> otError;
13563}
13564unsafe extern "C" {
13565 #[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."]
13566 pub fn otTcpAbort(aEndpoint: *mut otTcpEndpoint) -> otError;
13567}
13568unsafe extern "C" {
13569 #[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."]
13570 pub fn otTcpEndpointDeinitialize(aEndpoint: *mut otTcpEndpoint) -> otError;
13571}
13572#[doc = "< Accept the incoming connection."]
13573pub const OT_TCP_INCOMING_CONNECTION_ACTION_ACCEPT: otTcpIncomingConnectionAction = 0;
13574#[doc = "< Defer (silently ignore) the incoming connection."]
13575pub const OT_TCP_INCOMING_CONNECTION_ACTION_DEFER: otTcpIncomingConnectionAction = 1;
13576#[doc = "< Refuse the incoming connection."]
13577pub const OT_TCP_INCOMING_CONNECTION_ACTION_REFUSE: otTcpIncomingConnectionAction = 2;
13578#[doc = " Defines incoming connection actions.\n\n This is used in otTcpAcceptReady() callback."]
13579pub type otTcpIncomingConnectionAction = ::std::os::raw::c_uint;
13580#[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."]
13581pub type otTcpAcceptReady = ::std::option::Option<
13582 unsafe extern "C" fn(
13583 aListener: *mut otTcpListener,
13584 aPeer: *const otSockAddr,
13585 aAcceptInto: *mut *mut otTcpEndpoint,
13586 ) -> otTcpIncomingConnectionAction,
13587>;
13588#[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."]
13589pub type otTcpAcceptDone = ::std::option::Option<
13590 unsafe extern "C" fn(
13591 aListener: *mut otTcpListener,
13592 aEndpoint: *mut otTcpEndpoint,
13593 aPeer: *const otSockAddr,
13594 ),
13595>;
13596#[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."]
13597#[repr(C)]
13598#[derive(Copy, Clone)]
13599pub struct otTcpListener {
13600 pub mTcbListen: otTcpListener__bindgen_ty_1,
13601 #[doc = "< A pointer to the next TCP listener (internal use only)"]
13602 pub mNext: *mut otTcpListener,
13603 #[doc = "< A pointer to application-specific context"]
13604 pub mContext: *mut ::std::os::raw::c_void,
13605 #[doc = "< \"Accept ready\" callback function"]
13606 pub mAcceptReadyCallback: otTcpAcceptReady,
13607 #[doc = "< \"Accept done\" callback function"]
13608 pub mAcceptDoneCallback: otTcpAcceptDone,
13609}
13610#[repr(C)]
13611#[derive(Copy, Clone)]
13612pub union otTcpListener__bindgen_ty_1 {
13613 pub mSize: [u8; 40usize],
13614 pub mAlign: *mut ::std::os::raw::c_void,
13615}
13616impl Default for otTcpListener__bindgen_ty_1 {
13617 fn default() -> Self {
13618 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13619 unsafe {
13620 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13621 s.assume_init()
13622 }
13623 }
13624}
13625impl Default for otTcpListener {
13626 fn default() -> Self {
13627 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13628 unsafe {
13629 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13630 s.assume_init()
13631 }
13632 }
13633}
13634#[doc = " Contains arguments to the otTcpListenerInitialize() function."]
13635#[repr(C)]
13636#[derive(Debug, Copy, Clone)]
13637pub struct otTcpListenerInitializeArgs {
13638 #[doc = "< Pointer to application-specific context"]
13639 pub mContext: *mut ::std::os::raw::c_void,
13640 #[doc = "< \"Accept ready\" callback function"]
13641 pub mAcceptReadyCallback: otTcpAcceptReady,
13642 #[doc = "< \"Accept done\" callback function"]
13643 pub mAcceptDoneCallback: otTcpAcceptDone,
13644}
13645impl Default for otTcpListenerInitializeArgs {
13646 fn default() -> Self {
13647 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13648 unsafe {
13649 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13650 s.assume_init()
13651 }
13652 }
13653}
13654unsafe extern "C" {
13655 #[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."]
13656 pub fn otTcpListenerInitialize(
13657 aInstance: *mut otInstance,
13658 aListener: *mut otTcpListener,
13659 aArgs: *const otTcpListenerInitializeArgs,
13660 ) -> otError;
13661}
13662unsafe extern "C" {
13663 #[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."]
13664 pub fn otTcpListenerGetInstance(aListener: *mut otTcpListener) -> *mut otInstance;
13665}
13666unsafe extern "C" {
13667 #[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."]
13668 pub fn otTcpListenerGetContext(aListener: *mut otTcpListener) -> *mut ::std::os::raw::c_void;
13669}
13670unsafe extern "C" {
13671 #[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."]
13672 pub fn otTcpListen(aListener: *mut otTcpListener, aSockName: *const otSockAddr) -> otError;
13673}
13674unsafe extern "C" {
13675 #[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."]
13676 pub fn otTcpStopListening(aListener: *mut otTcpListener) -> otError;
13677}
13678unsafe extern "C" {
13679 #[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."]
13680 pub fn otTcpListenerDeinitialize(aListener: *mut otTcpListener) -> otError;
13681}
13682#[doc = " Holds diagnostic information for a Thread Child"]
13683#[repr(C)]
13684#[derive(Debug, Default, Copy, Clone)]
13685pub struct otChildInfo {
13686 #[doc = "< IEEE 802.15.4 Extended Address"]
13687 pub mExtAddress: otExtAddress,
13688 #[doc = "< Timeout"]
13689 pub mTimeout: u32,
13690 #[doc = "< Seconds since last heard"]
13691 pub mAge: u32,
13692 #[doc = "< Seconds since attach (requires `OPENTHREAD_CONFIG_UPTIME_ENABLE`)"]
13693 pub mConnectionTime: u64,
13694 #[doc = "< RLOC16"]
13695 pub mRloc16: u16,
13696 #[doc = "< Child ID"]
13697 pub mChildId: u16,
13698 #[doc = "< Network Data Version"]
13699 pub mNetworkDataVersion: u8,
13700 #[doc = "< Link Quality In"]
13701 pub mLinkQualityIn: u8,
13702 #[doc = "< Average RSSI"]
13703 pub mAverageRssi: i8,
13704 #[doc = "< Last observed RSSI"]
13705 pub mLastRssi: i8,
13706 #[doc = "< Frame error rate (0xffff->100%). Requires error tracking feature."]
13707 pub mFrameErrorRate: u16,
13708 #[doc = "< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature."]
13709 pub mMessageErrorRate: u16,
13710 #[doc = "< Number of queued messages for the child."]
13711 pub mQueuedMessageCnt: u16,
13712 #[doc = "< Supervision interval (in seconds)."]
13713 pub mSupervisionInterval: u16,
13714 #[doc = "< MLE version"]
13715 pub mVersion: u8,
13716 pub _bitfield_align_1: [u8; 0],
13717 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13718 pub __bindgen_padding_0: [u16; 3usize],
13719}
13720impl otChildInfo {
13721 #[inline]
13722 pub fn mRxOnWhenIdle(&self) -> bool {
13723 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13724 }
13725 #[inline]
13726 pub fn set_mRxOnWhenIdle(&mut self, val: bool) {
13727 unsafe {
13728 let val: u8 = ::std::mem::transmute(val);
13729 self._bitfield_1.set(0usize, 1u8, val as u64)
13730 }
13731 }
13732 #[inline]
13733 pub unsafe fn mRxOnWhenIdle_raw(this: *const Self) -> bool {
13734 unsafe {
13735 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13736 ::std::ptr::addr_of!((*this)._bitfield_1),
13737 0usize,
13738 1u8,
13739 ) as u8)
13740 }
13741 }
13742 #[inline]
13743 pub unsafe fn set_mRxOnWhenIdle_raw(this: *mut Self, val: bool) {
13744 unsafe {
13745 let val: u8 = ::std::mem::transmute(val);
13746 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13747 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13748 0usize,
13749 1u8,
13750 val as u64,
13751 )
13752 }
13753 }
13754 #[inline]
13755 pub fn mFullThreadDevice(&self) -> bool {
13756 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13757 }
13758 #[inline]
13759 pub fn set_mFullThreadDevice(&mut self, val: bool) {
13760 unsafe {
13761 let val: u8 = ::std::mem::transmute(val);
13762 self._bitfield_1.set(1usize, 1u8, val as u64)
13763 }
13764 }
13765 #[inline]
13766 pub unsafe fn mFullThreadDevice_raw(this: *const Self) -> bool {
13767 unsafe {
13768 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13769 ::std::ptr::addr_of!((*this)._bitfield_1),
13770 1usize,
13771 1u8,
13772 ) as u8)
13773 }
13774 }
13775 #[inline]
13776 pub unsafe fn set_mFullThreadDevice_raw(this: *mut Self, val: bool) {
13777 unsafe {
13778 let val: u8 = ::std::mem::transmute(val);
13779 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13780 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13781 1usize,
13782 1u8,
13783 val as u64,
13784 )
13785 }
13786 }
13787 #[inline]
13788 pub fn mFullNetworkData(&self) -> bool {
13789 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
13790 }
13791 #[inline]
13792 pub fn set_mFullNetworkData(&mut self, val: bool) {
13793 unsafe {
13794 let val: u8 = ::std::mem::transmute(val);
13795 self._bitfield_1.set(2usize, 1u8, val as u64)
13796 }
13797 }
13798 #[inline]
13799 pub unsafe fn mFullNetworkData_raw(this: *const Self) -> bool {
13800 unsafe {
13801 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13802 ::std::ptr::addr_of!((*this)._bitfield_1),
13803 2usize,
13804 1u8,
13805 ) as u8)
13806 }
13807 }
13808 #[inline]
13809 pub unsafe fn set_mFullNetworkData_raw(this: *mut Self, val: bool) {
13810 unsafe {
13811 let val: u8 = ::std::mem::transmute(val);
13812 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13813 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13814 2usize,
13815 1u8,
13816 val as u64,
13817 )
13818 }
13819 }
13820 #[inline]
13821 pub fn mIsStateRestoring(&self) -> bool {
13822 unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
13823 }
13824 #[inline]
13825 pub fn set_mIsStateRestoring(&mut self, val: bool) {
13826 unsafe {
13827 let val: u8 = ::std::mem::transmute(val);
13828 self._bitfield_1.set(3usize, 1u8, val as u64)
13829 }
13830 }
13831 #[inline]
13832 pub unsafe fn mIsStateRestoring_raw(this: *const Self) -> bool {
13833 unsafe {
13834 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13835 ::std::ptr::addr_of!((*this)._bitfield_1),
13836 3usize,
13837 1u8,
13838 ) as u8)
13839 }
13840 }
13841 #[inline]
13842 pub unsafe fn set_mIsStateRestoring_raw(this: *mut Self, val: bool) {
13843 unsafe {
13844 let val: u8 = ::std::mem::transmute(val);
13845 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13846 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13847 3usize,
13848 1u8,
13849 val as u64,
13850 )
13851 }
13852 }
13853 #[inline]
13854 pub fn mIsCslSynced(&self) -> bool {
13855 unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
13856 }
13857 #[inline]
13858 pub fn set_mIsCslSynced(&mut self, val: bool) {
13859 unsafe {
13860 let val: u8 = ::std::mem::transmute(val);
13861 self._bitfield_1.set(4usize, 1u8, val as u64)
13862 }
13863 }
13864 #[inline]
13865 pub unsafe fn mIsCslSynced_raw(this: *const Self) -> bool {
13866 unsafe {
13867 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13868 ::std::ptr::addr_of!((*this)._bitfield_1),
13869 4usize,
13870 1u8,
13871 ) as u8)
13872 }
13873 }
13874 #[inline]
13875 pub unsafe fn set_mIsCslSynced_raw(this: *mut Self, val: bool) {
13876 unsafe {
13877 let val: u8 = ::std::mem::transmute(val);
13878 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13879 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13880 4usize,
13881 1u8,
13882 val as u64,
13883 )
13884 }
13885 }
13886 #[inline]
13887 pub fn new_bitfield_1(
13888 mRxOnWhenIdle: bool,
13889 mFullThreadDevice: bool,
13890 mFullNetworkData: bool,
13891 mIsStateRestoring: bool,
13892 mIsCslSynced: bool,
13893 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
13894 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
13895 __bindgen_bitfield_unit.set(0usize, 1u8, {
13896 let mRxOnWhenIdle: u8 = unsafe { ::std::mem::transmute(mRxOnWhenIdle) };
13897 mRxOnWhenIdle as u64
13898 });
13899 __bindgen_bitfield_unit.set(1usize, 1u8, {
13900 let mFullThreadDevice: u8 = unsafe { ::std::mem::transmute(mFullThreadDevice) };
13901 mFullThreadDevice as u64
13902 });
13903 __bindgen_bitfield_unit.set(2usize, 1u8, {
13904 let mFullNetworkData: u8 = unsafe { ::std::mem::transmute(mFullNetworkData) };
13905 mFullNetworkData as u64
13906 });
13907 __bindgen_bitfield_unit.set(3usize, 1u8, {
13908 let mIsStateRestoring: u8 = unsafe { ::std::mem::transmute(mIsStateRestoring) };
13909 mIsStateRestoring as u64
13910 });
13911 __bindgen_bitfield_unit.set(4usize, 1u8, {
13912 let mIsCslSynced: u8 = unsafe { ::std::mem::transmute(mIsCslSynced) };
13913 mIsCslSynced as u64
13914 });
13915 __bindgen_bitfield_unit
13916 }
13917}
13918pub type otChildIp6AddressIterator = u16;
13919pub const OT_CACHE_ENTRY_STATE_CACHED: otCacheEntryState = 0;
13920pub const OT_CACHE_ENTRY_STATE_SNOOPED: otCacheEntryState = 1;
13921pub const OT_CACHE_ENTRY_STATE_QUERY: otCacheEntryState = 2;
13922pub const OT_CACHE_ENTRY_STATE_RETRY_QUERY: otCacheEntryState = 3;
13923#[doc = " Defines the EID cache entry state."]
13924pub type otCacheEntryState = ::std::os::raw::c_uint;
13925#[doc = " Represents an EID cache entry."]
13926#[repr(C)]
13927#[derive(Copy, Clone)]
13928pub struct otCacheEntryInfo {
13929 #[doc = "< Target EID"]
13930 pub mTarget: otIp6Address,
13931 #[doc = "< RLOC16"]
13932 pub mRloc16: otShortAddress,
13933 #[doc = "< Entry state"]
13934 pub mState: otCacheEntryState,
13935 pub _bitfield_align_1: [u8; 0],
13936 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
13937 #[doc = "< Last transaction time (applicable in cached state)."]
13938 pub mLastTransTime: u32,
13939 #[doc = "< Mesh Local EID (applicable if entry in cached state)."]
13940 pub mMeshLocalEid: otIp6Address,
13941 #[doc = "< Timeout in seconds (applicable if in snooped/query/retry-query states)."]
13942 pub mTimeout: u16,
13943 #[doc = "< Retry delay in seconds (applicable if in query-retry state)."]
13944 pub mRetryDelay: u16,
13945}
13946impl Default for otCacheEntryInfo {
13947 fn default() -> Self {
13948 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
13949 unsafe {
13950 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
13951 s.assume_init()
13952 }
13953 }
13954}
13955impl otCacheEntryInfo {
13956 #[inline]
13957 pub fn mCanEvict(&self) -> bool {
13958 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
13959 }
13960 #[inline]
13961 pub fn set_mCanEvict(&mut self, val: bool) {
13962 unsafe {
13963 let val: u8 = ::std::mem::transmute(val);
13964 self._bitfield_1.set(0usize, 1u8, val as u64)
13965 }
13966 }
13967 #[inline]
13968 pub unsafe fn mCanEvict_raw(this: *const Self) -> bool {
13969 unsafe {
13970 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
13971 ::std::ptr::addr_of!((*this)._bitfield_1),
13972 0usize,
13973 1u8,
13974 ) as u8)
13975 }
13976 }
13977 #[inline]
13978 pub unsafe fn set_mCanEvict_raw(this: *mut Self, val: bool) {
13979 unsafe {
13980 let val: u8 = ::std::mem::transmute(val);
13981 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
13982 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
13983 0usize,
13984 1u8,
13985 val as u64,
13986 )
13987 }
13988 }
13989 #[inline]
13990 pub fn mRampDown(&self) -> bool {
13991 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
13992 }
13993 #[inline]
13994 pub fn set_mRampDown(&mut self, val: bool) {
13995 unsafe {
13996 let val: u8 = ::std::mem::transmute(val);
13997 self._bitfield_1.set(1usize, 1u8, val as u64)
13998 }
13999 }
14000 #[inline]
14001 pub unsafe fn mRampDown_raw(this: *const Self) -> bool {
14002 unsafe {
14003 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14004 ::std::ptr::addr_of!((*this)._bitfield_1),
14005 1usize,
14006 1u8,
14007 ) as u8)
14008 }
14009 }
14010 #[inline]
14011 pub unsafe fn set_mRampDown_raw(this: *mut Self, val: bool) {
14012 unsafe {
14013 let val: u8 = ::std::mem::transmute(val);
14014 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14015 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14016 1usize,
14017 1u8,
14018 val as u64,
14019 )
14020 }
14021 }
14022 #[inline]
14023 pub fn mValidLastTrans(&self) -> bool {
14024 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
14025 }
14026 #[inline]
14027 pub fn set_mValidLastTrans(&mut self, val: bool) {
14028 unsafe {
14029 let val: u8 = ::std::mem::transmute(val);
14030 self._bitfield_1.set(2usize, 1u8, val as u64)
14031 }
14032 }
14033 #[inline]
14034 pub unsafe fn mValidLastTrans_raw(this: *const Self) -> bool {
14035 unsafe {
14036 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14037 ::std::ptr::addr_of!((*this)._bitfield_1),
14038 2usize,
14039 1u8,
14040 ) as u8)
14041 }
14042 }
14043 #[inline]
14044 pub unsafe fn set_mValidLastTrans_raw(this: *mut Self, val: bool) {
14045 unsafe {
14046 let val: u8 = ::std::mem::transmute(val);
14047 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14048 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14049 2usize,
14050 1u8,
14051 val as u64,
14052 )
14053 }
14054 }
14055 #[inline]
14056 pub fn new_bitfield_1(
14057 mCanEvict: bool,
14058 mRampDown: bool,
14059 mValidLastTrans: bool,
14060 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
14061 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
14062 __bindgen_bitfield_unit.set(0usize, 1u8, {
14063 let mCanEvict: u8 = unsafe { ::std::mem::transmute(mCanEvict) };
14064 mCanEvict as u64
14065 });
14066 __bindgen_bitfield_unit.set(1usize, 1u8, {
14067 let mRampDown: u8 = unsafe { ::std::mem::transmute(mRampDown) };
14068 mRampDown as u64
14069 });
14070 __bindgen_bitfield_unit.set(2usize, 1u8, {
14071 let mValidLastTrans: u8 = unsafe { ::std::mem::transmute(mValidLastTrans) };
14072 mValidLastTrans as u64
14073 });
14074 __bindgen_bitfield_unit
14075 }
14076}
14077#[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)."]
14078#[repr(C)]
14079#[derive(Debug, Copy, Clone)]
14080pub struct otCacheEntryIterator {
14081 #[doc = "< Opaque data used by the core implementation. Should not be changed by user."]
14082 pub mData: [*const ::std::os::raw::c_void; 2usize],
14083}
14084impl Default for otCacheEntryIterator {
14085 fn default() -> Self {
14086 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14087 unsafe {
14088 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14089 s.assume_init()
14090 }
14091 }
14092}
14093unsafe extern "C" {
14094 #[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"]
14095 pub fn otThreadGetMaxAllowedChildren(aInstance: *mut otInstance) -> u16;
14096}
14097unsafe extern "C" {
14098 #[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"]
14099 pub fn otThreadSetMaxAllowedChildren(aInstance: *mut otInstance, aMaxChildren: u16) -> otError;
14100}
14101unsafe extern "C" {
14102 #[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."]
14103 pub fn otThreadIsRouterEligible(aInstance: *mut otInstance) -> bool;
14104}
14105unsafe extern "C" {
14106 #[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."]
14107 pub fn otThreadSetRouterEligible(aInstance: *mut otInstance, aEligible: bool) -> otError;
14108}
14109unsafe extern "C" {
14110 #[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)"]
14111 pub fn otThreadSetPreferredRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
14112}
14113#[doc = "< Battery powered."]
14114pub const OT_POWER_SUPPLY_BATTERY: otPowerSupply = 0;
14115#[doc = "< Externally powered (mains-powered)."]
14116pub const OT_POWER_SUPPLY_EXTERNAL: otPowerSupply = 1;
14117#[doc = "< Stable external power with a battery backup or UPS."]
14118pub const OT_POWER_SUPPLY_EXTERNAL_STABLE: otPowerSupply = 2;
14119#[doc = "< Potentially unstable ext power (e.g. light bulb powered via a switch)."]
14120pub const OT_POWER_SUPPLY_EXTERNAL_UNSTABLE: otPowerSupply = 3;
14121#[doc = " Represents the power supply property on a device.\n\n This is used as a property in `otDeviceProperties` to calculate the leader weight."]
14122pub type otPowerSupply = ::std::os::raw::c_uint;
14123#[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."]
14124#[repr(C)]
14125#[derive(Debug, Copy, Clone)]
14126pub struct otDeviceProperties {
14127 #[doc = "< Power supply config."]
14128 pub mPowerSupply: otPowerSupply,
14129 pub _bitfield_align_1: [u8; 0],
14130 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
14131 #[doc = "< Weight adjustment. Should be -16 to +16 (clamped otherwise)."]
14132 pub mLeaderWeightAdjustment: i8,
14133}
14134impl Default for otDeviceProperties {
14135 fn default() -> Self {
14136 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14137 unsafe {
14138 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14139 s.assume_init()
14140 }
14141 }
14142}
14143impl otDeviceProperties {
14144 #[inline]
14145 pub fn mIsBorderRouter(&self) -> bool {
14146 unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
14147 }
14148 #[inline]
14149 pub fn set_mIsBorderRouter(&mut self, val: bool) {
14150 unsafe {
14151 let val: u8 = ::std::mem::transmute(val);
14152 self._bitfield_1.set(0usize, 1u8, val as u64)
14153 }
14154 }
14155 #[inline]
14156 pub unsafe fn mIsBorderRouter_raw(this: *const Self) -> bool {
14157 unsafe {
14158 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14159 ::std::ptr::addr_of!((*this)._bitfield_1),
14160 0usize,
14161 1u8,
14162 ) as u8)
14163 }
14164 }
14165 #[inline]
14166 pub unsafe fn set_mIsBorderRouter_raw(this: *mut Self, val: bool) {
14167 unsafe {
14168 let val: u8 = ::std::mem::transmute(val);
14169 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14170 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14171 0usize,
14172 1u8,
14173 val as u64,
14174 )
14175 }
14176 }
14177 #[inline]
14178 pub fn mSupportsCcm(&self) -> bool {
14179 unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
14180 }
14181 #[inline]
14182 pub fn set_mSupportsCcm(&mut self, val: bool) {
14183 unsafe {
14184 let val: u8 = ::std::mem::transmute(val);
14185 self._bitfield_1.set(1usize, 1u8, val as u64)
14186 }
14187 }
14188 #[inline]
14189 pub unsafe fn mSupportsCcm_raw(this: *const Self) -> bool {
14190 unsafe {
14191 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14192 ::std::ptr::addr_of!((*this)._bitfield_1),
14193 1usize,
14194 1u8,
14195 ) as u8)
14196 }
14197 }
14198 #[inline]
14199 pub unsafe fn set_mSupportsCcm_raw(this: *mut Self, val: bool) {
14200 unsafe {
14201 let val: u8 = ::std::mem::transmute(val);
14202 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14203 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14204 1usize,
14205 1u8,
14206 val as u64,
14207 )
14208 }
14209 }
14210 #[inline]
14211 pub fn mIsUnstable(&self) -> bool {
14212 unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
14213 }
14214 #[inline]
14215 pub fn set_mIsUnstable(&mut self, val: bool) {
14216 unsafe {
14217 let val: u8 = ::std::mem::transmute(val);
14218 self._bitfield_1.set(2usize, 1u8, val as u64)
14219 }
14220 }
14221 #[inline]
14222 pub unsafe fn mIsUnstable_raw(this: *const Self) -> bool {
14223 unsafe {
14224 ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
14225 ::std::ptr::addr_of!((*this)._bitfield_1),
14226 2usize,
14227 1u8,
14228 ) as u8)
14229 }
14230 }
14231 #[inline]
14232 pub unsafe fn set_mIsUnstable_raw(this: *mut Self, val: bool) {
14233 unsafe {
14234 let val: u8 = ::std::mem::transmute(val);
14235 <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
14236 ::std::ptr::addr_of_mut!((*this)._bitfield_1),
14237 2usize,
14238 1u8,
14239 val as u64,
14240 )
14241 }
14242 }
14243 #[inline]
14244 pub fn new_bitfield_1(
14245 mIsBorderRouter: bool,
14246 mSupportsCcm: bool,
14247 mIsUnstable: bool,
14248 ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
14249 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
14250 __bindgen_bitfield_unit.set(0usize, 1u8, {
14251 let mIsBorderRouter: u8 = unsafe { ::std::mem::transmute(mIsBorderRouter) };
14252 mIsBorderRouter as u64
14253 });
14254 __bindgen_bitfield_unit.set(1usize, 1u8, {
14255 let mSupportsCcm: u8 = unsafe { ::std::mem::transmute(mSupportsCcm) };
14256 mSupportsCcm as u64
14257 });
14258 __bindgen_bitfield_unit.set(2usize, 1u8, {
14259 let mIsUnstable: u8 = unsafe { ::std::mem::transmute(mIsUnstable) };
14260 mIsUnstable as u64
14261 });
14262 __bindgen_bitfield_unit
14263 }
14264}
14265unsafe extern "C" {
14266 #[doc = " Get the current device properties.\n\n Requires `OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE`.\n\n @returns The device properties `otDeviceProperties`."]
14267 pub fn otThreadGetDeviceProperties(aInstance: *mut otInstance) -> *const otDeviceProperties;
14268}
14269unsafe extern "C" {
14270 #[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."]
14271 pub fn otThreadSetDeviceProperties(
14272 aInstance: *mut otInstance,
14273 aDeviceProperties: *const otDeviceProperties,
14274 );
14275}
14276unsafe extern "C" {
14277 #[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"]
14278 pub fn otThreadGetLocalLeaderWeight(aInstance: *mut otInstance) -> u8;
14279}
14280unsafe extern "C" {
14281 #[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"]
14282 pub fn otThreadSetLocalLeaderWeight(aInstance: *mut otInstance, aWeight: u8);
14283}
14284unsafe extern "C" {
14285 #[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."]
14286 pub fn otThreadGetPreferredLeaderPartitionId(aInstance: *mut otInstance) -> u32;
14287}
14288unsafe extern "C" {
14289 #[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."]
14290 pub fn otThreadSetPreferredLeaderPartitionId(aInstance: *mut otInstance, aPartitionId: u32);
14291}
14292unsafe extern "C" {
14293 #[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"]
14294 pub fn otThreadGetJoinerUdpPort(aInstance: *mut otInstance) -> u16;
14295}
14296unsafe extern "C" {
14297 #[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"]
14298 pub fn otThreadSetJoinerUdpPort(aInstance: *mut otInstance, aJoinerUdpPort: u16) -> otError;
14299}
14300unsafe extern "C" {
14301 #[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."]
14302 pub fn otThreadSetSteeringData(aInstance: *mut otInstance, aExtAddress: *const otExtAddress);
14303}
14304unsafe extern "C" {
14305 #[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"]
14306 pub fn otThreadGetContextIdReuseDelay(aInstance: *mut otInstance) -> u32;
14307}
14308unsafe extern "C" {
14309 #[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"]
14310 pub fn otThreadSetContextIdReuseDelay(aInstance: *mut otInstance, aDelay: u32);
14311}
14312unsafe extern "C" {
14313 #[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"]
14314 pub fn otThreadGetNetworkIdTimeout(aInstance: *mut otInstance) -> u8;
14315}
14316unsafe extern "C" {
14317 #[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"]
14318 pub fn otThreadSetNetworkIdTimeout(aInstance: *mut otInstance, aTimeout: u8);
14319}
14320unsafe extern "C" {
14321 #[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"]
14322 pub fn otThreadGetRouterUpgradeThreshold(aInstance: *mut otInstance) -> u8;
14323}
14324unsafe extern "C" {
14325 #[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"]
14326 pub fn otThreadSetRouterUpgradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
14327}
14328unsafe extern "C" {
14329 #[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"]
14330 pub fn otThreadGetChildRouterLinks(aInstance: *mut otInstance) -> u8;
14331}
14332unsafe extern "C" {
14333 #[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"]
14334 pub fn otThreadSetChildRouterLinks(
14335 aInstance: *mut otInstance,
14336 aChildRouterLinks: u8,
14337 ) -> otError;
14338}
14339unsafe extern "C" {
14340 #[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."]
14341 pub fn otThreadReleaseRouterId(aInstance: *mut otInstance, aRouterId: u8) -> otError;
14342}
14343unsafe extern "C" {
14344 #[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."]
14345 pub fn otThreadBecomeRouter(aInstance: *mut otInstance) -> otError;
14346}
14347unsafe extern "C" {
14348 #[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."]
14349 pub fn otThreadBecomeLeader(aInstance: *mut otInstance) -> otError;
14350}
14351unsafe extern "C" {
14352 #[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"]
14353 pub fn otThreadGetRouterDowngradeThreshold(aInstance: *mut otInstance) -> u8;
14354}
14355unsafe extern "C" {
14356 #[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"]
14357 pub fn otThreadSetRouterDowngradeThreshold(aInstance: *mut otInstance, aThreshold: u8);
14358}
14359unsafe extern "C" {
14360 #[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"]
14361 pub fn otThreadGetRouterSelectionJitter(aInstance: *mut otInstance) -> u8;
14362}
14363unsafe extern "C" {
14364 #[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"]
14365 pub fn otThreadSetRouterSelectionJitter(aInstance: *mut otInstance, aRouterJitter: u8);
14366}
14367unsafe extern "C" {
14368 #[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."]
14369 pub fn otThreadGetChildInfoById(
14370 aInstance: *mut otInstance,
14371 aChildId: u16,
14372 aChildInfo: *mut otChildInfo,
14373 ) -> otError;
14374}
14375unsafe extern "C" {
14376 #[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"]
14377 pub fn otThreadGetChildInfoByIndex(
14378 aInstance: *mut otInstance,
14379 aChildIndex: u16,
14380 aChildInfo: *mut otChildInfo,
14381 ) -> otError;
14382}
14383unsafe extern "C" {
14384 #[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"]
14385 pub fn otThreadGetChildNextIp6Address(
14386 aInstance: *mut otInstance,
14387 aChildIndex: u16,
14388 aIterator: *mut otChildIp6AddressIterator,
14389 aAddress: *mut otIp6Address,
14390 ) -> otError;
14391}
14392unsafe extern "C" {
14393 #[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."]
14394 pub fn otThreadGetRouterIdSequence(aInstance: *mut otInstance) -> u8;
14395}
14396unsafe extern "C" {
14397 #[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."]
14398 pub fn otThreadGetMaxRouterId(aInstance: *mut otInstance) -> u8;
14399}
14400unsafe extern "C" {
14401 #[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."]
14402 pub fn otThreadGetRouterInfo(
14403 aInstance: *mut otInstance,
14404 aRouterId: u16,
14405 aRouterInfo: *mut otRouterInfo,
14406 ) -> otError;
14407}
14408unsafe extern "C" {
14409 #[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."]
14410 pub fn otThreadGetNextCacheEntry(
14411 aInstance: *mut otInstance,
14412 aEntryInfo: *mut otCacheEntryInfo,
14413 aIterator: *mut otCacheEntryIterator,
14414 ) -> otError;
14415}
14416unsafe extern "C" {
14417 #[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"]
14418 pub fn otThreadGetPskc(aInstance: *mut otInstance, aPskc: *mut otPskc);
14419}
14420unsafe extern "C" {
14421 #[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"]
14422 pub fn otThreadGetPskcRef(aInstance: *mut otInstance) -> otPskcRef;
14423}
14424unsafe extern "C" {
14425 #[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"]
14426 pub fn otThreadSetPskc(aInstance: *mut otInstance, aPskc: *const otPskc) -> otError;
14427}
14428unsafe extern "C" {
14429 #[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"]
14430 pub fn otThreadSetPskcRef(aInstance: *mut otInstance, aKeyRef: otPskcRef) -> otError;
14431}
14432unsafe extern "C" {
14433 #[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"]
14434 pub fn otThreadGetParentPriority(aInstance: *mut otInstance) -> i8;
14435}
14436unsafe extern "C" {
14437 #[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"]
14438 pub fn otThreadSetParentPriority(aInstance: *mut otInstance, aParentPriority: i8) -> otError;
14439}
14440unsafe extern "C" {
14441 #[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"]
14442 pub fn otThreadGetMaxChildIpAddresses(aInstance: *mut otInstance) -> u8;
14443}
14444unsafe extern "C" {
14445 #[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"]
14446 pub fn otThreadSetMaxChildIpAddresses(
14447 aInstance: *mut otInstance,
14448 aMaxIpAddresses: u8,
14449 ) -> otError;
14450}
14451#[doc = "< A child is being added."]
14452pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED: otNeighborTableEvent = 0;
14453#[doc = "< A child is being removed."]
14454pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED: otNeighborTableEvent = 1;
14455#[doc = "< An existing child's mode is changed."]
14456pub const OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED: otNeighborTableEvent = 2;
14457#[doc = "< A router is being added."]
14458pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED: otNeighborTableEvent = 3;
14459#[doc = "< A router is being removed."]
14460pub const OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED: otNeighborTableEvent = 4;
14461#[doc = " Defines the constants used in `otNeighborTableCallback` to indicate changes in neighbor table."]
14462pub type otNeighborTableEvent = ::std::os::raw::c_uint;
14463#[doc = " Represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table\n callback `otNeighborTableCallback`."]
14464#[repr(C)]
14465#[derive(Copy, Clone)]
14466pub struct otNeighborTableEntryInfo {
14467 #[doc = "< The OpenThread instance."]
14468 pub mInstance: *mut otInstance,
14469 pub mInfo: otNeighborTableEntryInfo__bindgen_ty_1,
14470}
14471#[repr(C)]
14472#[derive(Copy, Clone)]
14473pub union otNeighborTableEntryInfo__bindgen_ty_1 {
14474 #[doc = "< The child neighbor info."]
14475 pub mChild: otChildInfo,
14476 #[doc = "< The router neighbor info."]
14477 pub mRouter: otNeighborInfo,
14478}
14479impl Default for otNeighborTableEntryInfo__bindgen_ty_1 {
14480 fn default() -> Self {
14481 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14482 unsafe {
14483 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14484 s.assume_init()
14485 }
14486 }
14487}
14488impl Default for otNeighborTableEntryInfo {
14489 fn default() -> Self {
14490 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14491 unsafe {
14492 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14493 s.assume_init()
14494 }
14495 }
14496}
14497#[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."]
14498pub type otNeighborTableCallback = ::std::option::Option<
14499 unsafe extern "C" fn(aEvent: otNeighborTableEvent, aEntryInfo: *const otNeighborTableEntryInfo),
14500>;
14501unsafe extern "C" {
14502 #[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."]
14503 pub fn otThreadRegisterNeighborTableCallback(
14504 aInstance: *mut otInstance,
14505 aCallback: otNeighborTableCallback,
14506 );
14507}
14508unsafe extern "C" {
14509 #[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."]
14510 pub fn otThreadSetCcmEnabled(aInstance: *mut otInstance, aEnabled: bool);
14511}
14512unsafe extern "C" {
14513 #[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."]
14514 pub fn otThreadSetThreadVersionCheckEnabled(aInstance: *mut otInstance, aEnabled: bool);
14515}
14516unsafe extern "C" {
14517 #[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."]
14518 pub fn otThreadSetTmfOriginFilterEnabled(aInstance: *mut otInstance, aEnabled: bool);
14519}
14520unsafe extern "C" {
14521 #[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."]
14522 pub fn otThreadIsTmfOriginFilterEnabled(aInstance: *mut otInstance) -> bool;
14523}
14524unsafe extern "C" {
14525 #[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"]
14526 pub fn otThreadGetRouterIdRange(
14527 aInstance: *mut otInstance,
14528 aMinRouterId: *mut u8,
14529 aMaxRouterId: *mut u8,
14530 );
14531}
14532unsafe extern "C" {
14533 #[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"]
14534 pub fn otThreadSetRouterIdRange(
14535 aInstance: *mut otInstance,
14536 aMinRouterId: u8,
14537 aMaxRouterId: u8,
14538 ) -> otError;
14539}
14540unsafe extern "C" {
14541 #[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."]
14542 pub fn otThreadGetAdvertisementTrickleIntervalMax(aInstance: *mut otInstance) -> u32;
14543}
14544unsafe extern "C" {
14545 #[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."]
14546 pub fn otThreadIsRouterIdAllocated(aInstance: *mut otInstance, aRouterId: u8) -> bool;
14547}
14548unsafe extern "C" {
14549 #[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."]
14550 pub fn otThreadGetNextHopAndPathCost(
14551 aInstance: *mut otInstance,
14552 aDestRloc16: u16,
14553 aNextHopRloc16: *mut u16,
14554 aPathCost: *mut u8,
14555 );
14556}
14557#[doc = " Represents a TREL peer."]
14558#[repr(C)]
14559#[derive(Copy, Clone)]
14560pub struct otTrelPeer {
14561 #[doc = "< The Extended MAC Address of TREL peer."]
14562 pub mExtAddress: otExtAddress,
14563 #[doc = "< The Extended PAN Identifier of TREL peer."]
14564 pub mExtPanId: otExtendedPanId,
14565 #[doc = "< The IPv6 socket address of TREL peer."]
14566 pub mSockAddr: otSockAddr,
14567}
14568impl Default for otTrelPeer {
14569 fn default() -> Self {
14570 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14571 unsafe {
14572 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14573 s.assume_init()
14574 }
14575 }
14576}
14577#[doc = " Represents an iterator for iterating over TREL peer table entries."]
14578pub type otTrelPeerIterator = u16;
14579unsafe extern "C" {
14580 #[doc = " Enables or disables TREL operation.\n\n When @p aEnable is true, this function initiates an ongoing DNS-SD browse on the service name \"_trel._udp\" within the\n local browsing domain to discover other devices supporting TREL. Device also registers a new service to be advertised\n using DNS-SD, with the service name is \"_trel._udp\" indicating its support for TREL. Device is then ready to receive\n TREL messages from peers.\n\n When @p aEnable is false, this function stops the DNS-SD browse on the service name \"_trel._udp\", stops advertising\n TREL DNS-SD service, and clears the TREL peer table.\n\n @note By default the OpenThread stack enables the TREL operation on start.\n\n @param[in] aInstance A pointer to an OpenThread instance.\n @param[in] aEnable A boolean to enable/disable the TREL operation."]
14581 pub fn otTrelSetEnabled(aInstance: *mut otInstance, aEnable: bool);
14582}
14583unsafe extern "C" {
14584 #[doc = " Indicates whether the TREL operation is enabled.\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."]
14585 pub fn otTrelIsEnabled(aInstance: *mut otInstance) -> bool;
14586}
14587unsafe extern "C" {
14588 #[doc = " Initializes a peer table iterator.\n\n @param[in] aInstance The OpenThread instance.\n @param[in] aIterator The iterator to initialize."]
14589 pub fn otTrelInitPeerIterator(aInstance: *mut otInstance, aIterator: *mut otTrelPeerIterator);
14590}
14591unsafe extern "C" {
14592 #[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."]
14593 pub fn otTrelGetNextPeer(
14594 aInstance: *mut otInstance,
14595 aIterator: *mut otTrelPeerIterator,
14596 ) -> *const otTrelPeer;
14597}
14598unsafe extern "C" {
14599 #[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."]
14600 pub fn otTrelGetNumberOfPeers(aInstance: *mut otInstance) -> u16;
14601}
14602unsafe extern "C" {
14603 #[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."]
14604 pub fn otTrelSetFilterEnabled(aInstance: *mut otInstance, aEnable: bool);
14605}
14606unsafe extern "C" {
14607 #[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."]
14608 pub fn otTrelIsFilterEnabled(aInstance: *mut otInstance) -> bool;
14609}
14610#[doc = " Represents a group of TREL related counters."]
14611pub type otTrelCounters = otPlatTrelCounters;
14612unsafe extern "C" {
14613 #[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."]
14614 pub fn otTrelGetCounters(aInstance: *mut otInstance) -> *const otTrelCounters;
14615}
14616unsafe extern "C" {
14617 #[doc = " Resets the TREL counters.\n\n @param[in] aInstance A pointer to an OpenThread instance."]
14618 pub fn otTrelResetCounters(aInstance: *mut otInstance);
14619}
14620unsafe extern "C" {
14621 #[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."]
14622 pub fn otTrelGetUdpPort(aInstance: *mut otInstance) -> u16;
14623}
14624pub type __builtin_va_list = [__va_list_tag; 1usize];
14625#[repr(C)]
14626#[derive(Debug, Copy, Clone)]
14627pub struct __va_list_tag {
14628 pub gp_offset: ::std::os::raw::c_uint,
14629 pub fp_offset: ::std::os::raw::c_uint,
14630 pub overflow_arg_area: *mut ::std::os::raw::c_void,
14631 pub reg_save_area: *mut ::std::os::raw::c_void,
14632}
14633impl Default for __va_list_tag {
14634 fn default() -> Self {
14635 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
14636 unsafe {
14637 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
14638 s.assume_init()
14639 }
14640 }
14641}