Skip to main content

fdomain_fuchsia_net_routes_admin/
fdomain_fuchsia_net_routes_admin.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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_net_routes_admin_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct BaseRouteTableGetAuthorizationForRouteTableResponse {
15    pub credential: GrantForRouteTableAuthorization,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
19    for BaseRouteTableGetAuthorizationForRouteTableResponse
20{
21}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct GrantForRouteTableAuthorization {
25    /// The ID of the table this credential is authenticating.
26    pub table_id: u32,
27    /// The `EVENT` providing authentication over this route table.
28    pub token: fdomain_client::Event,
29}
30
31impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
32    for GrantForRouteTableAuthorization
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct ProofOfRouteTableAuthorization {
38    pub table: u32,
39    pub token: fdomain_client::Event,
40}
41
42impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
43    for ProofOfRouteTableAuthorization
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct RouteSetV4AddRouteRequest {
49    pub route: fdomain_fuchsia_net_routes::RouteV4,
50}
51
52impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RouteSetV4AddRouteRequest {}
53
54#[derive(Debug, PartialEq)]
55pub struct RouteSetV4AuthenticateForInterfaceRequest {
56    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
57}
58
59impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
60    for RouteSetV4AuthenticateForInterfaceRequest
61{
62}
63
64#[derive(Debug, PartialEq)]
65pub struct RouteSetV4RemoveRouteRequest {
66    pub route: fdomain_fuchsia_net_routes::RouteV4,
67}
68
69impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
70    for RouteSetV4RemoveRouteRequest
71{
72}
73
74#[derive(Debug, PartialEq)]
75pub struct RouteSetV6AddRouteRequest {
76    pub route: fdomain_fuchsia_net_routes::RouteV6,
77}
78
79impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RouteSetV6AddRouteRequest {}
80
81#[derive(Debug, PartialEq)]
82pub struct RouteSetV6AuthenticateForInterfaceRequest {
83    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
84}
85
86impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
87    for RouteSetV6AuthenticateForInterfaceRequest
88{
89}
90
91#[derive(Debug, PartialEq)]
92pub struct RouteSetV6RemoveRouteRequest {
93    pub route: fdomain_fuchsia_net_routes::RouteV6,
94}
95
96impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
97    for RouteSetV6RemoveRouteRequest
98{
99}
100
101#[derive(Debug, PartialEq)]
102pub struct RouteTableProviderV4GetInterfaceLocalTableRequest {
103    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
104}
105
106impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
107    for RouteTableProviderV4GetInterfaceLocalTableRequest
108{
109}
110
111#[derive(Debug, PartialEq)]
112pub struct RouteTableProviderV4NewRouteTableRequest {
113    pub provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
114    pub options: RouteTableOptionsV4,
115}
116
117impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
118    for RouteTableProviderV4NewRouteTableRequest
119{
120}
121
122#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct RouteTableProviderV4GetInterfaceLocalTableResponse {
124    pub route_table: fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
125}
126
127impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
128    for RouteTableProviderV4GetInterfaceLocalTableResponse
129{
130}
131
132#[derive(Debug, PartialEq)]
133pub struct RouteTableProviderV6GetInterfaceLocalTableRequest {
134    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
135}
136
137impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
138    for RouteTableProviderV6GetInterfaceLocalTableRequest
139{
140}
141
142#[derive(Debug, PartialEq)]
143pub struct RouteTableProviderV6NewRouteTableRequest {
144    pub provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
145    pub options: RouteTableOptionsV6,
146}
147
148impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
149    for RouteTableProviderV6NewRouteTableRequest
150{
151}
152
153#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
154pub struct RouteTableProviderV6GetInterfaceLocalTableResponse {
155    pub route_table: fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
156}
157
158impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
159    for RouteTableProviderV6GetInterfaceLocalTableResponse
160{
161}
162
163#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct RouteTableV4NewRouteSetRequest {
165    pub route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
166}
167
168impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
169    for RouteTableV4NewRouteSetRequest
170{
171}
172
173#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
174pub struct RouteTableV6NewRouteSetRequest {
175    pub route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
176}
177
178impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
179    for RouteTableV6NewRouteSetRequest
180{
181}
182
183#[derive(Debug, PartialEq)]
184pub struct RuleSetV4AddRuleRequest {
185    pub index: u32,
186    pub matcher: fdomain_fuchsia_net_routes::RuleMatcherV4,
187    pub action: fdomain_fuchsia_net_routes::RuleAction,
188}
189
190impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RuleSetV4AddRuleRequest {}
191
192#[derive(Debug, PartialEq)]
193pub struct RuleSetV6AddRuleRequest {
194    pub index: u32,
195    pub matcher: fdomain_fuchsia_net_routes::RuleMatcherV6,
196    pub action: fdomain_fuchsia_net_routes::RuleAction,
197}
198
199impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RuleSetV6AddRuleRequest {}
200
201#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
202pub struct RuleTableV4NewRuleSetRequest {
203    pub priority: u32,
204    pub rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
205}
206
207impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
208    for RuleTableV4NewRuleSetRequest
209{
210}
211
212#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
213pub struct RuleTableV6NewRuleSetRequest {
214    pub priority: u32,
215    pub rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
216}
217
218impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
219    for RuleTableV6NewRuleSetRequest
220{
221}
222
223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
224pub struct BaseRouteTableMarker;
225
226impl fdomain_client::fidl::ProtocolMarker for BaseRouteTableMarker {
227    type Proxy = BaseRouteTableProxy;
228    type RequestStream = BaseRouteTableRequestStream;
229
230    const DEBUG_NAME: &'static str = "(anonymous) BaseRouteTable";
231}
232pub type BaseRouteTableRemoveResult = Result<(), BaseRouteTableRemoveError>;
233
234pub trait BaseRouteTableProxyInterface: Send + Sync {
235    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
236    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
237    fn r#detach(&self) -> Result<(), fidl::Error>;
238    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
239        + Send;
240    fn r#remove(&self) -> Self::RemoveResponseFut;
241    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
242        + Send;
243    fn r#get_authorization_for_route_table(&self)
244    -> Self::GetAuthorizationForRouteTableResponseFut;
245}
246
247#[derive(Debug, Clone)]
248pub struct BaseRouteTableProxy {
249    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
250}
251
252impl fdomain_client::fidl::Proxy for BaseRouteTableProxy {
253    type Protocol = BaseRouteTableMarker;
254
255    fn from_channel(inner: fdomain_client::Channel) -> Self {
256        Self::new(inner)
257    }
258
259    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
260        self.client.into_channel().map_err(|client| Self { client })
261    }
262
263    fn as_channel(&self) -> &fdomain_client::Channel {
264        self.client.as_channel()
265    }
266}
267
268impl BaseRouteTableProxy {
269    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRouteTable.
270    pub fn new(channel: fdomain_client::Channel) -> Self {
271        let protocol_name =
272            <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
273        Self { client: fidl::client::Client::new(channel, protocol_name) }
274    }
275
276    /// Get a Stream of events from the remote end of the protocol.
277    ///
278    /// # Panics
279    ///
280    /// Panics if the event stream was already taken.
281    pub fn take_event_stream(&self) -> BaseRouteTableEventStream {
282        BaseRouteTableEventStream { event_receiver: self.client.take_event_receiver() }
283    }
284
285    /// Gets the table ID for this table.
286    pub fn r#get_table_id(
287        &self,
288    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
289        BaseRouteTableProxyInterface::r#get_table_id(self)
290    }
291
292    /// Detaches the lifetime of the route table from the lifetime of the
293    /// client end of the channel.
294    ///
295    /// After this method is called, the route table will not be removed
296    /// if the client end is closed. It's a no-op if called on the main table.
297    pub fn r#detach(&self) -> Result<(), fidl::Error> {
298        BaseRouteTableProxyInterface::r#detach(self)
299    }
300
301    /// Removes the route table explicitly.
302    ///
303    /// This method cannot be called on the main table or an interface-local
304    /// table, an error will be returned if called. The server will close the
305    /// channel after this method successfully returns.
306    pub fn r#remove(
307        &self,
308    ) -> fidl::client::QueryResponseFut<
309        BaseRouteTableRemoveResult,
310        fdomain_client::fidl::FDomainResourceDialect,
311    > {
312        BaseRouteTableProxyInterface::r#remove(self)
313    }
314
315    /// Gets an authentication credential for this table.
316    ///
317    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
318    /// held by the server. This credential can be passed into
319    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
320    /// table. The `EVENT` is stable throughout the lifetime of the route table.
321    /// Clients may duplicate this `EVENT` to make multiple API calls, or
322    /// transfer the `EVENT` to other clients.
323    ///
324    /// - response `credential` the authorization credential for this table.
325    pub fn r#get_authorization_for_route_table(
326        &self,
327    ) -> fidl::client::QueryResponseFut<
328        GrantForRouteTableAuthorization,
329        fdomain_client::fidl::FDomainResourceDialect,
330    > {
331        BaseRouteTableProxyInterface::r#get_authorization_for_route_table(self)
332    }
333}
334
335impl BaseRouteTableProxyInterface for BaseRouteTableProxy {
336    type GetTableIdResponseFut =
337        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
338    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
339        fn _decode(
340            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
341        ) -> Result<u32, fidl::Error> {
342            let _response = fidl::client::decode_transaction_body::<
343                BaseRouteTableGetTableIdResponse,
344                fdomain_client::fidl::FDomainResourceDialect,
345                0x7eab30c55edbfc15,
346            >(_buf?)?;
347            Ok(_response.table_id)
348        }
349        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
350            (),
351            0x7eab30c55edbfc15,
352            fidl::encoding::DynamicFlags::empty(),
353            _decode,
354        )
355    }
356
357    fn r#detach(&self) -> Result<(), fidl::Error> {
358        self.client.send::<fidl::encoding::EmptyPayload>(
359            (),
360            0x2853ab157285b384,
361            fidl::encoding::DynamicFlags::empty(),
362        )
363    }
364
365    type RemoveResponseFut = fidl::client::QueryResponseFut<
366        BaseRouteTableRemoveResult,
367        fdomain_client::fidl::FDomainResourceDialect,
368    >;
369    fn r#remove(&self) -> Self::RemoveResponseFut {
370        fn _decode(
371            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
372        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
373            let _response = fidl::client::decode_transaction_body::<
374                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
375                fdomain_client::fidl::FDomainResourceDialect,
376                0xc42e58a5fc79426,
377            >(_buf?)?;
378            Ok(_response.map(|x| x))
379        }
380        self.client
381            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
382                (),
383                0xc42e58a5fc79426,
384                fidl::encoding::DynamicFlags::empty(),
385                _decode,
386            )
387    }
388
389    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
390        GrantForRouteTableAuthorization,
391        fdomain_client::fidl::FDomainResourceDialect,
392    >;
393    fn r#get_authorization_for_route_table(
394        &self,
395    ) -> Self::GetAuthorizationForRouteTableResponseFut {
396        fn _decode(
397            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
398        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
399            let _response = fidl::client::decode_transaction_body::<
400                BaseRouteTableGetAuthorizationForRouteTableResponse,
401                fdomain_client::fidl::FDomainResourceDialect,
402                0x56a48c921ff3b6eb,
403            >(_buf?)?;
404            Ok(_response.credential)
405        }
406        self.client
407            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
408                (),
409                0x56a48c921ff3b6eb,
410                fidl::encoding::DynamicFlags::empty(),
411                _decode,
412            )
413    }
414}
415
416pub struct BaseRouteTableEventStream {
417    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
418}
419
420impl std::marker::Unpin for BaseRouteTableEventStream {}
421
422impl futures::stream::FusedStream for BaseRouteTableEventStream {
423    fn is_terminated(&self) -> bool {
424        self.event_receiver.is_terminated()
425    }
426}
427
428impl futures::Stream for BaseRouteTableEventStream {
429    type Item = Result<BaseRouteTableEvent, fidl::Error>;
430
431    fn poll_next(
432        mut self: std::pin::Pin<&mut Self>,
433        cx: &mut std::task::Context<'_>,
434    ) -> std::task::Poll<Option<Self::Item>> {
435        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
436            &mut self.event_receiver,
437            cx
438        )?) {
439            Some(buf) => std::task::Poll::Ready(Some(BaseRouteTableEvent::decode(buf))),
440            None => std::task::Poll::Ready(None),
441        }
442    }
443}
444
445#[derive(Debug)]
446pub enum BaseRouteTableEvent {}
447
448impl BaseRouteTableEvent {
449    /// Decodes a message buffer as a [`BaseRouteTableEvent`].
450    fn decode(
451        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452    ) -> Result<BaseRouteTableEvent, fidl::Error> {
453        let (bytes, _handles) = buf.split_mut();
454        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455        debug_assert_eq!(tx_header.tx_id, 0);
456        match tx_header.ordinal {
457            _ => Err(fidl::Error::UnknownOrdinal {
458                ordinal: tx_header.ordinal,
459                protocol_name:
460                    <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
461            }),
462        }
463    }
464}
465
466/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRouteTable.
467pub struct BaseRouteTableRequestStream {
468    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
469    is_terminated: bool,
470}
471
472impl std::marker::Unpin for BaseRouteTableRequestStream {}
473
474impl futures::stream::FusedStream for BaseRouteTableRequestStream {
475    fn is_terminated(&self) -> bool {
476        self.is_terminated
477    }
478}
479
480impl fdomain_client::fidl::RequestStream for BaseRouteTableRequestStream {
481    type Protocol = BaseRouteTableMarker;
482    type ControlHandle = BaseRouteTableControlHandle;
483
484    fn from_channel(channel: fdomain_client::Channel) -> Self {
485        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
486    }
487
488    fn control_handle(&self) -> Self::ControlHandle {
489        BaseRouteTableControlHandle { inner: self.inner.clone() }
490    }
491
492    fn into_inner(
493        self,
494    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
495    {
496        (self.inner, self.is_terminated)
497    }
498
499    fn from_inner(
500        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
501        is_terminated: bool,
502    ) -> Self {
503        Self { inner, is_terminated }
504    }
505}
506
507impl futures::Stream for BaseRouteTableRequestStream {
508    type Item = Result<BaseRouteTableRequest, fidl::Error>;
509
510    fn poll_next(
511        mut self: std::pin::Pin<&mut Self>,
512        cx: &mut std::task::Context<'_>,
513    ) -> std::task::Poll<Option<Self::Item>> {
514        let this = &mut *self;
515        if this.inner.check_shutdown(cx) {
516            this.is_terminated = true;
517            return std::task::Poll::Ready(None);
518        }
519        if this.is_terminated {
520            panic!("polled BaseRouteTableRequestStream after completion");
521        }
522        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
523            |bytes, handles| {
524                match this.inner.channel().read_etc(cx, bytes, handles) {
525                    std::task::Poll::Ready(Ok(())) => {}
526                    std::task::Poll::Pending => return std::task::Poll::Pending,
527                    std::task::Poll::Ready(Err(None)) => {
528                        this.is_terminated = true;
529                        return std::task::Poll::Ready(None);
530                    }
531                    std::task::Poll::Ready(Err(Some(e))) => {
532                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
533                            e.into(),
534                        ))));
535                    }
536                }
537
538                // A message has been received from the channel
539                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
540
541                std::task::Poll::Ready(Some(match header.ordinal {
542                0x7eab30c55edbfc15 => {
543                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
544                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
545                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
546                    let control_handle = BaseRouteTableControlHandle {
547                        inner: this.inner.clone(),
548                    };
549                    Ok(BaseRouteTableRequest::GetTableId {
550                        responder: BaseRouteTableGetTableIdResponder {
551                            control_handle: std::mem::ManuallyDrop::new(control_handle),
552                            tx_id: header.tx_id,
553                        },
554                    })
555                }
556                0x2853ab157285b384 => {
557                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
558                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
559                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
560                    let control_handle = BaseRouteTableControlHandle {
561                        inner: this.inner.clone(),
562                    };
563                    Ok(BaseRouteTableRequest::Detach {
564                        control_handle,
565                    })
566                }
567                0xc42e58a5fc79426 => {
568                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
569                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
570                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
571                    let control_handle = BaseRouteTableControlHandle {
572                        inner: this.inner.clone(),
573                    };
574                    Ok(BaseRouteTableRequest::Remove {
575                        responder: BaseRouteTableRemoveResponder {
576                            control_handle: std::mem::ManuallyDrop::new(control_handle),
577                            tx_id: header.tx_id,
578                        },
579                    })
580                }
581                0x56a48c921ff3b6eb => {
582                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
583                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
584                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
585                    let control_handle = BaseRouteTableControlHandle {
586                        inner: this.inner.clone(),
587                    };
588                    Ok(BaseRouteTableRequest::GetAuthorizationForRouteTable {
589                        responder: BaseRouteTableGetAuthorizationForRouteTableResponder {
590                            control_handle: std::mem::ManuallyDrop::new(control_handle),
591                            tx_id: header.tx_id,
592                        },
593                    })
594                }
595                _ => Err(fidl::Error::UnknownOrdinal {
596                    ordinal: header.ordinal,
597                    protocol_name: <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
598                }),
599            }))
600            },
601        )
602    }
603}
604
605/// Common base for `RouteTable` protocol that is IP version agnostic. This
606/// helps reduce FIDL duplication.
607#[derive(Debug)]
608pub enum BaseRouteTableRequest {
609    /// Gets the table ID for this table.
610    GetTableId { responder: BaseRouteTableGetTableIdResponder },
611    /// Detaches the lifetime of the route table from the lifetime of the
612    /// client end of the channel.
613    ///
614    /// After this method is called, the route table will not be removed
615    /// if the client end is closed. It's a no-op if called on the main table.
616    Detach { control_handle: BaseRouteTableControlHandle },
617    /// Removes the route table explicitly.
618    ///
619    /// This method cannot be called on the main table or an interface-local
620    /// table, an error will be returned if called. The server will close the
621    /// channel after this method successfully returns.
622    Remove { responder: BaseRouteTableRemoveResponder },
623    /// Gets an authentication credential for this table.
624    ///
625    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
626    /// held by the server. This credential can be passed into
627    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
628    /// table. The `EVENT` is stable throughout the lifetime of the route table.
629    /// Clients may duplicate this `EVENT` to make multiple API calls, or
630    /// transfer the `EVENT` to other clients.
631    ///
632    /// - response `credential` the authorization credential for this table.
633    GetAuthorizationForRouteTable {
634        responder: BaseRouteTableGetAuthorizationForRouteTableResponder,
635    },
636}
637
638impl BaseRouteTableRequest {
639    #[allow(irrefutable_let_patterns)]
640    pub fn into_get_table_id(self) -> Option<(BaseRouteTableGetTableIdResponder)> {
641        if let BaseRouteTableRequest::GetTableId { responder } = self {
642            Some((responder))
643        } else {
644            None
645        }
646    }
647
648    #[allow(irrefutable_let_patterns)]
649    pub fn into_detach(self) -> Option<(BaseRouteTableControlHandle)> {
650        if let BaseRouteTableRequest::Detach { control_handle } = self {
651            Some((control_handle))
652        } else {
653            None
654        }
655    }
656
657    #[allow(irrefutable_let_patterns)]
658    pub fn into_remove(self) -> Option<(BaseRouteTableRemoveResponder)> {
659        if let BaseRouteTableRequest::Remove { responder } = self {
660            Some((responder))
661        } else {
662            None
663        }
664    }
665
666    #[allow(irrefutable_let_patterns)]
667    pub fn into_get_authorization_for_route_table(
668        self,
669    ) -> Option<(BaseRouteTableGetAuthorizationForRouteTableResponder)> {
670        if let BaseRouteTableRequest::GetAuthorizationForRouteTable { responder } = self {
671            Some((responder))
672        } else {
673            None
674        }
675    }
676
677    /// Name of the method defined in FIDL
678    pub fn method_name(&self) -> &'static str {
679        match *self {
680            BaseRouteTableRequest::GetTableId { .. } => "get_table_id",
681            BaseRouteTableRequest::Detach { .. } => "detach",
682            BaseRouteTableRequest::Remove { .. } => "remove",
683            BaseRouteTableRequest::GetAuthorizationForRouteTable { .. } => {
684                "get_authorization_for_route_table"
685            }
686        }
687    }
688}
689
690#[derive(Debug, Clone)]
691pub struct BaseRouteTableControlHandle {
692    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
693}
694
695impl fdomain_client::fidl::ControlHandle for BaseRouteTableControlHandle {
696    fn shutdown(&self) {
697        self.inner.shutdown()
698    }
699
700    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
701        self.inner.shutdown_with_epitaph(status)
702    }
703
704    fn is_closed(&self) -> bool {
705        self.inner.channel().is_closed()
706    }
707    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
708        self.inner.channel().on_closed()
709    }
710}
711
712impl BaseRouteTableControlHandle {}
713
714#[must_use = "FIDL methods require a response to be sent"]
715#[derive(Debug)]
716pub struct BaseRouteTableGetTableIdResponder {
717    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
718    tx_id: u32,
719}
720
721/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
722/// if the responder is dropped without sending a response, so that the client
723/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
724impl std::ops::Drop for BaseRouteTableGetTableIdResponder {
725    fn drop(&mut self) {
726        self.control_handle.shutdown();
727        // Safety: drops once, never accessed again
728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
729    }
730}
731
732impl fdomain_client::fidl::Responder for BaseRouteTableGetTableIdResponder {
733    type ControlHandle = BaseRouteTableControlHandle;
734
735    fn control_handle(&self) -> &BaseRouteTableControlHandle {
736        &self.control_handle
737    }
738
739    fn drop_without_shutdown(mut self) {
740        // Safety: drops once, never accessed again due to mem::forget
741        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
742        // Prevent Drop from running (which would shut down the channel)
743        std::mem::forget(self);
744    }
745}
746
747impl BaseRouteTableGetTableIdResponder {
748    /// Sends a response to the FIDL transaction.
749    ///
750    /// Sets the channel to shutdown if an error occurs.
751    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
752        let _result = self.send_raw(table_id);
753        if _result.is_err() {
754            self.control_handle.shutdown();
755        }
756        self.drop_without_shutdown();
757        _result
758    }
759
760    /// Similar to "send" but does not shutdown the channel if an error occurs.
761    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
762        let _result = self.send_raw(table_id);
763        self.drop_without_shutdown();
764        _result
765    }
766
767    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
768        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
769            (table_id,),
770            self.tx_id,
771            0x7eab30c55edbfc15,
772            fidl::encoding::DynamicFlags::empty(),
773        )
774    }
775}
776
777#[must_use = "FIDL methods require a response to be sent"]
778#[derive(Debug)]
779pub struct BaseRouteTableRemoveResponder {
780    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
781    tx_id: u32,
782}
783
784/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
785/// if the responder is dropped without sending a response, so that the client
786/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
787impl std::ops::Drop for BaseRouteTableRemoveResponder {
788    fn drop(&mut self) {
789        self.control_handle.shutdown();
790        // Safety: drops once, never accessed again
791        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
792    }
793}
794
795impl fdomain_client::fidl::Responder for BaseRouteTableRemoveResponder {
796    type ControlHandle = BaseRouteTableControlHandle;
797
798    fn control_handle(&self) -> &BaseRouteTableControlHandle {
799        &self.control_handle
800    }
801
802    fn drop_without_shutdown(mut self) {
803        // Safety: drops once, never accessed again due to mem::forget
804        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
805        // Prevent Drop from running (which would shut down the channel)
806        std::mem::forget(self);
807    }
808}
809
810impl BaseRouteTableRemoveResponder {
811    /// Sends a response to the FIDL transaction.
812    ///
813    /// Sets the channel to shutdown if an error occurs.
814    pub fn send(
815        self,
816        mut result: Result<(), BaseRouteTableRemoveError>,
817    ) -> Result<(), fidl::Error> {
818        let _result = self.send_raw(result);
819        if _result.is_err() {
820            self.control_handle.shutdown();
821        }
822        self.drop_without_shutdown();
823        _result
824    }
825
826    /// Similar to "send" but does not shutdown the channel if an error occurs.
827    pub fn send_no_shutdown_on_err(
828        self,
829        mut result: Result<(), BaseRouteTableRemoveError>,
830    ) -> Result<(), fidl::Error> {
831        let _result = self.send_raw(result);
832        self.drop_without_shutdown();
833        _result
834    }
835
836    fn send_raw(
837        &self,
838        mut result: Result<(), BaseRouteTableRemoveError>,
839    ) -> Result<(), fidl::Error> {
840        self.control_handle.inner.send::<fidl::encoding::ResultType<
841            fidl::encoding::EmptyStruct,
842            BaseRouteTableRemoveError,
843        >>(
844            result,
845            self.tx_id,
846            0xc42e58a5fc79426,
847            fidl::encoding::DynamicFlags::empty(),
848        )
849    }
850}
851
852#[must_use = "FIDL methods require a response to be sent"]
853#[derive(Debug)]
854pub struct BaseRouteTableGetAuthorizationForRouteTableResponder {
855    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
856    tx_id: u32,
857}
858
859/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
860/// if the responder is dropped without sending a response, so that the client
861/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
862impl std::ops::Drop for BaseRouteTableGetAuthorizationForRouteTableResponder {
863    fn drop(&mut self) {
864        self.control_handle.shutdown();
865        // Safety: drops once, never accessed again
866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
867    }
868}
869
870impl fdomain_client::fidl::Responder for BaseRouteTableGetAuthorizationForRouteTableResponder {
871    type ControlHandle = BaseRouteTableControlHandle;
872
873    fn control_handle(&self) -> &BaseRouteTableControlHandle {
874        &self.control_handle
875    }
876
877    fn drop_without_shutdown(mut self) {
878        // Safety: drops once, never accessed again due to mem::forget
879        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
880        // Prevent Drop from running (which would shut down the channel)
881        std::mem::forget(self);
882    }
883}
884
885impl BaseRouteTableGetAuthorizationForRouteTableResponder {
886    /// Sends a response to the FIDL transaction.
887    ///
888    /// Sets the channel to shutdown if an error occurs.
889    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
890        let _result = self.send_raw(credential);
891        if _result.is_err() {
892            self.control_handle.shutdown();
893        }
894        self.drop_without_shutdown();
895        _result
896    }
897
898    /// Similar to "send" but does not shutdown the channel if an error occurs.
899    pub fn send_no_shutdown_on_err(
900        self,
901        mut credential: GrantForRouteTableAuthorization,
902    ) -> Result<(), fidl::Error> {
903        let _result = self.send_raw(credential);
904        self.drop_without_shutdown();
905        _result
906    }
907
908    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
909        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
910            (&mut credential,),
911            self.tx_id,
912            0x56a48c921ff3b6eb,
913            fidl::encoding::DynamicFlags::empty(),
914        )
915    }
916}
917
918#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
919pub struct BaseRuleSetMarker;
920
921impl fdomain_client::fidl::ProtocolMarker for BaseRuleSetMarker {
922    type Proxy = BaseRuleSetProxy;
923    type RequestStream = BaseRuleSetRequestStream;
924
925    const DEBUG_NAME: &'static str = "(anonymous) BaseRuleSet";
926}
927pub type BaseRuleSetAuthenticateForRouteTableResult = Result<(), AuthenticateForRouteTableError>;
928pub type BaseRuleSetRemoveRuleResult = Result<(), RuleSetError>;
929
930pub trait BaseRuleSetProxyInterface: Send + Sync {
931    type AuthenticateForRouteTableResponseFut: std::future::Future<
932            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
933        > + Send;
934    fn r#authenticate_for_route_table(
935        &self,
936        table: u32,
937        token: fdomain_client::Event,
938    ) -> Self::AuthenticateForRouteTableResponseFut;
939    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
940        + Send;
941    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
942    fn r#close(&self) -> Result<(), fidl::Error>;
943}
944
945#[derive(Debug, Clone)]
946pub struct BaseRuleSetProxy {
947    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
948}
949
950impl fdomain_client::fidl::Proxy for BaseRuleSetProxy {
951    type Protocol = BaseRuleSetMarker;
952
953    fn from_channel(inner: fdomain_client::Channel) -> Self {
954        Self::new(inner)
955    }
956
957    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
958        self.client.into_channel().map_err(|client| Self { client })
959    }
960
961    fn as_channel(&self) -> &fdomain_client::Channel {
962        self.client.as_channel()
963    }
964}
965
966impl BaseRuleSetProxy {
967    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRuleSet.
968    pub fn new(channel: fdomain_client::Channel) -> Self {
969        let protocol_name = <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
970        Self { client: fidl::client::Client::new(channel, protocol_name) }
971    }
972
973    /// Get a Stream of events from the remote end of the protocol.
974    ///
975    /// # Panics
976    ///
977    /// Panics if the event stream was already taken.
978    pub fn take_event_stream(&self) -> BaseRuleSetEventStream {
979        BaseRuleSetEventStream { event_receiver: self.client.take_event_receiver() }
980    }
981
982    /// Authenticates for a route table that will be used in an action.
983    pub fn r#authenticate_for_route_table(
984        &self,
985        mut table: u32,
986        mut token: fdomain_client::Event,
987    ) -> fidl::client::QueryResponseFut<
988        BaseRuleSetAuthenticateForRouteTableResult,
989        fdomain_client::fidl::FDomainResourceDialect,
990    > {
991        BaseRuleSetProxyInterface::r#authenticate_for_route_table(self, table, token)
992    }
993
994    /// Removes a rule from this rule set.
995    ///
996    /// If the client tries to remove from an index that does not have a rule,
997    /// the error `RULE_DOES_NOT_EXIST` will be returned.
998    ///
999    /// + request `index` the index of the rule.
1000    pub fn r#remove_rule(
1001        &self,
1002        mut index: u32,
1003    ) -> fidl::client::QueryResponseFut<
1004        BaseRuleSetRemoveRuleResult,
1005        fdomain_client::fidl::FDomainResourceDialect,
1006    > {
1007        BaseRuleSetProxyInterface::r#remove_rule(self, index)
1008    }
1009
1010    /// Removes all rules in the rule set and the underlying channel will be
1011    /// closed after the rules are removed.
1012    ///
1013    /// This method provides a way for synchronous closure.
1014    pub fn r#close(&self) -> Result<(), fidl::Error> {
1015        BaseRuleSetProxyInterface::r#close(self)
1016    }
1017}
1018
1019impl BaseRuleSetProxyInterface for BaseRuleSetProxy {
1020    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
1021        BaseRuleSetAuthenticateForRouteTableResult,
1022        fdomain_client::fidl::FDomainResourceDialect,
1023    >;
1024    fn r#authenticate_for_route_table(
1025        &self,
1026        mut table: u32,
1027        mut token: fdomain_client::Event,
1028    ) -> Self::AuthenticateForRouteTableResponseFut {
1029        fn _decode(
1030            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1031        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1032            let _response = fidl::client::decode_transaction_body::<
1033                fidl::encoding::ResultType<
1034                    fidl::encoding::EmptyStruct,
1035                    AuthenticateForRouteTableError,
1036                >,
1037                fdomain_client::fidl::FDomainResourceDialect,
1038                0x6fd845360ed9bc8f,
1039            >(_buf?)?;
1040            Ok(_response.map(|x| x))
1041        }
1042        self.client.send_query_and_decode::<
1043            ProofOfRouteTableAuthorization,
1044            BaseRuleSetAuthenticateForRouteTableResult,
1045        >(
1046            (table, token,),
1047            0x6fd845360ed9bc8f,
1048            fidl::encoding::DynamicFlags::empty(),
1049            _decode,
1050        )
1051    }
1052
1053    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
1054        BaseRuleSetRemoveRuleResult,
1055        fdomain_client::fidl::FDomainResourceDialect,
1056    >;
1057    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
1058        fn _decode(
1059            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1060        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1061            let _response = fidl::client::decode_transaction_body::<
1062                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1063                fdomain_client::fidl::FDomainResourceDialect,
1064                0x2ae3d7e817cbff90,
1065            >(_buf?)?;
1066            Ok(_response.map(|x| x))
1067        }
1068        self.client
1069            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
1070                (index,),
1071                0x2ae3d7e817cbff90,
1072                fidl::encoding::DynamicFlags::empty(),
1073                _decode,
1074            )
1075    }
1076
1077    fn r#close(&self) -> Result<(), fidl::Error> {
1078        self.client.send::<fidl::encoding::EmptyPayload>(
1079            (),
1080            0x457e1753672d4073,
1081            fidl::encoding::DynamicFlags::empty(),
1082        )
1083    }
1084}
1085
1086pub struct BaseRuleSetEventStream {
1087    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1088}
1089
1090impl std::marker::Unpin for BaseRuleSetEventStream {}
1091
1092impl futures::stream::FusedStream for BaseRuleSetEventStream {
1093    fn is_terminated(&self) -> bool {
1094        self.event_receiver.is_terminated()
1095    }
1096}
1097
1098impl futures::Stream for BaseRuleSetEventStream {
1099    type Item = Result<BaseRuleSetEvent, fidl::Error>;
1100
1101    fn poll_next(
1102        mut self: std::pin::Pin<&mut Self>,
1103        cx: &mut std::task::Context<'_>,
1104    ) -> std::task::Poll<Option<Self::Item>> {
1105        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1106            &mut self.event_receiver,
1107            cx
1108        )?) {
1109            Some(buf) => std::task::Poll::Ready(Some(BaseRuleSetEvent::decode(buf))),
1110            None => std::task::Poll::Ready(None),
1111        }
1112    }
1113}
1114
1115#[derive(Debug)]
1116pub enum BaseRuleSetEvent {}
1117
1118impl BaseRuleSetEvent {
1119    /// Decodes a message buffer as a [`BaseRuleSetEvent`].
1120    fn decode(
1121        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1122    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1123        let (bytes, _handles) = buf.split_mut();
1124        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1125        debug_assert_eq!(tx_header.tx_id, 0);
1126        match tx_header.ordinal {
1127            _ => Err(fidl::Error::UnknownOrdinal {
1128                ordinal: tx_header.ordinal,
1129                protocol_name:
1130                    <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1131            }),
1132        }
1133    }
1134}
1135
1136/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRuleSet.
1137pub struct BaseRuleSetRequestStream {
1138    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1139    is_terminated: bool,
1140}
1141
1142impl std::marker::Unpin for BaseRuleSetRequestStream {}
1143
1144impl futures::stream::FusedStream for BaseRuleSetRequestStream {
1145    fn is_terminated(&self) -> bool {
1146        self.is_terminated
1147    }
1148}
1149
1150impl fdomain_client::fidl::RequestStream for BaseRuleSetRequestStream {
1151    type Protocol = BaseRuleSetMarker;
1152    type ControlHandle = BaseRuleSetControlHandle;
1153
1154    fn from_channel(channel: fdomain_client::Channel) -> Self {
1155        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1156    }
1157
1158    fn control_handle(&self) -> Self::ControlHandle {
1159        BaseRuleSetControlHandle { inner: self.inner.clone() }
1160    }
1161
1162    fn into_inner(
1163        self,
1164    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1165    {
1166        (self.inner, self.is_terminated)
1167    }
1168
1169    fn from_inner(
1170        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1171        is_terminated: bool,
1172    ) -> Self {
1173        Self { inner, is_terminated }
1174    }
1175}
1176
1177impl futures::Stream for BaseRuleSetRequestStream {
1178    type Item = Result<BaseRuleSetRequest, fidl::Error>;
1179
1180    fn poll_next(
1181        mut self: std::pin::Pin<&mut Self>,
1182        cx: &mut std::task::Context<'_>,
1183    ) -> std::task::Poll<Option<Self::Item>> {
1184        let this = &mut *self;
1185        if this.inner.check_shutdown(cx) {
1186            this.is_terminated = true;
1187            return std::task::Poll::Ready(None);
1188        }
1189        if this.is_terminated {
1190            panic!("polled BaseRuleSetRequestStream after completion");
1191        }
1192        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1193            |bytes, handles| {
1194                match this.inner.channel().read_etc(cx, bytes, handles) {
1195                    std::task::Poll::Ready(Ok(())) => {}
1196                    std::task::Poll::Pending => return std::task::Poll::Pending,
1197                    std::task::Poll::Ready(Err(None)) => {
1198                        this.is_terminated = true;
1199                        return std::task::Poll::Ready(None);
1200                    }
1201                    std::task::Poll::Ready(Err(Some(e))) => {
1202                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1203                            e.into(),
1204                        ))));
1205                    }
1206                }
1207
1208                // A message has been received from the channel
1209                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1210
1211                std::task::Poll::Ready(Some(match header.ordinal {
1212                    0x6fd845360ed9bc8f => {
1213                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1214                        let mut req = fidl::new_empty!(
1215                            ProofOfRouteTableAuthorization,
1216                            fdomain_client::fidl::FDomainResourceDialect
1217                        );
1218                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
1219                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1220                        Ok(BaseRuleSetRequest::AuthenticateForRouteTable {
1221                            table: req.table,
1222                            token: req.token,
1223
1224                            responder: BaseRuleSetAuthenticateForRouteTableResponder {
1225                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1226                                tx_id: header.tx_id,
1227                            },
1228                        })
1229                    }
1230                    0x2ae3d7e817cbff90 => {
1231                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1232                        let mut req = fidl::new_empty!(
1233                            BaseRuleSetRemoveRuleRequest,
1234                            fdomain_client::fidl::FDomainResourceDialect
1235                        );
1236                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
1237                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1238                        Ok(BaseRuleSetRequest::RemoveRule {
1239                            index: req.index,
1240
1241                            responder: BaseRuleSetRemoveRuleResponder {
1242                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1243                                tx_id: header.tx_id,
1244                            },
1245                        })
1246                    }
1247                    0x457e1753672d4073 => {
1248                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1249                        let mut req = fidl::new_empty!(
1250                            fidl::encoding::EmptyPayload,
1251                            fdomain_client::fidl::FDomainResourceDialect
1252                        );
1253                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1254                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1255                        Ok(BaseRuleSetRequest::Close { control_handle })
1256                    }
1257                    _ => Err(fidl::Error::UnknownOrdinal {
1258                        ordinal: header.ordinal,
1259                        protocol_name:
1260                            <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1261                    }),
1262                }))
1263            },
1264        )
1265    }
1266}
1267
1268/// Common base for `RuleSet` protocol that is IP version agnostic. This
1269/// helps reduce FIDL duplication.
1270#[derive(Debug)]
1271pub enum BaseRuleSetRequest {
1272    /// Authenticates for a route table that will be used in an action.
1273    AuthenticateForRouteTable {
1274        table: u32,
1275        token: fdomain_client::Event,
1276        responder: BaseRuleSetAuthenticateForRouteTableResponder,
1277    },
1278    /// Removes a rule from this rule set.
1279    ///
1280    /// If the client tries to remove from an index that does not have a rule,
1281    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1282    ///
1283    /// + request `index` the index of the rule.
1284    RemoveRule { index: u32, responder: BaseRuleSetRemoveRuleResponder },
1285    /// Removes all rules in the rule set and the underlying channel will be
1286    /// closed after the rules are removed.
1287    ///
1288    /// This method provides a way for synchronous closure.
1289    Close { control_handle: BaseRuleSetControlHandle },
1290}
1291
1292impl BaseRuleSetRequest {
1293    #[allow(irrefutable_let_patterns)]
1294    pub fn into_authenticate_for_route_table(
1295        self,
1296    ) -> Option<(u32, fdomain_client::Event, BaseRuleSetAuthenticateForRouteTableResponder)> {
1297        if let BaseRuleSetRequest::AuthenticateForRouteTable { table, token, responder } = self {
1298            Some((table, token, responder))
1299        } else {
1300            None
1301        }
1302    }
1303
1304    #[allow(irrefutable_let_patterns)]
1305    pub fn into_remove_rule(self) -> Option<(u32, BaseRuleSetRemoveRuleResponder)> {
1306        if let BaseRuleSetRequest::RemoveRule { index, responder } = self {
1307            Some((index, responder))
1308        } else {
1309            None
1310        }
1311    }
1312
1313    #[allow(irrefutable_let_patterns)]
1314    pub fn into_close(self) -> Option<(BaseRuleSetControlHandle)> {
1315        if let BaseRuleSetRequest::Close { control_handle } = self {
1316            Some((control_handle))
1317        } else {
1318            None
1319        }
1320    }
1321
1322    /// Name of the method defined in FIDL
1323    pub fn method_name(&self) -> &'static str {
1324        match *self {
1325            BaseRuleSetRequest::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
1326            BaseRuleSetRequest::RemoveRule { .. } => "remove_rule",
1327            BaseRuleSetRequest::Close { .. } => "close",
1328        }
1329    }
1330}
1331
1332#[derive(Debug, Clone)]
1333pub struct BaseRuleSetControlHandle {
1334    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1335}
1336
1337impl fdomain_client::fidl::ControlHandle for BaseRuleSetControlHandle {
1338    fn shutdown(&self) {
1339        self.inner.shutdown()
1340    }
1341
1342    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1343        self.inner.shutdown_with_epitaph(status)
1344    }
1345
1346    fn is_closed(&self) -> bool {
1347        self.inner.channel().is_closed()
1348    }
1349    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1350        self.inner.channel().on_closed()
1351    }
1352}
1353
1354impl BaseRuleSetControlHandle {}
1355
1356#[must_use = "FIDL methods require a response to be sent"]
1357#[derive(Debug)]
1358pub struct BaseRuleSetAuthenticateForRouteTableResponder {
1359    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1360    tx_id: u32,
1361}
1362
1363/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1364/// if the responder is dropped without sending a response, so that the client
1365/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1366impl std::ops::Drop for BaseRuleSetAuthenticateForRouteTableResponder {
1367    fn drop(&mut self) {
1368        self.control_handle.shutdown();
1369        // Safety: drops once, never accessed again
1370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371    }
1372}
1373
1374impl fdomain_client::fidl::Responder for BaseRuleSetAuthenticateForRouteTableResponder {
1375    type ControlHandle = BaseRuleSetControlHandle;
1376
1377    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1378        &self.control_handle
1379    }
1380
1381    fn drop_without_shutdown(mut self) {
1382        // Safety: drops once, never accessed again due to mem::forget
1383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1384        // Prevent Drop from running (which would shut down the channel)
1385        std::mem::forget(self);
1386    }
1387}
1388
1389impl BaseRuleSetAuthenticateForRouteTableResponder {
1390    /// Sends a response to the FIDL transaction.
1391    ///
1392    /// Sets the channel to shutdown if an error occurs.
1393    pub fn send(
1394        self,
1395        mut result: Result<(), AuthenticateForRouteTableError>,
1396    ) -> Result<(), fidl::Error> {
1397        let _result = self.send_raw(result);
1398        if _result.is_err() {
1399            self.control_handle.shutdown();
1400        }
1401        self.drop_without_shutdown();
1402        _result
1403    }
1404
1405    /// Similar to "send" but does not shutdown the channel if an error occurs.
1406    pub fn send_no_shutdown_on_err(
1407        self,
1408        mut result: Result<(), AuthenticateForRouteTableError>,
1409    ) -> Result<(), fidl::Error> {
1410        let _result = self.send_raw(result);
1411        self.drop_without_shutdown();
1412        _result
1413    }
1414
1415    fn send_raw(
1416        &self,
1417        mut result: Result<(), AuthenticateForRouteTableError>,
1418    ) -> Result<(), fidl::Error> {
1419        self.control_handle.inner.send::<fidl::encoding::ResultType<
1420            fidl::encoding::EmptyStruct,
1421            AuthenticateForRouteTableError,
1422        >>(
1423            result,
1424            self.tx_id,
1425            0x6fd845360ed9bc8f,
1426            fidl::encoding::DynamicFlags::empty(),
1427        )
1428    }
1429}
1430
1431#[must_use = "FIDL methods require a response to be sent"]
1432#[derive(Debug)]
1433pub struct BaseRuleSetRemoveRuleResponder {
1434    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1435    tx_id: u32,
1436}
1437
1438/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1439/// if the responder is dropped without sending a response, so that the client
1440/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1441impl std::ops::Drop for BaseRuleSetRemoveRuleResponder {
1442    fn drop(&mut self) {
1443        self.control_handle.shutdown();
1444        // Safety: drops once, never accessed again
1445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1446    }
1447}
1448
1449impl fdomain_client::fidl::Responder for BaseRuleSetRemoveRuleResponder {
1450    type ControlHandle = BaseRuleSetControlHandle;
1451
1452    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1453        &self.control_handle
1454    }
1455
1456    fn drop_without_shutdown(mut self) {
1457        // Safety: drops once, never accessed again due to mem::forget
1458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1459        // Prevent Drop from running (which would shut down the channel)
1460        std::mem::forget(self);
1461    }
1462}
1463
1464impl BaseRuleSetRemoveRuleResponder {
1465    /// Sends a response to the FIDL transaction.
1466    ///
1467    /// Sets the channel to shutdown if an error occurs.
1468    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1469        let _result = self.send_raw(result);
1470        if _result.is_err() {
1471            self.control_handle.shutdown();
1472        }
1473        self.drop_without_shutdown();
1474        _result
1475    }
1476
1477    /// Similar to "send" but does not shutdown the channel if an error occurs.
1478    pub fn send_no_shutdown_on_err(
1479        self,
1480        mut result: Result<(), RuleSetError>,
1481    ) -> Result<(), fidl::Error> {
1482        let _result = self.send_raw(result);
1483        self.drop_without_shutdown();
1484        _result
1485    }
1486
1487    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1488        self.control_handle.inner.send::<fidl::encoding::ResultType<
1489            fidl::encoding::EmptyStruct,
1490            RuleSetError,
1491        >>(
1492            result,
1493            self.tx_id,
1494            0x2ae3d7e817cbff90,
1495            fidl::encoding::DynamicFlags::empty(),
1496        )
1497    }
1498}
1499
1500#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1501pub struct RouteSetV4Marker;
1502
1503impl fdomain_client::fidl::ProtocolMarker for RouteSetV4Marker {
1504    type Proxy = RouteSetV4Proxy;
1505    type RequestStream = RouteSetV4RequestStream;
1506
1507    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV4";
1508}
1509pub type RouteSetV4AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
1510pub type RouteSetV4AddRouteResult = Result<bool, RouteSetError>;
1511pub type RouteSetV4RemoveRouteResult = Result<bool, RouteSetError>;
1512
1513pub trait RouteSetV4ProxyInterface: Send + Sync {
1514    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error>>
1515        + Send;
1516    fn r#authenticate_for_interface(
1517        &self,
1518        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1519    ) -> Self::AuthenticateForInterfaceResponseFut;
1520    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV4AddRouteResult, fidl::Error>>
1521        + Send;
1522    fn r#add_route(&self, route: &fdomain_fuchsia_net_routes::RouteV4)
1523    -> Self::AddRouteResponseFut;
1524    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV4RemoveRouteResult, fidl::Error>>
1525        + Send;
1526    fn r#remove_route(
1527        &self,
1528        route: &fdomain_fuchsia_net_routes::RouteV4,
1529    ) -> Self::RemoveRouteResponseFut;
1530}
1531
1532#[derive(Debug, Clone)]
1533pub struct RouteSetV4Proxy {
1534    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1535}
1536
1537impl fdomain_client::fidl::Proxy for RouteSetV4Proxy {
1538    type Protocol = RouteSetV4Marker;
1539
1540    fn from_channel(inner: fdomain_client::Channel) -> Self {
1541        Self::new(inner)
1542    }
1543
1544    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1545        self.client.into_channel().map_err(|client| Self { client })
1546    }
1547
1548    fn as_channel(&self) -> &fdomain_client::Channel {
1549        self.client.as_channel()
1550    }
1551}
1552
1553impl RouteSetV4Proxy {
1554    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV4.
1555    pub fn new(channel: fdomain_client::Channel) -> Self {
1556        let protocol_name = <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1557        Self { client: fidl::client::Client::new(channel, protocol_name) }
1558    }
1559
1560    /// Get a Stream of events from the remote end of the protocol.
1561    ///
1562    /// # Panics
1563    ///
1564    /// Panics if the event stream was already taken.
1565    pub fn take_event_stream(&self) -> RouteSetV4EventStream {
1566        RouteSetV4EventStream { event_receiver: self.client.take_event_receiver() }
1567    }
1568
1569    /// Authenticate this route set to manage routes on the provided interface.
1570    /// Authentication is valid for the lifetime of the route set.
1571    ///
1572    /// + request `interface` the authentication credential for an interface.
1573    pub fn r#authenticate_for_interface(
1574        &self,
1575        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1576    ) -> fidl::client::QueryResponseFut<
1577        RouteSetV4AuthenticateForInterfaceResult,
1578        fdomain_client::fidl::FDomainResourceDialect,
1579    > {
1580        RouteSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
1581    }
1582
1583    /// Adds a route to this route set.
1584    ///
1585    /// + request `route` the route to add.
1586    /// - response `did_add` true iff the route was added to this `RouteSet`
1587    ///            as a result of this call.
1588    pub fn r#add_route(
1589        &self,
1590        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1591    ) -> fidl::client::QueryResponseFut<
1592        RouteSetV4AddRouteResult,
1593        fdomain_client::fidl::FDomainResourceDialect,
1594    > {
1595        RouteSetV4ProxyInterface::r#add_route(self, route)
1596    }
1597
1598    /// Removes a route from this route set.
1599    ///
1600    /// Note that if this route also exists other route sets, it will not be
1601    /// removed from the global routing table.
1602    ///
1603    /// + request `route` the route to remove.
1604    /// - response `did_remove` true iff the route was removed from this
1605    ///            `RouteSet` as a result of this call.
1606    pub fn r#remove_route(
1607        &self,
1608        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1609    ) -> fidl::client::QueryResponseFut<
1610        RouteSetV4RemoveRouteResult,
1611        fdomain_client::fidl::FDomainResourceDialect,
1612    > {
1613        RouteSetV4ProxyInterface::r#remove_route(self, route)
1614    }
1615}
1616
1617impl RouteSetV4ProxyInterface for RouteSetV4Proxy {
1618    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
1619        RouteSetV4AuthenticateForInterfaceResult,
1620        fdomain_client::fidl::FDomainResourceDialect,
1621    >;
1622    fn r#authenticate_for_interface(
1623        &self,
1624        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1625    ) -> Self::AuthenticateForInterfaceResponseFut {
1626        fn _decode(
1627            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1628        ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
1629            let _response = fidl::client::decode_transaction_body::<
1630                fidl::encoding::ResultType<
1631                    fidl::encoding::EmptyStruct,
1632                    AuthenticateForInterfaceError,
1633                >,
1634                fdomain_client::fidl::FDomainResourceDialect,
1635                0x74841ceef127518e,
1636            >(_buf?)?;
1637            Ok(_response.map(|x| x))
1638        }
1639        self.client.send_query_and_decode::<
1640            RouteSetV4AuthenticateForInterfaceRequest,
1641            RouteSetV4AuthenticateForInterfaceResult,
1642        >(
1643            (&mut credential,),
1644            0x74841ceef127518e,
1645            fidl::encoding::DynamicFlags::empty(),
1646            _decode,
1647        )
1648    }
1649
1650    type AddRouteResponseFut = fidl::client::QueryResponseFut<
1651        RouteSetV4AddRouteResult,
1652        fdomain_client::fidl::FDomainResourceDialect,
1653    >;
1654    fn r#add_route(
1655        &self,
1656        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1657    ) -> Self::AddRouteResponseFut {
1658        fn _decode(
1659            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1660        ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
1661            let _response = fidl::client::decode_transaction_body::<
1662                fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
1663                fdomain_client::fidl::FDomainResourceDialect,
1664                0x4bd69e45539e8ec0,
1665            >(_buf?)?;
1666            Ok(_response.map(|x| x.did_add))
1667        }
1668        self.client.send_query_and_decode::<RouteSetV4AddRouteRequest, RouteSetV4AddRouteResult>(
1669            (route,),
1670            0x4bd69e45539e8ec0,
1671            fidl::encoding::DynamicFlags::empty(),
1672            _decode,
1673        )
1674    }
1675
1676    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
1677        RouteSetV4RemoveRouteResult,
1678        fdomain_client::fidl::FDomainResourceDialect,
1679    >;
1680    fn r#remove_route(
1681        &self,
1682        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1683    ) -> Self::RemoveRouteResponseFut {
1684        fn _decode(
1685            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1686        ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
1687            let _response = fidl::client::decode_transaction_body::<
1688                fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
1689                fdomain_client::fidl::FDomainResourceDialect,
1690                0x514f6880232f1665,
1691            >(_buf?)?;
1692            Ok(_response.map(|x| x.did_remove))
1693        }
1694        self.client
1695            .send_query_and_decode::<RouteSetV4RemoveRouteRequest, RouteSetV4RemoveRouteResult>(
1696                (route,),
1697                0x514f6880232f1665,
1698                fidl::encoding::DynamicFlags::empty(),
1699                _decode,
1700            )
1701    }
1702}
1703
1704pub struct RouteSetV4EventStream {
1705    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1706}
1707
1708impl std::marker::Unpin for RouteSetV4EventStream {}
1709
1710impl futures::stream::FusedStream for RouteSetV4EventStream {
1711    fn is_terminated(&self) -> bool {
1712        self.event_receiver.is_terminated()
1713    }
1714}
1715
1716impl futures::Stream for RouteSetV4EventStream {
1717    type Item = Result<RouteSetV4Event, fidl::Error>;
1718
1719    fn poll_next(
1720        mut self: std::pin::Pin<&mut Self>,
1721        cx: &mut std::task::Context<'_>,
1722    ) -> std::task::Poll<Option<Self::Item>> {
1723        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1724            &mut self.event_receiver,
1725            cx
1726        )?) {
1727            Some(buf) => std::task::Poll::Ready(Some(RouteSetV4Event::decode(buf))),
1728            None => std::task::Poll::Ready(None),
1729        }
1730    }
1731}
1732
1733#[derive(Debug)]
1734pub enum RouteSetV4Event {}
1735
1736impl RouteSetV4Event {
1737    /// Decodes a message buffer as a [`RouteSetV4Event`].
1738    fn decode(
1739        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1740    ) -> Result<RouteSetV4Event, fidl::Error> {
1741        let (bytes, _handles) = buf.split_mut();
1742        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1743        debug_assert_eq!(tx_header.tx_id, 0);
1744        match tx_header.ordinal {
1745            _ => Err(fidl::Error::UnknownOrdinal {
1746                ordinal: tx_header.ordinal,
1747                protocol_name:
1748                    <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1749            }),
1750        }
1751    }
1752}
1753
1754/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV4.
1755pub struct RouteSetV4RequestStream {
1756    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1757    is_terminated: bool,
1758}
1759
1760impl std::marker::Unpin for RouteSetV4RequestStream {}
1761
1762impl futures::stream::FusedStream for RouteSetV4RequestStream {
1763    fn is_terminated(&self) -> bool {
1764        self.is_terminated
1765    }
1766}
1767
1768impl fdomain_client::fidl::RequestStream for RouteSetV4RequestStream {
1769    type Protocol = RouteSetV4Marker;
1770    type ControlHandle = RouteSetV4ControlHandle;
1771
1772    fn from_channel(channel: fdomain_client::Channel) -> Self {
1773        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1774    }
1775
1776    fn control_handle(&self) -> Self::ControlHandle {
1777        RouteSetV4ControlHandle { inner: self.inner.clone() }
1778    }
1779
1780    fn into_inner(
1781        self,
1782    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1783    {
1784        (self.inner, self.is_terminated)
1785    }
1786
1787    fn from_inner(
1788        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1789        is_terminated: bool,
1790    ) -> Self {
1791        Self { inner, is_terminated }
1792    }
1793}
1794
1795impl futures::Stream for RouteSetV4RequestStream {
1796    type Item = Result<RouteSetV4Request, fidl::Error>;
1797
1798    fn poll_next(
1799        mut self: std::pin::Pin<&mut Self>,
1800        cx: &mut std::task::Context<'_>,
1801    ) -> std::task::Poll<Option<Self::Item>> {
1802        let this = &mut *self;
1803        if this.inner.check_shutdown(cx) {
1804            this.is_terminated = true;
1805            return std::task::Poll::Ready(None);
1806        }
1807        if this.is_terminated {
1808            panic!("polled RouteSetV4RequestStream after completion");
1809        }
1810        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1811            |bytes, handles| {
1812                match this.inner.channel().read_etc(cx, bytes, handles) {
1813                    std::task::Poll::Ready(Ok(())) => {}
1814                    std::task::Poll::Pending => return std::task::Poll::Pending,
1815                    std::task::Poll::Ready(Err(None)) => {
1816                        this.is_terminated = true;
1817                        return std::task::Poll::Ready(None);
1818                    }
1819                    std::task::Poll::Ready(Err(Some(e))) => {
1820                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1821                            e.into(),
1822                        ))));
1823                    }
1824                }
1825
1826                // A message has been received from the channel
1827                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1828
1829                std::task::Poll::Ready(Some(match header.ordinal {
1830                    0x74841ceef127518e => {
1831                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1832                        let mut req = fidl::new_empty!(
1833                            RouteSetV4AuthenticateForInterfaceRequest,
1834                            fdomain_client::fidl::FDomainResourceDialect
1835                        );
1836                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1837                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1838                        Ok(RouteSetV4Request::AuthenticateForInterface {
1839                            credential: req.credential,
1840
1841                            responder: RouteSetV4AuthenticateForInterfaceResponder {
1842                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1843                                tx_id: header.tx_id,
1844                            },
1845                        })
1846                    }
1847                    0x4bd69e45539e8ec0 => {
1848                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1849                        let mut req = fidl::new_empty!(
1850                            RouteSetV4AddRouteRequest,
1851                            fdomain_client::fidl::FDomainResourceDialect
1852                        );
1853                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1854                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1855                        Ok(RouteSetV4Request::AddRoute {
1856                            route: req.route,
1857
1858                            responder: RouteSetV4AddRouteResponder {
1859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1860                                tx_id: header.tx_id,
1861                            },
1862                        })
1863                    }
1864                    0x514f6880232f1665 => {
1865                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1866                        let mut req = fidl::new_empty!(
1867                            RouteSetV4RemoveRouteRequest,
1868                            fdomain_client::fidl::FDomainResourceDialect
1869                        );
1870                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1871                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1872                        Ok(RouteSetV4Request::RemoveRoute {
1873                            route: req.route,
1874
1875                            responder: RouteSetV4RemoveRouteResponder {
1876                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1877                                tx_id: header.tx_id,
1878                            },
1879                        })
1880                    }
1881                    _ => Err(fidl::Error::UnknownOrdinal {
1882                        ordinal: header.ordinal,
1883                        protocol_name:
1884                            <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1885                    }),
1886                }))
1887            },
1888        )
1889    }
1890}
1891
1892/// Provides mutable access over a set of system's IPv4 routes.
1893///
1894/// The system maintains a single global routing table. A route set offers an
1895/// isolated window into a subset of the global routing table: clients are free
1896/// to manage the routes within their own route set, but not the route set of
1897/// others. Thus the global routing table represents the union of all existing
1898/// route sets. A route must be removed from all route sets to which it belongs
1899/// before it will be removed from the global table.
1900///
1901/// This protocol encodes the lifetime of the route set. Closing the client end
1902/// removes the route set, and will also remove any routes that were
1903/// solely-owned by this route set.
1904///
1905/// Note that the system reserves the right to remove routes out from underneath
1906/// this route set. This will always manifest as a `removed` event on the
1907/// [`fuchsia.net.routes/WatcherV4`] protocol.
1908///
1909/// If the route table backing this route set is removed, then this protocol
1910/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
1911#[derive(Debug)]
1912pub enum RouteSetV4Request {
1913    /// Authenticate this route set to manage routes on the provided interface.
1914    /// Authentication is valid for the lifetime of the route set.
1915    ///
1916    /// + request `interface` the authentication credential for an interface.
1917    AuthenticateForInterface {
1918        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1919        responder: RouteSetV4AuthenticateForInterfaceResponder,
1920    },
1921    /// Adds a route to this route set.
1922    ///
1923    /// + request `route` the route to add.
1924    /// - response `did_add` true iff the route was added to this `RouteSet`
1925    ///            as a result of this call.
1926    AddRoute { route: fdomain_fuchsia_net_routes::RouteV4, responder: RouteSetV4AddRouteResponder },
1927    /// Removes a route from this route set.
1928    ///
1929    /// Note that if this route also exists other route sets, it will not be
1930    /// removed from the global routing table.
1931    ///
1932    /// + request `route` the route to remove.
1933    /// - response `did_remove` true iff the route was removed from this
1934    ///            `RouteSet` as a result of this call.
1935    RemoveRoute {
1936        route: fdomain_fuchsia_net_routes::RouteV4,
1937        responder: RouteSetV4RemoveRouteResponder,
1938    },
1939}
1940
1941impl RouteSetV4Request {
1942    #[allow(irrefutable_let_patterns)]
1943    pub fn into_authenticate_for_interface(
1944        self,
1945    ) -> Option<(
1946        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1947        RouteSetV4AuthenticateForInterfaceResponder,
1948    )> {
1949        if let RouteSetV4Request::AuthenticateForInterface { credential, responder } = self {
1950            Some((credential, responder))
1951        } else {
1952            None
1953        }
1954    }
1955
1956    #[allow(irrefutable_let_patterns)]
1957    pub fn into_add_route(
1958        self,
1959    ) -> Option<(fdomain_fuchsia_net_routes::RouteV4, RouteSetV4AddRouteResponder)> {
1960        if let RouteSetV4Request::AddRoute { route, responder } = self {
1961            Some((route, responder))
1962        } else {
1963            None
1964        }
1965    }
1966
1967    #[allow(irrefutable_let_patterns)]
1968    pub fn into_remove_route(
1969        self,
1970    ) -> Option<(fdomain_fuchsia_net_routes::RouteV4, RouteSetV4RemoveRouteResponder)> {
1971        if let RouteSetV4Request::RemoveRoute { route, responder } = self {
1972            Some((route, responder))
1973        } else {
1974            None
1975        }
1976    }
1977
1978    /// Name of the method defined in FIDL
1979    pub fn method_name(&self) -> &'static str {
1980        match *self {
1981            RouteSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
1982            RouteSetV4Request::AddRoute { .. } => "add_route",
1983            RouteSetV4Request::RemoveRoute { .. } => "remove_route",
1984        }
1985    }
1986}
1987
1988#[derive(Debug, Clone)]
1989pub struct RouteSetV4ControlHandle {
1990    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1991}
1992
1993impl fdomain_client::fidl::ControlHandle for RouteSetV4ControlHandle {
1994    fn shutdown(&self) {
1995        self.inner.shutdown()
1996    }
1997
1998    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1999        self.inner.shutdown_with_epitaph(status)
2000    }
2001
2002    fn is_closed(&self) -> bool {
2003        self.inner.channel().is_closed()
2004    }
2005    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2006        self.inner.channel().on_closed()
2007    }
2008}
2009
2010impl RouteSetV4ControlHandle {}
2011
2012#[must_use = "FIDL methods require a response to be sent"]
2013#[derive(Debug)]
2014pub struct RouteSetV4AuthenticateForInterfaceResponder {
2015    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2016    tx_id: u32,
2017}
2018
2019/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2020/// if the responder is dropped without sending a response, so that the client
2021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2022impl std::ops::Drop for RouteSetV4AuthenticateForInterfaceResponder {
2023    fn drop(&mut self) {
2024        self.control_handle.shutdown();
2025        // Safety: drops once, never accessed again
2026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2027    }
2028}
2029
2030impl fdomain_client::fidl::Responder for RouteSetV4AuthenticateForInterfaceResponder {
2031    type ControlHandle = RouteSetV4ControlHandle;
2032
2033    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2034        &self.control_handle
2035    }
2036
2037    fn drop_without_shutdown(mut self) {
2038        // Safety: drops once, never accessed again due to mem::forget
2039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2040        // Prevent Drop from running (which would shut down the channel)
2041        std::mem::forget(self);
2042    }
2043}
2044
2045impl RouteSetV4AuthenticateForInterfaceResponder {
2046    /// Sends a response to the FIDL transaction.
2047    ///
2048    /// Sets the channel to shutdown if an error occurs.
2049    pub fn send(
2050        self,
2051        mut result: Result<(), AuthenticateForInterfaceError>,
2052    ) -> Result<(), fidl::Error> {
2053        let _result = self.send_raw(result);
2054        if _result.is_err() {
2055            self.control_handle.shutdown();
2056        }
2057        self.drop_without_shutdown();
2058        _result
2059    }
2060
2061    /// Similar to "send" but does not shutdown the channel if an error occurs.
2062    pub fn send_no_shutdown_on_err(
2063        self,
2064        mut result: Result<(), AuthenticateForInterfaceError>,
2065    ) -> Result<(), fidl::Error> {
2066        let _result = self.send_raw(result);
2067        self.drop_without_shutdown();
2068        _result
2069    }
2070
2071    fn send_raw(
2072        &self,
2073        mut result: Result<(), AuthenticateForInterfaceError>,
2074    ) -> Result<(), fidl::Error> {
2075        self.control_handle.inner.send::<fidl::encoding::ResultType<
2076            fidl::encoding::EmptyStruct,
2077            AuthenticateForInterfaceError,
2078        >>(
2079            result,
2080            self.tx_id,
2081            0x74841ceef127518e,
2082            fidl::encoding::DynamicFlags::empty(),
2083        )
2084    }
2085}
2086
2087#[must_use = "FIDL methods require a response to be sent"]
2088#[derive(Debug)]
2089pub struct RouteSetV4AddRouteResponder {
2090    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2091    tx_id: u32,
2092}
2093
2094/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2095/// if the responder is dropped without sending a response, so that the client
2096/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2097impl std::ops::Drop for RouteSetV4AddRouteResponder {
2098    fn drop(&mut self) {
2099        self.control_handle.shutdown();
2100        // Safety: drops once, never accessed again
2101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2102    }
2103}
2104
2105impl fdomain_client::fidl::Responder for RouteSetV4AddRouteResponder {
2106    type ControlHandle = RouteSetV4ControlHandle;
2107
2108    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2109        &self.control_handle
2110    }
2111
2112    fn drop_without_shutdown(mut self) {
2113        // Safety: drops once, never accessed again due to mem::forget
2114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2115        // Prevent Drop from running (which would shut down the channel)
2116        std::mem::forget(self);
2117    }
2118}
2119
2120impl RouteSetV4AddRouteResponder {
2121    /// Sends a response to the FIDL transaction.
2122    ///
2123    /// Sets the channel to shutdown if an error occurs.
2124    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2125        let _result = self.send_raw(result);
2126        if _result.is_err() {
2127            self.control_handle.shutdown();
2128        }
2129        self.drop_without_shutdown();
2130        _result
2131    }
2132
2133    /// Similar to "send" but does not shutdown the channel if an error occurs.
2134    pub fn send_no_shutdown_on_err(
2135        self,
2136        mut result: Result<bool, RouteSetError>,
2137    ) -> Result<(), fidl::Error> {
2138        let _result = self.send_raw(result);
2139        self.drop_without_shutdown();
2140        _result
2141    }
2142
2143    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2144        self.control_handle.inner.send::<fidl::encoding::ResultType<
2145            RouteSetV4AddRouteResponse,
2146            RouteSetError,
2147        >>(
2148            result.map(|did_add| (did_add,)),
2149            self.tx_id,
2150            0x4bd69e45539e8ec0,
2151            fidl::encoding::DynamicFlags::empty(),
2152        )
2153    }
2154}
2155
2156#[must_use = "FIDL methods require a response to be sent"]
2157#[derive(Debug)]
2158pub struct RouteSetV4RemoveRouteResponder {
2159    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2160    tx_id: u32,
2161}
2162
2163/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2164/// if the responder is dropped without sending a response, so that the client
2165/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2166impl std::ops::Drop for RouteSetV4RemoveRouteResponder {
2167    fn drop(&mut self) {
2168        self.control_handle.shutdown();
2169        // Safety: drops once, never accessed again
2170        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2171    }
2172}
2173
2174impl fdomain_client::fidl::Responder for RouteSetV4RemoveRouteResponder {
2175    type ControlHandle = RouteSetV4ControlHandle;
2176
2177    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2178        &self.control_handle
2179    }
2180
2181    fn drop_without_shutdown(mut self) {
2182        // Safety: drops once, never accessed again due to mem::forget
2183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2184        // Prevent Drop from running (which would shut down the channel)
2185        std::mem::forget(self);
2186    }
2187}
2188
2189impl RouteSetV4RemoveRouteResponder {
2190    /// Sends a response to the FIDL transaction.
2191    ///
2192    /// Sets the channel to shutdown if an error occurs.
2193    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2194        let _result = self.send_raw(result);
2195        if _result.is_err() {
2196            self.control_handle.shutdown();
2197        }
2198        self.drop_without_shutdown();
2199        _result
2200    }
2201
2202    /// Similar to "send" but does not shutdown the channel if an error occurs.
2203    pub fn send_no_shutdown_on_err(
2204        self,
2205        mut result: Result<bool, RouteSetError>,
2206    ) -> Result<(), fidl::Error> {
2207        let _result = self.send_raw(result);
2208        self.drop_without_shutdown();
2209        _result
2210    }
2211
2212    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2213        self.control_handle.inner.send::<fidl::encoding::ResultType<
2214            RouteSetV4RemoveRouteResponse,
2215            RouteSetError,
2216        >>(
2217            result.map(|did_remove| (did_remove,)),
2218            self.tx_id,
2219            0x514f6880232f1665,
2220            fidl::encoding::DynamicFlags::empty(),
2221        )
2222    }
2223}
2224
2225#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2226pub struct RouteSetV6Marker;
2227
2228impl fdomain_client::fidl::ProtocolMarker for RouteSetV6Marker {
2229    type Proxy = RouteSetV6Proxy;
2230    type RequestStream = RouteSetV6RequestStream;
2231
2232    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV6";
2233}
2234pub type RouteSetV6AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
2235pub type RouteSetV6AddRouteResult = Result<bool, RouteSetError>;
2236pub type RouteSetV6RemoveRouteResult = Result<bool, RouteSetError>;
2237
2238pub trait RouteSetV6ProxyInterface: Send + Sync {
2239    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error>>
2240        + Send;
2241    fn r#authenticate_for_interface(
2242        &self,
2243        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2244    ) -> Self::AuthenticateForInterfaceResponseFut;
2245    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV6AddRouteResult, fidl::Error>>
2246        + Send;
2247    fn r#add_route(&self, route: &fdomain_fuchsia_net_routes::RouteV6)
2248    -> Self::AddRouteResponseFut;
2249    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV6RemoveRouteResult, fidl::Error>>
2250        + Send;
2251    fn r#remove_route(
2252        &self,
2253        route: &fdomain_fuchsia_net_routes::RouteV6,
2254    ) -> Self::RemoveRouteResponseFut;
2255}
2256
2257#[derive(Debug, Clone)]
2258pub struct RouteSetV6Proxy {
2259    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2260}
2261
2262impl fdomain_client::fidl::Proxy for RouteSetV6Proxy {
2263    type Protocol = RouteSetV6Marker;
2264
2265    fn from_channel(inner: fdomain_client::Channel) -> Self {
2266        Self::new(inner)
2267    }
2268
2269    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2270        self.client.into_channel().map_err(|client| Self { client })
2271    }
2272
2273    fn as_channel(&self) -> &fdomain_client::Channel {
2274        self.client.as_channel()
2275    }
2276}
2277
2278impl RouteSetV6Proxy {
2279    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV6.
2280    pub fn new(channel: fdomain_client::Channel) -> Self {
2281        let protocol_name = <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2282        Self { client: fidl::client::Client::new(channel, protocol_name) }
2283    }
2284
2285    /// Get a Stream of events from the remote end of the protocol.
2286    ///
2287    /// # Panics
2288    ///
2289    /// Panics if the event stream was already taken.
2290    pub fn take_event_stream(&self) -> RouteSetV6EventStream {
2291        RouteSetV6EventStream { event_receiver: self.client.take_event_receiver() }
2292    }
2293
2294    /// Authenticate this route set to manage routes on the provided interface.
2295    /// Authentication is valid for the lifetime of the route set.
2296    ///
2297    /// + request `interface` the authentication credential for an interface.
2298    pub fn r#authenticate_for_interface(
2299        &self,
2300        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2301    ) -> fidl::client::QueryResponseFut<
2302        RouteSetV6AuthenticateForInterfaceResult,
2303        fdomain_client::fidl::FDomainResourceDialect,
2304    > {
2305        RouteSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
2306    }
2307
2308    /// Adds a route to this route set.
2309    ///
2310    /// + request `route` the route to add.
2311    /// - response `did_add` true iff the route was added to this `RouteSet`
2312    ///            as a result of this call.
2313    pub fn r#add_route(
2314        &self,
2315        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2316    ) -> fidl::client::QueryResponseFut<
2317        RouteSetV6AddRouteResult,
2318        fdomain_client::fidl::FDomainResourceDialect,
2319    > {
2320        RouteSetV6ProxyInterface::r#add_route(self, route)
2321    }
2322
2323    /// Removes a route from this route set.
2324    ///
2325    /// Note that if this route also exists other route sets, it will not be
2326    /// removed from the global routing table.
2327    ///
2328    /// + request `route` the route to remove.
2329    /// - response `did_remove` true iff the route was removed from this
2330    ///            `RouteSet` as a result of this call.
2331    pub fn r#remove_route(
2332        &self,
2333        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2334    ) -> fidl::client::QueryResponseFut<
2335        RouteSetV6RemoveRouteResult,
2336        fdomain_client::fidl::FDomainResourceDialect,
2337    > {
2338        RouteSetV6ProxyInterface::r#remove_route(self, route)
2339    }
2340}
2341
2342impl RouteSetV6ProxyInterface for RouteSetV6Proxy {
2343    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
2344        RouteSetV6AuthenticateForInterfaceResult,
2345        fdomain_client::fidl::FDomainResourceDialect,
2346    >;
2347    fn r#authenticate_for_interface(
2348        &self,
2349        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2350    ) -> Self::AuthenticateForInterfaceResponseFut {
2351        fn _decode(
2352            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2353        ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
2354            let _response = fidl::client::decode_transaction_body::<
2355                fidl::encoding::ResultType<
2356                    fidl::encoding::EmptyStruct,
2357                    AuthenticateForInterfaceError,
2358                >,
2359                fdomain_client::fidl::FDomainResourceDialect,
2360                0x7d63a6a7aed6f640,
2361            >(_buf?)?;
2362            Ok(_response.map(|x| x))
2363        }
2364        self.client.send_query_and_decode::<
2365            RouteSetV6AuthenticateForInterfaceRequest,
2366            RouteSetV6AuthenticateForInterfaceResult,
2367        >(
2368            (&mut credential,),
2369            0x7d63a6a7aed6f640,
2370            fidl::encoding::DynamicFlags::empty(),
2371            _decode,
2372        )
2373    }
2374
2375    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2376        RouteSetV6AddRouteResult,
2377        fdomain_client::fidl::FDomainResourceDialect,
2378    >;
2379    fn r#add_route(
2380        &self,
2381        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2382    ) -> Self::AddRouteResponseFut {
2383        fn _decode(
2384            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2385        ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
2386            let _response = fidl::client::decode_transaction_body::<
2387                fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
2388                fdomain_client::fidl::FDomainResourceDialect,
2389                0x67a2bd2ee34ace2e,
2390            >(_buf?)?;
2391            Ok(_response.map(|x| x.did_add))
2392        }
2393        self.client.send_query_and_decode::<RouteSetV6AddRouteRequest, RouteSetV6AddRouteResult>(
2394            (route,),
2395            0x67a2bd2ee34ace2e,
2396            fidl::encoding::DynamicFlags::empty(),
2397            _decode,
2398        )
2399    }
2400
2401    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
2402        RouteSetV6RemoveRouteResult,
2403        fdomain_client::fidl::FDomainResourceDialect,
2404    >;
2405    fn r#remove_route(
2406        &self,
2407        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2408    ) -> Self::RemoveRouteResponseFut {
2409        fn _decode(
2410            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2411        ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
2412            let _response = fidl::client::decode_transaction_body::<
2413                fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
2414                fdomain_client::fidl::FDomainResourceDialect,
2415                0x4e5b7d4b1112cd82,
2416            >(_buf?)?;
2417            Ok(_response.map(|x| x.did_remove))
2418        }
2419        self.client
2420            .send_query_and_decode::<RouteSetV6RemoveRouteRequest, RouteSetV6RemoveRouteResult>(
2421                (route,),
2422                0x4e5b7d4b1112cd82,
2423                fidl::encoding::DynamicFlags::empty(),
2424                _decode,
2425            )
2426    }
2427}
2428
2429pub struct RouteSetV6EventStream {
2430    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2431}
2432
2433impl std::marker::Unpin for RouteSetV6EventStream {}
2434
2435impl futures::stream::FusedStream for RouteSetV6EventStream {
2436    fn is_terminated(&self) -> bool {
2437        self.event_receiver.is_terminated()
2438    }
2439}
2440
2441impl futures::Stream for RouteSetV6EventStream {
2442    type Item = Result<RouteSetV6Event, fidl::Error>;
2443
2444    fn poll_next(
2445        mut self: std::pin::Pin<&mut Self>,
2446        cx: &mut std::task::Context<'_>,
2447    ) -> std::task::Poll<Option<Self::Item>> {
2448        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2449            &mut self.event_receiver,
2450            cx
2451        )?) {
2452            Some(buf) => std::task::Poll::Ready(Some(RouteSetV6Event::decode(buf))),
2453            None => std::task::Poll::Ready(None),
2454        }
2455    }
2456}
2457
2458#[derive(Debug)]
2459pub enum RouteSetV6Event {}
2460
2461impl RouteSetV6Event {
2462    /// Decodes a message buffer as a [`RouteSetV6Event`].
2463    fn decode(
2464        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2465    ) -> Result<RouteSetV6Event, fidl::Error> {
2466        let (bytes, _handles) = buf.split_mut();
2467        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2468        debug_assert_eq!(tx_header.tx_id, 0);
2469        match tx_header.ordinal {
2470            _ => Err(fidl::Error::UnknownOrdinal {
2471                ordinal: tx_header.ordinal,
2472                protocol_name:
2473                    <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2474            }),
2475        }
2476    }
2477}
2478
2479/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV6.
2480pub struct RouteSetV6RequestStream {
2481    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2482    is_terminated: bool,
2483}
2484
2485impl std::marker::Unpin for RouteSetV6RequestStream {}
2486
2487impl futures::stream::FusedStream for RouteSetV6RequestStream {
2488    fn is_terminated(&self) -> bool {
2489        self.is_terminated
2490    }
2491}
2492
2493impl fdomain_client::fidl::RequestStream for RouteSetV6RequestStream {
2494    type Protocol = RouteSetV6Marker;
2495    type ControlHandle = RouteSetV6ControlHandle;
2496
2497    fn from_channel(channel: fdomain_client::Channel) -> Self {
2498        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2499    }
2500
2501    fn control_handle(&self) -> Self::ControlHandle {
2502        RouteSetV6ControlHandle { inner: self.inner.clone() }
2503    }
2504
2505    fn into_inner(
2506        self,
2507    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2508    {
2509        (self.inner, self.is_terminated)
2510    }
2511
2512    fn from_inner(
2513        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2514        is_terminated: bool,
2515    ) -> Self {
2516        Self { inner, is_terminated }
2517    }
2518}
2519
2520impl futures::Stream for RouteSetV6RequestStream {
2521    type Item = Result<RouteSetV6Request, fidl::Error>;
2522
2523    fn poll_next(
2524        mut self: std::pin::Pin<&mut Self>,
2525        cx: &mut std::task::Context<'_>,
2526    ) -> std::task::Poll<Option<Self::Item>> {
2527        let this = &mut *self;
2528        if this.inner.check_shutdown(cx) {
2529            this.is_terminated = true;
2530            return std::task::Poll::Ready(None);
2531        }
2532        if this.is_terminated {
2533            panic!("polled RouteSetV6RequestStream after completion");
2534        }
2535        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2536            |bytes, handles| {
2537                match this.inner.channel().read_etc(cx, bytes, handles) {
2538                    std::task::Poll::Ready(Ok(())) => {}
2539                    std::task::Poll::Pending => return std::task::Poll::Pending,
2540                    std::task::Poll::Ready(Err(None)) => {
2541                        this.is_terminated = true;
2542                        return std::task::Poll::Ready(None);
2543                    }
2544                    std::task::Poll::Ready(Err(Some(e))) => {
2545                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2546                            e.into(),
2547                        ))));
2548                    }
2549                }
2550
2551                // A message has been received from the channel
2552                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2553
2554                std::task::Poll::Ready(Some(match header.ordinal {
2555                    0x7d63a6a7aed6f640 => {
2556                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2557                        let mut req = fidl::new_empty!(
2558                            RouteSetV6AuthenticateForInterfaceRequest,
2559                            fdomain_client::fidl::FDomainResourceDialect
2560                        );
2561                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2562                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2563                        Ok(RouteSetV6Request::AuthenticateForInterface {
2564                            credential: req.credential,
2565
2566                            responder: RouteSetV6AuthenticateForInterfaceResponder {
2567                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2568                                tx_id: header.tx_id,
2569                            },
2570                        })
2571                    }
2572                    0x67a2bd2ee34ace2e => {
2573                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2574                        let mut req = fidl::new_empty!(
2575                            RouteSetV6AddRouteRequest,
2576                            fdomain_client::fidl::FDomainResourceDialect
2577                        );
2578                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2579                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2580                        Ok(RouteSetV6Request::AddRoute {
2581                            route: req.route,
2582
2583                            responder: RouteSetV6AddRouteResponder {
2584                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2585                                tx_id: header.tx_id,
2586                            },
2587                        })
2588                    }
2589                    0x4e5b7d4b1112cd82 => {
2590                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2591                        let mut req = fidl::new_empty!(
2592                            RouteSetV6RemoveRouteRequest,
2593                            fdomain_client::fidl::FDomainResourceDialect
2594                        );
2595                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2596                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2597                        Ok(RouteSetV6Request::RemoveRoute {
2598                            route: req.route,
2599
2600                            responder: RouteSetV6RemoveRouteResponder {
2601                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2602                                tx_id: header.tx_id,
2603                            },
2604                        })
2605                    }
2606                    _ => Err(fidl::Error::UnknownOrdinal {
2607                        ordinal: header.ordinal,
2608                        protocol_name:
2609                            <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2610                    }),
2611                }))
2612            },
2613        )
2614    }
2615}
2616
2617/// Provides mutable access over a set of system's IPv6 routes.
2618///
2619/// The system maintains a single global routing table. A route set offers an
2620/// isolated window into a subset of the global routing table: clients are free
2621/// to manage the routes within their own route set, but not the route set of
2622/// others. Thus the global routing table represents the union of all existing
2623/// route sets. A route must be removed from all route sets to which it belongs
2624/// before it will be removed from the global table.
2625///
2626/// This protocol encodes the lifetime of the route set. Closing the client end
2627/// removes the route set, and will also remove any routes that were
2628/// solely-owned by this route set.
2629///
2630/// Note that the system reserves the right to remove routes out from underneath
2631/// this route set. This will always manifest as a `removed` event on the
2632/// [`fuchsia.net.routes/WatcherV6`] protocol.
2633///
2634/// If the route table backing this route set is removed, then this protocol
2635/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
2636#[derive(Debug)]
2637pub enum RouteSetV6Request {
2638    /// Authenticate this route set to manage routes on the provided interface.
2639    /// Authentication is valid for the lifetime of the route set.
2640    ///
2641    /// + request `interface` the authentication credential for an interface.
2642    AuthenticateForInterface {
2643        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2644        responder: RouteSetV6AuthenticateForInterfaceResponder,
2645    },
2646    /// Adds a route to this route set.
2647    ///
2648    /// + request `route` the route to add.
2649    /// - response `did_add` true iff the route was added to this `RouteSet`
2650    ///            as a result of this call.
2651    AddRoute { route: fdomain_fuchsia_net_routes::RouteV6, responder: RouteSetV6AddRouteResponder },
2652    /// Removes a route from this route set.
2653    ///
2654    /// Note that if this route also exists other route sets, it will not be
2655    /// removed from the global routing table.
2656    ///
2657    /// + request `route` the route to remove.
2658    /// - response `did_remove` true iff the route was removed from this
2659    ///            `RouteSet` as a result of this call.
2660    RemoveRoute {
2661        route: fdomain_fuchsia_net_routes::RouteV6,
2662        responder: RouteSetV6RemoveRouteResponder,
2663    },
2664}
2665
2666impl RouteSetV6Request {
2667    #[allow(irrefutable_let_patterns)]
2668    pub fn into_authenticate_for_interface(
2669        self,
2670    ) -> Option<(
2671        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2672        RouteSetV6AuthenticateForInterfaceResponder,
2673    )> {
2674        if let RouteSetV6Request::AuthenticateForInterface { credential, responder } = self {
2675            Some((credential, responder))
2676        } else {
2677            None
2678        }
2679    }
2680
2681    #[allow(irrefutable_let_patterns)]
2682    pub fn into_add_route(
2683        self,
2684    ) -> Option<(fdomain_fuchsia_net_routes::RouteV6, RouteSetV6AddRouteResponder)> {
2685        if let RouteSetV6Request::AddRoute { route, responder } = self {
2686            Some((route, responder))
2687        } else {
2688            None
2689        }
2690    }
2691
2692    #[allow(irrefutable_let_patterns)]
2693    pub fn into_remove_route(
2694        self,
2695    ) -> Option<(fdomain_fuchsia_net_routes::RouteV6, RouteSetV6RemoveRouteResponder)> {
2696        if let RouteSetV6Request::RemoveRoute { route, responder } = self {
2697            Some((route, responder))
2698        } else {
2699            None
2700        }
2701    }
2702
2703    /// Name of the method defined in FIDL
2704    pub fn method_name(&self) -> &'static str {
2705        match *self {
2706            RouteSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
2707            RouteSetV6Request::AddRoute { .. } => "add_route",
2708            RouteSetV6Request::RemoveRoute { .. } => "remove_route",
2709        }
2710    }
2711}
2712
2713#[derive(Debug, Clone)]
2714pub struct RouteSetV6ControlHandle {
2715    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2716}
2717
2718impl fdomain_client::fidl::ControlHandle for RouteSetV6ControlHandle {
2719    fn shutdown(&self) {
2720        self.inner.shutdown()
2721    }
2722
2723    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2724        self.inner.shutdown_with_epitaph(status)
2725    }
2726
2727    fn is_closed(&self) -> bool {
2728        self.inner.channel().is_closed()
2729    }
2730    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2731        self.inner.channel().on_closed()
2732    }
2733}
2734
2735impl RouteSetV6ControlHandle {}
2736
2737#[must_use = "FIDL methods require a response to be sent"]
2738#[derive(Debug)]
2739pub struct RouteSetV6AuthenticateForInterfaceResponder {
2740    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2741    tx_id: u32,
2742}
2743
2744/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2745/// if the responder is dropped without sending a response, so that the client
2746/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2747impl std::ops::Drop for RouteSetV6AuthenticateForInterfaceResponder {
2748    fn drop(&mut self) {
2749        self.control_handle.shutdown();
2750        // Safety: drops once, never accessed again
2751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2752    }
2753}
2754
2755impl fdomain_client::fidl::Responder for RouteSetV6AuthenticateForInterfaceResponder {
2756    type ControlHandle = RouteSetV6ControlHandle;
2757
2758    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2759        &self.control_handle
2760    }
2761
2762    fn drop_without_shutdown(mut self) {
2763        // Safety: drops once, never accessed again due to mem::forget
2764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2765        // Prevent Drop from running (which would shut down the channel)
2766        std::mem::forget(self);
2767    }
2768}
2769
2770impl RouteSetV6AuthenticateForInterfaceResponder {
2771    /// Sends a response to the FIDL transaction.
2772    ///
2773    /// Sets the channel to shutdown if an error occurs.
2774    pub fn send(
2775        self,
2776        mut result: Result<(), AuthenticateForInterfaceError>,
2777    ) -> Result<(), fidl::Error> {
2778        let _result = self.send_raw(result);
2779        if _result.is_err() {
2780            self.control_handle.shutdown();
2781        }
2782        self.drop_without_shutdown();
2783        _result
2784    }
2785
2786    /// Similar to "send" but does not shutdown the channel if an error occurs.
2787    pub fn send_no_shutdown_on_err(
2788        self,
2789        mut result: Result<(), AuthenticateForInterfaceError>,
2790    ) -> Result<(), fidl::Error> {
2791        let _result = self.send_raw(result);
2792        self.drop_without_shutdown();
2793        _result
2794    }
2795
2796    fn send_raw(
2797        &self,
2798        mut result: Result<(), AuthenticateForInterfaceError>,
2799    ) -> Result<(), fidl::Error> {
2800        self.control_handle.inner.send::<fidl::encoding::ResultType<
2801            fidl::encoding::EmptyStruct,
2802            AuthenticateForInterfaceError,
2803        >>(
2804            result,
2805            self.tx_id,
2806            0x7d63a6a7aed6f640,
2807            fidl::encoding::DynamicFlags::empty(),
2808        )
2809    }
2810}
2811
2812#[must_use = "FIDL methods require a response to be sent"]
2813#[derive(Debug)]
2814pub struct RouteSetV6AddRouteResponder {
2815    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2816    tx_id: u32,
2817}
2818
2819/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2820/// if the responder is dropped without sending a response, so that the client
2821/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2822impl std::ops::Drop for RouteSetV6AddRouteResponder {
2823    fn drop(&mut self) {
2824        self.control_handle.shutdown();
2825        // Safety: drops once, never accessed again
2826        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2827    }
2828}
2829
2830impl fdomain_client::fidl::Responder for RouteSetV6AddRouteResponder {
2831    type ControlHandle = RouteSetV6ControlHandle;
2832
2833    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2834        &self.control_handle
2835    }
2836
2837    fn drop_without_shutdown(mut self) {
2838        // Safety: drops once, never accessed again due to mem::forget
2839        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2840        // Prevent Drop from running (which would shut down the channel)
2841        std::mem::forget(self);
2842    }
2843}
2844
2845impl RouteSetV6AddRouteResponder {
2846    /// Sends a response to the FIDL transaction.
2847    ///
2848    /// Sets the channel to shutdown if an error occurs.
2849    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2850        let _result = self.send_raw(result);
2851        if _result.is_err() {
2852            self.control_handle.shutdown();
2853        }
2854        self.drop_without_shutdown();
2855        _result
2856    }
2857
2858    /// Similar to "send" but does not shutdown the channel if an error occurs.
2859    pub fn send_no_shutdown_on_err(
2860        self,
2861        mut result: Result<bool, RouteSetError>,
2862    ) -> Result<(), fidl::Error> {
2863        let _result = self.send_raw(result);
2864        self.drop_without_shutdown();
2865        _result
2866    }
2867
2868    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2869        self.control_handle.inner.send::<fidl::encoding::ResultType<
2870            RouteSetV6AddRouteResponse,
2871            RouteSetError,
2872        >>(
2873            result.map(|did_add| (did_add,)),
2874            self.tx_id,
2875            0x67a2bd2ee34ace2e,
2876            fidl::encoding::DynamicFlags::empty(),
2877        )
2878    }
2879}
2880
2881#[must_use = "FIDL methods require a response to be sent"]
2882#[derive(Debug)]
2883pub struct RouteSetV6RemoveRouteResponder {
2884    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2885    tx_id: u32,
2886}
2887
2888/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2889/// if the responder is dropped without sending a response, so that the client
2890/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2891impl std::ops::Drop for RouteSetV6RemoveRouteResponder {
2892    fn drop(&mut self) {
2893        self.control_handle.shutdown();
2894        // Safety: drops once, never accessed again
2895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2896    }
2897}
2898
2899impl fdomain_client::fidl::Responder for RouteSetV6RemoveRouteResponder {
2900    type ControlHandle = RouteSetV6ControlHandle;
2901
2902    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2903        &self.control_handle
2904    }
2905
2906    fn drop_without_shutdown(mut self) {
2907        // Safety: drops once, never accessed again due to mem::forget
2908        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2909        // Prevent Drop from running (which would shut down the channel)
2910        std::mem::forget(self);
2911    }
2912}
2913
2914impl RouteSetV6RemoveRouteResponder {
2915    /// Sends a response to the FIDL transaction.
2916    ///
2917    /// Sets the channel to shutdown if an error occurs.
2918    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2919        let _result = self.send_raw(result);
2920        if _result.is_err() {
2921            self.control_handle.shutdown();
2922        }
2923        self.drop_without_shutdown();
2924        _result
2925    }
2926
2927    /// Similar to "send" but does not shutdown the channel if an error occurs.
2928    pub fn send_no_shutdown_on_err(
2929        self,
2930        mut result: Result<bool, RouteSetError>,
2931    ) -> Result<(), fidl::Error> {
2932        let _result = self.send_raw(result);
2933        self.drop_without_shutdown();
2934        _result
2935    }
2936
2937    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2938        self.control_handle.inner.send::<fidl::encoding::ResultType<
2939            RouteSetV6RemoveRouteResponse,
2940            RouteSetError,
2941        >>(
2942            result.map(|did_remove| (did_remove,)),
2943            self.tx_id,
2944            0x4e5b7d4b1112cd82,
2945            fidl::encoding::DynamicFlags::empty(),
2946        )
2947    }
2948}
2949
2950#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2951pub struct RouteTableProviderV4Marker;
2952
2953impl fdomain_client::fidl::ProtocolMarker for RouteTableProviderV4Marker {
2954    type Proxy = RouteTableProviderV4Proxy;
2955    type RequestStream = RouteTableProviderV4RequestStream;
2956
2957    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV4";
2958}
2959impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableProviderV4Marker {}
2960pub type RouteTableProviderV4GetInterfaceLocalTableResult =
2961    Result<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>, GetInterfaceLocalTableError>;
2962
2963pub trait RouteTableProviderV4ProxyInterface: Send + Sync {
2964    fn r#new_route_table(
2965        &self,
2966        provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
2967        options: &RouteTableOptionsV4,
2968    ) -> Result<(), fidl::Error>;
2969    type GetInterfaceLocalTableResponseFut: std::future::Future<
2970            Output = Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error>,
2971        > + Send;
2972    fn r#get_interface_local_table(
2973        &self,
2974        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2975    ) -> Self::GetInterfaceLocalTableResponseFut;
2976}
2977
2978#[derive(Debug, Clone)]
2979pub struct RouteTableProviderV4Proxy {
2980    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2981}
2982
2983impl fdomain_client::fidl::Proxy for RouteTableProviderV4Proxy {
2984    type Protocol = RouteTableProviderV4Marker;
2985
2986    fn from_channel(inner: fdomain_client::Channel) -> Self {
2987        Self::new(inner)
2988    }
2989
2990    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2991        self.client.into_channel().map_err(|client| Self { client })
2992    }
2993
2994    fn as_channel(&self) -> &fdomain_client::Channel {
2995        self.client.as_channel()
2996    }
2997}
2998
2999impl RouteTableProviderV4Proxy {
3000    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV4.
3001    pub fn new(channel: fdomain_client::Channel) -> Self {
3002        let protocol_name =
3003            <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3004        Self { client: fidl::client::Client::new(channel, protocol_name) }
3005    }
3006
3007    /// Get a Stream of events from the remote end of the protocol.
3008    ///
3009    /// # Panics
3010    ///
3011    /// Panics if the event stream was already taken.
3012    pub fn take_event_stream(&self) -> RouteTableProviderV4EventStream {
3013        RouteTableProviderV4EventStream { event_receiver: self.client.take_event_receiver() }
3014    }
3015
3016    /// Creates a new route table. If the client end of the `provider` is
3017    /// closed, the route table is removed (unless detached).
3018    pub fn r#new_route_table(
3019        &self,
3020        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3021        mut options: &RouteTableOptionsV4,
3022    ) -> Result<(), fidl::Error> {
3023        RouteTableProviderV4ProxyInterface::r#new_route_table(self, provider, options)
3024    }
3025
3026    /// Gets the interface-local route table for this interface.
3027    ///
3028    /// + request credential of the interface to get local route table.
3029    /// - response client end of the `RouteTableV4` protocol if successfully.
3030    ///
3031    /// This table is only removed after the interface is removed AND all
3032    /// outstanding `RouteTableV4` channels are closed.
3033    ///
3034    /// Calling detach on the route table is a no-op.
3035    pub fn r#get_interface_local_table(
3036        &self,
3037        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3038    ) -> fidl::client::QueryResponseFut<
3039        RouteTableProviderV4GetInterfaceLocalTableResult,
3040        fdomain_client::fidl::FDomainResourceDialect,
3041    > {
3042        RouteTableProviderV4ProxyInterface::r#get_interface_local_table(self, credential)
3043    }
3044}
3045
3046impl RouteTableProviderV4ProxyInterface for RouteTableProviderV4Proxy {
3047    fn r#new_route_table(
3048        &self,
3049        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3050        mut options: &RouteTableOptionsV4,
3051    ) -> Result<(), fidl::Error> {
3052        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3053            (provider, options),
3054            0x703bc0eaf98f07cf,
3055            fidl::encoding::DynamicFlags::empty(),
3056        )
3057    }
3058
3059    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
3060        RouteTableProviderV4GetInterfaceLocalTableResult,
3061        fdomain_client::fidl::FDomainResourceDialect,
3062    >;
3063    fn r#get_interface_local_table(
3064        &self,
3065        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3066    ) -> Self::GetInterfaceLocalTableResponseFut {
3067        fn _decode(
3068            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3069        ) -> Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error> {
3070            let _response = fidl::client::decode_transaction_body::<
3071                fidl::encoding::ResultType<
3072                    RouteTableProviderV4GetInterfaceLocalTableResponse,
3073                    GetInterfaceLocalTableError,
3074                >,
3075                fdomain_client::fidl::FDomainResourceDialect,
3076                0x2596721a63bbacbd,
3077            >(_buf?)?;
3078            Ok(_response.map(|x| x.route_table))
3079        }
3080        self.client.send_query_and_decode::<
3081            RouteTableProviderV4GetInterfaceLocalTableRequest,
3082            RouteTableProviderV4GetInterfaceLocalTableResult,
3083        >(
3084            (&mut credential,),
3085            0x2596721a63bbacbd,
3086            fidl::encoding::DynamicFlags::empty(),
3087            _decode,
3088        )
3089    }
3090}
3091
3092pub struct RouteTableProviderV4EventStream {
3093    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3094}
3095
3096impl std::marker::Unpin for RouteTableProviderV4EventStream {}
3097
3098impl futures::stream::FusedStream for RouteTableProviderV4EventStream {
3099    fn is_terminated(&self) -> bool {
3100        self.event_receiver.is_terminated()
3101    }
3102}
3103
3104impl futures::Stream for RouteTableProviderV4EventStream {
3105    type Item = Result<RouteTableProviderV4Event, fidl::Error>;
3106
3107    fn poll_next(
3108        mut self: std::pin::Pin<&mut Self>,
3109        cx: &mut std::task::Context<'_>,
3110    ) -> std::task::Poll<Option<Self::Item>> {
3111        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3112            &mut self.event_receiver,
3113            cx
3114        )?) {
3115            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV4Event::decode(buf))),
3116            None => std::task::Poll::Ready(None),
3117        }
3118    }
3119}
3120
3121#[derive(Debug)]
3122pub enum RouteTableProviderV4Event {}
3123
3124impl RouteTableProviderV4Event {
3125    /// Decodes a message buffer as a [`RouteTableProviderV4Event`].
3126    fn decode(
3127        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3128    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
3129        let (bytes, _handles) = buf.split_mut();
3130        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3131        debug_assert_eq!(tx_header.tx_id, 0);
3132        match tx_header.ordinal {
3133            _ => Err(fidl::Error::UnknownOrdinal {
3134                ordinal: tx_header.ordinal,
3135                protocol_name:
3136                    <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3137            }),
3138        }
3139    }
3140}
3141
3142/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV4.
3143pub struct RouteTableProviderV4RequestStream {
3144    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3145    is_terminated: bool,
3146}
3147
3148impl std::marker::Unpin for RouteTableProviderV4RequestStream {}
3149
3150impl futures::stream::FusedStream for RouteTableProviderV4RequestStream {
3151    fn is_terminated(&self) -> bool {
3152        self.is_terminated
3153    }
3154}
3155
3156impl fdomain_client::fidl::RequestStream for RouteTableProviderV4RequestStream {
3157    type Protocol = RouteTableProviderV4Marker;
3158    type ControlHandle = RouteTableProviderV4ControlHandle;
3159
3160    fn from_channel(channel: fdomain_client::Channel) -> Self {
3161        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3162    }
3163
3164    fn control_handle(&self) -> Self::ControlHandle {
3165        RouteTableProviderV4ControlHandle { inner: self.inner.clone() }
3166    }
3167
3168    fn into_inner(
3169        self,
3170    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3171    {
3172        (self.inner, self.is_terminated)
3173    }
3174
3175    fn from_inner(
3176        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3177        is_terminated: bool,
3178    ) -> Self {
3179        Self { inner, is_terminated }
3180    }
3181}
3182
3183impl futures::Stream for RouteTableProviderV4RequestStream {
3184    type Item = Result<RouteTableProviderV4Request, fidl::Error>;
3185
3186    fn poll_next(
3187        mut self: std::pin::Pin<&mut Self>,
3188        cx: &mut std::task::Context<'_>,
3189    ) -> std::task::Poll<Option<Self::Item>> {
3190        let this = &mut *self;
3191        if this.inner.check_shutdown(cx) {
3192            this.is_terminated = true;
3193            return std::task::Poll::Ready(None);
3194        }
3195        if this.is_terminated {
3196            panic!("polled RouteTableProviderV4RequestStream after completion");
3197        }
3198        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3199            |bytes, handles| {
3200                match this.inner.channel().read_etc(cx, bytes, handles) {
3201                    std::task::Poll::Ready(Ok(())) => {}
3202                    std::task::Poll::Pending => return std::task::Poll::Pending,
3203                    std::task::Poll::Ready(Err(None)) => {
3204                        this.is_terminated = true;
3205                        return std::task::Poll::Ready(None);
3206                    }
3207                    std::task::Poll::Ready(Err(Some(e))) => {
3208                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3209                            e.into(),
3210                        ))));
3211                    }
3212                }
3213
3214                // A message has been received from the channel
3215                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3216
3217                std::task::Poll::Ready(Some(match header.ordinal {
3218                0x703bc0eaf98f07cf => {
3219                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3220                    let mut req = fidl::new_empty!(RouteTableProviderV4NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3221                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV4NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
3222                    let control_handle = RouteTableProviderV4ControlHandle {
3223                        inner: this.inner.clone(),
3224                    };
3225                    Ok(RouteTableProviderV4Request::NewRouteTable {provider: req.provider,
3226options: req.options,
3227
3228                        control_handle,
3229                    })
3230                }
3231                0x2596721a63bbacbd => {
3232                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3233                    let mut req = fidl::new_empty!(RouteTableProviderV4GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3234                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV4GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
3235                    let control_handle = RouteTableProviderV4ControlHandle {
3236                        inner: this.inner.clone(),
3237                    };
3238                    Ok(RouteTableProviderV4Request::GetInterfaceLocalTable {credential: req.credential,
3239
3240                        responder: RouteTableProviderV4GetInterfaceLocalTableResponder {
3241                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3242                            tx_id: header.tx_id,
3243                        },
3244                    })
3245                }
3246                _ => Err(fidl::Error::UnknownOrdinal {
3247                    ordinal: header.ordinal,
3248                    protocol_name: <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3249                }),
3250            }))
3251            },
3252        )
3253    }
3254}
3255
3256/// This protocol allows the client to create route tables.
3257#[derive(Debug)]
3258pub enum RouteTableProviderV4Request {
3259    /// Creates a new route table. If the client end of the `provider` is
3260    /// closed, the route table is removed (unless detached).
3261    NewRouteTable {
3262        provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3263        options: RouteTableOptionsV4,
3264        control_handle: RouteTableProviderV4ControlHandle,
3265    },
3266    /// Gets the interface-local route table for this interface.
3267    ///
3268    /// + request credential of the interface to get local route table.
3269    /// - response client end of the `RouteTableV4` protocol if successfully.
3270    ///
3271    /// This table is only removed after the interface is removed AND all
3272    /// outstanding `RouteTableV4` channels are closed.
3273    ///
3274    /// Calling detach on the route table is a no-op.
3275    GetInterfaceLocalTable {
3276        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3277        responder: RouteTableProviderV4GetInterfaceLocalTableResponder,
3278    },
3279}
3280
3281impl RouteTableProviderV4Request {
3282    #[allow(irrefutable_let_patterns)]
3283    pub fn into_new_route_table(
3284        self,
3285    ) -> Option<(
3286        fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3287        RouteTableOptionsV4,
3288        RouteTableProviderV4ControlHandle,
3289    )> {
3290        if let RouteTableProviderV4Request::NewRouteTable { provider, options, control_handle } =
3291            self
3292        {
3293            Some((provider, options, control_handle))
3294        } else {
3295            None
3296        }
3297    }
3298
3299    #[allow(irrefutable_let_patterns)]
3300    pub fn into_get_interface_local_table(
3301        self,
3302    ) -> Option<(
3303        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3304        RouteTableProviderV4GetInterfaceLocalTableResponder,
3305    )> {
3306        if let RouteTableProviderV4Request::GetInterfaceLocalTable { credential, responder } = self
3307        {
3308            Some((credential, responder))
3309        } else {
3310            None
3311        }
3312    }
3313
3314    /// Name of the method defined in FIDL
3315    pub fn method_name(&self) -> &'static str {
3316        match *self {
3317            RouteTableProviderV4Request::NewRouteTable { .. } => "new_route_table",
3318            RouteTableProviderV4Request::GetInterfaceLocalTable { .. } => {
3319                "get_interface_local_table"
3320            }
3321        }
3322    }
3323}
3324
3325#[derive(Debug, Clone)]
3326pub struct RouteTableProviderV4ControlHandle {
3327    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3328}
3329
3330impl fdomain_client::fidl::ControlHandle for RouteTableProviderV4ControlHandle {
3331    fn shutdown(&self) {
3332        self.inner.shutdown()
3333    }
3334
3335    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3336        self.inner.shutdown_with_epitaph(status)
3337    }
3338
3339    fn is_closed(&self) -> bool {
3340        self.inner.channel().is_closed()
3341    }
3342    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3343        self.inner.channel().on_closed()
3344    }
3345}
3346
3347impl RouteTableProviderV4ControlHandle {}
3348
3349#[must_use = "FIDL methods require a response to be sent"]
3350#[derive(Debug)]
3351pub struct RouteTableProviderV4GetInterfaceLocalTableResponder {
3352    control_handle: std::mem::ManuallyDrop<RouteTableProviderV4ControlHandle>,
3353    tx_id: u32,
3354}
3355
3356/// Set the the channel to be shutdown (see [`RouteTableProviderV4ControlHandle::shutdown`])
3357/// if the responder is dropped without sending a response, so that the client
3358/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3359impl std::ops::Drop for RouteTableProviderV4GetInterfaceLocalTableResponder {
3360    fn drop(&mut self) {
3361        self.control_handle.shutdown();
3362        // Safety: drops once, never accessed again
3363        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3364    }
3365}
3366
3367impl fdomain_client::fidl::Responder for RouteTableProviderV4GetInterfaceLocalTableResponder {
3368    type ControlHandle = RouteTableProviderV4ControlHandle;
3369
3370    fn control_handle(&self) -> &RouteTableProviderV4ControlHandle {
3371        &self.control_handle
3372    }
3373
3374    fn drop_without_shutdown(mut self) {
3375        // Safety: drops once, never accessed again due to mem::forget
3376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3377        // Prevent Drop from running (which would shut down the channel)
3378        std::mem::forget(self);
3379    }
3380}
3381
3382impl RouteTableProviderV4GetInterfaceLocalTableResponder {
3383    /// Sends a response to the FIDL transaction.
3384    ///
3385    /// Sets the channel to shutdown if an error occurs.
3386    pub fn send(
3387        self,
3388        mut result: Result<
3389            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3390            GetInterfaceLocalTableError,
3391        >,
3392    ) -> Result<(), fidl::Error> {
3393        let _result = self.send_raw(result);
3394        if _result.is_err() {
3395            self.control_handle.shutdown();
3396        }
3397        self.drop_without_shutdown();
3398        _result
3399    }
3400
3401    /// Similar to "send" but does not shutdown the channel if an error occurs.
3402    pub fn send_no_shutdown_on_err(
3403        self,
3404        mut result: Result<
3405            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3406            GetInterfaceLocalTableError,
3407        >,
3408    ) -> Result<(), fidl::Error> {
3409        let _result = self.send_raw(result);
3410        self.drop_without_shutdown();
3411        _result
3412    }
3413
3414    fn send_raw(
3415        &self,
3416        mut result: Result<
3417            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3418            GetInterfaceLocalTableError,
3419        >,
3420    ) -> Result<(), fidl::Error> {
3421        self.control_handle.inner.send::<fidl::encoding::ResultType<
3422            RouteTableProviderV4GetInterfaceLocalTableResponse,
3423            GetInterfaceLocalTableError,
3424        >>(
3425            result.map(|route_table| (route_table,)),
3426            self.tx_id,
3427            0x2596721a63bbacbd,
3428            fidl::encoding::DynamicFlags::empty(),
3429        )
3430    }
3431}
3432
3433#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3434pub struct RouteTableProviderV6Marker;
3435
3436impl fdomain_client::fidl::ProtocolMarker for RouteTableProviderV6Marker {
3437    type Proxy = RouteTableProviderV6Proxy;
3438    type RequestStream = RouteTableProviderV6RequestStream;
3439
3440    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV6";
3441}
3442impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableProviderV6Marker {}
3443pub type RouteTableProviderV6GetInterfaceLocalTableResult =
3444    Result<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>, GetInterfaceLocalTableError>;
3445
3446pub trait RouteTableProviderV6ProxyInterface: Send + Sync {
3447    fn r#new_route_table(
3448        &self,
3449        provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3450        options: &RouteTableOptionsV6,
3451    ) -> Result<(), fidl::Error>;
3452    type GetInterfaceLocalTableResponseFut: std::future::Future<
3453            Output = Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error>,
3454        > + Send;
3455    fn r#get_interface_local_table(
3456        &self,
3457        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3458    ) -> Self::GetInterfaceLocalTableResponseFut;
3459}
3460
3461#[derive(Debug, Clone)]
3462pub struct RouteTableProviderV6Proxy {
3463    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3464}
3465
3466impl fdomain_client::fidl::Proxy for RouteTableProviderV6Proxy {
3467    type Protocol = RouteTableProviderV6Marker;
3468
3469    fn from_channel(inner: fdomain_client::Channel) -> Self {
3470        Self::new(inner)
3471    }
3472
3473    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3474        self.client.into_channel().map_err(|client| Self { client })
3475    }
3476
3477    fn as_channel(&self) -> &fdomain_client::Channel {
3478        self.client.as_channel()
3479    }
3480}
3481
3482impl RouteTableProviderV6Proxy {
3483    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV6.
3484    pub fn new(channel: fdomain_client::Channel) -> Self {
3485        let protocol_name =
3486            <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3487        Self { client: fidl::client::Client::new(channel, protocol_name) }
3488    }
3489
3490    /// Get a Stream of events from the remote end of the protocol.
3491    ///
3492    /// # Panics
3493    ///
3494    /// Panics if the event stream was already taken.
3495    pub fn take_event_stream(&self) -> RouteTableProviderV6EventStream {
3496        RouteTableProviderV6EventStream { event_receiver: self.client.take_event_receiver() }
3497    }
3498
3499    /// Creates a new route table. If the client end of the `provider` is
3500    /// closed, the route table is removed (unless detached).
3501    pub fn r#new_route_table(
3502        &self,
3503        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3504        mut options: &RouteTableOptionsV6,
3505    ) -> Result<(), fidl::Error> {
3506        RouteTableProviderV6ProxyInterface::r#new_route_table(self, provider, options)
3507    }
3508
3509    /// Gets the interface-local route table for this interface.
3510    ///
3511    /// + request credential of the interface to get local route table.
3512    /// - response client end of the `RouteTableV6` protocol if successfully.
3513    ///
3514    /// This table is only removed after the interface is removed AND all
3515    /// outstanding `RouteTableV6` channels are closed.
3516    ///
3517    /// Calling detach on the route table is a no-op.
3518    pub fn r#get_interface_local_table(
3519        &self,
3520        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3521    ) -> fidl::client::QueryResponseFut<
3522        RouteTableProviderV6GetInterfaceLocalTableResult,
3523        fdomain_client::fidl::FDomainResourceDialect,
3524    > {
3525        RouteTableProviderV6ProxyInterface::r#get_interface_local_table(self, credential)
3526    }
3527}
3528
3529impl RouteTableProviderV6ProxyInterface for RouteTableProviderV6Proxy {
3530    fn r#new_route_table(
3531        &self,
3532        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3533        mut options: &RouteTableOptionsV6,
3534    ) -> Result<(), fidl::Error> {
3535        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
3536            (provider, options),
3537            0x152b67b397a31ca,
3538            fidl::encoding::DynamicFlags::empty(),
3539        )
3540    }
3541
3542    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
3543        RouteTableProviderV6GetInterfaceLocalTableResult,
3544        fdomain_client::fidl::FDomainResourceDialect,
3545    >;
3546    fn r#get_interface_local_table(
3547        &self,
3548        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3549    ) -> Self::GetInterfaceLocalTableResponseFut {
3550        fn _decode(
3551            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3552        ) -> Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error> {
3553            let _response = fidl::client::decode_transaction_body::<
3554                fidl::encoding::ResultType<
3555                    RouteTableProviderV6GetInterfaceLocalTableResponse,
3556                    GetInterfaceLocalTableError,
3557                >,
3558                fdomain_client::fidl::FDomainResourceDialect,
3559                0x6f82c1d63c3081f5,
3560            >(_buf?)?;
3561            Ok(_response.map(|x| x.route_table))
3562        }
3563        self.client.send_query_and_decode::<
3564            RouteTableProviderV6GetInterfaceLocalTableRequest,
3565            RouteTableProviderV6GetInterfaceLocalTableResult,
3566        >(
3567            (&mut credential,),
3568            0x6f82c1d63c3081f5,
3569            fidl::encoding::DynamicFlags::empty(),
3570            _decode,
3571        )
3572    }
3573}
3574
3575pub struct RouteTableProviderV6EventStream {
3576    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3577}
3578
3579impl std::marker::Unpin for RouteTableProviderV6EventStream {}
3580
3581impl futures::stream::FusedStream for RouteTableProviderV6EventStream {
3582    fn is_terminated(&self) -> bool {
3583        self.event_receiver.is_terminated()
3584    }
3585}
3586
3587impl futures::Stream for RouteTableProviderV6EventStream {
3588    type Item = Result<RouteTableProviderV6Event, fidl::Error>;
3589
3590    fn poll_next(
3591        mut self: std::pin::Pin<&mut Self>,
3592        cx: &mut std::task::Context<'_>,
3593    ) -> std::task::Poll<Option<Self::Item>> {
3594        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3595            &mut self.event_receiver,
3596            cx
3597        )?) {
3598            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV6Event::decode(buf))),
3599            None => std::task::Poll::Ready(None),
3600        }
3601    }
3602}
3603
3604#[derive(Debug)]
3605pub enum RouteTableProviderV6Event {}
3606
3607impl RouteTableProviderV6Event {
3608    /// Decodes a message buffer as a [`RouteTableProviderV6Event`].
3609    fn decode(
3610        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3611    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
3612        let (bytes, _handles) = buf.split_mut();
3613        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3614        debug_assert_eq!(tx_header.tx_id, 0);
3615        match tx_header.ordinal {
3616            _ => Err(fidl::Error::UnknownOrdinal {
3617                ordinal: tx_header.ordinal,
3618                protocol_name:
3619                    <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3620            }),
3621        }
3622    }
3623}
3624
3625/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV6.
3626pub struct RouteTableProviderV6RequestStream {
3627    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3628    is_terminated: bool,
3629}
3630
3631impl std::marker::Unpin for RouteTableProviderV6RequestStream {}
3632
3633impl futures::stream::FusedStream for RouteTableProviderV6RequestStream {
3634    fn is_terminated(&self) -> bool {
3635        self.is_terminated
3636    }
3637}
3638
3639impl fdomain_client::fidl::RequestStream for RouteTableProviderV6RequestStream {
3640    type Protocol = RouteTableProviderV6Marker;
3641    type ControlHandle = RouteTableProviderV6ControlHandle;
3642
3643    fn from_channel(channel: fdomain_client::Channel) -> Self {
3644        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3645    }
3646
3647    fn control_handle(&self) -> Self::ControlHandle {
3648        RouteTableProviderV6ControlHandle { inner: self.inner.clone() }
3649    }
3650
3651    fn into_inner(
3652        self,
3653    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3654    {
3655        (self.inner, self.is_terminated)
3656    }
3657
3658    fn from_inner(
3659        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3660        is_terminated: bool,
3661    ) -> Self {
3662        Self { inner, is_terminated }
3663    }
3664}
3665
3666impl futures::Stream for RouteTableProviderV6RequestStream {
3667    type Item = Result<RouteTableProviderV6Request, fidl::Error>;
3668
3669    fn poll_next(
3670        mut self: std::pin::Pin<&mut Self>,
3671        cx: &mut std::task::Context<'_>,
3672    ) -> std::task::Poll<Option<Self::Item>> {
3673        let this = &mut *self;
3674        if this.inner.check_shutdown(cx) {
3675            this.is_terminated = true;
3676            return std::task::Poll::Ready(None);
3677        }
3678        if this.is_terminated {
3679            panic!("polled RouteTableProviderV6RequestStream after completion");
3680        }
3681        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3682            |bytes, handles| {
3683                match this.inner.channel().read_etc(cx, bytes, handles) {
3684                    std::task::Poll::Ready(Ok(())) => {}
3685                    std::task::Poll::Pending => return std::task::Poll::Pending,
3686                    std::task::Poll::Ready(Err(None)) => {
3687                        this.is_terminated = true;
3688                        return std::task::Poll::Ready(None);
3689                    }
3690                    std::task::Poll::Ready(Err(Some(e))) => {
3691                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3692                            e.into(),
3693                        ))));
3694                    }
3695                }
3696
3697                // A message has been received from the channel
3698                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3699
3700                std::task::Poll::Ready(Some(match header.ordinal {
3701                0x152b67b397a31ca => {
3702                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3703                    let mut req = fidl::new_empty!(RouteTableProviderV6NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3704                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV6NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
3705                    let control_handle = RouteTableProviderV6ControlHandle {
3706                        inner: this.inner.clone(),
3707                    };
3708                    Ok(RouteTableProviderV6Request::NewRouteTable {provider: req.provider,
3709options: req.options,
3710
3711                        control_handle,
3712                    })
3713                }
3714                0x6f82c1d63c3081f5 => {
3715                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3716                    let mut req = fidl::new_empty!(RouteTableProviderV6GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3717                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV6GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
3718                    let control_handle = RouteTableProviderV6ControlHandle {
3719                        inner: this.inner.clone(),
3720                    };
3721                    Ok(RouteTableProviderV6Request::GetInterfaceLocalTable {credential: req.credential,
3722
3723                        responder: RouteTableProviderV6GetInterfaceLocalTableResponder {
3724                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3725                            tx_id: header.tx_id,
3726                        },
3727                    })
3728                }
3729                _ => Err(fidl::Error::UnknownOrdinal {
3730                    ordinal: header.ordinal,
3731                    protocol_name: <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3732                }),
3733            }))
3734            },
3735        )
3736    }
3737}
3738
3739/// This protocol allows the client to create route tables.
3740#[derive(Debug)]
3741pub enum RouteTableProviderV6Request {
3742    /// Creates a new route table. If the client end of the `provider` is
3743    /// closed, the route table is removed (unless detached).
3744    NewRouteTable {
3745        provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3746        options: RouteTableOptionsV6,
3747        control_handle: RouteTableProviderV6ControlHandle,
3748    },
3749    /// Gets the interface-local route table for this interface.
3750    ///
3751    /// + request credential of the interface to get local route table.
3752    /// - response client end of the `RouteTableV6` protocol if successfully.
3753    ///
3754    /// This table is only removed after the interface is removed AND all
3755    /// outstanding `RouteTableV6` channels are closed.
3756    ///
3757    /// Calling detach on the route table is a no-op.
3758    GetInterfaceLocalTable {
3759        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3760        responder: RouteTableProviderV6GetInterfaceLocalTableResponder,
3761    },
3762}
3763
3764impl RouteTableProviderV6Request {
3765    #[allow(irrefutable_let_patterns)]
3766    pub fn into_new_route_table(
3767        self,
3768    ) -> Option<(
3769        fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3770        RouteTableOptionsV6,
3771        RouteTableProviderV6ControlHandle,
3772    )> {
3773        if let RouteTableProviderV6Request::NewRouteTable { provider, options, control_handle } =
3774            self
3775        {
3776            Some((provider, options, control_handle))
3777        } else {
3778            None
3779        }
3780    }
3781
3782    #[allow(irrefutable_let_patterns)]
3783    pub fn into_get_interface_local_table(
3784        self,
3785    ) -> Option<(
3786        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3787        RouteTableProviderV6GetInterfaceLocalTableResponder,
3788    )> {
3789        if let RouteTableProviderV6Request::GetInterfaceLocalTable { credential, responder } = self
3790        {
3791            Some((credential, responder))
3792        } else {
3793            None
3794        }
3795    }
3796
3797    /// Name of the method defined in FIDL
3798    pub fn method_name(&self) -> &'static str {
3799        match *self {
3800            RouteTableProviderV6Request::NewRouteTable { .. } => "new_route_table",
3801            RouteTableProviderV6Request::GetInterfaceLocalTable { .. } => {
3802                "get_interface_local_table"
3803            }
3804        }
3805    }
3806}
3807
3808#[derive(Debug, Clone)]
3809pub struct RouteTableProviderV6ControlHandle {
3810    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3811}
3812
3813impl fdomain_client::fidl::ControlHandle for RouteTableProviderV6ControlHandle {
3814    fn shutdown(&self) {
3815        self.inner.shutdown()
3816    }
3817
3818    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3819        self.inner.shutdown_with_epitaph(status)
3820    }
3821
3822    fn is_closed(&self) -> bool {
3823        self.inner.channel().is_closed()
3824    }
3825    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3826        self.inner.channel().on_closed()
3827    }
3828}
3829
3830impl RouteTableProviderV6ControlHandle {}
3831
3832#[must_use = "FIDL methods require a response to be sent"]
3833#[derive(Debug)]
3834pub struct RouteTableProviderV6GetInterfaceLocalTableResponder {
3835    control_handle: std::mem::ManuallyDrop<RouteTableProviderV6ControlHandle>,
3836    tx_id: u32,
3837}
3838
3839/// Set the the channel to be shutdown (see [`RouteTableProviderV6ControlHandle::shutdown`])
3840/// if the responder is dropped without sending a response, so that the client
3841/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3842impl std::ops::Drop for RouteTableProviderV6GetInterfaceLocalTableResponder {
3843    fn drop(&mut self) {
3844        self.control_handle.shutdown();
3845        // Safety: drops once, never accessed again
3846        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3847    }
3848}
3849
3850impl fdomain_client::fidl::Responder for RouteTableProviderV6GetInterfaceLocalTableResponder {
3851    type ControlHandle = RouteTableProviderV6ControlHandle;
3852
3853    fn control_handle(&self) -> &RouteTableProviderV6ControlHandle {
3854        &self.control_handle
3855    }
3856
3857    fn drop_without_shutdown(mut self) {
3858        // Safety: drops once, never accessed again due to mem::forget
3859        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3860        // Prevent Drop from running (which would shut down the channel)
3861        std::mem::forget(self);
3862    }
3863}
3864
3865impl RouteTableProviderV6GetInterfaceLocalTableResponder {
3866    /// Sends a response to the FIDL transaction.
3867    ///
3868    /// Sets the channel to shutdown if an error occurs.
3869    pub fn send(
3870        self,
3871        mut result: Result<
3872            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3873            GetInterfaceLocalTableError,
3874        >,
3875    ) -> Result<(), fidl::Error> {
3876        let _result = self.send_raw(result);
3877        if _result.is_err() {
3878            self.control_handle.shutdown();
3879        }
3880        self.drop_without_shutdown();
3881        _result
3882    }
3883
3884    /// Similar to "send" but does not shutdown the channel if an error occurs.
3885    pub fn send_no_shutdown_on_err(
3886        self,
3887        mut result: Result<
3888            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3889            GetInterfaceLocalTableError,
3890        >,
3891    ) -> Result<(), fidl::Error> {
3892        let _result = self.send_raw(result);
3893        self.drop_without_shutdown();
3894        _result
3895    }
3896
3897    fn send_raw(
3898        &self,
3899        mut result: Result<
3900            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3901            GetInterfaceLocalTableError,
3902        >,
3903    ) -> Result<(), fidl::Error> {
3904        self.control_handle.inner.send::<fidl::encoding::ResultType<
3905            RouteTableProviderV6GetInterfaceLocalTableResponse,
3906            GetInterfaceLocalTableError,
3907        >>(
3908            result.map(|route_table| (route_table,)),
3909            self.tx_id,
3910            0x6f82c1d63c3081f5,
3911            fidl::encoding::DynamicFlags::empty(),
3912        )
3913    }
3914}
3915
3916#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3917pub struct RouteTableV4Marker;
3918
3919impl fdomain_client::fidl::ProtocolMarker for RouteTableV4Marker {
3920    type Proxy = RouteTableV4Proxy;
3921    type RequestStream = RouteTableV4RequestStream;
3922
3923    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV4";
3924}
3925impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableV4Marker {}
3926
3927pub trait RouteTableV4ProxyInterface: Send + Sync {
3928    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
3929    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
3930    fn r#detach(&self) -> Result<(), fidl::Error>;
3931    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
3932        + Send;
3933    fn r#remove(&self) -> Self::RemoveResponseFut;
3934    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
3935        + Send;
3936    fn r#get_authorization_for_route_table(&self)
3937    -> Self::GetAuthorizationForRouteTableResponseFut;
3938    fn r#new_route_set(
3939        &self,
3940        route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
3941    ) -> Result<(), fidl::Error>;
3942}
3943
3944#[derive(Debug, Clone)]
3945pub struct RouteTableV4Proxy {
3946    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3947}
3948
3949impl fdomain_client::fidl::Proxy for RouteTableV4Proxy {
3950    type Protocol = RouteTableV4Marker;
3951
3952    fn from_channel(inner: fdomain_client::Channel) -> Self {
3953        Self::new(inner)
3954    }
3955
3956    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3957        self.client.into_channel().map_err(|client| Self { client })
3958    }
3959
3960    fn as_channel(&self) -> &fdomain_client::Channel {
3961        self.client.as_channel()
3962    }
3963}
3964
3965impl RouteTableV4Proxy {
3966    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV4.
3967    pub fn new(channel: fdomain_client::Channel) -> Self {
3968        let protocol_name =
3969            <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3970        Self { client: fidl::client::Client::new(channel, protocol_name) }
3971    }
3972
3973    /// Get a Stream of events from the remote end of the protocol.
3974    ///
3975    /// # Panics
3976    ///
3977    /// Panics if the event stream was already taken.
3978    pub fn take_event_stream(&self) -> RouteTableV4EventStream {
3979        RouteTableV4EventStream { event_receiver: self.client.take_event_receiver() }
3980    }
3981
3982    /// Gets the table ID for this table.
3983    pub fn r#get_table_id(
3984        &self,
3985    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
3986        RouteTableV4ProxyInterface::r#get_table_id(self)
3987    }
3988
3989    /// Detaches the lifetime of the route table from the lifetime of the
3990    /// client end of the channel.
3991    ///
3992    /// After this method is called, the route table will not be removed
3993    /// if the client end is closed. It's a no-op if called on the main table.
3994    pub fn r#detach(&self) -> Result<(), fidl::Error> {
3995        RouteTableV4ProxyInterface::r#detach(self)
3996    }
3997
3998    /// Removes the route table explicitly.
3999    ///
4000    /// This method cannot be called on the main table or an interface-local
4001    /// table, an error will be returned if called. The server will close the
4002    /// channel after this method successfully returns.
4003    pub fn r#remove(
4004        &self,
4005    ) -> fidl::client::QueryResponseFut<
4006        BaseRouteTableRemoveResult,
4007        fdomain_client::fidl::FDomainResourceDialect,
4008    > {
4009        RouteTableV4ProxyInterface::r#remove(self)
4010    }
4011
4012    /// Gets an authentication credential for this table.
4013    ///
4014    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4015    /// held by the server. This credential can be passed into
4016    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4017    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4018    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4019    /// transfer the `EVENT` to other clients.
4020    ///
4021    /// - response `credential` the authorization credential for this table.
4022    pub fn r#get_authorization_for_route_table(
4023        &self,
4024    ) -> fidl::client::QueryResponseFut<
4025        GrantForRouteTableAuthorization,
4026        fdomain_client::fidl::FDomainResourceDialect,
4027    > {
4028        RouteTableV4ProxyInterface::r#get_authorization_for_route_table(self)
4029    }
4030
4031    /// Creates an empty route set.
4032    ///
4033    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4034    pub fn r#new_route_set(
4035        &self,
4036        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4037    ) -> Result<(), fidl::Error> {
4038        RouteTableV4ProxyInterface::r#new_route_set(self, route_set)
4039    }
4040}
4041
4042impl RouteTableV4ProxyInterface for RouteTableV4Proxy {
4043    type GetTableIdResponseFut =
4044        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
4045    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
4046        fn _decode(
4047            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4048        ) -> Result<u32, fidl::Error> {
4049            let _response = fidl::client::decode_transaction_body::<
4050                BaseRouteTableGetTableIdResponse,
4051                fdomain_client::fidl::FDomainResourceDialect,
4052                0x7eab30c55edbfc15,
4053            >(_buf?)?;
4054            Ok(_response.table_id)
4055        }
4056        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
4057            (),
4058            0x7eab30c55edbfc15,
4059            fidl::encoding::DynamicFlags::empty(),
4060            _decode,
4061        )
4062    }
4063
4064    fn r#detach(&self) -> Result<(), fidl::Error> {
4065        self.client.send::<fidl::encoding::EmptyPayload>(
4066            (),
4067            0x2853ab157285b384,
4068            fidl::encoding::DynamicFlags::empty(),
4069        )
4070    }
4071
4072    type RemoveResponseFut = fidl::client::QueryResponseFut<
4073        BaseRouteTableRemoveResult,
4074        fdomain_client::fidl::FDomainResourceDialect,
4075    >;
4076    fn r#remove(&self) -> Self::RemoveResponseFut {
4077        fn _decode(
4078            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4079        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4080            let _response = fidl::client::decode_transaction_body::<
4081                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
4082                fdomain_client::fidl::FDomainResourceDialect,
4083                0xc42e58a5fc79426,
4084            >(_buf?)?;
4085            Ok(_response.map(|x| x))
4086        }
4087        self.client
4088            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
4089                (),
4090                0xc42e58a5fc79426,
4091                fidl::encoding::DynamicFlags::empty(),
4092                _decode,
4093            )
4094    }
4095
4096    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
4097        GrantForRouteTableAuthorization,
4098        fdomain_client::fidl::FDomainResourceDialect,
4099    >;
4100    fn r#get_authorization_for_route_table(
4101        &self,
4102    ) -> Self::GetAuthorizationForRouteTableResponseFut {
4103        fn _decode(
4104            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4105        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4106            let _response = fidl::client::decode_transaction_body::<
4107                BaseRouteTableGetAuthorizationForRouteTableResponse,
4108                fdomain_client::fidl::FDomainResourceDialect,
4109                0x56a48c921ff3b6eb,
4110            >(_buf?)?;
4111            Ok(_response.credential)
4112        }
4113        self.client
4114            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
4115                (),
4116                0x56a48c921ff3b6eb,
4117                fidl::encoding::DynamicFlags::empty(),
4118                _decode,
4119            )
4120    }
4121
4122    fn r#new_route_set(
4123        &self,
4124        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4125    ) -> Result<(), fidl::Error> {
4126        self.client.send::<RouteTableV4NewRouteSetRequest>(
4127            (route_set,),
4128            0x6aeb6d05698abedb,
4129            fidl::encoding::DynamicFlags::empty(),
4130        )
4131    }
4132}
4133
4134pub struct RouteTableV4EventStream {
4135    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4136}
4137
4138impl std::marker::Unpin for RouteTableV4EventStream {}
4139
4140impl futures::stream::FusedStream for RouteTableV4EventStream {
4141    fn is_terminated(&self) -> bool {
4142        self.event_receiver.is_terminated()
4143    }
4144}
4145
4146impl futures::Stream for RouteTableV4EventStream {
4147    type Item = Result<RouteTableV4Event, fidl::Error>;
4148
4149    fn poll_next(
4150        mut self: std::pin::Pin<&mut Self>,
4151        cx: &mut std::task::Context<'_>,
4152    ) -> std::task::Poll<Option<Self::Item>> {
4153        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4154            &mut self.event_receiver,
4155            cx
4156        )?) {
4157            Some(buf) => std::task::Poll::Ready(Some(RouteTableV4Event::decode(buf))),
4158            None => std::task::Poll::Ready(None),
4159        }
4160    }
4161}
4162
4163#[derive(Debug)]
4164pub enum RouteTableV4Event {}
4165
4166impl RouteTableV4Event {
4167    /// Decodes a message buffer as a [`RouteTableV4Event`].
4168    fn decode(
4169        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4170    ) -> Result<RouteTableV4Event, fidl::Error> {
4171        let (bytes, _handles) = buf.split_mut();
4172        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4173        debug_assert_eq!(tx_header.tx_id, 0);
4174        match tx_header.ordinal {
4175            _ => Err(fidl::Error::UnknownOrdinal {
4176                ordinal: tx_header.ordinal,
4177                protocol_name:
4178                    <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4179            }),
4180        }
4181    }
4182}
4183
4184/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV4.
4185pub struct RouteTableV4RequestStream {
4186    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4187    is_terminated: bool,
4188}
4189
4190impl std::marker::Unpin for RouteTableV4RequestStream {}
4191
4192impl futures::stream::FusedStream for RouteTableV4RequestStream {
4193    fn is_terminated(&self) -> bool {
4194        self.is_terminated
4195    }
4196}
4197
4198impl fdomain_client::fidl::RequestStream for RouteTableV4RequestStream {
4199    type Protocol = RouteTableV4Marker;
4200    type ControlHandle = RouteTableV4ControlHandle;
4201
4202    fn from_channel(channel: fdomain_client::Channel) -> Self {
4203        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4204    }
4205
4206    fn control_handle(&self) -> Self::ControlHandle {
4207        RouteTableV4ControlHandle { inner: self.inner.clone() }
4208    }
4209
4210    fn into_inner(
4211        self,
4212    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4213    {
4214        (self.inner, self.is_terminated)
4215    }
4216
4217    fn from_inner(
4218        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4219        is_terminated: bool,
4220    ) -> Self {
4221        Self { inner, is_terminated }
4222    }
4223}
4224
4225impl futures::Stream for RouteTableV4RequestStream {
4226    type Item = Result<RouteTableV4Request, fidl::Error>;
4227
4228    fn poll_next(
4229        mut self: std::pin::Pin<&mut Self>,
4230        cx: &mut std::task::Context<'_>,
4231    ) -> std::task::Poll<Option<Self::Item>> {
4232        let this = &mut *self;
4233        if this.inner.check_shutdown(cx) {
4234            this.is_terminated = true;
4235            return std::task::Poll::Ready(None);
4236        }
4237        if this.is_terminated {
4238            panic!("polled RouteTableV4RequestStream after completion");
4239        }
4240        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4241            |bytes, handles| {
4242                match this.inner.channel().read_etc(cx, bytes, handles) {
4243                    std::task::Poll::Ready(Ok(())) => {}
4244                    std::task::Poll::Pending => return std::task::Poll::Pending,
4245                    std::task::Poll::Ready(Err(None)) => {
4246                        this.is_terminated = true;
4247                        return std::task::Poll::Ready(None);
4248                    }
4249                    std::task::Poll::Ready(Err(Some(e))) => {
4250                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4251                            e.into(),
4252                        ))));
4253                    }
4254                }
4255
4256                // A message has been received from the channel
4257                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4258
4259                std::task::Poll::Ready(Some(match header.ordinal {
4260                    0x7eab30c55edbfc15 => {
4261                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4262                        let mut req = fidl::new_empty!(
4263                            fidl::encoding::EmptyPayload,
4264                            fdomain_client::fidl::FDomainResourceDialect
4265                        );
4266                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4267                        let control_handle =
4268                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4269                        Ok(RouteTableV4Request::GetTableId {
4270                            responder: RouteTableV4GetTableIdResponder {
4271                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4272                                tx_id: header.tx_id,
4273                            },
4274                        })
4275                    }
4276                    0x2853ab157285b384 => {
4277                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4278                        let mut req = fidl::new_empty!(
4279                            fidl::encoding::EmptyPayload,
4280                            fdomain_client::fidl::FDomainResourceDialect
4281                        );
4282                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4283                        let control_handle =
4284                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4285                        Ok(RouteTableV4Request::Detach { control_handle })
4286                    }
4287                    0xc42e58a5fc79426 => {
4288                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4289                        let mut req = fidl::new_empty!(
4290                            fidl::encoding::EmptyPayload,
4291                            fdomain_client::fidl::FDomainResourceDialect
4292                        );
4293                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4294                        let control_handle =
4295                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4296                        Ok(RouteTableV4Request::Remove {
4297                            responder: RouteTableV4RemoveResponder {
4298                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4299                                tx_id: header.tx_id,
4300                            },
4301                        })
4302                    }
4303                    0x56a48c921ff3b6eb => {
4304                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4305                        let mut req = fidl::new_empty!(
4306                            fidl::encoding::EmptyPayload,
4307                            fdomain_client::fidl::FDomainResourceDialect
4308                        );
4309                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4310                        let control_handle =
4311                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4312                        Ok(RouteTableV4Request::GetAuthorizationForRouteTable {
4313                            responder: RouteTableV4GetAuthorizationForRouteTableResponder {
4314                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4315                                tx_id: header.tx_id,
4316                            },
4317                        })
4318                    }
4319                    0x6aeb6d05698abedb => {
4320                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4321                        let mut req = fidl::new_empty!(
4322                            RouteTableV4NewRouteSetRequest,
4323                            fdomain_client::fidl::FDomainResourceDialect
4324                        );
4325                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableV4NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
4326                        let control_handle =
4327                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4328                        Ok(RouteTableV4Request::NewRouteSet {
4329                            route_set: req.route_set,
4330
4331                            control_handle,
4332                        })
4333                    }
4334                    _ => Err(fidl::Error::UnknownOrdinal {
4335                        ordinal: header.ordinal,
4336                        protocol_name:
4337                            <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4338                    }),
4339                }))
4340            },
4341        )
4342    }
4343}
4344
4345/// Vends isolated administrative access to the system's IPv4 routing table.
4346///
4347/// A main route table is accessible through the discoverable [`RouteTableV4`]
4348/// protocol. Other tables can be installed using the `NewRouteTable` method
4349/// on [`RouteTableProviderV4`]. The [`RouteTableV4`] also encodes the lifetime
4350/// of the underlying route table, dropping the client end of the protocol
4351/// causes the underlying route table to be removed unless it is detached. The
4352/// main table is detached by default.
4353#[derive(Debug)]
4354pub enum RouteTableV4Request {
4355    /// Gets the table ID for this table.
4356    GetTableId { responder: RouteTableV4GetTableIdResponder },
4357    /// Detaches the lifetime of the route table from the lifetime of the
4358    /// client end of the channel.
4359    ///
4360    /// After this method is called, the route table will not be removed
4361    /// if the client end is closed. It's a no-op if called on the main table.
4362    Detach { control_handle: RouteTableV4ControlHandle },
4363    /// Removes the route table explicitly.
4364    ///
4365    /// This method cannot be called on the main table or an interface-local
4366    /// table, an error will be returned if called. The server will close the
4367    /// channel after this method successfully returns.
4368    Remove { responder: RouteTableV4RemoveResponder },
4369    /// Gets an authentication credential for this table.
4370    ///
4371    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4372    /// held by the server. This credential can be passed into
4373    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4374    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4375    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4376    /// transfer the `EVENT` to other clients.
4377    ///
4378    /// - response `credential` the authorization credential for this table.
4379    GetAuthorizationForRouteTable { responder: RouteTableV4GetAuthorizationForRouteTableResponder },
4380    /// Creates an empty route set.
4381    ///
4382    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4383    NewRouteSet {
4384        route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4385        control_handle: RouteTableV4ControlHandle,
4386    },
4387}
4388
4389impl RouteTableV4Request {
4390    #[allow(irrefutable_let_patterns)]
4391    pub fn into_get_table_id(self) -> Option<(RouteTableV4GetTableIdResponder)> {
4392        if let RouteTableV4Request::GetTableId { responder } = self {
4393            Some((responder))
4394        } else {
4395            None
4396        }
4397    }
4398
4399    #[allow(irrefutable_let_patterns)]
4400    pub fn into_detach(self) -> Option<(RouteTableV4ControlHandle)> {
4401        if let RouteTableV4Request::Detach { control_handle } = self {
4402            Some((control_handle))
4403        } else {
4404            None
4405        }
4406    }
4407
4408    #[allow(irrefutable_let_patterns)]
4409    pub fn into_remove(self) -> Option<(RouteTableV4RemoveResponder)> {
4410        if let RouteTableV4Request::Remove { responder } = self { Some((responder)) } else { None }
4411    }
4412
4413    #[allow(irrefutable_let_patterns)]
4414    pub fn into_get_authorization_for_route_table(
4415        self,
4416    ) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
4417        if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
4418            Some((responder))
4419        } else {
4420            None
4421        }
4422    }
4423
4424    #[allow(irrefutable_let_patterns)]
4425    pub fn into_new_route_set(
4426        self,
4427    ) -> Option<(fdomain_client::fidl::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)>
4428    {
4429        if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
4430            Some((route_set, control_handle))
4431        } else {
4432            None
4433        }
4434    }
4435
4436    /// Name of the method defined in FIDL
4437    pub fn method_name(&self) -> &'static str {
4438        match *self {
4439            RouteTableV4Request::GetTableId { .. } => "get_table_id",
4440            RouteTableV4Request::Detach { .. } => "detach",
4441            RouteTableV4Request::Remove { .. } => "remove",
4442            RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
4443                "get_authorization_for_route_table"
4444            }
4445            RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
4446        }
4447    }
4448}
4449
4450#[derive(Debug, Clone)]
4451pub struct RouteTableV4ControlHandle {
4452    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4453}
4454
4455impl fdomain_client::fidl::ControlHandle for RouteTableV4ControlHandle {
4456    fn shutdown(&self) {
4457        self.inner.shutdown()
4458    }
4459
4460    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4461        self.inner.shutdown_with_epitaph(status)
4462    }
4463
4464    fn is_closed(&self) -> bool {
4465        self.inner.channel().is_closed()
4466    }
4467    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4468        self.inner.channel().on_closed()
4469    }
4470}
4471
4472impl RouteTableV4ControlHandle {}
4473
4474#[must_use = "FIDL methods require a response to be sent"]
4475#[derive(Debug)]
4476pub struct RouteTableV4GetTableIdResponder {
4477    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4478    tx_id: u32,
4479}
4480
4481/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4482/// if the responder is dropped without sending a response, so that the client
4483/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4484impl std::ops::Drop for RouteTableV4GetTableIdResponder {
4485    fn drop(&mut self) {
4486        self.control_handle.shutdown();
4487        // Safety: drops once, never accessed again
4488        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4489    }
4490}
4491
4492impl fdomain_client::fidl::Responder for RouteTableV4GetTableIdResponder {
4493    type ControlHandle = RouteTableV4ControlHandle;
4494
4495    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4496        &self.control_handle
4497    }
4498
4499    fn drop_without_shutdown(mut self) {
4500        // Safety: drops once, never accessed again due to mem::forget
4501        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4502        // Prevent Drop from running (which would shut down the channel)
4503        std::mem::forget(self);
4504    }
4505}
4506
4507impl RouteTableV4GetTableIdResponder {
4508    /// Sends a response to the FIDL transaction.
4509    ///
4510    /// Sets the channel to shutdown if an error occurs.
4511    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
4512        let _result = self.send_raw(table_id);
4513        if _result.is_err() {
4514            self.control_handle.shutdown();
4515        }
4516        self.drop_without_shutdown();
4517        _result
4518    }
4519
4520    /// Similar to "send" but does not shutdown the channel if an error occurs.
4521    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
4522        let _result = self.send_raw(table_id);
4523        self.drop_without_shutdown();
4524        _result
4525    }
4526
4527    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
4528        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
4529            (table_id,),
4530            self.tx_id,
4531            0x7eab30c55edbfc15,
4532            fidl::encoding::DynamicFlags::empty(),
4533        )
4534    }
4535}
4536
4537#[must_use = "FIDL methods require a response to be sent"]
4538#[derive(Debug)]
4539pub struct RouteTableV4RemoveResponder {
4540    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4541    tx_id: u32,
4542}
4543
4544/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4545/// if the responder is dropped without sending a response, so that the client
4546/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4547impl std::ops::Drop for RouteTableV4RemoveResponder {
4548    fn drop(&mut self) {
4549        self.control_handle.shutdown();
4550        // Safety: drops once, never accessed again
4551        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4552    }
4553}
4554
4555impl fdomain_client::fidl::Responder for RouteTableV4RemoveResponder {
4556    type ControlHandle = RouteTableV4ControlHandle;
4557
4558    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4559        &self.control_handle
4560    }
4561
4562    fn drop_without_shutdown(mut self) {
4563        // Safety: drops once, never accessed again due to mem::forget
4564        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4565        // Prevent Drop from running (which would shut down the channel)
4566        std::mem::forget(self);
4567    }
4568}
4569
4570impl RouteTableV4RemoveResponder {
4571    /// Sends a response to the FIDL transaction.
4572    ///
4573    /// Sets the channel to shutdown if an error occurs.
4574    pub fn send(
4575        self,
4576        mut result: Result<(), BaseRouteTableRemoveError>,
4577    ) -> Result<(), fidl::Error> {
4578        let _result = self.send_raw(result);
4579        if _result.is_err() {
4580            self.control_handle.shutdown();
4581        }
4582        self.drop_without_shutdown();
4583        _result
4584    }
4585
4586    /// Similar to "send" but does not shutdown the channel if an error occurs.
4587    pub fn send_no_shutdown_on_err(
4588        self,
4589        mut result: Result<(), BaseRouteTableRemoveError>,
4590    ) -> Result<(), fidl::Error> {
4591        let _result = self.send_raw(result);
4592        self.drop_without_shutdown();
4593        _result
4594    }
4595
4596    fn send_raw(
4597        &self,
4598        mut result: Result<(), BaseRouteTableRemoveError>,
4599    ) -> Result<(), fidl::Error> {
4600        self.control_handle.inner.send::<fidl::encoding::ResultType<
4601            fidl::encoding::EmptyStruct,
4602            BaseRouteTableRemoveError,
4603        >>(
4604            result,
4605            self.tx_id,
4606            0xc42e58a5fc79426,
4607            fidl::encoding::DynamicFlags::empty(),
4608        )
4609    }
4610}
4611
4612#[must_use = "FIDL methods require a response to be sent"]
4613#[derive(Debug)]
4614pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
4615    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4616    tx_id: u32,
4617}
4618
4619/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4620/// if the responder is dropped without sending a response, so that the client
4621/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4622impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
4623    fn drop(&mut self) {
4624        self.control_handle.shutdown();
4625        // Safety: drops once, never accessed again
4626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4627    }
4628}
4629
4630impl fdomain_client::fidl::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
4631    type ControlHandle = RouteTableV4ControlHandle;
4632
4633    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4634        &self.control_handle
4635    }
4636
4637    fn drop_without_shutdown(mut self) {
4638        // Safety: drops once, never accessed again due to mem::forget
4639        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4640        // Prevent Drop from running (which would shut down the channel)
4641        std::mem::forget(self);
4642    }
4643}
4644
4645impl RouteTableV4GetAuthorizationForRouteTableResponder {
4646    /// Sends a response to the FIDL transaction.
4647    ///
4648    /// Sets the channel to shutdown if an error occurs.
4649    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
4650        let _result = self.send_raw(credential);
4651        if _result.is_err() {
4652            self.control_handle.shutdown();
4653        }
4654        self.drop_without_shutdown();
4655        _result
4656    }
4657
4658    /// Similar to "send" but does not shutdown the channel if an error occurs.
4659    pub fn send_no_shutdown_on_err(
4660        self,
4661        mut credential: GrantForRouteTableAuthorization,
4662    ) -> Result<(), fidl::Error> {
4663        let _result = self.send_raw(credential);
4664        self.drop_without_shutdown();
4665        _result
4666    }
4667
4668    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
4669        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
4670            (&mut credential,),
4671            self.tx_id,
4672            0x56a48c921ff3b6eb,
4673            fidl::encoding::DynamicFlags::empty(),
4674        )
4675    }
4676}
4677
4678#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4679pub struct RouteTableV6Marker;
4680
4681impl fdomain_client::fidl::ProtocolMarker for RouteTableV6Marker {
4682    type Proxy = RouteTableV6Proxy;
4683    type RequestStream = RouteTableV6RequestStream;
4684
4685    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
4686}
4687impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableV6Marker {}
4688
4689pub trait RouteTableV6ProxyInterface: Send + Sync {
4690    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
4691    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
4692    fn r#detach(&self) -> Result<(), fidl::Error>;
4693    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
4694        + Send;
4695    fn r#remove(&self) -> Self::RemoveResponseFut;
4696    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
4697        + Send;
4698    fn r#get_authorization_for_route_table(&self)
4699    -> Self::GetAuthorizationForRouteTableResponseFut;
4700    fn r#new_route_set(
4701        &self,
4702        route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4703    ) -> Result<(), fidl::Error>;
4704}
4705
4706#[derive(Debug, Clone)]
4707pub struct RouteTableV6Proxy {
4708    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
4709}
4710
4711impl fdomain_client::fidl::Proxy for RouteTableV6Proxy {
4712    type Protocol = RouteTableV6Marker;
4713
4714    fn from_channel(inner: fdomain_client::Channel) -> Self {
4715        Self::new(inner)
4716    }
4717
4718    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
4719        self.client.into_channel().map_err(|client| Self { client })
4720    }
4721
4722    fn as_channel(&self) -> &fdomain_client::Channel {
4723        self.client.as_channel()
4724    }
4725}
4726
4727impl RouteTableV6Proxy {
4728    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV6.
4729    pub fn new(channel: fdomain_client::Channel) -> Self {
4730        let protocol_name =
4731            <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4732        Self { client: fidl::client::Client::new(channel, protocol_name) }
4733    }
4734
4735    /// Get a Stream of events from the remote end of the protocol.
4736    ///
4737    /// # Panics
4738    ///
4739    /// Panics if the event stream was already taken.
4740    pub fn take_event_stream(&self) -> RouteTableV6EventStream {
4741        RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
4742    }
4743
4744    /// Gets the table ID for this table.
4745    pub fn r#get_table_id(
4746        &self,
4747    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
4748        RouteTableV6ProxyInterface::r#get_table_id(self)
4749    }
4750
4751    /// Detaches the lifetime of the route table from the lifetime of the
4752    /// client end of the channel.
4753    ///
4754    /// After this method is called, the route table will not be removed
4755    /// if the client end is closed. It's a no-op if called on the main table.
4756    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4757        RouteTableV6ProxyInterface::r#detach(self)
4758    }
4759
4760    /// Removes the route table explicitly.
4761    ///
4762    /// This method cannot be called on the main table or an interface-local
4763    /// table, an error will be returned if called. The server will close the
4764    /// channel after this method successfully returns.
4765    pub fn r#remove(
4766        &self,
4767    ) -> fidl::client::QueryResponseFut<
4768        BaseRouteTableRemoveResult,
4769        fdomain_client::fidl::FDomainResourceDialect,
4770    > {
4771        RouteTableV6ProxyInterface::r#remove(self)
4772    }
4773
4774    /// Gets an authentication credential for this table.
4775    ///
4776    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4777    /// held by the server. This credential can be passed into
4778    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4779    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4780    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4781    /// transfer the `EVENT` to other clients.
4782    ///
4783    /// - response `credential` the authorization credential for this table.
4784    pub fn r#get_authorization_for_route_table(
4785        &self,
4786    ) -> fidl::client::QueryResponseFut<
4787        GrantForRouteTableAuthorization,
4788        fdomain_client::fidl::FDomainResourceDialect,
4789    > {
4790        RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
4791    }
4792
4793    /// Creates an empty route set.
4794    ///
4795    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
4796    pub fn r#new_route_set(
4797        &self,
4798        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4799    ) -> Result<(), fidl::Error> {
4800        RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
4801    }
4802}
4803
4804impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
4805    type GetTableIdResponseFut =
4806        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
4807    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
4808        fn _decode(
4809            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4810        ) -> Result<u32, fidl::Error> {
4811            let _response = fidl::client::decode_transaction_body::<
4812                BaseRouteTableGetTableIdResponse,
4813                fdomain_client::fidl::FDomainResourceDialect,
4814                0x7eab30c55edbfc15,
4815            >(_buf?)?;
4816            Ok(_response.table_id)
4817        }
4818        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
4819            (),
4820            0x7eab30c55edbfc15,
4821            fidl::encoding::DynamicFlags::empty(),
4822            _decode,
4823        )
4824    }
4825
4826    fn r#detach(&self) -> Result<(), fidl::Error> {
4827        self.client.send::<fidl::encoding::EmptyPayload>(
4828            (),
4829            0x2853ab157285b384,
4830            fidl::encoding::DynamicFlags::empty(),
4831        )
4832    }
4833
4834    type RemoveResponseFut = fidl::client::QueryResponseFut<
4835        BaseRouteTableRemoveResult,
4836        fdomain_client::fidl::FDomainResourceDialect,
4837    >;
4838    fn r#remove(&self) -> Self::RemoveResponseFut {
4839        fn _decode(
4840            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4841        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4842            let _response = fidl::client::decode_transaction_body::<
4843                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
4844                fdomain_client::fidl::FDomainResourceDialect,
4845                0xc42e58a5fc79426,
4846            >(_buf?)?;
4847            Ok(_response.map(|x| x))
4848        }
4849        self.client
4850            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
4851                (),
4852                0xc42e58a5fc79426,
4853                fidl::encoding::DynamicFlags::empty(),
4854                _decode,
4855            )
4856    }
4857
4858    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
4859        GrantForRouteTableAuthorization,
4860        fdomain_client::fidl::FDomainResourceDialect,
4861    >;
4862    fn r#get_authorization_for_route_table(
4863        &self,
4864    ) -> Self::GetAuthorizationForRouteTableResponseFut {
4865        fn _decode(
4866            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4867        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4868            let _response = fidl::client::decode_transaction_body::<
4869                BaseRouteTableGetAuthorizationForRouteTableResponse,
4870                fdomain_client::fidl::FDomainResourceDialect,
4871                0x56a48c921ff3b6eb,
4872            >(_buf?)?;
4873            Ok(_response.credential)
4874        }
4875        self.client
4876            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
4877                (),
4878                0x56a48c921ff3b6eb,
4879                fidl::encoding::DynamicFlags::empty(),
4880                _decode,
4881            )
4882    }
4883
4884    fn r#new_route_set(
4885        &self,
4886        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4887    ) -> Result<(), fidl::Error> {
4888        self.client.send::<RouteTableV6NewRouteSetRequest>(
4889            (route_set,),
4890            0x479aeaf9ad470141,
4891            fidl::encoding::DynamicFlags::empty(),
4892        )
4893    }
4894}
4895
4896pub struct RouteTableV6EventStream {
4897    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4898}
4899
4900impl std::marker::Unpin for RouteTableV6EventStream {}
4901
4902impl futures::stream::FusedStream for RouteTableV6EventStream {
4903    fn is_terminated(&self) -> bool {
4904        self.event_receiver.is_terminated()
4905    }
4906}
4907
4908impl futures::Stream for RouteTableV6EventStream {
4909    type Item = Result<RouteTableV6Event, fidl::Error>;
4910
4911    fn poll_next(
4912        mut self: std::pin::Pin<&mut Self>,
4913        cx: &mut std::task::Context<'_>,
4914    ) -> std::task::Poll<Option<Self::Item>> {
4915        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4916            &mut self.event_receiver,
4917            cx
4918        )?) {
4919            Some(buf) => std::task::Poll::Ready(Some(RouteTableV6Event::decode(buf))),
4920            None => std::task::Poll::Ready(None),
4921        }
4922    }
4923}
4924
4925#[derive(Debug)]
4926pub enum RouteTableV6Event {}
4927
4928impl RouteTableV6Event {
4929    /// Decodes a message buffer as a [`RouteTableV6Event`].
4930    fn decode(
4931        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4932    ) -> Result<RouteTableV6Event, fidl::Error> {
4933        let (bytes, _handles) = buf.split_mut();
4934        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4935        debug_assert_eq!(tx_header.tx_id, 0);
4936        match tx_header.ordinal {
4937            _ => Err(fidl::Error::UnknownOrdinal {
4938                ordinal: tx_header.ordinal,
4939                protocol_name:
4940                    <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4941            }),
4942        }
4943    }
4944}
4945
4946/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV6.
4947pub struct RouteTableV6RequestStream {
4948    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4949    is_terminated: bool,
4950}
4951
4952impl std::marker::Unpin for RouteTableV6RequestStream {}
4953
4954impl futures::stream::FusedStream for RouteTableV6RequestStream {
4955    fn is_terminated(&self) -> bool {
4956        self.is_terminated
4957    }
4958}
4959
4960impl fdomain_client::fidl::RequestStream for RouteTableV6RequestStream {
4961    type Protocol = RouteTableV6Marker;
4962    type ControlHandle = RouteTableV6ControlHandle;
4963
4964    fn from_channel(channel: fdomain_client::Channel) -> Self {
4965        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4966    }
4967
4968    fn control_handle(&self) -> Self::ControlHandle {
4969        RouteTableV6ControlHandle { inner: self.inner.clone() }
4970    }
4971
4972    fn into_inner(
4973        self,
4974    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4975    {
4976        (self.inner, self.is_terminated)
4977    }
4978
4979    fn from_inner(
4980        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4981        is_terminated: bool,
4982    ) -> Self {
4983        Self { inner, is_terminated }
4984    }
4985}
4986
4987impl futures::Stream for RouteTableV6RequestStream {
4988    type Item = Result<RouteTableV6Request, fidl::Error>;
4989
4990    fn poll_next(
4991        mut self: std::pin::Pin<&mut Self>,
4992        cx: &mut std::task::Context<'_>,
4993    ) -> std::task::Poll<Option<Self::Item>> {
4994        let this = &mut *self;
4995        if this.inner.check_shutdown(cx) {
4996            this.is_terminated = true;
4997            return std::task::Poll::Ready(None);
4998        }
4999        if this.is_terminated {
5000            panic!("polled RouteTableV6RequestStream after completion");
5001        }
5002        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5003            |bytes, handles| {
5004                match this.inner.channel().read_etc(cx, bytes, handles) {
5005                    std::task::Poll::Ready(Ok(())) => {}
5006                    std::task::Poll::Pending => return std::task::Poll::Pending,
5007                    std::task::Poll::Ready(Err(None)) => {
5008                        this.is_terminated = true;
5009                        return std::task::Poll::Ready(None);
5010                    }
5011                    std::task::Poll::Ready(Err(Some(e))) => {
5012                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5013                            e.into(),
5014                        ))));
5015                    }
5016                }
5017
5018                // A message has been received from the channel
5019                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5020
5021                std::task::Poll::Ready(Some(match header.ordinal {
5022                    0x7eab30c55edbfc15 => {
5023                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5024                        let mut req = fidl::new_empty!(
5025                            fidl::encoding::EmptyPayload,
5026                            fdomain_client::fidl::FDomainResourceDialect
5027                        );
5028                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5029                        let control_handle =
5030                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5031                        Ok(RouteTableV6Request::GetTableId {
5032                            responder: RouteTableV6GetTableIdResponder {
5033                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5034                                tx_id: header.tx_id,
5035                            },
5036                        })
5037                    }
5038                    0x2853ab157285b384 => {
5039                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5040                        let mut req = fidl::new_empty!(
5041                            fidl::encoding::EmptyPayload,
5042                            fdomain_client::fidl::FDomainResourceDialect
5043                        );
5044                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5045                        let control_handle =
5046                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5047                        Ok(RouteTableV6Request::Detach { control_handle })
5048                    }
5049                    0xc42e58a5fc79426 => {
5050                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5051                        let mut req = fidl::new_empty!(
5052                            fidl::encoding::EmptyPayload,
5053                            fdomain_client::fidl::FDomainResourceDialect
5054                        );
5055                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5056                        let control_handle =
5057                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5058                        Ok(RouteTableV6Request::Remove {
5059                            responder: RouteTableV6RemoveResponder {
5060                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5061                                tx_id: header.tx_id,
5062                            },
5063                        })
5064                    }
5065                    0x56a48c921ff3b6eb => {
5066                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5067                        let mut req = fidl::new_empty!(
5068                            fidl::encoding::EmptyPayload,
5069                            fdomain_client::fidl::FDomainResourceDialect
5070                        );
5071                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5072                        let control_handle =
5073                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5074                        Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
5075                            responder: RouteTableV6GetAuthorizationForRouteTableResponder {
5076                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5077                                tx_id: header.tx_id,
5078                            },
5079                        })
5080                    }
5081                    0x479aeaf9ad470141 => {
5082                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5083                        let mut req = fidl::new_empty!(
5084                            RouteTableV6NewRouteSetRequest,
5085                            fdomain_client::fidl::FDomainResourceDialect
5086                        );
5087                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableV6NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
5088                        let control_handle =
5089                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5090                        Ok(RouteTableV6Request::NewRouteSet {
5091                            route_set: req.route_set,
5092
5093                            control_handle,
5094                        })
5095                    }
5096                    _ => Err(fidl::Error::UnknownOrdinal {
5097                        ordinal: header.ordinal,
5098                        protocol_name:
5099                            <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5100                    }),
5101                }))
5102            },
5103        )
5104    }
5105}
5106
5107/// Vends isolated administrative access to the system's IPv6 routing table.
5108///
5109/// A main route table is accessible through the discoverable [`RouteTableV6`]
5110/// protocol. Other tables can be installed using the `NewRouteTable` method
5111/// on [`RouteTableProviderV6`]. The [`RouteTableV6`] also encodes the lifetime
5112/// of the underlying route table, dropping the client end of the protocol
5113/// causes the underlying route table to be removed unless it is detached. The
5114/// main table is detached by default.
5115#[derive(Debug)]
5116pub enum RouteTableV6Request {
5117    /// Gets the table ID for this table.
5118    GetTableId { responder: RouteTableV6GetTableIdResponder },
5119    /// Detaches the lifetime of the route table from the lifetime of the
5120    /// client end of the channel.
5121    ///
5122    /// After this method is called, the route table will not be removed
5123    /// if the client end is closed. It's a no-op if called on the main table.
5124    Detach { control_handle: RouteTableV6ControlHandle },
5125    /// Removes the route table explicitly.
5126    ///
5127    /// This method cannot be called on the main table or an interface-local
5128    /// table, an error will be returned if called. The server will close the
5129    /// channel after this method successfully returns.
5130    Remove { responder: RouteTableV6RemoveResponder },
5131    /// Gets an authentication credential for this table.
5132    ///
5133    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5134    /// held by the server. This credential can be passed into
5135    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5136    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5137    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5138    /// transfer the `EVENT` to other clients.
5139    ///
5140    /// - response `credential` the authorization credential for this table.
5141    GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
5142    /// Creates an empty route set.
5143    ///
5144    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5145    NewRouteSet {
5146        route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
5147        control_handle: RouteTableV6ControlHandle,
5148    },
5149}
5150
5151impl RouteTableV6Request {
5152    #[allow(irrefutable_let_patterns)]
5153    pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
5154        if let RouteTableV6Request::GetTableId { responder } = self {
5155            Some((responder))
5156        } else {
5157            None
5158        }
5159    }
5160
5161    #[allow(irrefutable_let_patterns)]
5162    pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
5163        if let RouteTableV6Request::Detach { control_handle } = self {
5164            Some((control_handle))
5165        } else {
5166            None
5167        }
5168    }
5169
5170    #[allow(irrefutable_let_patterns)]
5171    pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
5172        if let RouteTableV6Request::Remove { responder } = self { Some((responder)) } else { None }
5173    }
5174
5175    #[allow(irrefutable_let_patterns)]
5176    pub fn into_get_authorization_for_route_table(
5177        self,
5178    ) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
5179        if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
5180            Some((responder))
5181        } else {
5182            None
5183        }
5184    }
5185
5186    #[allow(irrefutable_let_patterns)]
5187    pub fn into_new_route_set(
5188        self,
5189    ) -> Option<(fdomain_client::fidl::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)>
5190    {
5191        if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
5192            Some((route_set, control_handle))
5193        } else {
5194            None
5195        }
5196    }
5197
5198    /// Name of the method defined in FIDL
5199    pub fn method_name(&self) -> &'static str {
5200        match *self {
5201            RouteTableV6Request::GetTableId { .. } => "get_table_id",
5202            RouteTableV6Request::Detach { .. } => "detach",
5203            RouteTableV6Request::Remove { .. } => "remove",
5204            RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
5205                "get_authorization_for_route_table"
5206            }
5207            RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
5208        }
5209    }
5210}
5211
5212#[derive(Debug, Clone)]
5213pub struct RouteTableV6ControlHandle {
5214    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5215}
5216
5217impl fdomain_client::fidl::ControlHandle for RouteTableV6ControlHandle {
5218    fn shutdown(&self) {
5219        self.inner.shutdown()
5220    }
5221
5222    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5223        self.inner.shutdown_with_epitaph(status)
5224    }
5225
5226    fn is_closed(&self) -> bool {
5227        self.inner.channel().is_closed()
5228    }
5229    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5230        self.inner.channel().on_closed()
5231    }
5232}
5233
5234impl RouteTableV6ControlHandle {}
5235
5236#[must_use = "FIDL methods require a response to be sent"]
5237#[derive(Debug)]
5238pub struct RouteTableV6GetTableIdResponder {
5239    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5240    tx_id: u32,
5241}
5242
5243/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5244/// if the responder is dropped without sending a response, so that the client
5245/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5246impl std::ops::Drop for RouteTableV6GetTableIdResponder {
5247    fn drop(&mut self) {
5248        self.control_handle.shutdown();
5249        // Safety: drops once, never accessed again
5250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5251    }
5252}
5253
5254impl fdomain_client::fidl::Responder for RouteTableV6GetTableIdResponder {
5255    type ControlHandle = RouteTableV6ControlHandle;
5256
5257    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5258        &self.control_handle
5259    }
5260
5261    fn drop_without_shutdown(mut self) {
5262        // Safety: drops once, never accessed again due to mem::forget
5263        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5264        // Prevent Drop from running (which would shut down the channel)
5265        std::mem::forget(self);
5266    }
5267}
5268
5269impl RouteTableV6GetTableIdResponder {
5270    /// Sends a response to the FIDL transaction.
5271    ///
5272    /// Sets the channel to shutdown if an error occurs.
5273    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
5274        let _result = self.send_raw(table_id);
5275        if _result.is_err() {
5276            self.control_handle.shutdown();
5277        }
5278        self.drop_without_shutdown();
5279        _result
5280    }
5281
5282    /// Similar to "send" but does not shutdown the channel if an error occurs.
5283    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
5284        let _result = self.send_raw(table_id);
5285        self.drop_without_shutdown();
5286        _result
5287    }
5288
5289    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
5290        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
5291            (table_id,),
5292            self.tx_id,
5293            0x7eab30c55edbfc15,
5294            fidl::encoding::DynamicFlags::empty(),
5295        )
5296    }
5297}
5298
5299#[must_use = "FIDL methods require a response to be sent"]
5300#[derive(Debug)]
5301pub struct RouteTableV6RemoveResponder {
5302    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5303    tx_id: u32,
5304}
5305
5306/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5307/// if the responder is dropped without sending a response, so that the client
5308/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5309impl std::ops::Drop for RouteTableV6RemoveResponder {
5310    fn drop(&mut self) {
5311        self.control_handle.shutdown();
5312        // Safety: drops once, never accessed again
5313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5314    }
5315}
5316
5317impl fdomain_client::fidl::Responder for RouteTableV6RemoveResponder {
5318    type ControlHandle = RouteTableV6ControlHandle;
5319
5320    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5321        &self.control_handle
5322    }
5323
5324    fn drop_without_shutdown(mut self) {
5325        // Safety: drops once, never accessed again due to mem::forget
5326        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5327        // Prevent Drop from running (which would shut down the channel)
5328        std::mem::forget(self);
5329    }
5330}
5331
5332impl RouteTableV6RemoveResponder {
5333    /// Sends a response to the FIDL transaction.
5334    ///
5335    /// Sets the channel to shutdown if an error occurs.
5336    pub fn send(
5337        self,
5338        mut result: Result<(), BaseRouteTableRemoveError>,
5339    ) -> Result<(), fidl::Error> {
5340        let _result = self.send_raw(result);
5341        if _result.is_err() {
5342            self.control_handle.shutdown();
5343        }
5344        self.drop_without_shutdown();
5345        _result
5346    }
5347
5348    /// Similar to "send" but does not shutdown the channel if an error occurs.
5349    pub fn send_no_shutdown_on_err(
5350        self,
5351        mut result: Result<(), BaseRouteTableRemoveError>,
5352    ) -> Result<(), fidl::Error> {
5353        let _result = self.send_raw(result);
5354        self.drop_without_shutdown();
5355        _result
5356    }
5357
5358    fn send_raw(
5359        &self,
5360        mut result: Result<(), BaseRouteTableRemoveError>,
5361    ) -> Result<(), fidl::Error> {
5362        self.control_handle.inner.send::<fidl::encoding::ResultType<
5363            fidl::encoding::EmptyStruct,
5364            BaseRouteTableRemoveError,
5365        >>(
5366            result,
5367            self.tx_id,
5368            0xc42e58a5fc79426,
5369            fidl::encoding::DynamicFlags::empty(),
5370        )
5371    }
5372}
5373
5374#[must_use = "FIDL methods require a response to be sent"]
5375#[derive(Debug)]
5376pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
5377    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5378    tx_id: u32,
5379}
5380
5381/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5382/// if the responder is dropped without sending a response, so that the client
5383/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5384impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
5385    fn drop(&mut self) {
5386        self.control_handle.shutdown();
5387        // Safety: drops once, never accessed again
5388        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5389    }
5390}
5391
5392impl fdomain_client::fidl::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
5393    type ControlHandle = RouteTableV6ControlHandle;
5394
5395    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5396        &self.control_handle
5397    }
5398
5399    fn drop_without_shutdown(mut self) {
5400        // Safety: drops once, never accessed again due to mem::forget
5401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5402        // Prevent Drop from running (which would shut down the channel)
5403        std::mem::forget(self);
5404    }
5405}
5406
5407impl RouteTableV6GetAuthorizationForRouteTableResponder {
5408    /// Sends a response to the FIDL transaction.
5409    ///
5410    /// Sets the channel to shutdown if an error occurs.
5411    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5412        let _result = self.send_raw(credential);
5413        if _result.is_err() {
5414            self.control_handle.shutdown();
5415        }
5416        self.drop_without_shutdown();
5417        _result
5418    }
5419
5420    /// Similar to "send" but does not shutdown the channel if an error occurs.
5421    pub fn send_no_shutdown_on_err(
5422        self,
5423        mut credential: GrantForRouteTableAuthorization,
5424    ) -> Result<(), fidl::Error> {
5425        let _result = self.send_raw(credential);
5426        self.drop_without_shutdown();
5427        _result
5428    }
5429
5430    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5431        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
5432            (&mut credential,),
5433            self.tx_id,
5434            0x56a48c921ff3b6eb,
5435            fidl::encoding::DynamicFlags::empty(),
5436        )
5437    }
5438}
5439
5440#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5441pub struct RuleSetV4Marker;
5442
5443impl fdomain_client::fidl::ProtocolMarker for RuleSetV4Marker {
5444    type Proxy = RuleSetV4Proxy;
5445    type RequestStream = RuleSetV4RequestStream;
5446
5447    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
5448}
5449pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
5450
5451pub trait RuleSetV4ProxyInterface: Send + Sync {
5452    type AuthenticateForRouteTableResponseFut: std::future::Future<
5453            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
5454        > + Send;
5455    fn r#authenticate_for_route_table(
5456        &self,
5457        table: u32,
5458        token: fdomain_client::Event,
5459    ) -> Self::AuthenticateForRouteTableResponseFut;
5460    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
5461        + Send;
5462    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
5463    fn r#close(&self) -> Result<(), fidl::Error>;
5464    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
5465        + Send;
5466    fn r#add_rule(
5467        &self,
5468        index: u32,
5469        matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5470        action: &fdomain_fuchsia_net_routes::RuleAction,
5471    ) -> Self::AddRuleResponseFut;
5472}
5473
5474#[derive(Debug, Clone)]
5475pub struct RuleSetV4Proxy {
5476    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5477}
5478
5479impl fdomain_client::fidl::Proxy for RuleSetV4Proxy {
5480    type Protocol = RuleSetV4Marker;
5481
5482    fn from_channel(inner: fdomain_client::Channel) -> Self {
5483        Self::new(inner)
5484    }
5485
5486    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5487        self.client.into_channel().map_err(|client| Self { client })
5488    }
5489
5490    fn as_channel(&self) -> &fdomain_client::Channel {
5491        self.client.as_channel()
5492    }
5493}
5494
5495impl RuleSetV4Proxy {
5496    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV4.
5497    pub fn new(channel: fdomain_client::Channel) -> Self {
5498        let protocol_name = <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5499        Self { client: fidl::client::Client::new(channel, protocol_name) }
5500    }
5501
5502    /// Get a Stream of events from the remote end of the protocol.
5503    ///
5504    /// # Panics
5505    ///
5506    /// Panics if the event stream was already taken.
5507    pub fn take_event_stream(&self) -> RuleSetV4EventStream {
5508        RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
5509    }
5510
5511    /// Authenticates for a route table that will be used in an action.
5512    pub fn r#authenticate_for_route_table(
5513        &self,
5514        mut table: u32,
5515        mut token: fdomain_client::Event,
5516    ) -> fidl::client::QueryResponseFut<
5517        BaseRuleSetAuthenticateForRouteTableResult,
5518        fdomain_client::fidl::FDomainResourceDialect,
5519    > {
5520        RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
5521    }
5522
5523    /// Removes a rule from this rule set.
5524    ///
5525    /// If the client tries to remove from an index that does not have a rule,
5526    /// the error `RULE_DOES_NOT_EXIST` will be returned.
5527    ///
5528    /// + request `index` the index of the rule.
5529    pub fn r#remove_rule(
5530        &self,
5531        mut index: u32,
5532    ) -> fidl::client::QueryResponseFut<
5533        BaseRuleSetRemoveRuleResult,
5534        fdomain_client::fidl::FDomainResourceDialect,
5535    > {
5536        RuleSetV4ProxyInterface::r#remove_rule(self, index)
5537    }
5538
5539    /// Removes all rules in the rule set and the underlying channel will be
5540    /// closed after the rules are removed.
5541    ///
5542    /// This method provides a way for synchronous closure.
5543    pub fn r#close(&self) -> Result<(), fidl::Error> {
5544        RuleSetV4ProxyInterface::r#close(self)
5545    }
5546
5547    /// Adds a rule to this rule set.
5548    ///
5549    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
5550    /// is returned.
5551    ///
5552    /// + request `index` where to insert the rule.
5553    /// + request `matcher` the matcher of the rule.
5554    /// + request `action` action of the rule.
5555    pub fn r#add_rule(
5556        &self,
5557        mut index: u32,
5558        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5559        mut action: &fdomain_fuchsia_net_routes::RuleAction,
5560    ) -> fidl::client::QueryResponseFut<
5561        RuleSetV4AddRuleResult,
5562        fdomain_client::fidl::FDomainResourceDialect,
5563    > {
5564        RuleSetV4ProxyInterface::r#add_rule(self, index, matcher, action)
5565    }
5566}
5567
5568impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
5569    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
5570        BaseRuleSetAuthenticateForRouteTableResult,
5571        fdomain_client::fidl::FDomainResourceDialect,
5572    >;
5573    fn r#authenticate_for_route_table(
5574        &self,
5575        mut table: u32,
5576        mut token: fdomain_client::Event,
5577    ) -> Self::AuthenticateForRouteTableResponseFut {
5578        fn _decode(
5579            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5580        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
5581            let _response = fidl::client::decode_transaction_body::<
5582                fidl::encoding::ResultType<
5583                    fidl::encoding::EmptyStruct,
5584                    AuthenticateForRouteTableError,
5585                >,
5586                fdomain_client::fidl::FDomainResourceDialect,
5587                0x6fd845360ed9bc8f,
5588            >(_buf?)?;
5589            Ok(_response.map(|x| x))
5590        }
5591        self.client.send_query_and_decode::<
5592            ProofOfRouteTableAuthorization,
5593            BaseRuleSetAuthenticateForRouteTableResult,
5594        >(
5595            (table, token,),
5596            0x6fd845360ed9bc8f,
5597            fidl::encoding::DynamicFlags::empty(),
5598            _decode,
5599        )
5600    }
5601
5602    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
5603        BaseRuleSetRemoveRuleResult,
5604        fdomain_client::fidl::FDomainResourceDialect,
5605    >;
5606    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
5607        fn _decode(
5608            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5609        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
5610            let _response = fidl::client::decode_transaction_body::<
5611                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
5612                fdomain_client::fidl::FDomainResourceDialect,
5613                0x2ae3d7e817cbff90,
5614            >(_buf?)?;
5615            Ok(_response.map(|x| x))
5616        }
5617        self.client
5618            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
5619                (index,),
5620                0x2ae3d7e817cbff90,
5621                fidl::encoding::DynamicFlags::empty(),
5622                _decode,
5623            )
5624    }
5625
5626    fn r#close(&self) -> Result<(), fidl::Error> {
5627        self.client.send::<fidl::encoding::EmptyPayload>(
5628            (),
5629            0x457e1753672d4073,
5630            fidl::encoding::DynamicFlags::empty(),
5631        )
5632    }
5633
5634    type AddRuleResponseFut = fidl::client::QueryResponseFut<
5635        RuleSetV4AddRuleResult,
5636        fdomain_client::fidl::FDomainResourceDialect,
5637    >;
5638    fn r#add_rule(
5639        &self,
5640        mut index: u32,
5641        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5642        mut action: &fdomain_fuchsia_net_routes::RuleAction,
5643    ) -> Self::AddRuleResponseFut {
5644        fn _decode(
5645            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5646        ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
5647            let _response = fidl::client::decode_transaction_body::<
5648                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
5649                fdomain_client::fidl::FDomainResourceDialect,
5650                0x7f68325de94e80,
5651            >(_buf?)?;
5652            Ok(_response.map(|x| x))
5653        }
5654        self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
5655            (index, matcher, action),
5656            0x7f68325de94e80,
5657            fidl::encoding::DynamicFlags::empty(),
5658            _decode,
5659        )
5660    }
5661}
5662
5663pub struct RuleSetV4EventStream {
5664    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5665}
5666
5667impl std::marker::Unpin for RuleSetV4EventStream {}
5668
5669impl futures::stream::FusedStream for RuleSetV4EventStream {
5670    fn is_terminated(&self) -> bool {
5671        self.event_receiver.is_terminated()
5672    }
5673}
5674
5675impl futures::Stream for RuleSetV4EventStream {
5676    type Item = Result<RuleSetV4Event, fidl::Error>;
5677
5678    fn poll_next(
5679        mut self: std::pin::Pin<&mut Self>,
5680        cx: &mut std::task::Context<'_>,
5681    ) -> std::task::Poll<Option<Self::Item>> {
5682        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5683            &mut self.event_receiver,
5684            cx
5685        )?) {
5686            Some(buf) => std::task::Poll::Ready(Some(RuleSetV4Event::decode(buf))),
5687            None => std::task::Poll::Ready(None),
5688        }
5689    }
5690}
5691
5692#[derive(Debug)]
5693pub enum RuleSetV4Event {}
5694
5695impl RuleSetV4Event {
5696    /// Decodes a message buffer as a [`RuleSetV4Event`].
5697    fn decode(
5698        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5699    ) -> Result<RuleSetV4Event, fidl::Error> {
5700        let (bytes, _handles) = buf.split_mut();
5701        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5702        debug_assert_eq!(tx_header.tx_id, 0);
5703        match tx_header.ordinal {
5704            _ => Err(fidl::Error::UnknownOrdinal {
5705                ordinal: tx_header.ordinal,
5706                protocol_name:
5707                    <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5708            }),
5709        }
5710    }
5711}
5712
5713/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV4.
5714pub struct RuleSetV4RequestStream {
5715    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5716    is_terminated: bool,
5717}
5718
5719impl std::marker::Unpin for RuleSetV4RequestStream {}
5720
5721impl futures::stream::FusedStream for RuleSetV4RequestStream {
5722    fn is_terminated(&self) -> bool {
5723        self.is_terminated
5724    }
5725}
5726
5727impl fdomain_client::fidl::RequestStream for RuleSetV4RequestStream {
5728    type Protocol = RuleSetV4Marker;
5729    type ControlHandle = RuleSetV4ControlHandle;
5730
5731    fn from_channel(channel: fdomain_client::Channel) -> Self {
5732        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5733    }
5734
5735    fn control_handle(&self) -> Self::ControlHandle {
5736        RuleSetV4ControlHandle { inner: self.inner.clone() }
5737    }
5738
5739    fn into_inner(
5740        self,
5741    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5742    {
5743        (self.inner, self.is_terminated)
5744    }
5745
5746    fn from_inner(
5747        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5748        is_terminated: bool,
5749    ) -> Self {
5750        Self { inner, is_terminated }
5751    }
5752}
5753
5754impl futures::Stream for RuleSetV4RequestStream {
5755    type Item = Result<RuleSetV4Request, fidl::Error>;
5756
5757    fn poll_next(
5758        mut self: std::pin::Pin<&mut Self>,
5759        cx: &mut std::task::Context<'_>,
5760    ) -> std::task::Poll<Option<Self::Item>> {
5761        let this = &mut *self;
5762        if this.inner.check_shutdown(cx) {
5763            this.is_terminated = true;
5764            return std::task::Poll::Ready(None);
5765        }
5766        if this.is_terminated {
5767            panic!("polled RuleSetV4RequestStream after completion");
5768        }
5769        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5770            |bytes, handles| {
5771                match this.inner.channel().read_etc(cx, bytes, handles) {
5772                    std::task::Poll::Ready(Ok(())) => {}
5773                    std::task::Poll::Pending => return std::task::Poll::Pending,
5774                    std::task::Poll::Ready(Err(None)) => {
5775                        this.is_terminated = true;
5776                        return std::task::Poll::Ready(None);
5777                    }
5778                    std::task::Poll::Ready(Err(Some(e))) => {
5779                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5780                            e.into(),
5781                        ))));
5782                    }
5783                }
5784
5785                // A message has been received from the channel
5786                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5787
5788                std::task::Poll::Ready(Some(match header.ordinal {
5789                    0x6fd845360ed9bc8f => {
5790                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5791                        let mut req = fidl::new_empty!(
5792                            ProofOfRouteTableAuthorization,
5793                            fdomain_client::fidl::FDomainResourceDialect
5794                        );
5795                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
5796                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5797                        Ok(RuleSetV4Request::AuthenticateForRouteTable {
5798                            table: req.table,
5799                            token: req.token,
5800
5801                            responder: RuleSetV4AuthenticateForRouteTableResponder {
5802                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5803                                tx_id: header.tx_id,
5804                            },
5805                        })
5806                    }
5807                    0x2ae3d7e817cbff90 => {
5808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5809                        let mut req = fidl::new_empty!(
5810                            BaseRuleSetRemoveRuleRequest,
5811                            fdomain_client::fidl::FDomainResourceDialect
5812                        );
5813                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
5814                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5815                        Ok(RuleSetV4Request::RemoveRule {
5816                            index: req.index,
5817
5818                            responder: RuleSetV4RemoveRuleResponder {
5819                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5820                                tx_id: header.tx_id,
5821                            },
5822                        })
5823                    }
5824                    0x457e1753672d4073 => {
5825                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5826                        let mut req = fidl::new_empty!(
5827                            fidl::encoding::EmptyPayload,
5828                            fdomain_client::fidl::FDomainResourceDialect
5829                        );
5830                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5831                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5832                        Ok(RuleSetV4Request::Close { control_handle })
5833                    }
5834                    0x7f68325de94e80 => {
5835                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5836                        let mut req = fidl::new_empty!(
5837                            RuleSetV4AddRuleRequest,
5838                            fdomain_client::fidl::FDomainResourceDialect
5839                        );
5840                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleSetV4AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
5841                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5842                        Ok(RuleSetV4Request::AddRule {
5843                            index: req.index,
5844                            matcher: req.matcher,
5845                            action: req.action,
5846
5847                            responder: RuleSetV4AddRuleResponder {
5848                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5849                                tx_id: header.tx_id,
5850                            },
5851                        })
5852                    }
5853                    _ => Err(fidl::Error::UnknownOrdinal {
5854                        ordinal: header.ordinal,
5855                        protocol_name:
5856                            <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5857                    }),
5858                }))
5859            },
5860        )
5861    }
5862}
5863
5864/// Provides mutable access over a set of the system's IPv4 route rules.
5865///
5866/// A `RuleSet` has a priority and a rule has an index. A global order among the
5867/// rules is determined first by the priority of the `RuleSet` the rule belongs
5868/// to, and then the index of the rule inside the `RuleSet`.
5869///
5870/// This protocol encodes the lifetime of the rule set. Closing the client end
5871/// removes the rule set, and all the rules that are owned by the rule set.
5872#[derive(Debug)]
5873pub enum RuleSetV4Request {
5874    /// Authenticates for a route table that will be used in an action.
5875    AuthenticateForRouteTable {
5876        table: u32,
5877        token: fdomain_client::Event,
5878        responder: RuleSetV4AuthenticateForRouteTableResponder,
5879    },
5880    /// Removes a rule from this rule set.
5881    ///
5882    /// If the client tries to remove from an index that does not have a rule,
5883    /// the error `RULE_DOES_NOT_EXIST` will be returned.
5884    ///
5885    /// + request `index` the index of the rule.
5886    RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
5887    /// Removes all rules in the rule set and the underlying channel will be
5888    /// closed after the rules are removed.
5889    ///
5890    /// This method provides a way for synchronous closure.
5891    Close { control_handle: RuleSetV4ControlHandle },
5892    /// Adds a rule to this rule set.
5893    ///
5894    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
5895    /// is returned.
5896    ///
5897    /// + request `index` where to insert the rule.
5898    /// + request `matcher` the matcher of the rule.
5899    /// + request `action` action of the rule.
5900    AddRule {
5901        index: u32,
5902        matcher: fdomain_fuchsia_net_routes::RuleMatcherV4,
5903        action: fdomain_fuchsia_net_routes::RuleAction,
5904        responder: RuleSetV4AddRuleResponder,
5905    },
5906}
5907
5908impl RuleSetV4Request {
5909    #[allow(irrefutable_let_patterns)]
5910    pub fn into_authenticate_for_route_table(
5911        self,
5912    ) -> Option<(u32, fdomain_client::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
5913        if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
5914            Some((table, token, responder))
5915        } else {
5916            None
5917        }
5918    }
5919
5920    #[allow(irrefutable_let_patterns)]
5921    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
5922        if let RuleSetV4Request::RemoveRule { index, responder } = self {
5923            Some((index, responder))
5924        } else {
5925            None
5926        }
5927    }
5928
5929    #[allow(irrefutable_let_patterns)]
5930    pub fn into_close(self) -> Option<(RuleSetV4ControlHandle)> {
5931        if let RuleSetV4Request::Close { control_handle } = self {
5932            Some((control_handle))
5933        } else {
5934            None
5935        }
5936    }
5937
5938    #[allow(irrefutable_let_patterns)]
5939    pub fn into_add_rule(
5940        self,
5941    ) -> Option<(
5942        u32,
5943        fdomain_fuchsia_net_routes::RuleMatcherV4,
5944        fdomain_fuchsia_net_routes::RuleAction,
5945        RuleSetV4AddRuleResponder,
5946    )> {
5947        if let RuleSetV4Request::AddRule { index, matcher, action, responder } = self {
5948            Some((index, matcher, action, responder))
5949        } else {
5950            None
5951        }
5952    }
5953
5954    /// Name of the method defined in FIDL
5955    pub fn method_name(&self) -> &'static str {
5956        match *self {
5957            RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
5958            RuleSetV4Request::RemoveRule { .. } => "remove_rule",
5959            RuleSetV4Request::Close { .. } => "close",
5960            RuleSetV4Request::AddRule { .. } => "add_rule",
5961        }
5962    }
5963}
5964
5965#[derive(Debug, Clone)]
5966pub struct RuleSetV4ControlHandle {
5967    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5968}
5969
5970impl fdomain_client::fidl::ControlHandle for RuleSetV4ControlHandle {
5971    fn shutdown(&self) {
5972        self.inner.shutdown()
5973    }
5974
5975    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5976        self.inner.shutdown_with_epitaph(status)
5977    }
5978
5979    fn is_closed(&self) -> bool {
5980        self.inner.channel().is_closed()
5981    }
5982    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5983        self.inner.channel().on_closed()
5984    }
5985}
5986
5987impl RuleSetV4ControlHandle {}
5988
5989#[must_use = "FIDL methods require a response to be sent"]
5990#[derive(Debug)]
5991pub struct RuleSetV4AuthenticateForRouteTableResponder {
5992    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
5993    tx_id: u32,
5994}
5995
5996/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
5997/// if the responder is dropped without sending a response, so that the client
5998/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5999impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
6000    fn drop(&mut self) {
6001        self.control_handle.shutdown();
6002        // Safety: drops once, never accessed again
6003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6004    }
6005}
6006
6007impl fdomain_client::fidl::Responder for RuleSetV4AuthenticateForRouteTableResponder {
6008    type ControlHandle = RuleSetV4ControlHandle;
6009
6010    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6011        &self.control_handle
6012    }
6013
6014    fn drop_without_shutdown(mut self) {
6015        // Safety: drops once, never accessed again due to mem::forget
6016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6017        // Prevent Drop from running (which would shut down the channel)
6018        std::mem::forget(self);
6019    }
6020}
6021
6022impl RuleSetV4AuthenticateForRouteTableResponder {
6023    /// Sends a response to the FIDL transaction.
6024    ///
6025    /// Sets the channel to shutdown if an error occurs.
6026    pub fn send(
6027        self,
6028        mut result: Result<(), AuthenticateForRouteTableError>,
6029    ) -> Result<(), fidl::Error> {
6030        let _result = self.send_raw(result);
6031        if _result.is_err() {
6032            self.control_handle.shutdown();
6033        }
6034        self.drop_without_shutdown();
6035        _result
6036    }
6037
6038    /// Similar to "send" but does not shutdown the channel if an error occurs.
6039    pub fn send_no_shutdown_on_err(
6040        self,
6041        mut result: Result<(), AuthenticateForRouteTableError>,
6042    ) -> Result<(), fidl::Error> {
6043        let _result = self.send_raw(result);
6044        self.drop_without_shutdown();
6045        _result
6046    }
6047
6048    fn send_raw(
6049        &self,
6050        mut result: Result<(), AuthenticateForRouteTableError>,
6051    ) -> Result<(), fidl::Error> {
6052        self.control_handle.inner.send::<fidl::encoding::ResultType<
6053            fidl::encoding::EmptyStruct,
6054            AuthenticateForRouteTableError,
6055        >>(
6056            result,
6057            self.tx_id,
6058            0x6fd845360ed9bc8f,
6059            fidl::encoding::DynamicFlags::empty(),
6060        )
6061    }
6062}
6063
6064#[must_use = "FIDL methods require a response to be sent"]
6065#[derive(Debug)]
6066pub struct RuleSetV4RemoveRuleResponder {
6067    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
6068    tx_id: u32,
6069}
6070
6071/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
6072/// if the responder is dropped without sending a response, so that the client
6073/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6074impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
6075    fn drop(&mut self) {
6076        self.control_handle.shutdown();
6077        // Safety: drops once, never accessed again
6078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6079    }
6080}
6081
6082impl fdomain_client::fidl::Responder for RuleSetV4RemoveRuleResponder {
6083    type ControlHandle = RuleSetV4ControlHandle;
6084
6085    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6086        &self.control_handle
6087    }
6088
6089    fn drop_without_shutdown(mut self) {
6090        // Safety: drops once, never accessed again due to mem::forget
6091        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6092        // Prevent Drop from running (which would shut down the channel)
6093        std::mem::forget(self);
6094    }
6095}
6096
6097impl RuleSetV4RemoveRuleResponder {
6098    /// Sends a response to the FIDL transaction.
6099    ///
6100    /// Sets the channel to shutdown if an error occurs.
6101    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6102        let _result = self.send_raw(result);
6103        if _result.is_err() {
6104            self.control_handle.shutdown();
6105        }
6106        self.drop_without_shutdown();
6107        _result
6108    }
6109
6110    /// Similar to "send" but does not shutdown the channel if an error occurs.
6111    pub fn send_no_shutdown_on_err(
6112        self,
6113        mut result: Result<(), RuleSetError>,
6114    ) -> Result<(), fidl::Error> {
6115        let _result = self.send_raw(result);
6116        self.drop_without_shutdown();
6117        _result
6118    }
6119
6120    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6121        self.control_handle.inner.send::<fidl::encoding::ResultType<
6122            fidl::encoding::EmptyStruct,
6123            RuleSetError,
6124        >>(
6125            result,
6126            self.tx_id,
6127            0x2ae3d7e817cbff90,
6128            fidl::encoding::DynamicFlags::empty(),
6129        )
6130    }
6131}
6132
6133#[must_use = "FIDL methods require a response to be sent"]
6134#[derive(Debug)]
6135pub struct RuleSetV4AddRuleResponder {
6136    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
6137    tx_id: u32,
6138}
6139
6140/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
6141/// if the responder is dropped without sending a response, so that the client
6142/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6143impl std::ops::Drop for RuleSetV4AddRuleResponder {
6144    fn drop(&mut self) {
6145        self.control_handle.shutdown();
6146        // Safety: drops once, never accessed again
6147        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6148    }
6149}
6150
6151impl fdomain_client::fidl::Responder for RuleSetV4AddRuleResponder {
6152    type ControlHandle = RuleSetV4ControlHandle;
6153
6154    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6155        &self.control_handle
6156    }
6157
6158    fn drop_without_shutdown(mut self) {
6159        // Safety: drops once, never accessed again due to mem::forget
6160        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6161        // Prevent Drop from running (which would shut down the channel)
6162        std::mem::forget(self);
6163    }
6164}
6165
6166impl RuleSetV4AddRuleResponder {
6167    /// Sends a response to the FIDL transaction.
6168    ///
6169    /// Sets the channel to shutdown if an error occurs.
6170    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6171        let _result = self.send_raw(result);
6172        if _result.is_err() {
6173            self.control_handle.shutdown();
6174        }
6175        self.drop_without_shutdown();
6176        _result
6177    }
6178
6179    /// Similar to "send" but does not shutdown the channel if an error occurs.
6180    pub fn send_no_shutdown_on_err(
6181        self,
6182        mut result: Result<(), RuleSetError>,
6183    ) -> Result<(), fidl::Error> {
6184        let _result = self.send_raw(result);
6185        self.drop_without_shutdown();
6186        _result
6187    }
6188
6189    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6190        self.control_handle.inner.send::<fidl::encoding::ResultType<
6191            fidl::encoding::EmptyStruct,
6192            RuleSetError,
6193        >>(
6194            result,
6195            self.tx_id,
6196            0x7f68325de94e80,
6197            fidl::encoding::DynamicFlags::empty(),
6198        )
6199    }
6200}
6201
6202#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6203pub struct RuleSetV6Marker;
6204
6205impl fdomain_client::fidl::ProtocolMarker for RuleSetV6Marker {
6206    type Proxy = RuleSetV6Proxy;
6207    type RequestStream = RuleSetV6RequestStream;
6208
6209    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
6210}
6211pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
6212
6213pub trait RuleSetV6ProxyInterface: Send + Sync {
6214    type AuthenticateForRouteTableResponseFut: std::future::Future<
6215            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
6216        > + Send;
6217    fn r#authenticate_for_route_table(
6218        &self,
6219        table: u32,
6220        token: fdomain_client::Event,
6221    ) -> Self::AuthenticateForRouteTableResponseFut;
6222    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
6223        + Send;
6224    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
6225    fn r#close(&self) -> Result<(), fidl::Error>;
6226    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
6227        + Send;
6228    fn r#add_rule(
6229        &self,
6230        index: u32,
6231        matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6232        action: &fdomain_fuchsia_net_routes::RuleAction,
6233    ) -> Self::AddRuleResponseFut;
6234}
6235
6236#[derive(Debug, Clone)]
6237pub struct RuleSetV6Proxy {
6238    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
6239}
6240
6241impl fdomain_client::fidl::Proxy for RuleSetV6Proxy {
6242    type Protocol = RuleSetV6Marker;
6243
6244    fn from_channel(inner: fdomain_client::Channel) -> Self {
6245        Self::new(inner)
6246    }
6247
6248    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
6249        self.client.into_channel().map_err(|client| Self { client })
6250    }
6251
6252    fn as_channel(&self) -> &fdomain_client::Channel {
6253        self.client.as_channel()
6254    }
6255}
6256
6257impl RuleSetV6Proxy {
6258    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV6.
6259    pub fn new(channel: fdomain_client::Channel) -> Self {
6260        let protocol_name = <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
6261        Self { client: fidl::client::Client::new(channel, protocol_name) }
6262    }
6263
6264    /// Get a Stream of events from the remote end of the protocol.
6265    ///
6266    /// # Panics
6267    ///
6268    /// Panics if the event stream was already taken.
6269    pub fn take_event_stream(&self) -> RuleSetV6EventStream {
6270        RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
6271    }
6272
6273    /// Authenticates for a route table that will be used in an action.
6274    pub fn r#authenticate_for_route_table(
6275        &self,
6276        mut table: u32,
6277        mut token: fdomain_client::Event,
6278    ) -> fidl::client::QueryResponseFut<
6279        BaseRuleSetAuthenticateForRouteTableResult,
6280        fdomain_client::fidl::FDomainResourceDialect,
6281    > {
6282        RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
6283    }
6284
6285    /// Removes a rule from this rule set.
6286    ///
6287    /// If the client tries to remove from an index that does not have a rule,
6288    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6289    ///
6290    /// + request `index` the index of the rule.
6291    pub fn r#remove_rule(
6292        &self,
6293        mut index: u32,
6294    ) -> fidl::client::QueryResponseFut<
6295        BaseRuleSetRemoveRuleResult,
6296        fdomain_client::fidl::FDomainResourceDialect,
6297    > {
6298        RuleSetV6ProxyInterface::r#remove_rule(self, index)
6299    }
6300
6301    /// Removes all rules in the rule set and the underlying channel will be
6302    /// closed after the rules are removed.
6303    ///
6304    /// This method provides a way for synchronous closure.
6305    pub fn r#close(&self) -> Result<(), fidl::Error> {
6306        RuleSetV6ProxyInterface::r#close(self)
6307    }
6308
6309    /// Adds a rule to this rule set.
6310    ///
6311    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6312    /// is returned.
6313    ///
6314    /// + request `index` where to insert the rule.
6315    /// + request `matcher` the matcher of the rule.
6316    /// + request `action` action of the rule.
6317    pub fn r#add_rule(
6318        &self,
6319        mut index: u32,
6320        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6321        mut action: &fdomain_fuchsia_net_routes::RuleAction,
6322    ) -> fidl::client::QueryResponseFut<
6323        RuleSetV6AddRuleResult,
6324        fdomain_client::fidl::FDomainResourceDialect,
6325    > {
6326        RuleSetV6ProxyInterface::r#add_rule(self, index, matcher, action)
6327    }
6328}
6329
6330impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
6331    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
6332        BaseRuleSetAuthenticateForRouteTableResult,
6333        fdomain_client::fidl::FDomainResourceDialect,
6334    >;
6335    fn r#authenticate_for_route_table(
6336        &self,
6337        mut table: u32,
6338        mut token: fdomain_client::Event,
6339    ) -> Self::AuthenticateForRouteTableResponseFut {
6340        fn _decode(
6341            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6342        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6343            let _response = fidl::client::decode_transaction_body::<
6344                fidl::encoding::ResultType<
6345                    fidl::encoding::EmptyStruct,
6346                    AuthenticateForRouteTableError,
6347                >,
6348                fdomain_client::fidl::FDomainResourceDialect,
6349                0x6fd845360ed9bc8f,
6350            >(_buf?)?;
6351            Ok(_response.map(|x| x))
6352        }
6353        self.client.send_query_and_decode::<
6354            ProofOfRouteTableAuthorization,
6355            BaseRuleSetAuthenticateForRouteTableResult,
6356        >(
6357            (table, token,),
6358            0x6fd845360ed9bc8f,
6359            fidl::encoding::DynamicFlags::empty(),
6360            _decode,
6361        )
6362    }
6363
6364    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
6365        BaseRuleSetRemoveRuleResult,
6366        fdomain_client::fidl::FDomainResourceDialect,
6367    >;
6368    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
6369        fn _decode(
6370            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6371        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6372            let _response = fidl::client::decode_transaction_body::<
6373                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6374                fdomain_client::fidl::FDomainResourceDialect,
6375                0x2ae3d7e817cbff90,
6376            >(_buf?)?;
6377            Ok(_response.map(|x| x))
6378        }
6379        self.client
6380            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
6381                (index,),
6382                0x2ae3d7e817cbff90,
6383                fidl::encoding::DynamicFlags::empty(),
6384                _decode,
6385            )
6386    }
6387
6388    fn r#close(&self) -> Result<(), fidl::Error> {
6389        self.client.send::<fidl::encoding::EmptyPayload>(
6390            (),
6391            0x457e1753672d4073,
6392            fidl::encoding::DynamicFlags::empty(),
6393        )
6394    }
6395
6396    type AddRuleResponseFut = fidl::client::QueryResponseFut<
6397        RuleSetV6AddRuleResult,
6398        fdomain_client::fidl::FDomainResourceDialect,
6399    >;
6400    fn r#add_rule(
6401        &self,
6402        mut index: u32,
6403        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6404        mut action: &fdomain_fuchsia_net_routes::RuleAction,
6405    ) -> Self::AddRuleResponseFut {
6406        fn _decode(
6407            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6408        ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
6409            let _response = fidl::client::decode_transaction_body::<
6410                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6411                fdomain_client::fidl::FDomainResourceDialect,
6412                0x946cad8f8a726b3,
6413            >(_buf?)?;
6414            Ok(_response.map(|x| x))
6415        }
6416        self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
6417            (index, matcher, action),
6418            0x946cad8f8a726b3,
6419            fidl::encoding::DynamicFlags::empty(),
6420            _decode,
6421        )
6422    }
6423}
6424
6425pub struct RuleSetV6EventStream {
6426    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
6427}
6428
6429impl std::marker::Unpin for RuleSetV6EventStream {}
6430
6431impl futures::stream::FusedStream for RuleSetV6EventStream {
6432    fn is_terminated(&self) -> bool {
6433        self.event_receiver.is_terminated()
6434    }
6435}
6436
6437impl futures::Stream for RuleSetV6EventStream {
6438    type Item = Result<RuleSetV6Event, fidl::Error>;
6439
6440    fn poll_next(
6441        mut self: std::pin::Pin<&mut Self>,
6442        cx: &mut std::task::Context<'_>,
6443    ) -> std::task::Poll<Option<Self::Item>> {
6444        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6445            &mut self.event_receiver,
6446            cx
6447        )?) {
6448            Some(buf) => std::task::Poll::Ready(Some(RuleSetV6Event::decode(buf))),
6449            None => std::task::Poll::Ready(None),
6450        }
6451    }
6452}
6453
6454#[derive(Debug)]
6455pub enum RuleSetV6Event {}
6456
6457impl RuleSetV6Event {
6458    /// Decodes a message buffer as a [`RuleSetV6Event`].
6459    fn decode(
6460        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6461    ) -> Result<RuleSetV6Event, fidl::Error> {
6462        let (bytes, _handles) = buf.split_mut();
6463        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6464        debug_assert_eq!(tx_header.tx_id, 0);
6465        match tx_header.ordinal {
6466            _ => Err(fidl::Error::UnknownOrdinal {
6467                ordinal: tx_header.ordinal,
6468                protocol_name:
6469                    <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6470            }),
6471        }
6472    }
6473}
6474
6475/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV6.
6476pub struct RuleSetV6RequestStream {
6477    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6478    is_terminated: bool,
6479}
6480
6481impl std::marker::Unpin for RuleSetV6RequestStream {}
6482
6483impl futures::stream::FusedStream for RuleSetV6RequestStream {
6484    fn is_terminated(&self) -> bool {
6485        self.is_terminated
6486    }
6487}
6488
6489impl fdomain_client::fidl::RequestStream for RuleSetV6RequestStream {
6490    type Protocol = RuleSetV6Marker;
6491    type ControlHandle = RuleSetV6ControlHandle;
6492
6493    fn from_channel(channel: fdomain_client::Channel) -> Self {
6494        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6495    }
6496
6497    fn control_handle(&self) -> Self::ControlHandle {
6498        RuleSetV6ControlHandle { inner: self.inner.clone() }
6499    }
6500
6501    fn into_inner(
6502        self,
6503    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
6504    {
6505        (self.inner, self.is_terminated)
6506    }
6507
6508    fn from_inner(
6509        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6510        is_terminated: bool,
6511    ) -> Self {
6512        Self { inner, is_terminated }
6513    }
6514}
6515
6516impl futures::Stream for RuleSetV6RequestStream {
6517    type Item = Result<RuleSetV6Request, fidl::Error>;
6518
6519    fn poll_next(
6520        mut self: std::pin::Pin<&mut Self>,
6521        cx: &mut std::task::Context<'_>,
6522    ) -> std::task::Poll<Option<Self::Item>> {
6523        let this = &mut *self;
6524        if this.inner.check_shutdown(cx) {
6525            this.is_terminated = true;
6526            return std::task::Poll::Ready(None);
6527        }
6528        if this.is_terminated {
6529            panic!("polled RuleSetV6RequestStream after completion");
6530        }
6531        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
6532            |bytes, handles| {
6533                match this.inner.channel().read_etc(cx, bytes, handles) {
6534                    std::task::Poll::Ready(Ok(())) => {}
6535                    std::task::Poll::Pending => return std::task::Poll::Pending,
6536                    std::task::Poll::Ready(Err(None)) => {
6537                        this.is_terminated = true;
6538                        return std::task::Poll::Ready(None);
6539                    }
6540                    std::task::Poll::Ready(Err(Some(e))) => {
6541                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6542                            e.into(),
6543                        ))));
6544                    }
6545                }
6546
6547                // A message has been received from the channel
6548                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6549
6550                std::task::Poll::Ready(Some(match header.ordinal {
6551                    0x6fd845360ed9bc8f => {
6552                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6553                        let mut req = fidl::new_empty!(
6554                            ProofOfRouteTableAuthorization,
6555                            fdomain_client::fidl::FDomainResourceDialect
6556                        );
6557                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
6558                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6559                        Ok(RuleSetV6Request::AuthenticateForRouteTable {
6560                            table: req.table,
6561                            token: req.token,
6562
6563                            responder: RuleSetV6AuthenticateForRouteTableResponder {
6564                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6565                                tx_id: header.tx_id,
6566                            },
6567                        })
6568                    }
6569                    0x2ae3d7e817cbff90 => {
6570                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6571                        let mut req = fidl::new_empty!(
6572                            BaseRuleSetRemoveRuleRequest,
6573                            fdomain_client::fidl::FDomainResourceDialect
6574                        );
6575                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6576                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6577                        Ok(RuleSetV6Request::RemoveRule {
6578                            index: req.index,
6579
6580                            responder: RuleSetV6RemoveRuleResponder {
6581                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6582                                tx_id: header.tx_id,
6583                            },
6584                        })
6585                    }
6586                    0x457e1753672d4073 => {
6587                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6588                        let mut req = fidl::new_empty!(
6589                            fidl::encoding::EmptyPayload,
6590                            fdomain_client::fidl::FDomainResourceDialect
6591                        );
6592                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6593                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6594                        Ok(RuleSetV6Request::Close { control_handle })
6595                    }
6596                    0x946cad8f8a726b3 => {
6597                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6598                        let mut req = fidl::new_empty!(
6599                            RuleSetV6AddRuleRequest,
6600                            fdomain_client::fidl::FDomainResourceDialect
6601                        );
6602                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleSetV6AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6603                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6604                        Ok(RuleSetV6Request::AddRule {
6605                            index: req.index,
6606                            matcher: req.matcher,
6607                            action: req.action,
6608
6609                            responder: RuleSetV6AddRuleResponder {
6610                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6611                                tx_id: header.tx_id,
6612                            },
6613                        })
6614                    }
6615                    _ => Err(fidl::Error::UnknownOrdinal {
6616                        ordinal: header.ordinal,
6617                        protocol_name:
6618                            <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6619                    }),
6620                }))
6621            },
6622        )
6623    }
6624}
6625
6626/// Provides mutable access over a set of the system's IPv6 route rules.
6627///
6628/// A `RuleSet` has a priority and a rule has an index. A global order among the
6629/// rules is determined first by the priority of the `RuleSet` the rule belongs
6630/// to, and then the index of the rule inside the `RuleSet`.
6631///
6632/// This protocol encodes the lifetime of the rule set. Closing the client end
6633/// removes the rule set, and all the rules that are owned by the rule set.
6634#[derive(Debug)]
6635pub enum RuleSetV6Request {
6636    /// Authenticates for a route table that will be used in an action.
6637    AuthenticateForRouteTable {
6638        table: u32,
6639        token: fdomain_client::Event,
6640        responder: RuleSetV6AuthenticateForRouteTableResponder,
6641    },
6642    /// Removes a rule from this rule set.
6643    ///
6644    /// If the client tries to remove from an index that does not have a rule,
6645    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6646    ///
6647    /// + request `index` the index of the rule.
6648    RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
6649    /// Removes all rules in the rule set and the underlying channel will be
6650    /// closed after the rules are removed.
6651    ///
6652    /// This method provides a way for synchronous closure.
6653    Close { control_handle: RuleSetV6ControlHandle },
6654    /// Adds a rule to this rule set.
6655    ///
6656    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6657    /// is returned.
6658    ///
6659    /// + request `index` where to insert the rule.
6660    /// + request `matcher` the matcher of the rule.
6661    /// + request `action` action of the rule.
6662    AddRule {
6663        index: u32,
6664        matcher: fdomain_fuchsia_net_routes::RuleMatcherV6,
6665        action: fdomain_fuchsia_net_routes::RuleAction,
6666        responder: RuleSetV6AddRuleResponder,
6667    },
6668}
6669
6670impl RuleSetV6Request {
6671    #[allow(irrefutable_let_patterns)]
6672    pub fn into_authenticate_for_route_table(
6673        self,
6674    ) -> Option<(u32, fdomain_client::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
6675        if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
6676            Some((table, token, responder))
6677        } else {
6678            None
6679        }
6680    }
6681
6682    #[allow(irrefutable_let_patterns)]
6683    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
6684        if let RuleSetV6Request::RemoveRule { index, responder } = self {
6685            Some((index, responder))
6686        } else {
6687            None
6688        }
6689    }
6690
6691    #[allow(irrefutable_let_patterns)]
6692    pub fn into_close(self) -> Option<(RuleSetV6ControlHandle)> {
6693        if let RuleSetV6Request::Close { control_handle } = self {
6694            Some((control_handle))
6695        } else {
6696            None
6697        }
6698    }
6699
6700    #[allow(irrefutable_let_patterns)]
6701    pub fn into_add_rule(
6702        self,
6703    ) -> Option<(
6704        u32,
6705        fdomain_fuchsia_net_routes::RuleMatcherV6,
6706        fdomain_fuchsia_net_routes::RuleAction,
6707        RuleSetV6AddRuleResponder,
6708    )> {
6709        if let RuleSetV6Request::AddRule { index, matcher, action, responder } = self {
6710            Some((index, matcher, action, responder))
6711        } else {
6712            None
6713        }
6714    }
6715
6716    /// Name of the method defined in FIDL
6717    pub fn method_name(&self) -> &'static str {
6718        match *self {
6719            RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
6720            RuleSetV6Request::RemoveRule { .. } => "remove_rule",
6721            RuleSetV6Request::Close { .. } => "close",
6722            RuleSetV6Request::AddRule { .. } => "add_rule",
6723        }
6724    }
6725}
6726
6727#[derive(Debug, Clone)]
6728pub struct RuleSetV6ControlHandle {
6729    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6730}
6731
6732impl fdomain_client::fidl::ControlHandle for RuleSetV6ControlHandle {
6733    fn shutdown(&self) {
6734        self.inner.shutdown()
6735    }
6736
6737    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6738        self.inner.shutdown_with_epitaph(status)
6739    }
6740
6741    fn is_closed(&self) -> bool {
6742        self.inner.channel().is_closed()
6743    }
6744    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6745        self.inner.channel().on_closed()
6746    }
6747}
6748
6749impl RuleSetV6ControlHandle {}
6750
6751#[must_use = "FIDL methods require a response to be sent"]
6752#[derive(Debug)]
6753pub struct RuleSetV6AuthenticateForRouteTableResponder {
6754    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6755    tx_id: u32,
6756}
6757
6758/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6759/// if the responder is dropped without sending a response, so that the client
6760/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6761impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
6762    fn drop(&mut self) {
6763        self.control_handle.shutdown();
6764        // Safety: drops once, never accessed again
6765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6766    }
6767}
6768
6769impl fdomain_client::fidl::Responder for RuleSetV6AuthenticateForRouteTableResponder {
6770    type ControlHandle = RuleSetV6ControlHandle;
6771
6772    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6773        &self.control_handle
6774    }
6775
6776    fn drop_without_shutdown(mut self) {
6777        // Safety: drops once, never accessed again due to mem::forget
6778        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6779        // Prevent Drop from running (which would shut down the channel)
6780        std::mem::forget(self);
6781    }
6782}
6783
6784impl RuleSetV6AuthenticateForRouteTableResponder {
6785    /// Sends a response to the FIDL transaction.
6786    ///
6787    /// Sets the channel to shutdown if an error occurs.
6788    pub fn send(
6789        self,
6790        mut result: Result<(), AuthenticateForRouteTableError>,
6791    ) -> Result<(), fidl::Error> {
6792        let _result = self.send_raw(result);
6793        if _result.is_err() {
6794            self.control_handle.shutdown();
6795        }
6796        self.drop_without_shutdown();
6797        _result
6798    }
6799
6800    /// Similar to "send" but does not shutdown the channel if an error occurs.
6801    pub fn send_no_shutdown_on_err(
6802        self,
6803        mut result: Result<(), AuthenticateForRouteTableError>,
6804    ) -> Result<(), fidl::Error> {
6805        let _result = self.send_raw(result);
6806        self.drop_without_shutdown();
6807        _result
6808    }
6809
6810    fn send_raw(
6811        &self,
6812        mut result: Result<(), AuthenticateForRouteTableError>,
6813    ) -> Result<(), fidl::Error> {
6814        self.control_handle.inner.send::<fidl::encoding::ResultType<
6815            fidl::encoding::EmptyStruct,
6816            AuthenticateForRouteTableError,
6817        >>(
6818            result,
6819            self.tx_id,
6820            0x6fd845360ed9bc8f,
6821            fidl::encoding::DynamicFlags::empty(),
6822        )
6823    }
6824}
6825
6826#[must_use = "FIDL methods require a response to be sent"]
6827#[derive(Debug)]
6828pub struct RuleSetV6RemoveRuleResponder {
6829    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6830    tx_id: u32,
6831}
6832
6833/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6834/// if the responder is dropped without sending a response, so that the client
6835/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6836impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
6837    fn drop(&mut self) {
6838        self.control_handle.shutdown();
6839        // Safety: drops once, never accessed again
6840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6841    }
6842}
6843
6844impl fdomain_client::fidl::Responder for RuleSetV6RemoveRuleResponder {
6845    type ControlHandle = RuleSetV6ControlHandle;
6846
6847    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6848        &self.control_handle
6849    }
6850
6851    fn drop_without_shutdown(mut self) {
6852        // Safety: drops once, never accessed again due to mem::forget
6853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6854        // Prevent Drop from running (which would shut down the channel)
6855        std::mem::forget(self);
6856    }
6857}
6858
6859impl RuleSetV6RemoveRuleResponder {
6860    /// Sends a response to the FIDL transaction.
6861    ///
6862    /// Sets the channel to shutdown if an error occurs.
6863    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6864        let _result = self.send_raw(result);
6865        if _result.is_err() {
6866            self.control_handle.shutdown();
6867        }
6868        self.drop_without_shutdown();
6869        _result
6870    }
6871
6872    /// Similar to "send" but does not shutdown the channel if an error occurs.
6873    pub fn send_no_shutdown_on_err(
6874        self,
6875        mut result: Result<(), RuleSetError>,
6876    ) -> Result<(), fidl::Error> {
6877        let _result = self.send_raw(result);
6878        self.drop_without_shutdown();
6879        _result
6880    }
6881
6882    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6883        self.control_handle.inner.send::<fidl::encoding::ResultType<
6884            fidl::encoding::EmptyStruct,
6885            RuleSetError,
6886        >>(
6887            result,
6888            self.tx_id,
6889            0x2ae3d7e817cbff90,
6890            fidl::encoding::DynamicFlags::empty(),
6891        )
6892    }
6893}
6894
6895#[must_use = "FIDL methods require a response to be sent"]
6896#[derive(Debug)]
6897pub struct RuleSetV6AddRuleResponder {
6898    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6899    tx_id: u32,
6900}
6901
6902/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6903/// if the responder is dropped without sending a response, so that the client
6904/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6905impl std::ops::Drop for RuleSetV6AddRuleResponder {
6906    fn drop(&mut self) {
6907        self.control_handle.shutdown();
6908        // Safety: drops once, never accessed again
6909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6910    }
6911}
6912
6913impl fdomain_client::fidl::Responder for RuleSetV6AddRuleResponder {
6914    type ControlHandle = RuleSetV6ControlHandle;
6915
6916    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6917        &self.control_handle
6918    }
6919
6920    fn drop_without_shutdown(mut self) {
6921        // Safety: drops once, never accessed again due to mem::forget
6922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6923        // Prevent Drop from running (which would shut down the channel)
6924        std::mem::forget(self);
6925    }
6926}
6927
6928impl RuleSetV6AddRuleResponder {
6929    /// Sends a response to the FIDL transaction.
6930    ///
6931    /// Sets the channel to shutdown if an error occurs.
6932    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6933        let _result = self.send_raw(result);
6934        if _result.is_err() {
6935            self.control_handle.shutdown();
6936        }
6937        self.drop_without_shutdown();
6938        _result
6939    }
6940
6941    /// Similar to "send" but does not shutdown the channel if an error occurs.
6942    pub fn send_no_shutdown_on_err(
6943        self,
6944        mut result: Result<(), RuleSetError>,
6945    ) -> Result<(), fidl::Error> {
6946        let _result = self.send_raw(result);
6947        self.drop_without_shutdown();
6948        _result
6949    }
6950
6951    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6952        self.control_handle.inner.send::<fidl::encoding::ResultType<
6953            fidl::encoding::EmptyStruct,
6954            RuleSetError,
6955        >>(
6956            result,
6957            self.tx_id,
6958            0x946cad8f8a726b3,
6959            fidl::encoding::DynamicFlags::empty(),
6960        )
6961    }
6962}
6963
6964#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6965pub struct RuleTableV4Marker;
6966
6967impl fdomain_client::fidl::ProtocolMarker for RuleTableV4Marker {
6968    type Proxy = RuleTableV4Proxy;
6969    type RequestStream = RuleTableV4RequestStream;
6970
6971    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
6972}
6973impl fdomain_client::fidl::DiscoverableProtocolMarker for RuleTableV4Marker {}
6974
6975pub trait RuleTableV4ProxyInterface: Send + Sync {
6976    fn r#new_rule_set(
6977        &self,
6978        priority: u32,
6979        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
6980    ) -> Result<(), fidl::Error>;
6981}
6982
6983#[derive(Debug, Clone)]
6984pub struct RuleTableV4Proxy {
6985    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
6986}
6987
6988impl fdomain_client::fidl::Proxy for RuleTableV4Proxy {
6989    type Protocol = RuleTableV4Marker;
6990
6991    fn from_channel(inner: fdomain_client::Channel) -> Self {
6992        Self::new(inner)
6993    }
6994
6995    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
6996        self.client.into_channel().map_err(|client| Self { client })
6997    }
6998
6999    fn as_channel(&self) -> &fdomain_client::Channel {
7000        self.client.as_channel()
7001    }
7002}
7003
7004impl RuleTableV4Proxy {
7005    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV4.
7006    pub fn new(channel: fdomain_client::Channel) -> Self {
7007        let protocol_name = <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7008        Self { client: fidl::client::Client::new(channel, protocol_name) }
7009    }
7010
7011    /// Get a Stream of events from the remote end of the protocol.
7012    ///
7013    /// # Panics
7014    ///
7015    /// Panics if the event stream was already taken.
7016    pub fn take_event_stream(&self) -> RuleTableV4EventStream {
7017        RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
7018    }
7019
7020    /// Returns an empty rule set at requested priority.
7021    ///
7022    /// Clients are free to manage the rules within their own rule set, but not
7023    /// the rule set of others. Only one rule set is allowed at each `priority`
7024    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7025    /// a rule set at the given `priority`.
7026    ///
7027    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
7028    ///   globally ordered according to this number.
7029    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
7030    pub fn r#new_rule_set(
7031        &self,
7032        mut priority: u32,
7033        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7034    ) -> Result<(), fidl::Error> {
7035        RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
7036    }
7037}
7038
7039impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
7040    fn r#new_rule_set(
7041        &self,
7042        mut priority: u32,
7043        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7044    ) -> Result<(), fidl::Error> {
7045        self.client.send::<RuleTableV4NewRuleSetRequest>(
7046            (priority, rule_set),
7047            0xa32a9097da46f3a,
7048            fidl::encoding::DynamicFlags::empty(),
7049        )
7050    }
7051}
7052
7053pub struct RuleTableV4EventStream {
7054    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7055}
7056
7057impl std::marker::Unpin for RuleTableV4EventStream {}
7058
7059impl futures::stream::FusedStream for RuleTableV4EventStream {
7060    fn is_terminated(&self) -> bool {
7061        self.event_receiver.is_terminated()
7062    }
7063}
7064
7065impl futures::Stream for RuleTableV4EventStream {
7066    type Item = Result<RuleTableV4Event, fidl::Error>;
7067
7068    fn poll_next(
7069        mut self: std::pin::Pin<&mut Self>,
7070        cx: &mut std::task::Context<'_>,
7071    ) -> std::task::Poll<Option<Self::Item>> {
7072        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7073            &mut self.event_receiver,
7074            cx
7075        )?) {
7076            Some(buf) => std::task::Poll::Ready(Some(RuleTableV4Event::decode(buf))),
7077            None => std::task::Poll::Ready(None),
7078        }
7079    }
7080}
7081
7082#[derive(Debug)]
7083pub enum RuleTableV4Event {}
7084
7085impl RuleTableV4Event {
7086    /// Decodes a message buffer as a [`RuleTableV4Event`].
7087    fn decode(
7088        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7089    ) -> Result<RuleTableV4Event, fidl::Error> {
7090        let (bytes, _handles) = buf.split_mut();
7091        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7092        debug_assert_eq!(tx_header.tx_id, 0);
7093        match tx_header.ordinal {
7094            _ => Err(fidl::Error::UnknownOrdinal {
7095                ordinal: tx_header.ordinal,
7096                protocol_name:
7097                    <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7098            }),
7099        }
7100    }
7101}
7102
7103/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV4.
7104pub struct RuleTableV4RequestStream {
7105    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7106    is_terminated: bool,
7107}
7108
7109impl std::marker::Unpin for RuleTableV4RequestStream {}
7110
7111impl futures::stream::FusedStream for RuleTableV4RequestStream {
7112    fn is_terminated(&self) -> bool {
7113        self.is_terminated
7114    }
7115}
7116
7117impl fdomain_client::fidl::RequestStream for RuleTableV4RequestStream {
7118    type Protocol = RuleTableV4Marker;
7119    type ControlHandle = RuleTableV4ControlHandle;
7120
7121    fn from_channel(channel: fdomain_client::Channel) -> Self {
7122        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7123    }
7124
7125    fn control_handle(&self) -> Self::ControlHandle {
7126        RuleTableV4ControlHandle { inner: self.inner.clone() }
7127    }
7128
7129    fn into_inner(
7130        self,
7131    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7132    {
7133        (self.inner, self.is_terminated)
7134    }
7135
7136    fn from_inner(
7137        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7138        is_terminated: bool,
7139    ) -> Self {
7140        Self { inner, is_terminated }
7141    }
7142}
7143
7144impl futures::Stream for RuleTableV4RequestStream {
7145    type Item = Result<RuleTableV4Request, fidl::Error>;
7146
7147    fn poll_next(
7148        mut self: std::pin::Pin<&mut Self>,
7149        cx: &mut std::task::Context<'_>,
7150    ) -> std::task::Poll<Option<Self::Item>> {
7151        let this = &mut *self;
7152        if this.inner.check_shutdown(cx) {
7153            this.is_terminated = true;
7154            return std::task::Poll::Ready(None);
7155        }
7156        if this.is_terminated {
7157            panic!("polled RuleTableV4RequestStream after completion");
7158        }
7159        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7160            |bytes, handles| {
7161                match this.inner.channel().read_etc(cx, bytes, handles) {
7162                    std::task::Poll::Ready(Ok(())) => {}
7163                    std::task::Poll::Pending => return std::task::Poll::Pending,
7164                    std::task::Poll::Ready(Err(None)) => {
7165                        this.is_terminated = true;
7166                        return std::task::Poll::Ready(None);
7167                    }
7168                    std::task::Poll::Ready(Err(Some(e))) => {
7169                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7170                            e.into(),
7171                        ))));
7172                    }
7173                }
7174
7175                // A message has been received from the channel
7176                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7177
7178                std::task::Poll::Ready(Some(match header.ordinal {
7179                    0xa32a9097da46f3a => {
7180                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7181                        let mut req = fidl::new_empty!(
7182                            RuleTableV4NewRuleSetRequest,
7183                            fdomain_client::fidl::FDomainResourceDialect
7184                        );
7185                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleTableV4NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
7186                        let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
7187                        Ok(RuleTableV4Request::NewRuleSet {
7188                            priority: req.priority,
7189                            rule_set: req.rule_set,
7190
7191                            control_handle,
7192                        })
7193                    }
7194                    _ => Err(fidl::Error::UnknownOrdinal {
7195                        ordinal: header.ordinal,
7196                        protocol_name:
7197                            <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7198                    }),
7199                }))
7200            },
7201        )
7202    }
7203}
7204
7205/// Gives isolated access to the system's policy routing rules.
7206#[derive(Debug)]
7207pub enum RuleTableV4Request {
7208    /// Returns an empty rule set at requested priority.
7209    ///
7210    /// Clients are free to manage the rules within their own rule set, but not
7211    /// the rule set of others. Only one rule set is allowed at each `priority`
7212    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7213    /// a rule set at the given `priority`.
7214    ///
7215    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
7216    ///   globally ordered according to this number.
7217    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
7218    NewRuleSet {
7219        priority: u32,
7220        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7221        control_handle: RuleTableV4ControlHandle,
7222    },
7223}
7224
7225impl RuleTableV4Request {
7226    #[allow(irrefutable_let_patterns)]
7227    pub fn into_new_rule_set(
7228        self,
7229    ) -> Option<(u32, fdomain_client::fidl::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)>
7230    {
7231        if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
7232            Some((priority, rule_set, control_handle))
7233        } else {
7234            None
7235        }
7236    }
7237
7238    /// Name of the method defined in FIDL
7239    pub fn method_name(&self) -> &'static str {
7240        match *self {
7241            RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
7242        }
7243    }
7244}
7245
7246#[derive(Debug, Clone)]
7247pub struct RuleTableV4ControlHandle {
7248    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7249}
7250
7251impl fdomain_client::fidl::ControlHandle for RuleTableV4ControlHandle {
7252    fn shutdown(&self) {
7253        self.inner.shutdown()
7254    }
7255
7256    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7257        self.inner.shutdown_with_epitaph(status)
7258    }
7259
7260    fn is_closed(&self) -> bool {
7261        self.inner.channel().is_closed()
7262    }
7263    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7264        self.inner.channel().on_closed()
7265    }
7266}
7267
7268impl RuleTableV4ControlHandle {}
7269
7270#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7271pub struct RuleTableV6Marker;
7272
7273impl fdomain_client::fidl::ProtocolMarker for RuleTableV6Marker {
7274    type Proxy = RuleTableV6Proxy;
7275    type RequestStream = RuleTableV6RequestStream;
7276
7277    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
7278}
7279impl fdomain_client::fidl::DiscoverableProtocolMarker for RuleTableV6Marker {}
7280
7281pub trait RuleTableV6ProxyInterface: Send + Sync {
7282    fn r#new_rule_set(
7283        &self,
7284        priority: u32,
7285        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7286    ) -> Result<(), fidl::Error>;
7287}
7288
7289#[derive(Debug, Clone)]
7290pub struct RuleTableV6Proxy {
7291    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7292}
7293
7294impl fdomain_client::fidl::Proxy for RuleTableV6Proxy {
7295    type Protocol = RuleTableV6Marker;
7296
7297    fn from_channel(inner: fdomain_client::Channel) -> Self {
7298        Self::new(inner)
7299    }
7300
7301    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7302        self.client.into_channel().map_err(|client| Self { client })
7303    }
7304
7305    fn as_channel(&self) -> &fdomain_client::Channel {
7306        self.client.as_channel()
7307    }
7308}
7309
7310impl RuleTableV6Proxy {
7311    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV6.
7312    pub fn new(channel: fdomain_client::Channel) -> Self {
7313        let protocol_name = <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7314        Self { client: fidl::client::Client::new(channel, protocol_name) }
7315    }
7316
7317    /// Get a Stream of events from the remote end of the protocol.
7318    ///
7319    /// # Panics
7320    ///
7321    /// Panics if the event stream was already taken.
7322    pub fn take_event_stream(&self) -> RuleTableV6EventStream {
7323        RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
7324    }
7325
7326    /// Returns an empty rule set at requested priority.
7327    ///
7328    /// Clients are free to manage the rules within their own rule set, but not
7329    /// the rule set of others. Only one rule set is allowed at each `priority`
7330    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7331    /// a rule set at the given `priority`.
7332    ///
7333    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
7334    ///   globally ordered according to this number.
7335    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
7336    pub fn r#new_rule_set(
7337        &self,
7338        mut priority: u32,
7339        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7340    ) -> Result<(), fidl::Error> {
7341        RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
7342    }
7343}
7344
7345impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
7346    fn r#new_rule_set(
7347        &self,
7348        mut priority: u32,
7349        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7350    ) -> Result<(), fidl::Error> {
7351        self.client.send::<RuleTableV6NewRuleSetRequest>(
7352            (priority, rule_set),
7353            0x2261cc6eee9726a0,
7354            fidl::encoding::DynamicFlags::empty(),
7355        )
7356    }
7357}
7358
7359pub struct RuleTableV6EventStream {
7360    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7361}
7362
7363impl std::marker::Unpin for RuleTableV6EventStream {}
7364
7365impl futures::stream::FusedStream for RuleTableV6EventStream {
7366    fn is_terminated(&self) -> bool {
7367        self.event_receiver.is_terminated()
7368    }
7369}
7370
7371impl futures::Stream for RuleTableV6EventStream {
7372    type Item = Result<RuleTableV6Event, fidl::Error>;
7373
7374    fn poll_next(
7375        mut self: std::pin::Pin<&mut Self>,
7376        cx: &mut std::task::Context<'_>,
7377    ) -> std::task::Poll<Option<Self::Item>> {
7378        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7379            &mut self.event_receiver,
7380            cx
7381        )?) {
7382            Some(buf) => std::task::Poll::Ready(Some(RuleTableV6Event::decode(buf))),
7383            None => std::task::Poll::Ready(None),
7384        }
7385    }
7386}
7387
7388#[derive(Debug)]
7389pub enum RuleTableV6Event {}
7390
7391impl RuleTableV6Event {
7392    /// Decodes a message buffer as a [`RuleTableV6Event`].
7393    fn decode(
7394        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7395    ) -> Result<RuleTableV6Event, fidl::Error> {
7396        let (bytes, _handles) = buf.split_mut();
7397        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7398        debug_assert_eq!(tx_header.tx_id, 0);
7399        match tx_header.ordinal {
7400            _ => Err(fidl::Error::UnknownOrdinal {
7401                ordinal: tx_header.ordinal,
7402                protocol_name:
7403                    <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7404            }),
7405        }
7406    }
7407}
7408
7409/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV6.
7410pub struct RuleTableV6RequestStream {
7411    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7412    is_terminated: bool,
7413}
7414
7415impl std::marker::Unpin for RuleTableV6RequestStream {}
7416
7417impl futures::stream::FusedStream for RuleTableV6RequestStream {
7418    fn is_terminated(&self) -> bool {
7419        self.is_terminated
7420    }
7421}
7422
7423impl fdomain_client::fidl::RequestStream for RuleTableV6RequestStream {
7424    type Protocol = RuleTableV6Marker;
7425    type ControlHandle = RuleTableV6ControlHandle;
7426
7427    fn from_channel(channel: fdomain_client::Channel) -> Self {
7428        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7429    }
7430
7431    fn control_handle(&self) -> Self::ControlHandle {
7432        RuleTableV6ControlHandle { inner: self.inner.clone() }
7433    }
7434
7435    fn into_inner(
7436        self,
7437    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7438    {
7439        (self.inner, self.is_terminated)
7440    }
7441
7442    fn from_inner(
7443        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7444        is_terminated: bool,
7445    ) -> Self {
7446        Self { inner, is_terminated }
7447    }
7448}
7449
7450impl futures::Stream for RuleTableV6RequestStream {
7451    type Item = Result<RuleTableV6Request, fidl::Error>;
7452
7453    fn poll_next(
7454        mut self: std::pin::Pin<&mut Self>,
7455        cx: &mut std::task::Context<'_>,
7456    ) -> std::task::Poll<Option<Self::Item>> {
7457        let this = &mut *self;
7458        if this.inner.check_shutdown(cx) {
7459            this.is_terminated = true;
7460            return std::task::Poll::Ready(None);
7461        }
7462        if this.is_terminated {
7463            panic!("polled RuleTableV6RequestStream after completion");
7464        }
7465        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7466            |bytes, handles| {
7467                match this.inner.channel().read_etc(cx, bytes, handles) {
7468                    std::task::Poll::Ready(Ok(())) => {}
7469                    std::task::Poll::Pending => return std::task::Poll::Pending,
7470                    std::task::Poll::Ready(Err(None)) => {
7471                        this.is_terminated = true;
7472                        return std::task::Poll::Ready(None);
7473                    }
7474                    std::task::Poll::Ready(Err(Some(e))) => {
7475                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7476                            e.into(),
7477                        ))));
7478                    }
7479                }
7480
7481                // A message has been received from the channel
7482                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7483
7484                std::task::Poll::Ready(Some(match header.ordinal {
7485                    0x2261cc6eee9726a0 => {
7486                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7487                        let mut req = fidl::new_empty!(
7488                            RuleTableV6NewRuleSetRequest,
7489                            fdomain_client::fidl::FDomainResourceDialect
7490                        );
7491                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleTableV6NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
7492                        let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
7493                        Ok(RuleTableV6Request::NewRuleSet {
7494                            priority: req.priority,
7495                            rule_set: req.rule_set,
7496
7497                            control_handle,
7498                        })
7499                    }
7500                    _ => Err(fidl::Error::UnknownOrdinal {
7501                        ordinal: header.ordinal,
7502                        protocol_name:
7503                            <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7504                    }),
7505                }))
7506            },
7507        )
7508    }
7509}
7510
7511/// Gives isolated access to the system's policy routing rules.
7512#[derive(Debug)]
7513pub enum RuleTableV6Request {
7514    /// Returns an empty rule set at requested priority.
7515    ///
7516    /// Clients are free to manage the rules within their own rule set, but not
7517    /// the rule set of others. Only one rule set is allowed at each `priority`
7518    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7519    /// a rule set at the given `priority`.
7520    ///
7521    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
7522    ///   globally ordered according to this number.
7523    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
7524    NewRuleSet {
7525        priority: u32,
7526        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7527        control_handle: RuleTableV6ControlHandle,
7528    },
7529}
7530
7531impl RuleTableV6Request {
7532    #[allow(irrefutable_let_patterns)]
7533    pub fn into_new_rule_set(
7534        self,
7535    ) -> Option<(u32, fdomain_client::fidl::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)>
7536    {
7537        if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
7538            Some((priority, rule_set, control_handle))
7539        } else {
7540            None
7541        }
7542    }
7543
7544    /// Name of the method defined in FIDL
7545    pub fn method_name(&self) -> &'static str {
7546        match *self {
7547            RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
7548        }
7549    }
7550}
7551
7552#[derive(Debug, Clone)]
7553pub struct RuleTableV6ControlHandle {
7554    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7555}
7556
7557impl fdomain_client::fidl::ControlHandle for RuleTableV6ControlHandle {
7558    fn shutdown(&self) {
7559        self.inner.shutdown()
7560    }
7561
7562    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7563        self.inner.shutdown_with_epitaph(status)
7564    }
7565
7566    fn is_closed(&self) -> bool {
7567        self.inner.channel().is_closed()
7568    }
7569    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7570        self.inner.channel().on_closed()
7571    }
7572}
7573
7574impl RuleTableV6ControlHandle {}
7575
7576mod internal {
7577    use super::*;
7578
7579    impl fidl::encoding::ResourceTypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
7580        type Borrowed<'a> = &'a mut Self;
7581        fn take_or_borrow<'a>(
7582            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7583        ) -> Self::Borrowed<'a> {
7584            value
7585        }
7586    }
7587
7588    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
7589        type Owned = Self;
7590
7591        #[inline(always)]
7592        fn inline_align(_context: fidl::encoding::Context) -> usize {
7593            4
7594        }
7595
7596        #[inline(always)]
7597        fn inline_size(_context: fidl::encoding::Context) -> usize {
7598            8
7599        }
7600    }
7601
7602    unsafe impl
7603        fidl::encoding::Encode<
7604            BaseRouteTableGetAuthorizationForRouteTableResponse,
7605            fdomain_client::fidl::FDomainResourceDialect,
7606        > for &mut BaseRouteTableGetAuthorizationForRouteTableResponse
7607    {
7608        #[inline]
7609        unsafe fn encode(
7610            self,
7611            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7612            offset: usize,
7613            _depth: fidl::encoding::Depth,
7614        ) -> fidl::Result<()> {
7615            encoder
7616                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
7617            // Delegate to tuple encoding.
7618            fidl::encoding::Encode::<BaseRouteTableGetAuthorizationForRouteTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
7619                (
7620                    <GrantForRouteTableAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
7621                ),
7622                encoder, offset, _depth
7623            )
7624        }
7625    }
7626    unsafe impl<
7627        T0: fidl::encoding::Encode<
7628                GrantForRouteTableAuthorization,
7629                fdomain_client::fidl::FDomainResourceDialect,
7630            >,
7631    >
7632        fidl::encoding::Encode<
7633            BaseRouteTableGetAuthorizationForRouteTableResponse,
7634            fdomain_client::fidl::FDomainResourceDialect,
7635        > for (T0,)
7636    {
7637        #[inline]
7638        unsafe fn encode(
7639            self,
7640            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7641            offset: usize,
7642            depth: fidl::encoding::Depth,
7643        ) -> fidl::Result<()> {
7644            encoder
7645                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
7646            // Zero out padding regions. There's no need to apply masks
7647            // because the unmasked parts will be overwritten by fields.
7648            // Write the fields.
7649            self.0.encode(encoder, offset + 0, depth)?;
7650            Ok(())
7651        }
7652    }
7653
7654    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7655        for BaseRouteTableGetAuthorizationForRouteTableResponse
7656    {
7657        #[inline(always)]
7658        fn new_empty() -> Self {
7659            Self {
7660                credential: fidl::new_empty!(
7661                    GrantForRouteTableAuthorization,
7662                    fdomain_client::fidl::FDomainResourceDialect
7663                ),
7664            }
7665        }
7666
7667        #[inline]
7668        unsafe fn decode(
7669            &mut self,
7670            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7671            offset: usize,
7672            _depth: fidl::encoding::Depth,
7673        ) -> fidl::Result<()> {
7674            decoder.debug_check_bounds::<Self>(offset);
7675            // Verify that padding bytes are zero.
7676            fidl::decode!(
7677                GrantForRouteTableAuthorization,
7678                fdomain_client::fidl::FDomainResourceDialect,
7679                &mut self.credential,
7680                decoder,
7681                offset + 0,
7682                _depth
7683            )?;
7684            Ok(())
7685        }
7686    }
7687
7688    impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
7689        type Borrowed<'a> = &'a mut Self;
7690        fn take_or_borrow<'a>(
7691            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7692        ) -> Self::Borrowed<'a> {
7693            value
7694        }
7695    }
7696
7697    unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
7698        type Owned = Self;
7699
7700        #[inline(always)]
7701        fn inline_align(_context: fidl::encoding::Context) -> usize {
7702            4
7703        }
7704
7705        #[inline(always)]
7706        fn inline_size(_context: fidl::encoding::Context) -> usize {
7707            8
7708        }
7709    }
7710
7711    unsafe impl
7712        fidl::encoding::Encode<
7713            GrantForRouteTableAuthorization,
7714            fdomain_client::fidl::FDomainResourceDialect,
7715        > for &mut GrantForRouteTableAuthorization
7716    {
7717        #[inline]
7718        unsafe fn encode(
7719            self,
7720            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7721            offset: usize,
7722            _depth: fidl::encoding::Depth,
7723        ) -> fidl::Result<()> {
7724            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
7725            // Delegate to tuple encoding.
7726            fidl::encoding::Encode::<
7727                GrantForRouteTableAuthorization,
7728                fdomain_client::fidl::FDomainResourceDialect,
7729            >::encode(
7730                (
7731                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
7732                    <fidl::encoding::HandleType<
7733                        fdomain_client::Event,
7734                        { fidl::ObjectType::EVENT.into_raw() },
7735                        3,
7736                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7737                        &mut self.token
7738                    ),
7739                ),
7740                encoder,
7741                offset,
7742                _depth,
7743            )
7744        }
7745    }
7746    unsafe impl<
7747        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
7748        T1: fidl::encoding::Encode<
7749                fidl::encoding::HandleType<
7750                    fdomain_client::Event,
7751                    { fidl::ObjectType::EVENT.into_raw() },
7752                    3,
7753                >,
7754                fdomain_client::fidl::FDomainResourceDialect,
7755            >,
7756    >
7757        fidl::encoding::Encode<
7758            GrantForRouteTableAuthorization,
7759            fdomain_client::fidl::FDomainResourceDialect,
7760        > for (T0, T1)
7761    {
7762        #[inline]
7763        unsafe fn encode(
7764            self,
7765            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7766            offset: usize,
7767            depth: fidl::encoding::Depth,
7768        ) -> fidl::Result<()> {
7769            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
7770            // Zero out padding regions. There's no need to apply masks
7771            // because the unmasked parts will be overwritten by fields.
7772            // Write the fields.
7773            self.0.encode(encoder, offset + 0, depth)?;
7774            self.1.encode(encoder, offset + 4, depth)?;
7775            Ok(())
7776        }
7777    }
7778
7779    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7780        for GrantForRouteTableAuthorization
7781    {
7782        #[inline(always)]
7783        fn new_empty() -> Self {
7784            Self {
7785                table_id: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
7786                token: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fdomain_client::fidl::FDomainResourceDialect),
7787            }
7788        }
7789
7790        #[inline]
7791        unsafe fn decode(
7792            &mut self,
7793            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7794            offset: usize,
7795            _depth: fidl::encoding::Depth,
7796        ) -> fidl::Result<()> {
7797            decoder.debug_check_bounds::<Self>(offset);
7798            // Verify that padding bytes are zero.
7799            fidl::decode!(
7800                u32,
7801                fdomain_client::fidl::FDomainResourceDialect,
7802                &mut self.table_id,
7803                decoder,
7804                offset + 0,
7805                _depth
7806            )?;
7807            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fdomain_client::fidl::FDomainResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
7808            Ok(())
7809        }
7810    }
7811
7812    impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
7813        type Borrowed<'a> = &'a mut Self;
7814        fn take_or_borrow<'a>(
7815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7816        ) -> Self::Borrowed<'a> {
7817            value
7818        }
7819    }
7820
7821    unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
7822        type Owned = Self;
7823
7824        #[inline(always)]
7825        fn inline_align(_context: fidl::encoding::Context) -> usize {
7826            4
7827        }
7828
7829        #[inline(always)]
7830        fn inline_size(_context: fidl::encoding::Context) -> usize {
7831            8
7832        }
7833    }
7834
7835    unsafe impl
7836        fidl::encoding::Encode<
7837            ProofOfRouteTableAuthorization,
7838            fdomain_client::fidl::FDomainResourceDialect,
7839        > for &mut ProofOfRouteTableAuthorization
7840    {
7841        #[inline]
7842        unsafe fn encode(
7843            self,
7844            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7845            offset: usize,
7846            _depth: fidl::encoding::Depth,
7847        ) -> fidl::Result<()> {
7848            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
7849            // Delegate to tuple encoding.
7850            fidl::encoding::Encode::<
7851                ProofOfRouteTableAuthorization,
7852                fdomain_client::fidl::FDomainResourceDialect,
7853            >::encode(
7854                (
7855                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
7856                    <fidl::encoding::HandleType<
7857                        fdomain_client::Event,
7858                        { fidl::ObjectType::EVENT.into_raw() },
7859                        0,
7860                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7861                        &mut self.token
7862                    ),
7863                ),
7864                encoder,
7865                offset,
7866                _depth,
7867            )
7868        }
7869    }
7870    unsafe impl<
7871        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
7872        T1: fidl::encoding::Encode<
7873                fidl::encoding::HandleType<
7874                    fdomain_client::Event,
7875                    { fidl::ObjectType::EVENT.into_raw() },
7876                    0,
7877                >,
7878                fdomain_client::fidl::FDomainResourceDialect,
7879            >,
7880    >
7881        fidl::encoding::Encode<
7882            ProofOfRouteTableAuthorization,
7883            fdomain_client::fidl::FDomainResourceDialect,
7884        > for (T0, T1)
7885    {
7886        #[inline]
7887        unsafe fn encode(
7888            self,
7889            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7890            offset: usize,
7891            depth: fidl::encoding::Depth,
7892        ) -> fidl::Result<()> {
7893            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
7894            // Zero out padding regions. There's no need to apply masks
7895            // because the unmasked parts will be overwritten by fields.
7896            // Write the fields.
7897            self.0.encode(encoder, offset + 0, depth)?;
7898            self.1.encode(encoder, offset + 4, depth)?;
7899            Ok(())
7900        }
7901    }
7902
7903    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7904        for ProofOfRouteTableAuthorization
7905    {
7906        #[inline(always)]
7907        fn new_empty() -> Self {
7908            Self {
7909                table: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
7910                token: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fdomain_client::fidl::FDomainResourceDialect),
7911            }
7912        }
7913
7914        #[inline]
7915        unsafe fn decode(
7916            &mut self,
7917            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7918            offset: usize,
7919            _depth: fidl::encoding::Depth,
7920        ) -> fidl::Result<()> {
7921            decoder.debug_check_bounds::<Self>(offset);
7922            // Verify that padding bytes are zero.
7923            fidl::decode!(
7924                u32,
7925                fdomain_client::fidl::FDomainResourceDialect,
7926                &mut self.table,
7927                decoder,
7928                offset + 0,
7929                _depth
7930            )?;
7931            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fdomain_client::fidl::FDomainResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
7932            Ok(())
7933        }
7934    }
7935
7936    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
7937        type Borrowed<'a> = &'a mut Self;
7938        fn take_or_borrow<'a>(
7939            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7940        ) -> Self::Borrowed<'a> {
7941            value
7942        }
7943    }
7944
7945    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
7946        type Owned = Self;
7947
7948        #[inline(always)]
7949        fn inline_align(_context: fidl::encoding::Context) -> usize {
7950            8
7951        }
7952
7953        #[inline(always)]
7954        fn inline_size(_context: fidl::encoding::Context) -> usize {
7955            40
7956        }
7957    }
7958
7959    unsafe impl
7960        fidl::encoding::Encode<
7961            RouteSetV4AddRouteRequest,
7962            fdomain_client::fidl::FDomainResourceDialect,
7963        > for &mut RouteSetV4AddRouteRequest
7964    {
7965        #[inline]
7966        unsafe fn encode(
7967            self,
7968            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7969            offset: usize,
7970            _depth: fidl::encoding::Depth,
7971        ) -> fidl::Result<()> {
7972            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
7973            // Delegate to tuple encoding.
7974            fidl::encoding::Encode::<
7975                RouteSetV4AddRouteRequest,
7976                fdomain_client::fidl::FDomainResourceDialect,
7977            >::encode(
7978                (<fdomain_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
7979                    &self.route,
7980                ),),
7981                encoder,
7982                offset,
7983                _depth,
7984            )
7985        }
7986    }
7987    unsafe impl<
7988        T0: fidl::encoding::Encode<
7989                fdomain_fuchsia_net_routes::RouteV4,
7990                fdomain_client::fidl::FDomainResourceDialect,
7991            >,
7992    >
7993        fidl::encoding::Encode<
7994            RouteSetV4AddRouteRequest,
7995            fdomain_client::fidl::FDomainResourceDialect,
7996        > for (T0,)
7997    {
7998        #[inline]
7999        unsafe fn encode(
8000            self,
8001            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8002            offset: usize,
8003            depth: fidl::encoding::Depth,
8004        ) -> fidl::Result<()> {
8005            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
8006            // Zero out padding regions. There's no need to apply masks
8007            // because the unmasked parts will be overwritten by fields.
8008            // Write the fields.
8009            self.0.encode(encoder, offset + 0, depth)?;
8010            Ok(())
8011        }
8012    }
8013
8014    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8015        for RouteSetV4AddRouteRequest
8016    {
8017        #[inline(always)]
8018        fn new_empty() -> Self {
8019            Self {
8020                route: fidl::new_empty!(
8021                    fdomain_fuchsia_net_routes::RouteV4,
8022                    fdomain_client::fidl::FDomainResourceDialect
8023                ),
8024            }
8025        }
8026
8027        #[inline]
8028        unsafe fn decode(
8029            &mut self,
8030            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8031            offset: usize,
8032            _depth: fidl::encoding::Depth,
8033        ) -> fidl::Result<()> {
8034            decoder.debug_check_bounds::<Self>(offset);
8035            // Verify that padding bytes are zero.
8036            fidl::decode!(
8037                fdomain_fuchsia_net_routes::RouteV4,
8038                fdomain_client::fidl::FDomainResourceDialect,
8039                &mut self.route,
8040                decoder,
8041                offset + 0,
8042                _depth
8043            )?;
8044            Ok(())
8045        }
8046    }
8047
8048    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
8049        type Borrowed<'a> = &'a mut Self;
8050        fn take_or_borrow<'a>(
8051            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8052        ) -> Self::Borrowed<'a> {
8053            value
8054        }
8055    }
8056
8057    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
8058        type Owned = Self;
8059
8060        #[inline(always)]
8061        fn inline_align(_context: fidl::encoding::Context) -> usize {
8062            8
8063        }
8064
8065        #[inline(always)]
8066        fn inline_size(_context: fidl::encoding::Context) -> usize {
8067            16
8068        }
8069    }
8070
8071    unsafe impl
8072        fidl::encoding::Encode<
8073            RouteSetV4AuthenticateForInterfaceRequest,
8074            fdomain_client::fidl::FDomainResourceDialect,
8075        > for &mut RouteSetV4AuthenticateForInterfaceRequest
8076    {
8077        #[inline]
8078        unsafe fn encode(
8079            self,
8080            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8081            offset: usize,
8082            _depth: fidl::encoding::Depth,
8083        ) -> fidl::Result<()> {
8084            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
8085            // Delegate to tuple encoding.
8086            fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8087                (
8088                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8089                ),
8090                encoder, offset, _depth
8091            )
8092        }
8093    }
8094    unsafe impl<
8095        T0: fidl::encoding::Encode<
8096                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8097                fdomain_client::fidl::FDomainResourceDialect,
8098            >,
8099    >
8100        fidl::encoding::Encode<
8101            RouteSetV4AuthenticateForInterfaceRequest,
8102            fdomain_client::fidl::FDomainResourceDialect,
8103        > for (T0,)
8104    {
8105        #[inline]
8106        unsafe fn encode(
8107            self,
8108            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8109            offset: usize,
8110            depth: fidl::encoding::Depth,
8111        ) -> fidl::Result<()> {
8112            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
8113            // Zero out padding regions. There's no need to apply masks
8114            // because the unmasked parts will be overwritten by fields.
8115            // Write the fields.
8116            self.0.encode(encoder, offset + 0, depth)?;
8117            Ok(())
8118        }
8119    }
8120
8121    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8122        for RouteSetV4AuthenticateForInterfaceRequest
8123    {
8124        #[inline(always)]
8125        fn new_empty() -> Self {
8126            Self {
8127                credential: fidl::new_empty!(
8128                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8129                    fdomain_client::fidl::FDomainResourceDialect
8130                ),
8131            }
8132        }
8133
8134        #[inline]
8135        unsafe fn decode(
8136            &mut self,
8137            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8138            offset: usize,
8139            _depth: fidl::encoding::Depth,
8140        ) -> fidl::Result<()> {
8141            decoder.debug_check_bounds::<Self>(offset);
8142            // Verify that padding bytes are zero.
8143            fidl::decode!(
8144                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8145                fdomain_client::fidl::FDomainResourceDialect,
8146                &mut self.credential,
8147                decoder,
8148                offset + 0,
8149                _depth
8150            )?;
8151            Ok(())
8152        }
8153    }
8154
8155    impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
8156        type Borrowed<'a> = &'a mut Self;
8157        fn take_or_borrow<'a>(
8158            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8159        ) -> Self::Borrowed<'a> {
8160            value
8161        }
8162    }
8163
8164    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
8165        type Owned = Self;
8166
8167        #[inline(always)]
8168        fn inline_align(_context: fidl::encoding::Context) -> usize {
8169            8
8170        }
8171
8172        #[inline(always)]
8173        fn inline_size(_context: fidl::encoding::Context) -> usize {
8174            40
8175        }
8176    }
8177
8178    unsafe impl
8179        fidl::encoding::Encode<
8180            RouteSetV4RemoveRouteRequest,
8181            fdomain_client::fidl::FDomainResourceDialect,
8182        > for &mut RouteSetV4RemoveRouteRequest
8183    {
8184        #[inline]
8185        unsafe fn encode(
8186            self,
8187            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8188            offset: usize,
8189            _depth: fidl::encoding::Depth,
8190        ) -> fidl::Result<()> {
8191            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
8192            // Delegate to tuple encoding.
8193            fidl::encoding::Encode::<
8194                RouteSetV4RemoveRouteRequest,
8195                fdomain_client::fidl::FDomainResourceDialect,
8196            >::encode(
8197                (<fdomain_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
8198                    &self.route,
8199                ),),
8200                encoder,
8201                offset,
8202                _depth,
8203            )
8204        }
8205    }
8206    unsafe impl<
8207        T0: fidl::encoding::Encode<
8208                fdomain_fuchsia_net_routes::RouteV4,
8209                fdomain_client::fidl::FDomainResourceDialect,
8210            >,
8211    >
8212        fidl::encoding::Encode<
8213            RouteSetV4RemoveRouteRequest,
8214            fdomain_client::fidl::FDomainResourceDialect,
8215        > for (T0,)
8216    {
8217        #[inline]
8218        unsafe fn encode(
8219            self,
8220            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8221            offset: usize,
8222            depth: fidl::encoding::Depth,
8223        ) -> fidl::Result<()> {
8224            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
8225            // Zero out padding regions. There's no need to apply masks
8226            // because the unmasked parts will be overwritten by fields.
8227            // Write the fields.
8228            self.0.encode(encoder, offset + 0, depth)?;
8229            Ok(())
8230        }
8231    }
8232
8233    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8234        for RouteSetV4RemoveRouteRequest
8235    {
8236        #[inline(always)]
8237        fn new_empty() -> Self {
8238            Self {
8239                route: fidl::new_empty!(
8240                    fdomain_fuchsia_net_routes::RouteV4,
8241                    fdomain_client::fidl::FDomainResourceDialect
8242                ),
8243            }
8244        }
8245
8246        #[inline]
8247        unsafe fn decode(
8248            &mut self,
8249            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8250            offset: usize,
8251            _depth: fidl::encoding::Depth,
8252        ) -> fidl::Result<()> {
8253            decoder.debug_check_bounds::<Self>(offset);
8254            // Verify that padding bytes are zero.
8255            fidl::decode!(
8256                fdomain_fuchsia_net_routes::RouteV4,
8257                fdomain_client::fidl::FDomainResourceDialect,
8258                &mut self.route,
8259                decoder,
8260                offset + 0,
8261                _depth
8262            )?;
8263            Ok(())
8264        }
8265    }
8266
8267    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
8268        type Borrowed<'a> = &'a mut Self;
8269        fn take_or_borrow<'a>(
8270            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8271        ) -> Self::Borrowed<'a> {
8272            value
8273        }
8274    }
8275
8276    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
8277        type Owned = Self;
8278
8279        #[inline(always)]
8280        fn inline_align(_context: fidl::encoding::Context) -> usize {
8281            8
8282        }
8283
8284        #[inline(always)]
8285        fn inline_size(_context: fidl::encoding::Context) -> usize {
8286            56
8287        }
8288    }
8289
8290    unsafe impl
8291        fidl::encoding::Encode<
8292            RouteSetV6AddRouteRequest,
8293            fdomain_client::fidl::FDomainResourceDialect,
8294        > for &mut RouteSetV6AddRouteRequest
8295    {
8296        #[inline]
8297        unsafe fn encode(
8298            self,
8299            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8300            offset: usize,
8301            _depth: fidl::encoding::Depth,
8302        ) -> fidl::Result<()> {
8303            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
8304            // Delegate to tuple encoding.
8305            fidl::encoding::Encode::<
8306                RouteSetV6AddRouteRequest,
8307                fdomain_client::fidl::FDomainResourceDialect,
8308            >::encode(
8309                (<fdomain_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
8310                    &self.route,
8311                ),),
8312                encoder,
8313                offset,
8314                _depth,
8315            )
8316        }
8317    }
8318    unsafe impl<
8319        T0: fidl::encoding::Encode<
8320                fdomain_fuchsia_net_routes::RouteV6,
8321                fdomain_client::fidl::FDomainResourceDialect,
8322            >,
8323    >
8324        fidl::encoding::Encode<
8325            RouteSetV6AddRouteRequest,
8326            fdomain_client::fidl::FDomainResourceDialect,
8327        > for (T0,)
8328    {
8329        #[inline]
8330        unsafe fn encode(
8331            self,
8332            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8333            offset: usize,
8334            depth: fidl::encoding::Depth,
8335        ) -> fidl::Result<()> {
8336            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
8337            // Zero out padding regions. There's no need to apply masks
8338            // because the unmasked parts will be overwritten by fields.
8339            // Write the fields.
8340            self.0.encode(encoder, offset + 0, depth)?;
8341            Ok(())
8342        }
8343    }
8344
8345    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8346        for RouteSetV6AddRouteRequest
8347    {
8348        #[inline(always)]
8349        fn new_empty() -> Self {
8350            Self {
8351                route: fidl::new_empty!(
8352                    fdomain_fuchsia_net_routes::RouteV6,
8353                    fdomain_client::fidl::FDomainResourceDialect
8354                ),
8355            }
8356        }
8357
8358        #[inline]
8359        unsafe fn decode(
8360            &mut self,
8361            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8362            offset: usize,
8363            _depth: fidl::encoding::Depth,
8364        ) -> fidl::Result<()> {
8365            decoder.debug_check_bounds::<Self>(offset);
8366            // Verify that padding bytes are zero.
8367            fidl::decode!(
8368                fdomain_fuchsia_net_routes::RouteV6,
8369                fdomain_client::fidl::FDomainResourceDialect,
8370                &mut self.route,
8371                decoder,
8372                offset + 0,
8373                _depth
8374            )?;
8375            Ok(())
8376        }
8377    }
8378
8379    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
8380        type Borrowed<'a> = &'a mut Self;
8381        fn take_or_borrow<'a>(
8382            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8383        ) -> Self::Borrowed<'a> {
8384            value
8385        }
8386    }
8387
8388    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
8389        type Owned = Self;
8390
8391        #[inline(always)]
8392        fn inline_align(_context: fidl::encoding::Context) -> usize {
8393            8
8394        }
8395
8396        #[inline(always)]
8397        fn inline_size(_context: fidl::encoding::Context) -> usize {
8398            16
8399        }
8400    }
8401
8402    unsafe impl
8403        fidl::encoding::Encode<
8404            RouteSetV6AuthenticateForInterfaceRequest,
8405            fdomain_client::fidl::FDomainResourceDialect,
8406        > for &mut RouteSetV6AuthenticateForInterfaceRequest
8407    {
8408        #[inline]
8409        unsafe fn encode(
8410            self,
8411            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8412            offset: usize,
8413            _depth: fidl::encoding::Depth,
8414        ) -> fidl::Result<()> {
8415            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
8416            // Delegate to tuple encoding.
8417            fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8418                (
8419                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8420                ),
8421                encoder, offset, _depth
8422            )
8423        }
8424    }
8425    unsafe impl<
8426        T0: fidl::encoding::Encode<
8427                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8428                fdomain_client::fidl::FDomainResourceDialect,
8429            >,
8430    >
8431        fidl::encoding::Encode<
8432            RouteSetV6AuthenticateForInterfaceRequest,
8433            fdomain_client::fidl::FDomainResourceDialect,
8434        > for (T0,)
8435    {
8436        #[inline]
8437        unsafe fn encode(
8438            self,
8439            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8440            offset: usize,
8441            depth: fidl::encoding::Depth,
8442        ) -> fidl::Result<()> {
8443            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
8444            // Zero out padding regions. There's no need to apply masks
8445            // because the unmasked parts will be overwritten by fields.
8446            // Write the fields.
8447            self.0.encode(encoder, offset + 0, depth)?;
8448            Ok(())
8449        }
8450    }
8451
8452    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8453        for RouteSetV6AuthenticateForInterfaceRequest
8454    {
8455        #[inline(always)]
8456        fn new_empty() -> Self {
8457            Self {
8458                credential: fidl::new_empty!(
8459                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8460                    fdomain_client::fidl::FDomainResourceDialect
8461                ),
8462            }
8463        }
8464
8465        #[inline]
8466        unsafe fn decode(
8467            &mut self,
8468            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8469            offset: usize,
8470            _depth: fidl::encoding::Depth,
8471        ) -> fidl::Result<()> {
8472            decoder.debug_check_bounds::<Self>(offset);
8473            // Verify that padding bytes are zero.
8474            fidl::decode!(
8475                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8476                fdomain_client::fidl::FDomainResourceDialect,
8477                &mut self.credential,
8478                decoder,
8479                offset + 0,
8480                _depth
8481            )?;
8482            Ok(())
8483        }
8484    }
8485
8486    impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
8487        type Borrowed<'a> = &'a mut Self;
8488        fn take_or_borrow<'a>(
8489            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8490        ) -> Self::Borrowed<'a> {
8491            value
8492        }
8493    }
8494
8495    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
8496        type Owned = Self;
8497
8498        #[inline(always)]
8499        fn inline_align(_context: fidl::encoding::Context) -> usize {
8500            8
8501        }
8502
8503        #[inline(always)]
8504        fn inline_size(_context: fidl::encoding::Context) -> usize {
8505            56
8506        }
8507    }
8508
8509    unsafe impl
8510        fidl::encoding::Encode<
8511            RouteSetV6RemoveRouteRequest,
8512            fdomain_client::fidl::FDomainResourceDialect,
8513        > for &mut RouteSetV6RemoveRouteRequest
8514    {
8515        #[inline]
8516        unsafe fn encode(
8517            self,
8518            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8519            offset: usize,
8520            _depth: fidl::encoding::Depth,
8521        ) -> fidl::Result<()> {
8522            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
8523            // Delegate to tuple encoding.
8524            fidl::encoding::Encode::<
8525                RouteSetV6RemoveRouteRequest,
8526                fdomain_client::fidl::FDomainResourceDialect,
8527            >::encode(
8528                (<fdomain_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
8529                    &self.route,
8530                ),),
8531                encoder,
8532                offset,
8533                _depth,
8534            )
8535        }
8536    }
8537    unsafe impl<
8538        T0: fidl::encoding::Encode<
8539                fdomain_fuchsia_net_routes::RouteV6,
8540                fdomain_client::fidl::FDomainResourceDialect,
8541            >,
8542    >
8543        fidl::encoding::Encode<
8544            RouteSetV6RemoveRouteRequest,
8545            fdomain_client::fidl::FDomainResourceDialect,
8546        > for (T0,)
8547    {
8548        #[inline]
8549        unsafe fn encode(
8550            self,
8551            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8552            offset: usize,
8553            depth: fidl::encoding::Depth,
8554        ) -> fidl::Result<()> {
8555            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
8556            // Zero out padding regions. There's no need to apply masks
8557            // because the unmasked parts will be overwritten by fields.
8558            // Write the fields.
8559            self.0.encode(encoder, offset + 0, depth)?;
8560            Ok(())
8561        }
8562    }
8563
8564    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8565        for RouteSetV6RemoveRouteRequest
8566    {
8567        #[inline(always)]
8568        fn new_empty() -> Self {
8569            Self {
8570                route: fidl::new_empty!(
8571                    fdomain_fuchsia_net_routes::RouteV6,
8572                    fdomain_client::fidl::FDomainResourceDialect
8573                ),
8574            }
8575        }
8576
8577        #[inline]
8578        unsafe fn decode(
8579            &mut self,
8580            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8581            offset: usize,
8582            _depth: fidl::encoding::Depth,
8583        ) -> fidl::Result<()> {
8584            decoder.debug_check_bounds::<Self>(offset);
8585            // Verify that padding bytes are zero.
8586            fidl::decode!(
8587                fdomain_fuchsia_net_routes::RouteV6,
8588                fdomain_client::fidl::FDomainResourceDialect,
8589                &mut self.route,
8590                decoder,
8591                offset + 0,
8592                _depth
8593            )?;
8594            Ok(())
8595        }
8596    }
8597
8598    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
8599        type Borrowed<'a> = &'a mut Self;
8600        fn take_or_borrow<'a>(
8601            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8602        ) -> Self::Borrowed<'a> {
8603            value
8604        }
8605    }
8606
8607    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
8608        type Owned = Self;
8609
8610        #[inline(always)]
8611        fn inline_align(_context: fidl::encoding::Context) -> usize {
8612            8
8613        }
8614
8615        #[inline(always)]
8616        fn inline_size(_context: fidl::encoding::Context) -> usize {
8617            16
8618        }
8619    }
8620
8621    unsafe impl
8622        fidl::encoding::Encode<
8623            RouteTableProviderV4GetInterfaceLocalTableRequest,
8624            fdomain_client::fidl::FDomainResourceDialect,
8625        > for &mut RouteTableProviderV4GetInterfaceLocalTableRequest
8626    {
8627        #[inline]
8628        unsafe fn encode(
8629            self,
8630            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8631            offset: usize,
8632            _depth: fidl::encoding::Depth,
8633        ) -> fidl::Result<()> {
8634            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
8635            // Delegate to tuple encoding.
8636            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8637                (
8638                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8639                ),
8640                encoder, offset, _depth
8641            )
8642        }
8643    }
8644    unsafe impl<
8645        T0: fidl::encoding::Encode<
8646                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8647                fdomain_client::fidl::FDomainResourceDialect,
8648            >,
8649    >
8650        fidl::encoding::Encode<
8651            RouteTableProviderV4GetInterfaceLocalTableRequest,
8652            fdomain_client::fidl::FDomainResourceDialect,
8653        > for (T0,)
8654    {
8655        #[inline]
8656        unsafe fn encode(
8657            self,
8658            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8659            offset: usize,
8660            depth: fidl::encoding::Depth,
8661        ) -> fidl::Result<()> {
8662            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
8663            // Zero out padding regions. There's no need to apply masks
8664            // because the unmasked parts will be overwritten by fields.
8665            // Write the fields.
8666            self.0.encode(encoder, offset + 0, depth)?;
8667            Ok(())
8668        }
8669    }
8670
8671    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8672        for RouteTableProviderV4GetInterfaceLocalTableRequest
8673    {
8674        #[inline(always)]
8675        fn new_empty() -> Self {
8676            Self {
8677                credential: fidl::new_empty!(
8678                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8679                    fdomain_client::fidl::FDomainResourceDialect
8680                ),
8681            }
8682        }
8683
8684        #[inline]
8685        unsafe fn decode(
8686            &mut self,
8687            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8688            offset: usize,
8689            _depth: fidl::encoding::Depth,
8690        ) -> fidl::Result<()> {
8691            decoder.debug_check_bounds::<Self>(offset);
8692            // Verify that padding bytes are zero.
8693            fidl::decode!(
8694                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8695                fdomain_client::fidl::FDomainResourceDialect,
8696                &mut self.credential,
8697                decoder,
8698                offset + 0,
8699                _depth
8700            )?;
8701            Ok(())
8702        }
8703    }
8704
8705    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
8706        type Borrowed<'a> = &'a mut Self;
8707        fn take_or_borrow<'a>(
8708            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8709        ) -> Self::Borrowed<'a> {
8710            value
8711        }
8712    }
8713
8714    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
8715        type Owned = Self;
8716
8717        #[inline(always)]
8718        fn inline_align(_context: fidl::encoding::Context) -> usize {
8719            8
8720        }
8721
8722        #[inline(always)]
8723        fn inline_size(_context: fidl::encoding::Context) -> usize {
8724            24
8725        }
8726    }
8727
8728    unsafe impl
8729        fidl::encoding::Encode<
8730            RouteTableProviderV4NewRouteTableRequest,
8731            fdomain_client::fidl::FDomainResourceDialect,
8732        > for &mut RouteTableProviderV4NewRouteTableRequest
8733    {
8734        #[inline]
8735        unsafe fn encode(
8736            self,
8737            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8738            offset: usize,
8739            _depth: fidl::encoding::Depth,
8740        ) -> fidl::Result<()> {
8741            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
8742            // Delegate to tuple encoding.
8743            fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8744                (
8745                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
8746                    <RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
8747                ),
8748                encoder, offset, _depth
8749            )
8750        }
8751    }
8752    unsafe impl<
8753        T0: fidl::encoding::Encode<
8754                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8755                fdomain_client::fidl::FDomainResourceDialect,
8756            >,
8757        T1: fidl::encoding::Encode<RouteTableOptionsV4, fdomain_client::fidl::FDomainResourceDialect>,
8758    >
8759        fidl::encoding::Encode<
8760            RouteTableProviderV4NewRouteTableRequest,
8761            fdomain_client::fidl::FDomainResourceDialect,
8762        > for (T0, T1)
8763    {
8764        #[inline]
8765        unsafe fn encode(
8766            self,
8767            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8768            offset: usize,
8769            depth: fidl::encoding::Depth,
8770        ) -> fidl::Result<()> {
8771            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
8772            // Zero out padding regions. There's no need to apply masks
8773            // because the unmasked parts will be overwritten by fields.
8774            unsafe {
8775                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8776                (ptr as *mut u64).write_unaligned(0);
8777            }
8778            // Write the fields.
8779            self.0.encode(encoder, offset + 0, depth)?;
8780            self.1.encode(encoder, offset + 8, depth)?;
8781            Ok(())
8782        }
8783    }
8784
8785    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8786        for RouteTableProviderV4NewRouteTableRequest
8787    {
8788        #[inline(always)]
8789        fn new_empty() -> Self {
8790            Self {
8791                provider: fidl::new_empty!(
8792                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8793                    fdomain_client::fidl::FDomainResourceDialect
8794                ),
8795                options: fidl::new_empty!(
8796                    RouteTableOptionsV4,
8797                    fdomain_client::fidl::FDomainResourceDialect
8798                ),
8799            }
8800        }
8801
8802        #[inline]
8803        unsafe fn decode(
8804            &mut self,
8805            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8806            offset: usize,
8807            _depth: fidl::encoding::Depth,
8808        ) -> fidl::Result<()> {
8809            decoder.debug_check_bounds::<Self>(offset);
8810            // Verify that padding bytes are zero.
8811            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8812            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8813            let mask = 0xffffffff00000000u64;
8814            let maskedval = padval & mask;
8815            if maskedval != 0 {
8816                return Err(fidl::Error::NonZeroPadding {
8817                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8818                });
8819            }
8820            fidl::decode!(
8821                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8822                fdomain_client::fidl::FDomainResourceDialect,
8823                &mut self.provider,
8824                decoder,
8825                offset + 0,
8826                _depth
8827            )?;
8828            fidl::decode!(
8829                RouteTableOptionsV4,
8830                fdomain_client::fidl::FDomainResourceDialect,
8831                &mut self.options,
8832                decoder,
8833                offset + 8,
8834                _depth
8835            )?;
8836            Ok(())
8837        }
8838    }
8839
8840    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
8841        type Borrowed<'a> = &'a mut Self;
8842        fn take_or_borrow<'a>(
8843            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8844        ) -> Self::Borrowed<'a> {
8845            value
8846        }
8847    }
8848
8849    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
8850        type Owned = Self;
8851
8852        #[inline(always)]
8853        fn inline_align(_context: fidl::encoding::Context) -> usize {
8854            4
8855        }
8856
8857        #[inline(always)]
8858        fn inline_size(_context: fidl::encoding::Context) -> usize {
8859            4
8860        }
8861    }
8862
8863    unsafe impl
8864        fidl::encoding::Encode<
8865            RouteTableProviderV4GetInterfaceLocalTableResponse,
8866            fdomain_client::fidl::FDomainResourceDialect,
8867        > for &mut RouteTableProviderV4GetInterfaceLocalTableResponse
8868    {
8869        #[inline]
8870        unsafe fn encode(
8871            self,
8872            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8873            offset: usize,
8874            _depth: fidl::encoding::Depth,
8875        ) -> fidl::Result<()> {
8876            encoder
8877                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
8878            // Delegate to tuple encoding.
8879            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
8880                (
8881                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
8882                ),
8883                encoder, offset, _depth
8884            )
8885        }
8886    }
8887    unsafe impl<
8888        T0: fidl::encoding::Encode<
8889                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
8890                fdomain_client::fidl::FDomainResourceDialect,
8891            >,
8892    >
8893        fidl::encoding::Encode<
8894            RouteTableProviderV4GetInterfaceLocalTableResponse,
8895            fdomain_client::fidl::FDomainResourceDialect,
8896        > for (T0,)
8897    {
8898        #[inline]
8899        unsafe fn encode(
8900            self,
8901            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8902            offset: usize,
8903            depth: fidl::encoding::Depth,
8904        ) -> fidl::Result<()> {
8905            encoder
8906                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
8907            // Zero out padding regions. There's no need to apply masks
8908            // because the unmasked parts will be overwritten by fields.
8909            // Write the fields.
8910            self.0.encode(encoder, offset + 0, depth)?;
8911            Ok(())
8912        }
8913    }
8914
8915    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8916        for RouteTableProviderV4GetInterfaceLocalTableResponse
8917    {
8918        #[inline(always)]
8919        fn new_empty() -> Self {
8920            Self {
8921                route_table: fidl::new_empty!(
8922                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
8923                    fdomain_client::fidl::FDomainResourceDialect
8924                ),
8925            }
8926        }
8927
8928        #[inline]
8929        unsafe fn decode(
8930            &mut self,
8931            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8932            offset: usize,
8933            _depth: fidl::encoding::Depth,
8934        ) -> fidl::Result<()> {
8935            decoder.debug_check_bounds::<Self>(offset);
8936            // Verify that padding bytes are zero.
8937            fidl::decode!(
8938                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
8939                fdomain_client::fidl::FDomainResourceDialect,
8940                &mut self.route_table,
8941                decoder,
8942                offset + 0,
8943                _depth
8944            )?;
8945            Ok(())
8946        }
8947    }
8948
8949    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
8950        type Borrowed<'a> = &'a mut Self;
8951        fn take_or_borrow<'a>(
8952            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8953        ) -> Self::Borrowed<'a> {
8954            value
8955        }
8956    }
8957
8958    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
8959        type Owned = Self;
8960
8961        #[inline(always)]
8962        fn inline_align(_context: fidl::encoding::Context) -> usize {
8963            8
8964        }
8965
8966        #[inline(always)]
8967        fn inline_size(_context: fidl::encoding::Context) -> usize {
8968            16
8969        }
8970    }
8971
8972    unsafe impl
8973        fidl::encoding::Encode<
8974            RouteTableProviderV6GetInterfaceLocalTableRequest,
8975            fdomain_client::fidl::FDomainResourceDialect,
8976        > for &mut RouteTableProviderV6GetInterfaceLocalTableRequest
8977    {
8978        #[inline]
8979        unsafe fn encode(
8980            self,
8981            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8982            offset: usize,
8983            _depth: fidl::encoding::Depth,
8984        ) -> fidl::Result<()> {
8985            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
8986            // Delegate to tuple encoding.
8987            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8988                (
8989                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8990                ),
8991                encoder, offset, _depth
8992            )
8993        }
8994    }
8995    unsafe impl<
8996        T0: fidl::encoding::Encode<
8997                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8998                fdomain_client::fidl::FDomainResourceDialect,
8999            >,
9000    >
9001        fidl::encoding::Encode<
9002            RouteTableProviderV6GetInterfaceLocalTableRequest,
9003            fdomain_client::fidl::FDomainResourceDialect,
9004        > for (T0,)
9005    {
9006        #[inline]
9007        unsafe fn encode(
9008            self,
9009            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9010            offset: usize,
9011            depth: fidl::encoding::Depth,
9012        ) -> fidl::Result<()> {
9013            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
9014            // Zero out padding regions. There's no need to apply masks
9015            // because the unmasked parts will be overwritten by fields.
9016            // Write the fields.
9017            self.0.encode(encoder, offset + 0, depth)?;
9018            Ok(())
9019        }
9020    }
9021
9022    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9023        for RouteTableProviderV6GetInterfaceLocalTableRequest
9024    {
9025        #[inline(always)]
9026        fn new_empty() -> Self {
9027            Self {
9028                credential: fidl::new_empty!(
9029                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9030                    fdomain_client::fidl::FDomainResourceDialect
9031                ),
9032            }
9033        }
9034
9035        #[inline]
9036        unsafe fn decode(
9037            &mut self,
9038            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9039            offset: usize,
9040            _depth: fidl::encoding::Depth,
9041        ) -> fidl::Result<()> {
9042            decoder.debug_check_bounds::<Self>(offset);
9043            // Verify that padding bytes are zero.
9044            fidl::decode!(
9045                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9046                fdomain_client::fidl::FDomainResourceDialect,
9047                &mut self.credential,
9048                decoder,
9049                offset + 0,
9050                _depth
9051            )?;
9052            Ok(())
9053        }
9054    }
9055
9056    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
9057        type Borrowed<'a> = &'a mut Self;
9058        fn take_or_borrow<'a>(
9059            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9060        ) -> Self::Borrowed<'a> {
9061            value
9062        }
9063    }
9064
9065    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
9066        type Owned = Self;
9067
9068        #[inline(always)]
9069        fn inline_align(_context: fidl::encoding::Context) -> usize {
9070            8
9071        }
9072
9073        #[inline(always)]
9074        fn inline_size(_context: fidl::encoding::Context) -> usize {
9075            24
9076        }
9077    }
9078
9079    unsafe impl
9080        fidl::encoding::Encode<
9081            RouteTableProviderV6NewRouteTableRequest,
9082            fdomain_client::fidl::FDomainResourceDialect,
9083        > for &mut RouteTableProviderV6NewRouteTableRequest
9084    {
9085        #[inline]
9086        unsafe fn encode(
9087            self,
9088            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9089            offset: usize,
9090            _depth: fidl::encoding::Depth,
9091        ) -> fidl::Result<()> {
9092            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
9093            // Delegate to tuple encoding.
9094            fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9095                (
9096                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
9097                    <RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9098                ),
9099                encoder, offset, _depth
9100            )
9101        }
9102    }
9103    unsafe impl<
9104        T0: fidl::encoding::Encode<
9105                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9106                fdomain_client::fidl::FDomainResourceDialect,
9107            >,
9108        T1: fidl::encoding::Encode<RouteTableOptionsV6, fdomain_client::fidl::FDomainResourceDialect>,
9109    >
9110        fidl::encoding::Encode<
9111            RouteTableProviderV6NewRouteTableRequest,
9112            fdomain_client::fidl::FDomainResourceDialect,
9113        > for (T0, T1)
9114    {
9115        #[inline]
9116        unsafe fn encode(
9117            self,
9118            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9119            offset: usize,
9120            depth: fidl::encoding::Depth,
9121        ) -> fidl::Result<()> {
9122            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
9123            // Zero out padding regions. There's no need to apply masks
9124            // because the unmasked parts will be overwritten by fields.
9125            unsafe {
9126                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9127                (ptr as *mut u64).write_unaligned(0);
9128            }
9129            // Write the fields.
9130            self.0.encode(encoder, offset + 0, depth)?;
9131            self.1.encode(encoder, offset + 8, depth)?;
9132            Ok(())
9133        }
9134    }
9135
9136    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9137        for RouteTableProviderV6NewRouteTableRequest
9138    {
9139        #[inline(always)]
9140        fn new_empty() -> Self {
9141            Self {
9142                provider: fidl::new_empty!(
9143                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9144                    fdomain_client::fidl::FDomainResourceDialect
9145                ),
9146                options: fidl::new_empty!(
9147                    RouteTableOptionsV6,
9148                    fdomain_client::fidl::FDomainResourceDialect
9149                ),
9150            }
9151        }
9152
9153        #[inline]
9154        unsafe fn decode(
9155            &mut self,
9156            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9157            offset: usize,
9158            _depth: fidl::encoding::Depth,
9159        ) -> fidl::Result<()> {
9160            decoder.debug_check_bounds::<Self>(offset);
9161            // Verify that padding bytes are zero.
9162            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9163            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9164            let mask = 0xffffffff00000000u64;
9165            let maskedval = padval & mask;
9166            if maskedval != 0 {
9167                return Err(fidl::Error::NonZeroPadding {
9168                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9169                });
9170            }
9171            fidl::decode!(
9172                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9173                fdomain_client::fidl::FDomainResourceDialect,
9174                &mut self.provider,
9175                decoder,
9176                offset + 0,
9177                _depth
9178            )?;
9179            fidl::decode!(
9180                RouteTableOptionsV6,
9181                fdomain_client::fidl::FDomainResourceDialect,
9182                &mut self.options,
9183                decoder,
9184                offset + 8,
9185                _depth
9186            )?;
9187            Ok(())
9188        }
9189    }
9190
9191    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
9192        type Borrowed<'a> = &'a mut Self;
9193        fn take_or_borrow<'a>(
9194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9195        ) -> Self::Borrowed<'a> {
9196            value
9197        }
9198    }
9199
9200    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
9201        type Owned = Self;
9202
9203        #[inline(always)]
9204        fn inline_align(_context: fidl::encoding::Context) -> usize {
9205            4
9206        }
9207
9208        #[inline(always)]
9209        fn inline_size(_context: fidl::encoding::Context) -> usize {
9210            4
9211        }
9212    }
9213
9214    unsafe impl
9215        fidl::encoding::Encode<
9216            RouteTableProviderV6GetInterfaceLocalTableResponse,
9217            fdomain_client::fidl::FDomainResourceDialect,
9218        > for &mut RouteTableProviderV6GetInterfaceLocalTableResponse
9219    {
9220        #[inline]
9221        unsafe fn encode(
9222            self,
9223            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9224            offset: usize,
9225            _depth: fidl::encoding::Depth,
9226        ) -> fidl::Result<()> {
9227            encoder
9228                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
9229            // Delegate to tuple encoding.
9230            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
9231                (
9232                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
9233                ),
9234                encoder, offset, _depth
9235            )
9236        }
9237    }
9238    unsafe impl<
9239        T0: fidl::encoding::Encode<
9240                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9241                fdomain_client::fidl::FDomainResourceDialect,
9242            >,
9243    >
9244        fidl::encoding::Encode<
9245            RouteTableProviderV6GetInterfaceLocalTableResponse,
9246            fdomain_client::fidl::FDomainResourceDialect,
9247        > for (T0,)
9248    {
9249        #[inline]
9250        unsafe fn encode(
9251            self,
9252            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9253            offset: usize,
9254            depth: fidl::encoding::Depth,
9255        ) -> fidl::Result<()> {
9256            encoder
9257                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
9258            // Zero out padding regions. There's no need to apply masks
9259            // because the unmasked parts will be overwritten by fields.
9260            // Write the fields.
9261            self.0.encode(encoder, offset + 0, depth)?;
9262            Ok(())
9263        }
9264    }
9265
9266    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9267        for RouteTableProviderV6GetInterfaceLocalTableResponse
9268    {
9269        #[inline(always)]
9270        fn new_empty() -> Self {
9271            Self {
9272                route_table: fidl::new_empty!(
9273                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9274                    fdomain_client::fidl::FDomainResourceDialect
9275                ),
9276            }
9277        }
9278
9279        #[inline]
9280        unsafe fn decode(
9281            &mut self,
9282            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9283            offset: usize,
9284            _depth: fidl::encoding::Depth,
9285        ) -> fidl::Result<()> {
9286            decoder.debug_check_bounds::<Self>(offset);
9287            // Verify that padding bytes are zero.
9288            fidl::decode!(
9289                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9290                fdomain_client::fidl::FDomainResourceDialect,
9291                &mut self.route_table,
9292                decoder,
9293                offset + 0,
9294                _depth
9295            )?;
9296            Ok(())
9297        }
9298    }
9299
9300    impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
9301        type Borrowed<'a> = &'a mut Self;
9302        fn take_or_borrow<'a>(
9303            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9304        ) -> Self::Borrowed<'a> {
9305            value
9306        }
9307    }
9308
9309    unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
9310        type Owned = Self;
9311
9312        #[inline(always)]
9313        fn inline_align(_context: fidl::encoding::Context) -> usize {
9314            4
9315        }
9316
9317        #[inline(always)]
9318        fn inline_size(_context: fidl::encoding::Context) -> usize {
9319            4
9320        }
9321    }
9322
9323    unsafe impl
9324        fidl::encoding::Encode<
9325            RouteTableV4NewRouteSetRequest,
9326            fdomain_client::fidl::FDomainResourceDialect,
9327        > for &mut RouteTableV4NewRouteSetRequest
9328    {
9329        #[inline]
9330        unsafe fn encode(
9331            self,
9332            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9333            offset: usize,
9334            _depth: fidl::encoding::Depth,
9335        ) -> fidl::Result<()> {
9336            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
9337            // Delegate to tuple encoding.
9338            fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9339                (
9340                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
9341                ),
9342                encoder, offset, _depth
9343            )
9344        }
9345    }
9346    unsafe impl<
9347        T0: fidl::encoding::Encode<
9348                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9349                fdomain_client::fidl::FDomainResourceDialect,
9350            >,
9351    >
9352        fidl::encoding::Encode<
9353            RouteTableV4NewRouteSetRequest,
9354            fdomain_client::fidl::FDomainResourceDialect,
9355        > for (T0,)
9356    {
9357        #[inline]
9358        unsafe fn encode(
9359            self,
9360            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9361            offset: usize,
9362            depth: fidl::encoding::Depth,
9363        ) -> fidl::Result<()> {
9364            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
9365            // Zero out padding regions. There's no need to apply masks
9366            // because the unmasked parts will be overwritten by fields.
9367            // Write the fields.
9368            self.0.encode(encoder, offset + 0, depth)?;
9369            Ok(())
9370        }
9371    }
9372
9373    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9374        for RouteTableV4NewRouteSetRequest
9375    {
9376        #[inline(always)]
9377        fn new_empty() -> Self {
9378            Self {
9379                route_set: fidl::new_empty!(
9380                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9381                    fdomain_client::fidl::FDomainResourceDialect
9382                ),
9383            }
9384        }
9385
9386        #[inline]
9387        unsafe fn decode(
9388            &mut self,
9389            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9390            offset: usize,
9391            _depth: fidl::encoding::Depth,
9392        ) -> fidl::Result<()> {
9393            decoder.debug_check_bounds::<Self>(offset);
9394            // Verify that padding bytes are zero.
9395            fidl::decode!(
9396                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9397                fdomain_client::fidl::FDomainResourceDialect,
9398                &mut self.route_set,
9399                decoder,
9400                offset + 0,
9401                _depth
9402            )?;
9403            Ok(())
9404        }
9405    }
9406
9407    impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
9408        type Borrowed<'a> = &'a mut Self;
9409        fn take_or_borrow<'a>(
9410            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9411        ) -> Self::Borrowed<'a> {
9412            value
9413        }
9414    }
9415
9416    unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
9417        type Owned = Self;
9418
9419        #[inline(always)]
9420        fn inline_align(_context: fidl::encoding::Context) -> usize {
9421            4
9422        }
9423
9424        #[inline(always)]
9425        fn inline_size(_context: fidl::encoding::Context) -> usize {
9426            4
9427        }
9428    }
9429
9430    unsafe impl
9431        fidl::encoding::Encode<
9432            RouteTableV6NewRouteSetRequest,
9433            fdomain_client::fidl::FDomainResourceDialect,
9434        > for &mut RouteTableV6NewRouteSetRequest
9435    {
9436        #[inline]
9437        unsafe fn encode(
9438            self,
9439            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9440            offset: usize,
9441            _depth: fidl::encoding::Depth,
9442        ) -> fidl::Result<()> {
9443            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
9444            // Delegate to tuple encoding.
9445            fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9446                (
9447                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
9448                ),
9449                encoder, offset, _depth
9450            )
9451        }
9452    }
9453    unsafe impl<
9454        T0: fidl::encoding::Encode<
9455                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9456                fdomain_client::fidl::FDomainResourceDialect,
9457            >,
9458    >
9459        fidl::encoding::Encode<
9460            RouteTableV6NewRouteSetRequest,
9461            fdomain_client::fidl::FDomainResourceDialect,
9462        > for (T0,)
9463    {
9464        #[inline]
9465        unsafe fn encode(
9466            self,
9467            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9468            offset: usize,
9469            depth: fidl::encoding::Depth,
9470        ) -> fidl::Result<()> {
9471            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
9472            // Zero out padding regions. There's no need to apply masks
9473            // because the unmasked parts will be overwritten by fields.
9474            // Write the fields.
9475            self.0.encode(encoder, offset + 0, depth)?;
9476            Ok(())
9477        }
9478    }
9479
9480    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9481        for RouteTableV6NewRouteSetRequest
9482    {
9483        #[inline(always)]
9484        fn new_empty() -> Self {
9485            Self {
9486                route_set: fidl::new_empty!(
9487                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9488                    fdomain_client::fidl::FDomainResourceDialect
9489                ),
9490            }
9491        }
9492
9493        #[inline]
9494        unsafe fn decode(
9495            &mut self,
9496            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9497            offset: usize,
9498            _depth: fidl::encoding::Depth,
9499        ) -> fidl::Result<()> {
9500            decoder.debug_check_bounds::<Self>(offset);
9501            // Verify that padding bytes are zero.
9502            fidl::decode!(
9503                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9504                fdomain_client::fidl::FDomainResourceDialect,
9505                &mut self.route_set,
9506                decoder,
9507                offset + 0,
9508                _depth
9509            )?;
9510            Ok(())
9511        }
9512    }
9513
9514    impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
9515        type Borrowed<'a> = &'a mut Self;
9516        fn take_or_borrow<'a>(
9517            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9518        ) -> Self::Borrowed<'a> {
9519            value
9520        }
9521    }
9522
9523    unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
9524        type Owned = Self;
9525
9526        #[inline(always)]
9527        fn inline_align(_context: fidl::encoding::Context) -> usize {
9528            8
9529        }
9530
9531        #[inline(always)]
9532        fn inline_size(_context: fidl::encoding::Context) -> usize {
9533            40
9534        }
9535    }
9536
9537    unsafe impl
9538        fidl::encoding::Encode<
9539            RuleSetV4AddRuleRequest,
9540            fdomain_client::fidl::FDomainResourceDialect,
9541        > for &mut RuleSetV4AddRuleRequest
9542    {
9543        #[inline]
9544        unsafe fn encode(
9545            self,
9546            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9547            offset: usize,
9548            _depth: fidl::encoding::Depth,
9549        ) -> fidl::Result<()> {
9550            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
9551            // Delegate to tuple encoding.
9552            fidl::encoding::Encode::<RuleSetV4AddRuleRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9553                (
9554                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
9555                    <fdomain_fuchsia_net_routes::RuleMatcherV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
9556                    <fdomain_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
9557                ),
9558                encoder, offset, _depth
9559            )
9560        }
9561    }
9562    unsafe impl<
9563        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9564        T1: fidl::encoding::Encode<
9565                fdomain_fuchsia_net_routes::RuleMatcherV4,
9566                fdomain_client::fidl::FDomainResourceDialect,
9567            >,
9568        T2: fidl::encoding::Encode<
9569                fdomain_fuchsia_net_routes::RuleAction,
9570                fdomain_client::fidl::FDomainResourceDialect,
9571            >,
9572    >
9573        fidl::encoding::Encode<
9574            RuleSetV4AddRuleRequest,
9575            fdomain_client::fidl::FDomainResourceDialect,
9576        > for (T0, T1, T2)
9577    {
9578        #[inline]
9579        unsafe fn encode(
9580            self,
9581            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9582            offset: usize,
9583            depth: fidl::encoding::Depth,
9584        ) -> fidl::Result<()> {
9585            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
9586            // Zero out padding regions. There's no need to apply masks
9587            // because the unmasked parts will be overwritten by fields.
9588            unsafe {
9589                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9590                (ptr as *mut u64).write_unaligned(0);
9591            }
9592            // Write the fields.
9593            self.0.encode(encoder, offset + 0, depth)?;
9594            self.1.encode(encoder, offset + 8, depth)?;
9595            self.2.encode(encoder, offset + 24, depth)?;
9596            Ok(())
9597        }
9598    }
9599
9600    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9601        for RuleSetV4AddRuleRequest
9602    {
9603        #[inline(always)]
9604        fn new_empty() -> Self {
9605            Self {
9606                index: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9607                matcher: fidl::new_empty!(
9608                    fdomain_fuchsia_net_routes::RuleMatcherV4,
9609                    fdomain_client::fidl::FDomainResourceDialect
9610                ),
9611                action: fidl::new_empty!(
9612                    fdomain_fuchsia_net_routes::RuleAction,
9613                    fdomain_client::fidl::FDomainResourceDialect
9614                ),
9615            }
9616        }
9617
9618        #[inline]
9619        unsafe fn decode(
9620            &mut self,
9621            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9622            offset: usize,
9623            _depth: fidl::encoding::Depth,
9624        ) -> fidl::Result<()> {
9625            decoder.debug_check_bounds::<Self>(offset);
9626            // Verify that padding bytes are zero.
9627            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9628            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9629            let mask = 0xffffffff00000000u64;
9630            let maskedval = padval & mask;
9631            if maskedval != 0 {
9632                return Err(fidl::Error::NonZeroPadding {
9633                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9634                });
9635            }
9636            fidl::decode!(
9637                u32,
9638                fdomain_client::fidl::FDomainResourceDialect,
9639                &mut self.index,
9640                decoder,
9641                offset + 0,
9642                _depth
9643            )?;
9644            fidl::decode!(
9645                fdomain_fuchsia_net_routes::RuleMatcherV4,
9646                fdomain_client::fidl::FDomainResourceDialect,
9647                &mut self.matcher,
9648                decoder,
9649                offset + 8,
9650                _depth
9651            )?;
9652            fidl::decode!(
9653                fdomain_fuchsia_net_routes::RuleAction,
9654                fdomain_client::fidl::FDomainResourceDialect,
9655                &mut self.action,
9656                decoder,
9657                offset + 24,
9658                _depth
9659            )?;
9660            Ok(())
9661        }
9662    }
9663
9664    impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
9665        type Borrowed<'a> = &'a mut Self;
9666        fn take_or_borrow<'a>(
9667            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9668        ) -> Self::Borrowed<'a> {
9669            value
9670        }
9671    }
9672
9673    unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
9674        type Owned = Self;
9675
9676        #[inline(always)]
9677        fn inline_align(_context: fidl::encoding::Context) -> usize {
9678            8
9679        }
9680
9681        #[inline(always)]
9682        fn inline_size(_context: fidl::encoding::Context) -> usize {
9683            40
9684        }
9685    }
9686
9687    unsafe impl
9688        fidl::encoding::Encode<
9689            RuleSetV6AddRuleRequest,
9690            fdomain_client::fidl::FDomainResourceDialect,
9691        > for &mut RuleSetV6AddRuleRequest
9692    {
9693        #[inline]
9694        unsafe fn encode(
9695            self,
9696            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9697            offset: usize,
9698            _depth: fidl::encoding::Depth,
9699        ) -> fidl::Result<()> {
9700            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
9701            // Delegate to tuple encoding.
9702            fidl::encoding::Encode::<RuleSetV6AddRuleRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9703                (
9704                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
9705                    <fdomain_fuchsia_net_routes::RuleMatcherV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
9706                    <fdomain_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
9707                ),
9708                encoder, offset, _depth
9709            )
9710        }
9711    }
9712    unsafe impl<
9713        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9714        T1: fidl::encoding::Encode<
9715                fdomain_fuchsia_net_routes::RuleMatcherV6,
9716                fdomain_client::fidl::FDomainResourceDialect,
9717            >,
9718        T2: fidl::encoding::Encode<
9719                fdomain_fuchsia_net_routes::RuleAction,
9720                fdomain_client::fidl::FDomainResourceDialect,
9721            >,
9722    >
9723        fidl::encoding::Encode<
9724            RuleSetV6AddRuleRequest,
9725            fdomain_client::fidl::FDomainResourceDialect,
9726        > for (T0, T1, T2)
9727    {
9728        #[inline]
9729        unsafe fn encode(
9730            self,
9731            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9732            offset: usize,
9733            depth: fidl::encoding::Depth,
9734        ) -> fidl::Result<()> {
9735            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
9736            // Zero out padding regions. There's no need to apply masks
9737            // because the unmasked parts will be overwritten by fields.
9738            unsafe {
9739                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9740                (ptr as *mut u64).write_unaligned(0);
9741            }
9742            // Write the fields.
9743            self.0.encode(encoder, offset + 0, depth)?;
9744            self.1.encode(encoder, offset + 8, depth)?;
9745            self.2.encode(encoder, offset + 24, depth)?;
9746            Ok(())
9747        }
9748    }
9749
9750    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9751        for RuleSetV6AddRuleRequest
9752    {
9753        #[inline(always)]
9754        fn new_empty() -> Self {
9755            Self {
9756                index: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9757                matcher: fidl::new_empty!(
9758                    fdomain_fuchsia_net_routes::RuleMatcherV6,
9759                    fdomain_client::fidl::FDomainResourceDialect
9760                ),
9761                action: fidl::new_empty!(
9762                    fdomain_fuchsia_net_routes::RuleAction,
9763                    fdomain_client::fidl::FDomainResourceDialect
9764                ),
9765            }
9766        }
9767
9768        #[inline]
9769        unsafe fn decode(
9770            &mut self,
9771            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9772            offset: usize,
9773            _depth: fidl::encoding::Depth,
9774        ) -> fidl::Result<()> {
9775            decoder.debug_check_bounds::<Self>(offset);
9776            // Verify that padding bytes are zero.
9777            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9778            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9779            let mask = 0xffffffff00000000u64;
9780            let maskedval = padval & mask;
9781            if maskedval != 0 {
9782                return Err(fidl::Error::NonZeroPadding {
9783                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9784                });
9785            }
9786            fidl::decode!(
9787                u32,
9788                fdomain_client::fidl::FDomainResourceDialect,
9789                &mut self.index,
9790                decoder,
9791                offset + 0,
9792                _depth
9793            )?;
9794            fidl::decode!(
9795                fdomain_fuchsia_net_routes::RuleMatcherV6,
9796                fdomain_client::fidl::FDomainResourceDialect,
9797                &mut self.matcher,
9798                decoder,
9799                offset + 8,
9800                _depth
9801            )?;
9802            fidl::decode!(
9803                fdomain_fuchsia_net_routes::RuleAction,
9804                fdomain_client::fidl::FDomainResourceDialect,
9805                &mut self.action,
9806                decoder,
9807                offset + 24,
9808                _depth
9809            )?;
9810            Ok(())
9811        }
9812    }
9813
9814    impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
9815        type Borrowed<'a> = &'a mut Self;
9816        fn take_or_borrow<'a>(
9817            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9818        ) -> Self::Borrowed<'a> {
9819            value
9820        }
9821    }
9822
9823    unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
9824        type Owned = Self;
9825
9826        #[inline(always)]
9827        fn inline_align(_context: fidl::encoding::Context) -> usize {
9828            4
9829        }
9830
9831        #[inline(always)]
9832        fn inline_size(_context: fidl::encoding::Context) -> usize {
9833            8
9834        }
9835    }
9836
9837    unsafe impl
9838        fidl::encoding::Encode<
9839            RuleTableV4NewRuleSetRequest,
9840            fdomain_client::fidl::FDomainResourceDialect,
9841        > for &mut RuleTableV4NewRuleSetRequest
9842    {
9843        #[inline]
9844        unsafe fn encode(
9845            self,
9846            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9847            offset: usize,
9848            _depth: fidl::encoding::Depth,
9849        ) -> fidl::Result<()> {
9850            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
9851            // Delegate to tuple encoding.
9852            fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9853                (
9854                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
9855                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
9856                ),
9857                encoder, offset, _depth
9858            )
9859        }
9860    }
9861    unsafe impl<
9862        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9863        T1: fidl::encoding::Encode<
9864                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9865                fdomain_client::fidl::FDomainResourceDialect,
9866            >,
9867    >
9868        fidl::encoding::Encode<
9869            RuleTableV4NewRuleSetRequest,
9870            fdomain_client::fidl::FDomainResourceDialect,
9871        > for (T0, T1)
9872    {
9873        #[inline]
9874        unsafe fn encode(
9875            self,
9876            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9877            offset: usize,
9878            depth: fidl::encoding::Depth,
9879        ) -> fidl::Result<()> {
9880            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
9881            // Zero out padding regions. There's no need to apply masks
9882            // because the unmasked parts will be overwritten by fields.
9883            // Write the fields.
9884            self.0.encode(encoder, offset + 0, depth)?;
9885            self.1.encode(encoder, offset + 4, depth)?;
9886            Ok(())
9887        }
9888    }
9889
9890    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9891        for RuleTableV4NewRuleSetRequest
9892    {
9893        #[inline(always)]
9894        fn new_empty() -> Self {
9895            Self {
9896                priority: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9897                rule_set: fidl::new_empty!(
9898                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9899                    fdomain_client::fidl::FDomainResourceDialect
9900                ),
9901            }
9902        }
9903
9904        #[inline]
9905        unsafe fn decode(
9906            &mut self,
9907            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9908            offset: usize,
9909            _depth: fidl::encoding::Depth,
9910        ) -> fidl::Result<()> {
9911            decoder.debug_check_bounds::<Self>(offset);
9912            // Verify that padding bytes are zero.
9913            fidl::decode!(
9914                u32,
9915                fdomain_client::fidl::FDomainResourceDialect,
9916                &mut self.priority,
9917                decoder,
9918                offset + 0,
9919                _depth
9920            )?;
9921            fidl::decode!(
9922                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9923                fdomain_client::fidl::FDomainResourceDialect,
9924                &mut self.rule_set,
9925                decoder,
9926                offset + 4,
9927                _depth
9928            )?;
9929            Ok(())
9930        }
9931    }
9932
9933    impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
9934        type Borrowed<'a> = &'a mut Self;
9935        fn take_or_borrow<'a>(
9936            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9937        ) -> Self::Borrowed<'a> {
9938            value
9939        }
9940    }
9941
9942    unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
9943        type Owned = Self;
9944
9945        #[inline(always)]
9946        fn inline_align(_context: fidl::encoding::Context) -> usize {
9947            4
9948        }
9949
9950        #[inline(always)]
9951        fn inline_size(_context: fidl::encoding::Context) -> usize {
9952            8
9953        }
9954    }
9955
9956    unsafe impl
9957        fidl::encoding::Encode<
9958            RuleTableV6NewRuleSetRequest,
9959            fdomain_client::fidl::FDomainResourceDialect,
9960        > for &mut RuleTableV6NewRuleSetRequest
9961    {
9962        #[inline]
9963        unsafe fn encode(
9964            self,
9965            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9966            offset: usize,
9967            _depth: fidl::encoding::Depth,
9968        ) -> fidl::Result<()> {
9969            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
9970            // Delegate to tuple encoding.
9971            fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9972                (
9973                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
9974                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
9975                ),
9976                encoder, offset, _depth
9977            )
9978        }
9979    }
9980    unsafe impl<
9981        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9982        T1: fidl::encoding::Encode<
9983                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
9984                fdomain_client::fidl::FDomainResourceDialect,
9985            >,
9986    >
9987        fidl::encoding::Encode<
9988            RuleTableV6NewRuleSetRequest,
9989            fdomain_client::fidl::FDomainResourceDialect,
9990        > for (T0, T1)
9991    {
9992        #[inline]
9993        unsafe fn encode(
9994            self,
9995            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9996            offset: usize,
9997            depth: fidl::encoding::Depth,
9998        ) -> fidl::Result<()> {
9999            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
10000            // Zero out padding regions. There's no need to apply masks
10001            // because the unmasked parts will be overwritten by fields.
10002            // Write the fields.
10003            self.0.encode(encoder, offset + 0, depth)?;
10004            self.1.encode(encoder, offset + 4, depth)?;
10005            Ok(())
10006        }
10007    }
10008
10009    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
10010        for RuleTableV6NewRuleSetRequest
10011    {
10012        #[inline(always)]
10013        fn new_empty() -> Self {
10014            Self {
10015                priority: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
10016                rule_set: fidl::new_empty!(
10017                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
10018                    fdomain_client::fidl::FDomainResourceDialect
10019                ),
10020            }
10021        }
10022
10023        #[inline]
10024        unsafe fn decode(
10025            &mut self,
10026            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10027            offset: usize,
10028            _depth: fidl::encoding::Depth,
10029        ) -> fidl::Result<()> {
10030            decoder.debug_check_bounds::<Self>(offset);
10031            // Verify that padding bytes are zero.
10032            fidl::decode!(
10033                u32,
10034                fdomain_client::fidl::FDomainResourceDialect,
10035                &mut self.priority,
10036                decoder,
10037                offset + 0,
10038                _depth
10039            )?;
10040            fidl::decode!(
10041                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
10042                fdomain_client::fidl::FDomainResourceDialect,
10043                &mut self.rule_set,
10044                decoder,
10045                offset + 4,
10046                _depth
10047            )?;
10048            Ok(())
10049        }
10050    }
10051}