openthread/ot/
infra_if.rs1use crate::prelude_internal::*;
6
7pub trait InfraInterface {
11 fn plat_infra_if_on_state_changed(&self, id: u32, is_running: bool);
14
15 fn plat_infra_if_discover_nat64_prefix_done(&self, infra_if_idx: u32, ip6_prefix: Ip6Prefix);
18}
19
20impl<T: InfraInterface + ot::Boxable> InfraInterface for ot::Box<T> {
21 fn plat_infra_if_on_state_changed(&self, id: u32, is_running: bool) {
22 self.as_ref().plat_infra_if_on_state_changed(id, is_running);
23 }
24
25 fn plat_infra_if_discover_nat64_prefix_done(&self, infra_if_idx: u32, ip6_prefix: Ip6Prefix) {
26 self.as_ref().plat_infra_if_discover_nat64_prefix_done(infra_if_idx, ip6_prefix);
27 }
28}
29
30impl InfraInterface for Instance {
31 fn plat_infra_if_on_state_changed(&self, id: u32, is_running: bool) {
32 unsafe {
33 otPlatInfraIfStateChanged(self.as_ot_ptr(), id, is_running);
34 }
35 }
36
37 fn plat_infra_if_discover_nat64_prefix_done(&self, infra_if_idx: u32, ip6_prefix: Ip6Prefix) {
38 unsafe {
39 otPlatInfraIfDiscoverNat64PrefixDone(self.as_ot_ptr(), infra_if_idx, &ip6_prefix.into())
40 }
41 }
42}