fidl_fuchsia_net_filter_deprecated/
fidl_fuchsia_net_filter_deprecated.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_filter_deprecated__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct FilterMarker;
16
17impl fidl::endpoints::ProtocolMarker for FilterMarker {
18    type Proxy = FilterProxy;
19    type RequestStream = FilterRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = FilterSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.net.filter.deprecated.Filter";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for FilterMarker {}
26pub type FilterEnableInterfaceResult = Result<(), EnableDisableInterfaceError>;
27pub type FilterDisableInterfaceResult = Result<(), EnableDisableInterfaceError>;
28pub type FilterUpdateRulesResult = Result<(), FilterUpdateRulesError>;
29pub type FilterUpdateNatRulesResult = Result<(), FilterUpdateNatRulesError>;
30pub type FilterUpdateRdrRulesResult = Result<(), FilterUpdateRdrRulesError>;
31
32pub trait FilterProxyInterface: Send + Sync {
33    type EnableInterfaceResponseFut: std::future::Future<Output = Result<FilterEnableInterfaceResult, fidl::Error>>
34        + Send;
35    fn r#enable_interface(&self, id: u64) -> Self::EnableInterfaceResponseFut;
36    type DisableInterfaceResponseFut: std::future::Future<Output = Result<FilterDisableInterfaceResult, fidl::Error>>
37        + Send;
38    fn r#disable_interface(&self, id: u64) -> Self::DisableInterfaceResponseFut;
39    type GetRulesResponseFut: std::future::Future<Output = Result<(Vec<Rule>, u32), fidl::Error>>
40        + Send;
41    fn r#get_rules(&self) -> Self::GetRulesResponseFut;
42    type UpdateRulesResponseFut: std::future::Future<Output = Result<FilterUpdateRulesResult, fidl::Error>>
43        + Send;
44    fn r#update_rules(&self, rules: &[Rule], generation: u32) -> Self::UpdateRulesResponseFut;
45    type GetNatRulesResponseFut: std::future::Future<Output = Result<(Vec<Nat>, u32), fidl::Error>>
46        + Send;
47    fn r#get_nat_rules(&self) -> Self::GetNatRulesResponseFut;
48    type UpdateNatRulesResponseFut: std::future::Future<Output = Result<FilterUpdateNatRulesResult, fidl::Error>>
49        + Send;
50    fn r#update_nat_rules(&self, rules: &[Nat], generation: u32)
51    -> Self::UpdateNatRulesResponseFut;
52    type GetRdrRulesResponseFut: std::future::Future<Output = Result<(Vec<Rdr>, u32), fidl::Error>>
53        + Send;
54    fn r#get_rdr_rules(&self) -> Self::GetRdrRulesResponseFut;
55    type UpdateRdrRulesResponseFut: std::future::Future<Output = Result<FilterUpdateRdrRulesResult, fidl::Error>>
56        + Send;
57    fn r#update_rdr_rules(&self, rules: &[Rdr], generation: u32)
58    -> Self::UpdateRdrRulesResponseFut;
59    type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
60    fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct FilterSynchronousProxy {
65    client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for FilterSynchronousProxy {
70    type Proxy = FilterProxy;
71    type Protocol = FilterMarker;
72
73    fn from_channel(inner: fidl::Channel) -> Self {
74        Self::new(inner)
75    }
76
77    fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    fn as_channel(&self) -> &fidl::Channel {
82        self.client.as_channel()
83    }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl FilterSynchronousProxy {
88    pub fn new(channel: fidl::Channel) -> Self {
89        let protocol_name = <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
90        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
91    }
92
93    pub fn into_channel(self) -> fidl::Channel {
94        self.client.into_channel()
95    }
96
97    /// Waits until an event arrives and returns it. It is safe for other
98    /// threads to make concurrent requests while waiting for an event.
99    pub fn wait_for_event(
100        &self,
101        deadline: zx::MonotonicInstant,
102    ) -> Result<FilterEvent, fidl::Error> {
103        FilterEvent::decode(self.client.wait_for_event(deadline)?)
104    }
105
106    /// Enable the filter on a specific interface.
107    ///
108    /// The filter is disabled by default. If the filter is already enabled,
109    /// no error is returned.
110    ///
111    /// + request `id` The id of the network interface.
112    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
113    pub fn r#enable_interface(
114        &self,
115        mut id: u64,
116        ___deadline: zx::MonotonicInstant,
117    ) -> Result<FilterEnableInterfaceResult, fidl::Error> {
118        let _response =
119            self.client.send_query::<FilterEnableInterfaceRequest, fidl::encoding::ResultType<
120                fidl::encoding::EmptyStruct,
121                EnableDisableInterfaceError,
122            >>(
123                (id,),
124                0xbf4c680f4001075,
125                fidl::encoding::DynamicFlags::empty(),
126                ___deadline,
127            )?;
128        Ok(_response.map(|x| x))
129    }
130
131    /// Disable the filter on a specific interface.
132    ///
133    /// The filter is disabled by default. If the filter is already disabled,
134    /// no error is returned.
135    ///
136    /// + request `id` The id of the network interface.
137    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
138    pub fn r#disable_interface(
139        &self,
140        mut id: u64,
141        ___deadline: zx::MonotonicInstant,
142    ) -> Result<FilterDisableInterfaceResult, fidl::Error> {
143        let _response =
144            self.client.send_query::<FilterDisableInterfaceRequest, fidl::encoding::ResultType<
145                fidl::encoding::EmptyStruct,
146                EnableDisableInterfaceError,
147            >>(
148                (id,),
149                0x30d2e0e00378a294,
150                fidl::encoding::DynamicFlags::empty(),
151                ___deadline,
152            )?;
153        Ok(_response.map(|x| x))
154    }
155
156    /// GetRules gets the current rules. They do not include NAT or RDR rules.
157    /// (use GetNatRules or GetRdrRules instead).
158    ///
159    /// - response `rules` The current filter rules.
160    /// - response `generation` The generation number associated with the current
161    ///   rules.
162    pub fn r#get_rules(
163        &self,
164        ___deadline: zx::MonotonicInstant,
165    ) -> Result<(Vec<Rule>, u32), fidl::Error> {
166        let _response =
167            self.client.send_query::<fidl::encoding::EmptyPayload, FilterGetRulesResponse>(
168                (),
169                0x284ee4bab557a949,
170                fidl::encoding::DynamicFlags::empty(),
171                ___deadline,
172            )?;
173        Ok((_response.rules, _response.generation))
174    }
175
176    /// UpdateRules updates the current rules. It does not update NAT or RDR rules
177    /// (use UpdateNatRules or UpdateRdrRules instead).
178    ///
179    /// UpdateRules takes a generation number that is previously returned from
180    /// GetRules. The generation number has to be up-to-date, i.e. it has to
181    /// match with the one associated with the current rules. The service will
182    /// assign a new generation number to the new rules.
183    ///
184    /// + request `rules` The new filter rules to install.
185    /// + request `generation` The generation number previously returned from
186    ///   GetRules.
187    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
188    ///   generation number for the current rules.
189    /// * error Reports `BAD_RULE` if `rules` are not valid.
190    pub fn r#update_rules(
191        &self,
192        mut rules: &[Rule],
193        mut generation: u32,
194        ___deadline: zx::MonotonicInstant,
195    ) -> Result<FilterUpdateRulesResult, fidl::Error> {
196        let _response =
197            self.client.send_query::<FilterUpdateRulesRequest, fidl::encoding::ResultType<
198                fidl::encoding::EmptyStruct,
199                FilterUpdateRulesError,
200            >>(
201                (rules, generation),
202                0x32181f0bf9bb9a07,
203                fidl::encoding::DynamicFlags::empty(),
204                ___deadline,
205            )?;
206        Ok(_response.map(|x| x))
207    }
208
209    /// GetNatRules gets the current NAT rules.
210    ///
211    /// - response `rules` The current NAT rules.
212    /// - response `generation` The generation number associated with the current
213    ///   NAT rules.
214    pub fn r#get_nat_rules(
215        &self,
216        ___deadline: zx::MonotonicInstant,
217    ) -> Result<(Vec<Nat>, u32), fidl::Error> {
218        let _response =
219            self.client.send_query::<fidl::encoding::EmptyPayload, FilterGetNatRulesResponse>(
220                (),
221                0x5d61f46aabe0443b,
222                fidl::encoding::DynamicFlags::empty(),
223                ___deadline,
224            )?;
225        Ok((_response.rules, _response.generation))
226    }
227
228    /// UpdateNatRules updates the current NAT rules.
229    ///
230    /// UpdateNatRules takes a generation number that is previously returned from
231    /// GetRules. The generation number has to be up-to-date, i.e. it has to
232    /// match with the one associated with the current NAT rules. The service will
233    /// assign a new generation number to the new NAT rules.
234    ///
235    /// + request `rules` The new NAT rules to install.
236    /// + request `generation` The generation number previously returned from
237    ///   GetNATRules.
238    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
239    ///   generation number for the current rules.
240    /// * error Reports `BAD_RULE` if `rules` are not valid.
241    pub fn r#update_nat_rules(
242        &self,
243        mut rules: &[Nat],
244        mut generation: u32,
245        ___deadline: zx::MonotonicInstant,
246    ) -> Result<FilterUpdateNatRulesResult, fidl::Error> {
247        let _response =
248            self.client.send_query::<FilterUpdateNatRulesRequest, fidl::encoding::ResultType<
249                fidl::encoding::EmptyStruct,
250                FilterUpdateNatRulesError,
251            >>(
252                (rules, generation),
253                0x1711b0f7d45a2ce2,
254                fidl::encoding::DynamicFlags::empty(),
255                ___deadline,
256            )?;
257        Ok(_response.map(|x| x))
258    }
259
260    /// GetRdrRules gets the current RDR rules.
261    ///
262    /// - response `rules` The current RDR rules.
263    /// - response `generation` The generation number associated with the current
264    ///   RDR rules.
265    pub fn r#get_rdr_rules(
266        &self,
267        ___deadline: zx::MonotonicInstant,
268    ) -> Result<(Vec<Rdr>, u32), fidl::Error> {
269        let _response =
270            self.client.send_query::<fidl::encoding::EmptyPayload, FilterGetRdrRulesResponse>(
271                (),
272                0x10c953b9ce96e5ed,
273                fidl::encoding::DynamicFlags::empty(),
274                ___deadline,
275            )?;
276        Ok((_response.rules, _response.generation))
277    }
278
279    /// UpdateRdrRules updates the previous RDR rules with new rules.
280    ///
281    /// UpdateRdrRules takes a generation number that is previously returned from
282    /// GetRules. The generation number has to be up-to-date, i.e. it has to
283    /// match with the one associated with the current RDR rules. The service will
284    /// assign a new generation number to the new RDR rules.
285    ///
286    /// + request `rules` The new RDR rules to install.
287    /// + request `generation` The generation number previously returned from
288    ///   GetRDRRules.
289    /// * error Reports `NOT_SUPPORTED` if the operation is not supported.
290    pub fn r#update_rdr_rules(
291        &self,
292        mut rules: &[Rdr],
293        mut generation: u32,
294        ___deadline: zx::MonotonicInstant,
295    ) -> Result<FilterUpdateRdrRulesResult, fidl::Error> {
296        let _response =
297            self.client.send_query::<FilterUpdateRdrRulesRequest, fidl::encoding::ResultType<
298                fidl::encoding::EmptyStruct,
299                FilterUpdateRdrRulesError,
300            >>(
301                (rules, generation),
302                0x640119eed9f46c55,
303                fidl::encoding::DynamicFlags::empty(),
304                ___deadline,
305            )?;
306        Ok(_response.map(|x| x))
307    }
308
309    /// No-op method that allows checking for presence.
310    ///
311    /// It's not currently possible for a client with an optionally-provided
312    /// protocol to check whether there's someone on the other end without
313    /// making a FIDL call (https://fxbug.dev/296283299). This method provides a
314    /// workaround by giving a client a two-way method that it can call to check
315    /// for liveness.
316    pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
317        let _response =
318            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
319                (),
320                0x5b2e2293c3aa2942,
321                fidl::encoding::DynamicFlags::empty(),
322                ___deadline,
323            )?;
324        Ok(_response)
325    }
326}
327
328#[cfg(target_os = "fuchsia")]
329impl From<FilterSynchronousProxy> for zx::NullableHandle {
330    fn from(value: FilterSynchronousProxy) -> Self {
331        value.into_channel().into()
332    }
333}
334
335#[cfg(target_os = "fuchsia")]
336impl From<fidl::Channel> for FilterSynchronousProxy {
337    fn from(value: fidl::Channel) -> Self {
338        Self::new(value)
339    }
340}
341
342#[cfg(target_os = "fuchsia")]
343impl fidl::endpoints::FromClient for FilterSynchronousProxy {
344    type Protocol = FilterMarker;
345
346    fn from_client(value: fidl::endpoints::ClientEnd<FilterMarker>) -> Self {
347        Self::new(value.into_channel())
348    }
349}
350
351#[derive(Debug, Clone)]
352pub struct FilterProxy {
353    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
354}
355
356impl fidl::endpoints::Proxy for FilterProxy {
357    type Protocol = FilterMarker;
358
359    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
360        Self::new(inner)
361    }
362
363    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
364        self.client.into_channel().map_err(|client| Self { client })
365    }
366
367    fn as_channel(&self) -> &::fidl::AsyncChannel {
368        self.client.as_channel()
369    }
370}
371
372impl FilterProxy {
373    /// Create a new Proxy for fuchsia.net.filter.deprecated/Filter.
374    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
375        let protocol_name = <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
376        Self { client: fidl::client::Client::new(channel, protocol_name) }
377    }
378
379    /// Get a Stream of events from the remote end of the protocol.
380    ///
381    /// # Panics
382    ///
383    /// Panics if the event stream was already taken.
384    pub fn take_event_stream(&self) -> FilterEventStream {
385        FilterEventStream { event_receiver: self.client.take_event_receiver() }
386    }
387
388    /// Enable the filter on a specific interface.
389    ///
390    /// The filter is disabled by default. If the filter is already enabled,
391    /// no error is returned.
392    ///
393    /// + request `id` The id of the network interface.
394    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
395    pub fn r#enable_interface(
396        &self,
397        mut id: u64,
398    ) -> fidl::client::QueryResponseFut<
399        FilterEnableInterfaceResult,
400        fidl::encoding::DefaultFuchsiaResourceDialect,
401    > {
402        FilterProxyInterface::r#enable_interface(self, id)
403    }
404
405    /// Disable the filter on a specific interface.
406    ///
407    /// The filter is disabled by default. If the filter is already disabled,
408    /// no error is returned.
409    ///
410    /// + request `id` The id of the network interface.
411    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
412    pub fn r#disable_interface(
413        &self,
414        mut id: u64,
415    ) -> fidl::client::QueryResponseFut<
416        FilterDisableInterfaceResult,
417        fidl::encoding::DefaultFuchsiaResourceDialect,
418    > {
419        FilterProxyInterface::r#disable_interface(self, id)
420    }
421
422    /// GetRules gets the current rules. They do not include NAT or RDR rules.
423    /// (use GetNatRules or GetRdrRules instead).
424    ///
425    /// - response `rules` The current filter rules.
426    /// - response `generation` The generation number associated with the current
427    ///   rules.
428    pub fn r#get_rules(
429        &self,
430    ) -> fidl::client::QueryResponseFut<
431        (Vec<Rule>, u32),
432        fidl::encoding::DefaultFuchsiaResourceDialect,
433    > {
434        FilterProxyInterface::r#get_rules(self)
435    }
436
437    /// UpdateRules updates the current rules. It does not update NAT or RDR rules
438    /// (use UpdateNatRules or UpdateRdrRules instead).
439    ///
440    /// UpdateRules takes a generation number that is previously returned from
441    /// GetRules. The generation number has to be up-to-date, i.e. it has to
442    /// match with the one associated with the current rules. The service will
443    /// assign a new generation number to the new rules.
444    ///
445    /// + request `rules` The new filter rules to install.
446    /// + request `generation` The generation number previously returned from
447    ///   GetRules.
448    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
449    ///   generation number for the current rules.
450    /// * error Reports `BAD_RULE` if `rules` are not valid.
451    pub fn r#update_rules(
452        &self,
453        mut rules: &[Rule],
454        mut generation: u32,
455    ) -> fidl::client::QueryResponseFut<
456        FilterUpdateRulesResult,
457        fidl::encoding::DefaultFuchsiaResourceDialect,
458    > {
459        FilterProxyInterface::r#update_rules(self, rules, generation)
460    }
461
462    /// GetNatRules gets the current NAT rules.
463    ///
464    /// - response `rules` The current NAT rules.
465    /// - response `generation` The generation number associated with the current
466    ///   NAT rules.
467    pub fn r#get_nat_rules(
468        &self,
469    ) -> fidl::client::QueryResponseFut<
470        (Vec<Nat>, u32),
471        fidl::encoding::DefaultFuchsiaResourceDialect,
472    > {
473        FilterProxyInterface::r#get_nat_rules(self)
474    }
475
476    /// UpdateNatRules updates the current NAT rules.
477    ///
478    /// UpdateNatRules takes a generation number that is previously returned from
479    /// GetRules. The generation number has to be up-to-date, i.e. it has to
480    /// match with the one associated with the current NAT rules. The service will
481    /// assign a new generation number to the new NAT rules.
482    ///
483    /// + request `rules` The new NAT rules to install.
484    /// + request `generation` The generation number previously returned from
485    ///   GetNATRules.
486    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
487    ///   generation number for the current rules.
488    /// * error Reports `BAD_RULE` if `rules` are not valid.
489    pub fn r#update_nat_rules(
490        &self,
491        mut rules: &[Nat],
492        mut generation: u32,
493    ) -> fidl::client::QueryResponseFut<
494        FilterUpdateNatRulesResult,
495        fidl::encoding::DefaultFuchsiaResourceDialect,
496    > {
497        FilterProxyInterface::r#update_nat_rules(self, rules, generation)
498    }
499
500    /// GetRdrRules gets the current RDR rules.
501    ///
502    /// - response `rules` The current RDR rules.
503    /// - response `generation` The generation number associated with the current
504    ///   RDR rules.
505    pub fn r#get_rdr_rules(
506        &self,
507    ) -> fidl::client::QueryResponseFut<
508        (Vec<Rdr>, u32),
509        fidl::encoding::DefaultFuchsiaResourceDialect,
510    > {
511        FilterProxyInterface::r#get_rdr_rules(self)
512    }
513
514    /// UpdateRdrRules updates the previous RDR rules with new rules.
515    ///
516    /// UpdateRdrRules takes a generation number that is previously returned from
517    /// GetRules. The generation number has to be up-to-date, i.e. it has to
518    /// match with the one associated with the current RDR rules. The service will
519    /// assign a new generation number to the new RDR rules.
520    ///
521    /// + request `rules` The new RDR rules to install.
522    /// + request `generation` The generation number previously returned from
523    ///   GetRDRRules.
524    /// * error Reports `NOT_SUPPORTED` if the operation is not supported.
525    pub fn r#update_rdr_rules(
526        &self,
527        mut rules: &[Rdr],
528        mut generation: u32,
529    ) -> fidl::client::QueryResponseFut<
530        FilterUpdateRdrRulesResult,
531        fidl::encoding::DefaultFuchsiaResourceDialect,
532    > {
533        FilterProxyInterface::r#update_rdr_rules(self, rules, generation)
534    }
535
536    /// No-op method that allows checking for presence.
537    ///
538    /// It's not currently possible for a client with an optionally-provided
539    /// protocol to check whether there's someone on the other end without
540    /// making a FIDL call (https://fxbug.dev/296283299). This method provides a
541    /// workaround by giving a client a two-way method that it can call to check
542    /// for liveness.
543    pub fn r#check_presence(
544        &self,
545    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
546        FilterProxyInterface::r#check_presence(self)
547    }
548}
549
550impl FilterProxyInterface for FilterProxy {
551    type EnableInterfaceResponseFut = fidl::client::QueryResponseFut<
552        FilterEnableInterfaceResult,
553        fidl::encoding::DefaultFuchsiaResourceDialect,
554    >;
555    fn r#enable_interface(&self, mut id: u64) -> Self::EnableInterfaceResponseFut {
556        fn _decode(
557            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
558        ) -> Result<FilterEnableInterfaceResult, fidl::Error> {
559            let _response = fidl::client::decode_transaction_body::<
560                fidl::encoding::ResultType<
561                    fidl::encoding::EmptyStruct,
562                    EnableDisableInterfaceError,
563                >,
564                fidl::encoding::DefaultFuchsiaResourceDialect,
565                0xbf4c680f4001075,
566            >(_buf?)?;
567            Ok(_response.map(|x| x))
568        }
569        self.client
570            .send_query_and_decode::<FilterEnableInterfaceRequest, FilterEnableInterfaceResult>(
571                (id,),
572                0xbf4c680f4001075,
573                fidl::encoding::DynamicFlags::empty(),
574                _decode,
575            )
576    }
577
578    type DisableInterfaceResponseFut = fidl::client::QueryResponseFut<
579        FilterDisableInterfaceResult,
580        fidl::encoding::DefaultFuchsiaResourceDialect,
581    >;
582    fn r#disable_interface(&self, mut id: u64) -> Self::DisableInterfaceResponseFut {
583        fn _decode(
584            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
585        ) -> Result<FilterDisableInterfaceResult, fidl::Error> {
586            let _response = fidl::client::decode_transaction_body::<
587                fidl::encoding::ResultType<
588                    fidl::encoding::EmptyStruct,
589                    EnableDisableInterfaceError,
590                >,
591                fidl::encoding::DefaultFuchsiaResourceDialect,
592                0x30d2e0e00378a294,
593            >(_buf?)?;
594            Ok(_response.map(|x| x))
595        }
596        self.client
597            .send_query_and_decode::<FilterDisableInterfaceRequest, FilterDisableInterfaceResult>(
598                (id,),
599                0x30d2e0e00378a294,
600                fidl::encoding::DynamicFlags::empty(),
601                _decode,
602            )
603    }
604
605    type GetRulesResponseFut = fidl::client::QueryResponseFut<
606        (Vec<Rule>, u32),
607        fidl::encoding::DefaultFuchsiaResourceDialect,
608    >;
609    fn r#get_rules(&self) -> Self::GetRulesResponseFut {
610        fn _decode(
611            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
612        ) -> Result<(Vec<Rule>, u32), fidl::Error> {
613            let _response = fidl::client::decode_transaction_body::<
614                FilterGetRulesResponse,
615                fidl::encoding::DefaultFuchsiaResourceDialect,
616                0x284ee4bab557a949,
617            >(_buf?)?;
618            Ok((_response.rules, _response.generation))
619        }
620        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<Rule>, u32)>(
621            (),
622            0x284ee4bab557a949,
623            fidl::encoding::DynamicFlags::empty(),
624            _decode,
625        )
626    }
627
628    type UpdateRulesResponseFut = fidl::client::QueryResponseFut<
629        FilterUpdateRulesResult,
630        fidl::encoding::DefaultFuchsiaResourceDialect,
631    >;
632    fn r#update_rules(
633        &self,
634        mut rules: &[Rule],
635        mut generation: u32,
636    ) -> Self::UpdateRulesResponseFut {
637        fn _decode(
638            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
639        ) -> Result<FilterUpdateRulesResult, fidl::Error> {
640            let _response = fidl::client::decode_transaction_body::<
641                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FilterUpdateRulesError>,
642                fidl::encoding::DefaultFuchsiaResourceDialect,
643                0x32181f0bf9bb9a07,
644            >(_buf?)?;
645            Ok(_response.map(|x| x))
646        }
647        self.client.send_query_and_decode::<FilterUpdateRulesRequest, FilterUpdateRulesResult>(
648            (rules, generation),
649            0x32181f0bf9bb9a07,
650            fidl::encoding::DynamicFlags::empty(),
651            _decode,
652        )
653    }
654
655    type GetNatRulesResponseFut = fidl::client::QueryResponseFut<
656        (Vec<Nat>, u32),
657        fidl::encoding::DefaultFuchsiaResourceDialect,
658    >;
659    fn r#get_nat_rules(&self) -> Self::GetNatRulesResponseFut {
660        fn _decode(
661            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
662        ) -> Result<(Vec<Nat>, u32), fidl::Error> {
663            let _response = fidl::client::decode_transaction_body::<
664                FilterGetNatRulesResponse,
665                fidl::encoding::DefaultFuchsiaResourceDialect,
666                0x5d61f46aabe0443b,
667            >(_buf?)?;
668            Ok((_response.rules, _response.generation))
669        }
670        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<Nat>, u32)>(
671            (),
672            0x5d61f46aabe0443b,
673            fidl::encoding::DynamicFlags::empty(),
674            _decode,
675        )
676    }
677
678    type UpdateNatRulesResponseFut = fidl::client::QueryResponseFut<
679        FilterUpdateNatRulesResult,
680        fidl::encoding::DefaultFuchsiaResourceDialect,
681    >;
682    fn r#update_nat_rules(
683        &self,
684        mut rules: &[Nat],
685        mut generation: u32,
686    ) -> Self::UpdateNatRulesResponseFut {
687        fn _decode(
688            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
689        ) -> Result<FilterUpdateNatRulesResult, fidl::Error> {
690            let _response = fidl::client::decode_transaction_body::<
691                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FilterUpdateNatRulesError>,
692                fidl::encoding::DefaultFuchsiaResourceDialect,
693                0x1711b0f7d45a2ce2,
694            >(_buf?)?;
695            Ok(_response.map(|x| x))
696        }
697        self.client
698            .send_query_and_decode::<FilterUpdateNatRulesRequest, FilterUpdateNatRulesResult>(
699                (rules, generation),
700                0x1711b0f7d45a2ce2,
701                fidl::encoding::DynamicFlags::empty(),
702                _decode,
703            )
704    }
705
706    type GetRdrRulesResponseFut = fidl::client::QueryResponseFut<
707        (Vec<Rdr>, u32),
708        fidl::encoding::DefaultFuchsiaResourceDialect,
709    >;
710    fn r#get_rdr_rules(&self) -> Self::GetRdrRulesResponseFut {
711        fn _decode(
712            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
713        ) -> Result<(Vec<Rdr>, u32), fidl::Error> {
714            let _response = fidl::client::decode_transaction_body::<
715                FilterGetRdrRulesResponse,
716                fidl::encoding::DefaultFuchsiaResourceDialect,
717                0x10c953b9ce96e5ed,
718            >(_buf?)?;
719            Ok((_response.rules, _response.generation))
720        }
721        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<Rdr>, u32)>(
722            (),
723            0x10c953b9ce96e5ed,
724            fidl::encoding::DynamicFlags::empty(),
725            _decode,
726        )
727    }
728
729    type UpdateRdrRulesResponseFut = fidl::client::QueryResponseFut<
730        FilterUpdateRdrRulesResult,
731        fidl::encoding::DefaultFuchsiaResourceDialect,
732    >;
733    fn r#update_rdr_rules(
734        &self,
735        mut rules: &[Rdr],
736        mut generation: u32,
737    ) -> Self::UpdateRdrRulesResponseFut {
738        fn _decode(
739            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
740        ) -> Result<FilterUpdateRdrRulesResult, fidl::Error> {
741            let _response = fidl::client::decode_transaction_body::<
742                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FilterUpdateRdrRulesError>,
743                fidl::encoding::DefaultFuchsiaResourceDialect,
744                0x640119eed9f46c55,
745            >(_buf?)?;
746            Ok(_response.map(|x| x))
747        }
748        self.client
749            .send_query_and_decode::<FilterUpdateRdrRulesRequest, FilterUpdateRdrRulesResult>(
750                (rules, generation),
751                0x640119eed9f46c55,
752                fidl::encoding::DynamicFlags::empty(),
753                _decode,
754            )
755    }
756
757    type CheckPresenceResponseFut =
758        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
759    fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
760        fn _decode(
761            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
762        ) -> Result<(), fidl::Error> {
763            let _response = fidl::client::decode_transaction_body::<
764                fidl::encoding::EmptyPayload,
765                fidl::encoding::DefaultFuchsiaResourceDialect,
766                0x5b2e2293c3aa2942,
767            >(_buf?)?;
768            Ok(_response)
769        }
770        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
771            (),
772            0x5b2e2293c3aa2942,
773            fidl::encoding::DynamicFlags::empty(),
774            _decode,
775        )
776    }
777}
778
779pub struct FilterEventStream {
780    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
781}
782
783impl std::marker::Unpin for FilterEventStream {}
784
785impl futures::stream::FusedStream for FilterEventStream {
786    fn is_terminated(&self) -> bool {
787        self.event_receiver.is_terminated()
788    }
789}
790
791impl futures::Stream for FilterEventStream {
792    type Item = Result<FilterEvent, fidl::Error>;
793
794    fn poll_next(
795        mut self: std::pin::Pin<&mut Self>,
796        cx: &mut std::task::Context<'_>,
797    ) -> std::task::Poll<Option<Self::Item>> {
798        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
799            &mut self.event_receiver,
800            cx
801        )?) {
802            Some(buf) => std::task::Poll::Ready(Some(FilterEvent::decode(buf))),
803            None => std::task::Poll::Ready(None),
804        }
805    }
806}
807
808#[derive(Debug)]
809pub enum FilterEvent {}
810
811impl FilterEvent {
812    /// Decodes a message buffer as a [`FilterEvent`].
813    fn decode(
814        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
815    ) -> Result<FilterEvent, fidl::Error> {
816        let (bytes, _handles) = buf.split_mut();
817        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
818        debug_assert_eq!(tx_header.tx_id, 0);
819        match tx_header.ordinal {
820            _ => Err(fidl::Error::UnknownOrdinal {
821                ordinal: tx_header.ordinal,
822                protocol_name: <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823            }),
824        }
825    }
826}
827
828/// A Stream of incoming requests for fuchsia.net.filter.deprecated/Filter.
829pub struct FilterRequestStream {
830    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
831    is_terminated: bool,
832}
833
834impl std::marker::Unpin for FilterRequestStream {}
835
836impl futures::stream::FusedStream for FilterRequestStream {
837    fn is_terminated(&self) -> bool {
838        self.is_terminated
839    }
840}
841
842impl fidl::endpoints::RequestStream for FilterRequestStream {
843    type Protocol = FilterMarker;
844    type ControlHandle = FilterControlHandle;
845
846    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
847        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
848    }
849
850    fn control_handle(&self) -> Self::ControlHandle {
851        FilterControlHandle { inner: self.inner.clone() }
852    }
853
854    fn into_inner(
855        self,
856    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
857    {
858        (self.inner, self.is_terminated)
859    }
860
861    fn from_inner(
862        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
863        is_terminated: bool,
864    ) -> Self {
865        Self { inner, is_terminated }
866    }
867}
868
869impl futures::Stream for FilterRequestStream {
870    type Item = Result<FilterRequest, fidl::Error>;
871
872    fn poll_next(
873        mut self: std::pin::Pin<&mut Self>,
874        cx: &mut std::task::Context<'_>,
875    ) -> std::task::Poll<Option<Self::Item>> {
876        let this = &mut *self;
877        if this.inner.check_shutdown(cx) {
878            this.is_terminated = true;
879            return std::task::Poll::Ready(None);
880        }
881        if this.is_terminated {
882            panic!("polled FilterRequestStream after completion");
883        }
884        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
885            |bytes, handles| {
886                match this.inner.channel().read_etc(cx, bytes, handles) {
887                    std::task::Poll::Ready(Ok(())) => {}
888                    std::task::Poll::Pending => return std::task::Poll::Pending,
889                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
890                        this.is_terminated = true;
891                        return std::task::Poll::Ready(None);
892                    }
893                    std::task::Poll::Ready(Err(e)) => {
894                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
895                            e.into(),
896                        ))));
897                    }
898                }
899
900                // A message has been received from the channel
901                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
902
903                std::task::Poll::Ready(Some(match header.ordinal {
904                    0xbf4c680f4001075 => {
905                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
906                        let mut req = fidl::new_empty!(
907                            FilterEnableInterfaceRequest,
908                            fidl::encoding::DefaultFuchsiaResourceDialect
909                        );
910                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterEnableInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
911                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
912                        Ok(FilterRequest::EnableInterface {
913                            id: req.id,
914
915                            responder: FilterEnableInterfaceResponder {
916                                control_handle: std::mem::ManuallyDrop::new(control_handle),
917                                tx_id: header.tx_id,
918                            },
919                        })
920                    }
921                    0x30d2e0e00378a294 => {
922                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
923                        let mut req = fidl::new_empty!(
924                            FilterDisableInterfaceRequest,
925                            fidl::encoding::DefaultFuchsiaResourceDialect
926                        );
927                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterDisableInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
928                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
929                        Ok(FilterRequest::DisableInterface {
930                            id: req.id,
931
932                            responder: FilterDisableInterfaceResponder {
933                                control_handle: std::mem::ManuallyDrop::new(control_handle),
934                                tx_id: header.tx_id,
935                            },
936                        })
937                    }
938                    0x284ee4bab557a949 => {
939                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
940                        let mut req = fidl::new_empty!(
941                            fidl::encoding::EmptyPayload,
942                            fidl::encoding::DefaultFuchsiaResourceDialect
943                        );
944                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
945                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
946                        Ok(FilterRequest::GetRules {
947                            responder: FilterGetRulesResponder {
948                                control_handle: std::mem::ManuallyDrop::new(control_handle),
949                                tx_id: header.tx_id,
950                            },
951                        })
952                    }
953                    0x32181f0bf9bb9a07 => {
954                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
955                        let mut req = fidl::new_empty!(
956                            FilterUpdateRulesRequest,
957                            fidl::encoding::DefaultFuchsiaResourceDialect
958                        );
959                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterUpdateRulesRequest>(&header, _body_bytes, handles, &mut req)?;
960                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
961                        Ok(FilterRequest::UpdateRules {
962                            rules: req.rules,
963                            generation: req.generation,
964
965                            responder: FilterUpdateRulesResponder {
966                                control_handle: std::mem::ManuallyDrop::new(control_handle),
967                                tx_id: header.tx_id,
968                            },
969                        })
970                    }
971                    0x5d61f46aabe0443b => {
972                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
973                        let mut req = fidl::new_empty!(
974                            fidl::encoding::EmptyPayload,
975                            fidl::encoding::DefaultFuchsiaResourceDialect
976                        );
977                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
978                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
979                        Ok(FilterRequest::GetNatRules {
980                            responder: FilterGetNatRulesResponder {
981                                control_handle: std::mem::ManuallyDrop::new(control_handle),
982                                tx_id: header.tx_id,
983                            },
984                        })
985                    }
986                    0x1711b0f7d45a2ce2 => {
987                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
988                        let mut req = fidl::new_empty!(
989                            FilterUpdateNatRulesRequest,
990                            fidl::encoding::DefaultFuchsiaResourceDialect
991                        );
992                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterUpdateNatRulesRequest>(&header, _body_bytes, handles, &mut req)?;
993                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
994                        Ok(FilterRequest::UpdateNatRules {
995                            rules: req.rules,
996                            generation: req.generation,
997
998                            responder: FilterUpdateNatRulesResponder {
999                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1000                                tx_id: header.tx_id,
1001                            },
1002                        })
1003                    }
1004                    0x10c953b9ce96e5ed => {
1005                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1006                        let mut req = fidl::new_empty!(
1007                            fidl::encoding::EmptyPayload,
1008                            fidl::encoding::DefaultFuchsiaResourceDialect
1009                        );
1010                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1011                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
1012                        Ok(FilterRequest::GetRdrRules {
1013                            responder: FilterGetRdrRulesResponder {
1014                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1015                                tx_id: header.tx_id,
1016                            },
1017                        })
1018                    }
1019                    0x640119eed9f46c55 => {
1020                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1021                        let mut req = fidl::new_empty!(
1022                            FilterUpdateRdrRulesRequest,
1023                            fidl::encoding::DefaultFuchsiaResourceDialect
1024                        );
1025                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterUpdateRdrRulesRequest>(&header, _body_bytes, handles, &mut req)?;
1026                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
1027                        Ok(FilterRequest::UpdateRdrRules {
1028                            rules: req.rules,
1029                            generation: req.generation,
1030
1031                            responder: FilterUpdateRdrRulesResponder {
1032                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1033                                tx_id: header.tx_id,
1034                            },
1035                        })
1036                    }
1037                    0x5b2e2293c3aa2942 => {
1038                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1039                        let mut req = fidl::new_empty!(
1040                            fidl::encoding::EmptyPayload,
1041                            fidl::encoding::DefaultFuchsiaResourceDialect
1042                        );
1043                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1044                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
1045                        Ok(FilterRequest::CheckPresence {
1046                            responder: FilterCheckPresenceResponder {
1047                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1048                                tx_id: header.tx_id,
1049                            },
1050                        })
1051                    }
1052                    _ => Err(fidl::Error::UnknownOrdinal {
1053                        ordinal: header.ordinal,
1054                        protocol_name:
1055                            <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1056                    }),
1057                }))
1058            },
1059        )
1060    }
1061}
1062
1063/// A protocol for filtering TCP/IP traffic and Network Address Translation.
1064#[derive(Debug)]
1065pub enum FilterRequest {
1066    /// Enable the filter on a specific interface.
1067    ///
1068    /// The filter is disabled by default. If the filter is already enabled,
1069    /// no error is returned.
1070    ///
1071    /// + request `id` The id of the network interface.
1072    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
1073    EnableInterface { id: u64, responder: FilterEnableInterfaceResponder },
1074    /// Disable the filter on a specific interface.
1075    ///
1076    /// The filter is disabled by default. If the filter is already disabled,
1077    /// no error is returned.
1078    ///
1079    /// + request `id` The id of the network interface.
1080    /// * error Reports `NOT_FOUND` if `id` is not a valid interface.
1081    DisableInterface { id: u64, responder: FilterDisableInterfaceResponder },
1082    /// GetRules gets the current rules. They do not include NAT or RDR rules.
1083    /// (use GetNatRules or GetRdrRules instead).
1084    ///
1085    /// - response `rules` The current filter rules.
1086    /// - response `generation` The generation number associated with the current
1087    ///   rules.
1088    GetRules { responder: FilterGetRulesResponder },
1089    /// UpdateRules updates the current rules. It does not update NAT or RDR rules
1090    /// (use UpdateNatRules or UpdateRdrRules instead).
1091    ///
1092    /// UpdateRules takes a generation number that is previously returned from
1093    /// GetRules. The generation number has to be up-to-date, i.e. it has to
1094    /// match with the one associated with the current rules. The service will
1095    /// assign a new generation number to the new rules.
1096    ///
1097    /// + request `rules` The new filter rules to install.
1098    /// + request `generation` The generation number previously returned from
1099    ///   GetRules.
1100    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
1101    ///   generation number for the current rules.
1102    /// * error Reports `BAD_RULE` if `rules` are not valid.
1103    UpdateRules { rules: Vec<Rule>, generation: u32, responder: FilterUpdateRulesResponder },
1104    /// GetNatRules gets the current NAT rules.
1105    ///
1106    /// - response `rules` The current NAT rules.
1107    /// - response `generation` The generation number associated with the current
1108    ///   NAT rules.
1109    GetNatRules { responder: FilterGetNatRulesResponder },
1110    /// UpdateNatRules updates the current NAT rules.
1111    ///
1112    /// UpdateNatRules takes a generation number that is previously returned from
1113    /// GetRules. The generation number has to be up-to-date, i.e. it has to
1114    /// match with the one associated with the current NAT rules. The service will
1115    /// assign a new generation number to the new NAT rules.
1116    ///
1117    /// + request `rules` The new NAT rules to install.
1118    /// + request `generation` The generation number previously returned from
1119    ///   GetNATRules.
1120    /// * error Reports `GENERATION_MISMATCH` if `generation` is not the
1121    ///   generation number for the current rules.
1122    /// * error Reports `BAD_RULE` if `rules` are not valid.
1123    UpdateNatRules { rules: Vec<Nat>, generation: u32, responder: FilterUpdateNatRulesResponder },
1124    /// GetRdrRules gets the current RDR rules.
1125    ///
1126    /// - response `rules` The current RDR rules.
1127    /// - response `generation` The generation number associated with the current
1128    ///   RDR rules.
1129    GetRdrRules { responder: FilterGetRdrRulesResponder },
1130    /// UpdateRdrRules updates the previous RDR rules with new rules.
1131    ///
1132    /// UpdateRdrRules takes a generation number that is previously returned from
1133    /// GetRules. The generation number has to be up-to-date, i.e. it has to
1134    /// match with the one associated with the current RDR rules. The service will
1135    /// assign a new generation number to the new RDR rules.
1136    ///
1137    /// + request `rules` The new RDR rules to install.
1138    /// + request `generation` The generation number previously returned from
1139    ///   GetRDRRules.
1140    /// * error Reports `NOT_SUPPORTED` if the operation is not supported.
1141    UpdateRdrRules { rules: Vec<Rdr>, generation: u32, responder: FilterUpdateRdrRulesResponder },
1142    /// No-op method that allows checking for presence.
1143    ///
1144    /// It's not currently possible for a client with an optionally-provided
1145    /// protocol to check whether there's someone on the other end without
1146    /// making a FIDL call (https://fxbug.dev/296283299). This method provides a
1147    /// workaround by giving a client a two-way method that it can call to check
1148    /// for liveness.
1149    CheckPresence { responder: FilterCheckPresenceResponder },
1150}
1151
1152impl FilterRequest {
1153    #[allow(irrefutable_let_patterns)]
1154    pub fn into_enable_interface(self) -> Option<(u64, FilterEnableInterfaceResponder)> {
1155        if let FilterRequest::EnableInterface { id, responder } = self {
1156            Some((id, responder))
1157        } else {
1158            None
1159        }
1160    }
1161
1162    #[allow(irrefutable_let_patterns)]
1163    pub fn into_disable_interface(self) -> Option<(u64, FilterDisableInterfaceResponder)> {
1164        if let FilterRequest::DisableInterface { id, responder } = self {
1165            Some((id, responder))
1166        } else {
1167            None
1168        }
1169    }
1170
1171    #[allow(irrefutable_let_patterns)]
1172    pub fn into_get_rules(self) -> Option<(FilterGetRulesResponder)> {
1173        if let FilterRequest::GetRules { responder } = self { Some((responder)) } else { None }
1174    }
1175
1176    #[allow(irrefutable_let_patterns)]
1177    pub fn into_update_rules(self) -> Option<(Vec<Rule>, u32, FilterUpdateRulesResponder)> {
1178        if let FilterRequest::UpdateRules { rules, generation, responder } = self {
1179            Some((rules, generation, responder))
1180        } else {
1181            None
1182        }
1183    }
1184
1185    #[allow(irrefutable_let_patterns)]
1186    pub fn into_get_nat_rules(self) -> Option<(FilterGetNatRulesResponder)> {
1187        if let FilterRequest::GetNatRules { responder } = self { Some((responder)) } else { None }
1188    }
1189
1190    #[allow(irrefutable_let_patterns)]
1191    pub fn into_update_nat_rules(self) -> Option<(Vec<Nat>, u32, FilterUpdateNatRulesResponder)> {
1192        if let FilterRequest::UpdateNatRules { rules, generation, responder } = self {
1193            Some((rules, generation, responder))
1194        } else {
1195            None
1196        }
1197    }
1198
1199    #[allow(irrefutable_let_patterns)]
1200    pub fn into_get_rdr_rules(self) -> Option<(FilterGetRdrRulesResponder)> {
1201        if let FilterRequest::GetRdrRules { responder } = self { Some((responder)) } else { None }
1202    }
1203
1204    #[allow(irrefutable_let_patterns)]
1205    pub fn into_update_rdr_rules(self) -> Option<(Vec<Rdr>, u32, FilterUpdateRdrRulesResponder)> {
1206        if let FilterRequest::UpdateRdrRules { rules, generation, responder } = self {
1207            Some((rules, generation, responder))
1208        } else {
1209            None
1210        }
1211    }
1212
1213    #[allow(irrefutable_let_patterns)]
1214    pub fn into_check_presence(self) -> Option<(FilterCheckPresenceResponder)> {
1215        if let FilterRequest::CheckPresence { responder } = self { Some((responder)) } else { None }
1216    }
1217
1218    /// Name of the method defined in FIDL
1219    pub fn method_name(&self) -> &'static str {
1220        match *self {
1221            FilterRequest::EnableInterface { .. } => "enable_interface",
1222            FilterRequest::DisableInterface { .. } => "disable_interface",
1223            FilterRequest::GetRules { .. } => "get_rules",
1224            FilterRequest::UpdateRules { .. } => "update_rules",
1225            FilterRequest::GetNatRules { .. } => "get_nat_rules",
1226            FilterRequest::UpdateNatRules { .. } => "update_nat_rules",
1227            FilterRequest::GetRdrRules { .. } => "get_rdr_rules",
1228            FilterRequest::UpdateRdrRules { .. } => "update_rdr_rules",
1229            FilterRequest::CheckPresence { .. } => "check_presence",
1230        }
1231    }
1232}
1233
1234#[derive(Debug, Clone)]
1235pub struct FilterControlHandle {
1236    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1237}
1238
1239impl fidl::endpoints::ControlHandle for FilterControlHandle {
1240    fn shutdown(&self) {
1241        self.inner.shutdown()
1242    }
1243
1244    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1245        self.inner.shutdown_with_epitaph(status)
1246    }
1247
1248    fn is_closed(&self) -> bool {
1249        self.inner.channel().is_closed()
1250    }
1251    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1252        self.inner.channel().on_closed()
1253    }
1254
1255    #[cfg(target_os = "fuchsia")]
1256    fn signal_peer(
1257        &self,
1258        clear_mask: zx::Signals,
1259        set_mask: zx::Signals,
1260    ) -> Result<(), zx_status::Status> {
1261        use fidl::Peered;
1262        self.inner.channel().signal_peer(clear_mask, set_mask)
1263    }
1264}
1265
1266impl FilterControlHandle {}
1267
1268#[must_use = "FIDL methods require a response to be sent"]
1269#[derive(Debug)]
1270pub struct FilterEnableInterfaceResponder {
1271    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1272    tx_id: u32,
1273}
1274
1275/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1276/// if the responder is dropped without sending a response, so that the client
1277/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1278impl std::ops::Drop for FilterEnableInterfaceResponder {
1279    fn drop(&mut self) {
1280        self.control_handle.shutdown();
1281        // Safety: drops once, never accessed again
1282        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1283    }
1284}
1285
1286impl fidl::endpoints::Responder for FilterEnableInterfaceResponder {
1287    type ControlHandle = FilterControlHandle;
1288
1289    fn control_handle(&self) -> &FilterControlHandle {
1290        &self.control_handle
1291    }
1292
1293    fn drop_without_shutdown(mut self) {
1294        // Safety: drops once, never accessed again due to mem::forget
1295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1296        // Prevent Drop from running (which would shut down the channel)
1297        std::mem::forget(self);
1298    }
1299}
1300
1301impl FilterEnableInterfaceResponder {
1302    /// Sends a response to the FIDL transaction.
1303    ///
1304    /// Sets the channel to shutdown if an error occurs.
1305    pub fn send(
1306        self,
1307        mut result: Result<(), EnableDisableInterfaceError>,
1308    ) -> Result<(), fidl::Error> {
1309        let _result = self.send_raw(result);
1310        if _result.is_err() {
1311            self.control_handle.shutdown();
1312        }
1313        self.drop_without_shutdown();
1314        _result
1315    }
1316
1317    /// Similar to "send" but does not shutdown the channel if an error occurs.
1318    pub fn send_no_shutdown_on_err(
1319        self,
1320        mut result: Result<(), EnableDisableInterfaceError>,
1321    ) -> Result<(), fidl::Error> {
1322        let _result = self.send_raw(result);
1323        self.drop_without_shutdown();
1324        _result
1325    }
1326
1327    fn send_raw(
1328        &self,
1329        mut result: Result<(), EnableDisableInterfaceError>,
1330    ) -> Result<(), fidl::Error> {
1331        self.control_handle.inner.send::<fidl::encoding::ResultType<
1332            fidl::encoding::EmptyStruct,
1333            EnableDisableInterfaceError,
1334        >>(
1335            result,
1336            self.tx_id,
1337            0xbf4c680f4001075,
1338            fidl::encoding::DynamicFlags::empty(),
1339        )
1340    }
1341}
1342
1343#[must_use = "FIDL methods require a response to be sent"]
1344#[derive(Debug)]
1345pub struct FilterDisableInterfaceResponder {
1346    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1347    tx_id: u32,
1348}
1349
1350/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1351/// if the responder is dropped without sending a response, so that the client
1352/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1353impl std::ops::Drop for FilterDisableInterfaceResponder {
1354    fn drop(&mut self) {
1355        self.control_handle.shutdown();
1356        // Safety: drops once, never accessed again
1357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358    }
1359}
1360
1361impl fidl::endpoints::Responder for FilterDisableInterfaceResponder {
1362    type ControlHandle = FilterControlHandle;
1363
1364    fn control_handle(&self) -> &FilterControlHandle {
1365        &self.control_handle
1366    }
1367
1368    fn drop_without_shutdown(mut self) {
1369        // Safety: drops once, never accessed again due to mem::forget
1370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371        // Prevent Drop from running (which would shut down the channel)
1372        std::mem::forget(self);
1373    }
1374}
1375
1376impl FilterDisableInterfaceResponder {
1377    /// Sends a response to the FIDL transaction.
1378    ///
1379    /// Sets the channel to shutdown if an error occurs.
1380    pub fn send(
1381        self,
1382        mut result: Result<(), EnableDisableInterfaceError>,
1383    ) -> Result<(), fidl::Error> {
1384        let _result = self.send_raw(result);
1385        if _result.is_err() {
1386            self.control_handle.shutdown();
1387        }
1388        self.drop_without_shutdown();
1389        _result
1390    }
1391
1392    /// Similar to "send" but does not shutdown the channel if an error occurs.
1393    pub fn send_no_shutdown_on_err(
1394        self,
1395        mut result: Result<(), EnableDisableInterfaceError>,
1396    ) -> Result<(), fidl::Error> {
1397        let _result = self.send_raw(result);
1398        self.drop_without_shutdown();
1399        _result
1400    }
1401
1402    fn send_raw(
1403        &self,
1404        mut result: Result<(), EnableDisableInterfaceError>,
1405    ) -> Result<(), fidl::Error> {
1406        self.control_handle.inner.send::<fidl::encoding::ResultType<
1407            fidl::encoding::EmptyStruct,
1408            EnableDisableInterfaceError,
1409        >>(
1410            result,
1411            self.tx_id,
1412            0x30d2e0e00378a294,
1413            fidl::encoding::DynamicFlags::empty(),
1414        )
1415    }
1416}
1417
1418#[must_use = "FIDL methods require a response to be sent"]
1419#[derive(Debug)]
1420pub struct FilterGetRulesResponder {
1421    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1422    tx_id: u32,
1423}
1424
1425/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1426/// if the responder is dropped without sending a response, so that the client
1427/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1428impl std::ops::Drop for FilterGetRulesResponder {
1429    fn drop(&mut self) {
1430        self.control_handle.shutdown();
1431        // Safety: drops once, never accessed again
1432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1433    }
1434}
1435
1436impl fidl::endpoints::Responder for FilterGetRulesResponder {
1437    type ControlHandle = FilterControlHandle;
1438
1439    fn control_handle(&self) -> &FilterControlHandle {
1440        &self.control_handle
1441    }
1442
1443    fn drop_without_shutdown(mut self) {
1444        // Safety: drops once, never accessed again due to mem::forget
1445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1446        // Prevent Drop from running (which would shut down the channel)
1447        std::mem::forget(self);
1448    }
1449}
1450
1451impl FilterGetRulesResponder {
1452    /// Sends a response to the FIDL transaction.
1453    ///
1454    /// Sets the channel to shutdown if an error occurs.
1455    pub fn send(self, mut rules: &[Rule], mut generation: u32) -> Result<(), fidl::Error> {
1456        let _result = self.send_raw(rules, generation);
1457        if _result.is_err() {
1458            self.control_handle.shutdown();
1459        }
1460        self.drop_without_shutdown();
1461        _result
1462    }
1463
1464    /// Similar to "send" but does not shutdown the channel if an error occurs.
1465    pub fn send_no_shutdown_on_err(
1466        self,
1467        mut rules: &[Rule],
1468        mut generation: u32,
1469    ) -> Result<(), fidl::Error> {
1470        let _result = self.send_raw(rules, generation);
1471        self.drop_without_shutdown();
1472        _result
1473    }
1474
1475    fn send_raw(&self, mut rules: &[Rule], mut generation: u32) -> Result<(), fidl::Error> {
1476        self.control_handle.inner.send::<FilterGetRulesResponse>(
1477            (rules, generation),
1478            self.tx_id,
1479            0x284ee4bab557a949,
1480            fidl::encoding::DynamicFlags::empty(),
1481        )
1482    }
1483}
1484
1485#[must_use = "FIDL methods require a response to be sent"]
1486#[derive(Debug)]
1487pub struct FilterUpdateRulesResponder {
1488    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1489    tx_id: u32,
1490}
1491
1492/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1493/// if the responder is dropped without sending a response, so that the client
1494/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1495impl std::ops::Drop for FilterUpdateRulesResponder {
1496    fn drop(&mut self) {
1497        self.control_handle.shutdown();
1498        // Safety: drops once, never accessed again
1499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500    }
1501}
1502
1503impl fidl::endpoints::Responder for FilterUpdateRulesResponder {
1504    type ControlHandle = FilterControlHandle;
1505
1506    fn control_handle(&self) -> &FilterControlHandle {
1507        &self.control_handle
1508    }
1509
1510    fn drop_without_shutdown(mut self) {
1511        // Safety: drops once, never accessed again due to mem::forget
1512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1513        // Prevent Drop from running (which would shut down the channel)
1514        std::mem::forget(self);
1515    }
1516}
1517
1518impl FilterUpdateRulesResponder {
1519    /// Sends a response to the FIDL transaction.
1520    ///
1521    /// Sets the channel to shutdown if an error occurs.
1522    pub fn send(self, mut result: Result<(), FilterUpdateRulesError>) -> Result<(), fidl::Error> {
1523        let _result = self.send_raw(result);
1524        if _result.is_err() {
1525            self.control_handle.shutdown();
1526        }
1527        self.drop_without_shutdown();
1528        _result
1529    }
1530
1531    /// Similar to "send" but does not shutdown the channel if an error occurs.
1532    pub fn send_no_shutdown_on_err(
1533        self,
1534        mut result: Result<(), FilterUpdateRulesError>,
1535    ) -> Result<(), fidl::Error> {
1536        let _result = self.send_raw(result);
1537        self.drop_without_shutdown();
1538        _result
1539    }
1540
1541    fn send_raw(&self, mut result: Result<(), FilterUpdateRulesError>) -> Result<(), fidl::Error> {
1542        self.control_handle.inner.send::<fidl::encoding::ResultType<
1543            fidl::encoding::EmptyStruct,
1544            FilterUpdateRulesError,
1545        >>(
1546            result,
1547            self.tx_id,
1548            0x32181f0bf9bb9a07,
1549            fidl::encoding::DynamicFlags::empty(),
1550        )
1551    }
1552}
1553
1554#[must_use = "FIDL methods require a response to be sent"]
1555#[derive(Debug)]
1556pub struct FilterGetNatRulesResponder {
1557    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1558    tx_id: u32,
1559}
1560
1561/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1562/// if the responder is dropped without sending a response, so that the client
1563/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1564impl std::ops::Drop for FilterGetNatRulesResponder {
1565    fn drop(&mut self) {
1566        self.control_handle.shutdown();
1567        // Safety: drops once, never accessed again
1568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569    }
1570}
1571
1572impl fidl::endpoints::Responder for FilterGetNatRulesResponder {
1573    type ControlHandle = FilterControlHandle;
1574
1575    fn control_handle(&self) -> &FilterControlHandle {
1576        &self.control_handle
1577    }
1578
1579    fn drop_without_shutdown(mut self) {
1580        // Safety: drops once, never accessed again due to mem::forget
1581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1582        // Prevent Drop from running (which would shut down the channel)
1583        std::mem::forget(self);
1584    }
1585}
1586
1587impl FilterGetNatRulesResponder {
1588    /// Sends a response to the FIDL transaction.
1589    ///
1590    /// Sets the channel to shutdown if an error occurs.
1591    pub fn send(self, mut rules: &[Nat], mut generation: u32) -> Result<(), fidl::Error> {
1592        let _result = self.send_raw(rules, generation);
1593        if _result.is_err() {
1594            self.control_handle.shutdown();
1595        }
1596        self.drop_without_shutdown();
1597        _result
1598    }
1599
1600    /// Similar to "send" but does not shutdown the channel if an error occurs.
1601    pub fn send_no_shutdown_on_err(
1602        self,
1603        mut rules: &[Nat],
1604        mut generation: u32,
1605    ) -> Result<(), fidl::Error> {
1606        let _result = self.send_raw(rules, generation);
1607        self.drop_without_shutdown();
1608        _result
1609    }
1610
1611    fn send_raw(&self, mut rules: &[Nat], mut generation: u32) -> Result<(), fidl::Error> {
1612        self.control_handle.inner.send::<FilterGetNatRulesResponse>(
1613            (rules, generation),
1614            self.tx_id,
1615            0x5d61f46aabe0443b,
1616            fidl::encoding::DynamicFlags::empty(),
1617        )
1618    }
1619}
1620
1621#[must_use = "FIDL methods require a response to be sent"]
1622#[derive(Debug)]
1623pub struct FilterUpdateNatRulesResponder {
1624    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1625    tx_id: u32,
1626}
1627
1628/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1629/// if the responder is dropped without sending a response, so that the client
1630/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1631impl std::ops::Drop for FilterUpdateNatRulesResponder {
1632    fn drop(&mut self) {
1633        self.control_handle.shutdown();
1634        // Safety: drops once, never accessed again
1635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1636    }
1637}
1638
1639impl fidl::endpoints::Responder for FilterUpdateNatRulesResponder {
1640    type ControlHandle = FilterControlHandle;
1641
1642    fn control_handle(&self) -> &FilterControlHandle {
1643        &self.control_handle
1644    }
1645
1646    fn drop_without_shutdown(mut self) {
1647        // Safety: drops once, never accessed again due to mem::forget
1648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1649        // Prevent Drop from running (which would shut down the channel)
1650        std::mem::forget(self);
1651    }
1652}
1653
1654impl FilterUpdateNatRulesResponder {
1655    /// Sends a response to the FIDL transaction.
1656    ///
1657    /// Sets the channel to shutdown if an error occurs.
1658    pub fn send(
1659        self,
1660        mut result: Result<(), FilterUpdateNatRulesError>,
1661    ) -> Result<(), fidl::Error> {
1662        let _result = self.send_raw(result);
1663        if _result.is_err() {
1664            self.control_handle.shutdown();
1665        }
1666        self.drop_without_shutdown();
1667        _result
1668    }
1669
1670    /// Similar to "send" but does not shutdown the channel if an error occurs.
1671    pub fn send_no_shutdown_on_err(
1672        self,
1673        mut result: Result<(), FilterUpdateNatRulesError>,
1674    ) -> Result<(), fidl::Error> {
1675        let _result = self.send_raw(result);
1676        self.drop_without_shutdown();
1677        _result
1678    }
1679
1680    fn send_raw(
1681        &self,
1682        mut result: Result<(), FilterUpdateNatRulesError>,
1683    ) -> Result<(), fidl::Error> {
1684        self.control_handle.inner.send::<fidl::encoding::ResultType<
1685            fidl::encoding::EmptyStruct,
1686            FilterUpdateNatRulesError,
1687        >>(
1688            result,
1689            self.tx_id,
1690            0x1711b0f7d45a2ce2,
1691            fidl::encoding::DynamicFlags::empty(),
1692        )
1693    }
1694}
1695
1696#[must_use = "FIDL methods require a response to be sent"]
1697#[derive(Debug)]
1698pub struct FilterGetRdrRulesResponder {
1699    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1700    tx_id: u32,
1701}
1702
1703/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1704/// if the responder is dropped without sending a response, so that the client
1705/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1706impl std::ops::Drop for FilterGetRdrRulesResponder {
1707    fn drop(&mut self) {
1708        self.control_handle.shutdown();
1709        // Safety: drops once, never accessed again
1710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1711    }
1712}
1713
1714impl fidl::endpoints::Responder for FilterGetRdrRulesResponder {
1715    type ControlHandle = FilterControlHandle;
1716
1717    fn control_handle(&self) -> &FilterControlHandle {
1718        &self.control_handle
1719    }
1720
1721    fn drop_without_shutdown(mut self) {
1722        // Safety: drops once, never accessed again due to mem::forget
1723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724        // Prevent Drop from running (which would shut down the channel)
1725        std::mem::forget(self);
1726    }
1727}
1728
1729impl FilterGetRdrRulesResponder {
1730    /// Sends a response to the FIDL transaction.
1731    ///
1732    /// Sets the channel to shutdown if an error occurs.
1733    pub fn send(self, mut rules: &[Rdr], mut generation: u32) -> Result<(), fidl::Error> {
1734        let _result = self.send_raw(rules, generation);
1735        if _result.is_err() {
1736            self.control_handle.shutdown();
1737        }
1738        self.drop_without_shutdown();
1739        _result
1740    }
1741
1742    /// Similar to "send" but does not shutdown the channel if an error occurs.
1743    pub fn send_no_shutdown_on_err(
1744        self,
1745        mut rules: &[Rdr],
1746        mut generation: u32,
1747    ) -> Result<(), fidl::Error> {
1748        let _result = self.send_raw(rules, generation);
1749        self.drop_without_shutdown();
1750        _result
1751    }
1752
1753    fn send_raw(&self, mut rules: &[Rdr], mut generation: u32) -> Result<(), fidl::Error> {
1754        self.control_handle.inner.send::<FilterGetRdrRulesResponse>(
1755            (rules, generation),
1756            self.tx_id,
1757            0x10c953b9ce96e5ed,
1758            fidl::encoding::DynamicFlags::empty(),
1759        )
1760    }
1761}
1762
1763#[must_use = "FIDL methods require a response to be sent"]
1764#[derive(Debug)]
1765pub struct FilterUpdateRdrRulesResponder {
1766    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1767    tx_id: u32,
1768}
1769
1770/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1771/// if the responder is dropped without sending a response, so that the client
1772/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1773impl std::ops::Drop for FilterUpdateRdrRulesResponder {
1774    fn drop(&mut self) {
1775        self.control_handle.shutdown();
1776        // Safety: drops once, never accessed again
1777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1778    }
1779}
1780
1781impl fidl::endpoints::Responder for FilterUpdateRdrRulesResponder {
1782    type ControlHandle = FilterControlHandle;
1783
1784    fn control_handle(&self) -> &FilterControlHandle {
1785        &self.control_handle
1786    }
1787
1788    fn drop_without_shutdown(mut self) {
1789        // Safety: drops once, never accessed again due to mem::forget
1790        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1791        // Prevent Drop from running (which would shut down the channel)
1792        std::mem::forget(self);
1793    }
1794}
1795
1796impl FilterUpdateRdrRulesResponder {
1797    /// Sends a response to the FIDL transaction.
1798    ///
1799    /// Sets the channel to shutdown if an error occurs.
1800    pub fn send(
1801        self,
1802        mut result: Result<(), FilterUpdateRdrRulesError>,
1803    ) -> Result<(), fidl::Error> {
1804        let _result = self.send_raw(result);
1805        if _result.is_err() {
1806            self.control_handle.shutdown();
1807        }
1808        self.drop_without_shutdown();
1809        _result
1810    }
1811
1812    /// Similar to "send" but does not shutdown the channel if an error occurs.
1813    pub fn send_no_shutdown_on_err(
1814        self,
1815        mut result: Result<(), FilterUpdateRdrRulesError>,
1816    ) -> Result<(), fidl::Error> {
1817        let _result = self.send_raw(result);
1818        self.drop_without_shutdown();
1819        _result
1820    }
1821
1822    fn send_raw(
1823        &self,
1824        mut result: Result<(), FilterUpdateRdrRulesError>,
1825    ) -> Result<(), fidl::Error> {
1826        self.control_handle.inner.send::<fidl::encoding::ResultType<
1827            fidl::encoding::EmptyStruct,
1828            FilterUpdateRdrRulesError,
1829        >>(
1830            result,
1831            self.tx_id,
1832            0x640119eed9f46c55,
1833            fidl::encoding::DynamicFlags::empty(),
1834        )
1835    }
1836}
1837
1838#[must_use = "FIDL methods require a response to be sent"]
1839#[derive(Debug)]
1840pub struct FilterCheckPresenceResponder {
1841    control_handle: std::mem::ManuallyDrop<FilterControlHandle>,
1842    tx_id: u32,
1843}
1844
1845/// Set the the channel to be shutdown (see [`FilterControlHandle::shutdown`])
1846/// if the responder is dropped without sending a response, so that the client
1847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1848impl std::ops::Drop for FilterCheckPresenceResponder {
1849    fn drop(&mut self) {
1850        self.control_handle.shutdown();
1851        // Safety: drops once, never accessed again
1852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1853    }
1854}
1855
1856impl fidl::endpoints::Responder for FilterCheckPresenceResponder {
1857    type ControlHandle = FilterControlHandle;
1858
1859    fn control_handle(&self) -> &FilterControlHandle {
1860        &self.control_handle
1861    }
1862
1863    fn drop_without_shutdown(mut self) {
1864        // Safety: drops once, never accessed again due to mem::forget
1865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866        // Prevent Drop from running (which would shut down the channel)
1867        std::mem::forget(self);
1868    }
1869}
1870
1871impl FilterCheckPresenceResponder {
1872    /// Sends a response to the FIDL transaction.
1873    ///
1874    /// Sets the channel to shutdown if an error occurs.
1875    pub fn send(self) -> Result<(), fidl::Error> {
1876        let _result = self.send_raw();
1877        if _result.is_err() {
1878            self.control_handle.shutdown();
1879        }
1880        self.drop_without_shutdown();
1881        _result
1882    }
1883
1884    /// Similar to "send" but does not shutdown the channel if an error occurs.
1885    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1886        let _result = self.send_raw();
1887        self.drop_without_shutdown();
1888        _result
1889    }
1890
1891    fn send_raw(&self) -> Result<(), fidl::Error> {
1892        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1893            (),
1894            self.tx_id,
1895            0x5b2e2293c3aa2942,
1896            fidl::encoding::DynamicFlags::empty(),
1897        )
1898    }
1899}
1900
1901mod internal {
1902    use super::*;
1903}