1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type Protocol = u8;
13
14pub const SOCKET_PROTOCOL_NAME: &str = "fuchsia.posix.socket.raw/Socket";
15
16#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct Empty;
18
19impl fidl::Persistable for Empty {}
20
21#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct Icmpv6Filter {
25 pub blocked_types: [u32; 8],
33}
34
35impl fidl::Persistable for Icmpv6Filter {}
36
37#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ProviderSocketRequest {
39 pub domain: fidl_fuchsia_posix_socket__common::Domain,
40 pub proto: ProtocolAssociation,
41}
42
43impl fidl::Persistable for ProviderSocketRequest {}
44
45#[derive(Clone, Debug, PartialEq)]
46pub struct ProviderSocketWithOptionsRequest {
47 pub domain: fidl_fuchsia_posix_socket__common::Domain,
48 pub proto: ProtocolAssociation,
49 pub opts: fidl_fuchsia_posix_socket__common::SocketCreationOptions,
50}
51
52impl fidl::Persistable for ProviderSocketWithOptionsRequest {}
53
54#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct SocketRecvMsgRequest {
56 pub want_addr: bool,
57 pub data_len: u32,
58 pub want_control: bool,
59 pub flags: fidl_fuchsia_posix_socket__common::RecvMsgFlags,
60}
61
62impl fidl::Persistable for SocketRecvMsgRequest {}
63
64#[derive(Clone, Debug, PartialEq)]
65pub struct SocketSendMsgRequest {
66 pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
67 pub data: Vec<u8>,
68 pub control: fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
69 pub flags: fidl_fuchsia_posix_socket__common::SendMsgFlags,
70}
71
72impl fidl::Persistable for SocketSendMsgRequest {}
73
74#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75#[repr(C)]
76pub struct SocketSetIcmpv6FilterRequest {
77 pub filter: Icmpv6Filter,
78}
79
80impl fidl::Persistable for SocketSetIcmpv6FilterRequest {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct SocketSetIpHeaderIncludedRequest {
84 pub value: bool,
85}
86
87impl fidl::Persistable for SocketSetIpHeaderIncludedRequest {}
88
89#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct SocketSetIpv6ChecksumRequest {
91 pub config: Ipv6ChecksumConfiguration,
92}
93
94impl fidl::Persistable for SocketSetIpv6ChecksumRequest {}
95
96#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97#[repr(C)]
98pub struct SocketGetIcmpv6FilterResponse {
99 pub filter: Icmpv6Filter,
100}
101
102impl fidl::Persistable for SocketGetIcmpv6FilterResponse {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct SocketGetInfoResponse {
106 pub domain: fidl_fuchsia_posix_socket__common::Domain,
107 pub proto: ProtocolAssociation,
108}
109
110impl fidl::Persistable for SocketGetInfoResponse {}
111
112#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
113pub struct SocketGetIpHeaderIncludedResponse {
114 pub value: bool,
115}
116
117impl fidl::Persistable for SocketGetIpHeaderIncludedResponse {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct SocketGetIpv6ChecksumResponse {
121 pub config: Ipv6ChecksumConfiguration,
122}
123
124impl fidl::Persistable for SocketGetIpv6ChecksumResponse {}
125
126#[derive(Clone, Debug, PartialEq)]
127pub struct SocketRecvMsgResponse {
128 pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
129 pub data: Vec<u8>,
130 pub control: fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
131 pub truncated: u32,
132}
133
134impl fidl::Persistable for SocketRecvMsgResponse {}
135
136#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
138pub enum Ipv6ChecksumConfiguration {
139 Disabled(Empty),
142 Offset(i32),
151}
152
153impl Ipv6ChecksumConfiguration {
154 #[inline]
155 pub fn ordinal(&self) -> u64 {
156 match *self {
157 Self::Disabled(_) => 1,
158 Self::Offset(_) => 2,
159 }
160 }
161}
162
163impl fidl::Persistable for Ipv6ChecksumConfiguration {}
164
165#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub enum ProtocolAssociation {
168 Unassociated(Empty),
173 Associated(u8),
178}
179
180impl ProtocolAssociation {
181 #[inline]
182 pub fn ordinal(&self) -> u64 {
183 match *self {
184 Self::Unassociated(_) => 1,
185 Self::Associated(_) => 2,
186 }
187 }
188}
189
190impl fidl::Persistable for ProtocolAssociation {}
191
192pub mod provider_ordinals {
193 pub const SOCKET: u64 = 0xdfa6a591ab48fd1;
194 pub const SOCKET_WITH_OPTIONS: u64 = 0x34cd6e7e82c46f85;
195}
196
197pub mod socket_ordinals {
198 pub const CLONE: u64 = 0x20d8a7aba2168a79;
199 pub const CLOSE: u64 = 0x5ac5d459ad7f657e;
200 pub const QUERY: u64 = 0x2658edee9decfc06;
201 pub const SET_REUSE_ADDRESS: u64 = 0x1fd74ee8b9a4a876;
202 pub const GET_REUSE_ADDRESS: u64 = 0x67b7206b8d1bc0a5;
203 pub const GET_ERROR: u64 = 0x5aad39b33e5f6ebb;
204 pub const SET_BROADCAST: u64 = 0x6023e081ce3cd947;
205 pub const GET_BROADCAST: u64 = 0x68796fc556f9780d;
206 pub const SET_SEND_BUFFER: u64 = 0x756eac32d73a7a70;
207 pub const GET_SEND_BUFFER: u64 = 0x78a52fd9c7b2410b;
208 pub const SET_RECEIVE_BUFFER: u64 = 0x6b0cf2f1919c7001;
209 pub const GET_RECEIVE_BUFFER: u64 = 0x14c1a4b64f709e5c;
210 pub const SET_KEEP_ALIVE: u64 = 0x572df8f0b920d2c7;
211 pub const GET_KEEP_ALIVE: u64 = 0x2dd29d3215f2c9d2;
212 pub const SET_OUT_OF_BAND_INLINE: u64 = 0x3ecb49968bee439;
213 pub const GET_OUT_OF_BAND_INLINE: u64 = 0x348c1ab3aeca1745;
214 pub const SET_NO_CHECK: u64 = 0x6bbf00c53a4c78c2;
215 pub const GET_NO_CHECK: u64 = 0x2cd4249286417694;
216 pub const SET_LINGER: u64 = 0x45386351246e998e;
217 pub const GET_LINGER: u64 = 0x48eb20fc5ccb0e45;
218 pub const SET_REUSE_PORT: u64 = 0x24dd3e5cb36d9ccb;
219 pub const GET_REUSE_PORT: u64 = 0x7a112c1ab54ff828;
220 pub const GET_ACCEPT_CONN: u64 = 0x67ce6db6c2ec8966;
221 pub const SET_BIND_TO_DEVICE: u64 = 0x2118b483f28aafc4;
222 pub const GET_BIND_TO_DEVICE: u64 = 0x1ab1fbf0ef7906c8;
223 pub const SET_BIND_TO_INTERFACE_INDEX: u64 = 0x6e387a0def00821;
224 pub const GET_BIND_TO_INTERFACE_INDEX: u64 = 0x59c31dd3e3078295;
225 pub const SET_TIMESTAMP: u64 = 0x285d6516c263d839;
226 pub const GET_TIMESTAMP: u64 = 0x49f2fffbbcc2bd27;
227 pub const SET_MARK: u64 = 0x6ead6de09f653236;
228 pub const GET_MARK: u64 = 0x57a2752c61d93d47;
229 pub const BIND: u64 = 0x4bc6400ae92125d;
230 pub const CONNECT: u64 = 0x5f05f19bfdd38871;
231 pub const DISCONNECT: u64 = 0x74e63b91f7b29b2;
232 pub const GET_SOCK_NAME: u64 = 0x475f23f84a1a4f85;
233 pub const GET_PEER_NAME: u64 = 0x1ffecf4bd5b6432e;
234 pub const SHUTDOWN: u64 = 0x247f38b6db68c336;
235 pub const SET_IP_TYPE_OF_SERVICE: u64 = 0x995c600475b6d46;
236 pub const GET_IP_TYPE_OF_SERVICE: u64 = 0x3814a04259f75fcb;
237 pub const SET_IP_TTL: u64 = 0x29e2424b433ae1ef;
238 pub const GET_IP_TTL: u64 = 0x47e47fa1f24da471;
239 pub const SET_IP_PACKET_INFO: u64 = 0x392d16bee20c0e16;
240 pub const GET_IP_PACKET_INFO: u64 = 0x54b505f242280740;
241 pub const SET_IP_RECEIVE_TYPE_OF_SERVICE: u64 = 0x6c4f6714995f84ef;
242 pub const GET_IP_RECEIVE_TYPE_OF_SERVICE: u64 = 0x4158ba7dc2795960;
243 pub const SET_IP_RECEIVE_TTL: u64 = 0x46f15be0ce0ab82b;
244 pub const GET_IP_RECEIVE_TTL: u64 = 0x678ddd5a5dfa2eb5;
245 pub const SET_IP_MULTICAST_INTERFACE: u64 = 0x752fbfa9b12befe;
246 pub const GET_IP_MULTICAST_INTERFACE: u64 = 0x320bd14c4df046c4;
247 pub const SET_IP_MULTICAST_TTL: u64 = 0x63134d53772916a1;
248 pub const GET_IP_MULTICAST_TTL: u64 = 0x4665cd378f39e1a;
249 pub const SET_IP_MULTICAST_LOOPBACK: u64 = 0x20c55c11f00943ea;
250 pub const GET_IP_MULTICAST_LOOPBACK: u64 = 0x3b6b26ff558298f2;
251 pub const ADD_IP_MEMBERSHIP: u64 = 0x76bc7df115a3b4d0;
252 pub const DROP_IP_MEMBERSHIP: u64 = 0x2888f3099188d03;
253 pub const SET_IP_TRANSPARENT: u64 = 0x1ae532b0c066e3a0;
254 pub const GET_IP_TRANSPARENT: u64 = 0x51d43695962ebfb5;
255 pub const SET_IP_RECEIVE_ORIGINAL_DESTINATION_ADDRESS: u64 = 0x4722b4ce52f7840;
256 pub const GET_IP_RECEIVE_ORIGINAL_DESTINATION_ADDRESS: u64 = 0x2a0e7dc5d6bfdfe9;
257 pub const ADD_IPV6_MEMBERSHIP: u64 = 0x7c94727acb4ea4b3;
258 pub const DROP_IPV6_MEMBERSHIP: u64 = 0x42104c70ccaba304;
259 pub const SET_IPV6_MULTICAST_INTERFACE: u64 = 0x135f76db3774ab3b;
260 pub const GET_IPV6_MULTICAST_INTERFACE: u64 = 0x1f26fcdd348f1882;
261 pub const SET_IPV6_UNICAST_HOPS: u64 = 0x157d51e98f462859;
262 pub const GET_IPV6_UNICAST_HOPS: u64 = 0x21f4641cad8bd8d2;
263 pub const SET_IPV6_RECEIVE_HOP_LIMIT: u64 = 0x5c24808ed2e84a1e;
264 pub const GET_IPV6_RECEIVE_HOP_LIMIT: u64 = 0x341e06689885b4c0;
265 pub const SET_IPV6_MULTICAST_HOPS: u64 = 0x25b9cd4d181f82c1;
266 pub const GET_IPV6_MULTICAST_HOPS: u64 = 0x52916948a365012a;
267 pub const SET_IPV6_MULTICAST_LOOPBACK: u64 = 0x55701c409ff41b40;
268 pub const GET_IPV6_MULTICAST_LOOPBACK: u64 = 0x4415b701fde319c3;
269 pub const SET_IPV6_ONLY: u64 = 0x4873f1364758cbba;
270 pub const GET_IPV6_ONLY: u64 = 0x4aa3340a1a26b89c;
271 pub const SET_IPV6_RECEIVE_TRAFFIC_CLASS: u64 = 0x58f07c8788d099a0;
272 pub const GET_IPV6_RECEIVE_TRAFFIC_CLASS: u64 = 0x2e334df1da553ffa;
273 pub const SET_IPV6_TRAFFIC_CLASS: u64 = 0x6af077800c5a0b4f;
274 pub const GET_IPV6_TRAFFIC_CLASS: u64 = 0x6baf6eed8fc2f04;
275 pub const SET_IPV6_RECEIVE_PACKET_INFO: u64 = 0x19259775b1a92768;
276 pub const GET_IPV6_RECEIVE_PACKET_INFO: u64 = 0x7acd4a2775baec75;
277 pub const GET_ORIGINAL_DESTINATION: u64 = 0x38bf28f0dafdbac0;
278 pub const DESCRIBE: u64 = 0x335706eccf54a135;
279 pub const RECV_MSG: u64 = 0x1dfb695351d3aa1d;
280 pub const SEND_MSG: u64 = 0x2cf1eac9a7fc8958;
281 pub const GET_INFO: u64 = 0x39676f75aec339ba;
282 pub const SET_IP_HEADER_INCLUDED: u64 = 0x5d06a606d95e8f3;
283 pub const GET_IP_HEADER_INCLUDED: u64 = 0x76125ad1f4d175f6;
284 pub const SET_ICMPV6_FILTER: u64 = 0x4ebea92a43ae68a9;
285 pub const GET_ICMPV6_FILTER: u64 = 0x43bd4f3bc0970ace;
286 pub const SET_IPV6_CHECKSUM: u64 = 0x18b7809577199cb4;
287 pub const GET_IPV6_CHECKSUM: u64 = 0x1847bf5b2d263dd;
288}
289
290mod internal {
291 use super::*;
292
293 impl fidl::encoding::ValueTypeMarker for Empty {
294 type Borrowed<'a> = &'a Self;
295 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
296 value
297 }
298 }
299
300 unsafe impl fidl::encoding::TypeMarker for Empty {
301 type Owned = Self;
302
303 #[inline(always)]
304 fn inline_align(_context: fidl::encoding::Context) -> usize {
305 1
306 }
307
308 #[inline(always)]
309 fn inline_size(_context: fidl::encoding::Context) -> usize {
310 1
311 }
312 }
313
314 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
315 #[inline]
316 unsafe fn encode(
317 self,
318 encoder: &mut fidl::encoding::Encoder<'_, D>,
319 offset: usize,
320 _depth: fidl::encoding::Depth,
321 ) -> fidl::Result<()> {
322 encoder.debug_check_bounds::<Empty>(offset);
323 encoder.write_num(0u8, offset);
324 Ok(())
325 }
326 }
327
328 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
329 #[inline(always)]
330 fn new_empty() -> Self {
331 Self
332 }
333
334 #[inline]
335 unsafe fn decode(
336 &mut self,
337 decoder: &mut fidl::encoding::Decoder<'_, D>,
338 offset: usize,
339 _depth: fidl::encoding::Depth,
340 ) -> fidl::Result<()> {
341 decoder.debug_check_bounds::<Self>(offset);
342 match decoder.read_num::<u8>(offset) {
343 0 => Ok(()),
344 _ => Err(fidl::Error::Invalid),
345 }
346 }
347 }
348
349 impl fidl::encoding::ValueTypeMarker for Icmpv6Filter {
350 type Borrowed<'a> = &'a Self;
351 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
352 value
353 }
354 }
355
356 unsafe impl fidl::encoding::TypeMarker for Icmpv6Filter {
357 type Owned = Self;
358
359 #[inline(always)]
360 fn inline_align(_context: fidl::encoding::Context) -> usize {
361 4
362 }
363
364 #[inline(always)]
365 fn inline_size(_context: fidl::encoding::Context) -> usize {
366 32
367 }
368 #[inline(always)]
369 fn encode_is_copy() -> bool {
370 true
371 }
372
373 #[inline(always)]
374 fn decode_is_copy() -> bool {
375 true
376 }
377 }
378
379 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Icmpv6Filter, D>
380 for &Icmpv6Filter
381 {
382 #[inline]
383 unsafe fn encode(
384 self,
385 encoder: &mut fidl::encoding::Encoder<'_, D>,
386 offset: usize,
387 _depth: fidl::encoding::Depth,
388 ) -> fidl::Result<()> {
389 encoder.debug_check_bounds::<Icmpv6Filter>(offset);
390 unsafe {
391 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
393 (buf_ptr as *mut Icmpv6Filter)
394 .write_unaligned((self as *const Icmpv6Filter).read());
395 }
398 Ok(())
399 }
400 }
401 unsafe impl<
402 D: fidl::encoding::ResourceDialect,
403 T0: fidl::encoding::Encode<fidl::encoding::Array<u32, 8>, D>,
404 > fidl::encoding::Encode<Icmpv6Filter, D> for (T0,)
405 {
406 #[inline]
407 unsafe fn encode(
408 self,
409 encoder: &mut fidl::encoding::Encoder<'_, D>,
410 offset: usize,
411 depth: fidl::encoding::Depth,
412 ) -> fidl::Result<()> {
413 encoder.debug_check_bounds::<Icmpv6Filter>(offset);
414 self.0.encode(encoder, offset + 0, depth)?;
418 Ok(())
419 }
420 }
421
422 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Icmpv6Filter {
423 #[inline(always)]
424 fn new_empty() -> Self {
425 Self { blocked_types: fidl::new_empty!(fidl::encoding::Array<u32, 8>, D) }
426 }
427
428 #[inline]
429 unsafe fn decode(
430 &mut self,
431 decoder: &mut fidl::encoding::Decoder<'_, D>,
432 offset: usize,
433 _depth: fidl::encoding::Depth,
434 ) -> fidl::Result<()> {
435 decoder.debug_check_bounds::<Self>(offset);
436 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
437 unsafe {
440 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
441 }
442 Ok(())
443 }
444 }
445
446 impl fidl::encoding::ValueTypeMarker for ProviderSocketRequest {
447 type Borrowed<'a> = &'a Self;
448 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
449 value
450 }
451 }
452
453 unsafe impl fidl::encoding::TypeMarker for ProviderSocketRequest {
454 type Owned = Self;
455
456 #[inline(always)]
457 fn inline_align(_context: fidl::encoding::Context) -> usize {
458 8
459 }
460
461 #[inline(always)]
462 fn inline_size(_context: fidl::encoding::Context) -> usize {
463 24
464 }
465 }
466
467 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSocketRequest, D>
468 for &ProviderSocketRequest
469 {
470 #[inline]
471 unsafe fn encode(
472 self,
473 encoder: &mut fidl::encoding::Encoder<'_, D>,
474 offset: usize,
475 _depth: fidl::encoding::Depth,
476 ) -> fidl::Result<()> {
477 encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
478 fidl::encoding::Encode::<ProviderSocketRequest, D>::encode(
480 (
481 <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
482 <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
483 ),
484 encoder, offset, _depth
485 )
486 }
487 }
488 unsafe impl<
489 D: fidl::encoding::ResourceDialect,
490 T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
491 T1: fidl::encoding::Encode<ProtocolAssociation, D>,
492 > fidl::encoding::Encode<ProviderSocketRequest, D> for (T0, T1)
493 {
494 #[inline]
495 unsafe fn encode(
496 self,
497 encoder: &mut fidl::encoding::Encoder<'_, D>,
498 offset: usize,
499 depth: fidl::encoding::Depth,
500 ) -> fidl::Result<()> {
501 encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
502 unsafe {
505 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
506 (ptr as *mut u64).write_unaligned(0);
507 }
508 self.0.encode(encoder, offset + 0, depth)?;
510 self.1.encode(encoder, offset + 8, depth)?;
511 Ok(())
512 }
513 }
514
515 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSocketRequest {
516 #[inline(always)]
517 fn new_empty() -> Self {
518 Self {
519 domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
520 proto: fidl::new_empty!(ProtocolAssociation, D),
521 }
522 }
523
524 #[inline]
525 unsafe fn decode(
526 &mut self,
527 decoder: &mut fidl::encoding::Decoder<'_, D>,
528 offset: usize,
529 _depth: fidl::encoding::Depth,
530 ) -> fidl::Result<()> {
531 decoder.debug_check_bounds::<Self>(offset);
532 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
534 let padval = unsafe { (ptr as *const u64).read_unaligned() };
535 let mask = 0xffffffffffff0000u64;
536 let maskedval = padval & mask;
537 if maskedval != 0 {
538 return Err(fidl::Error::NonZeroPadding {
539 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
540 });
541 }
542 fidl::decode!(
543 fidl_fuchsia_posix_socket__common::Domain,
544 D,
545 &mut self.domain,
546 decoder,
547 offset + 0,
548 _depth
549 )?;
550 fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
551 Ok(())
552 }
553 }
554
555 impl fidl::encoding::ValueTypeMarker for ProviderSocketWithOptionsRequest {
556 type Borrowed<'a> = &'a Self;
557 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
558 value
559 }
560 }
561
562 unsafe impl fidl::encoding::TypeMarker for ProviderSocketWithOptionsRequest {
563 type Owned = Self;
564
565 #[inline(always)]
566 fn inline_align(_context: fidl::encoding::Context) -> usize {
567 8
568 }
569
570 #[inline(always)]
571 fn inline_size(_context: fidl::encoding::Context) -> usize {
572 40
573 }
574 }
575
576 unsafe impl<D: fidl::encoding::ResourceDialect>
577 fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D>
578 for &ProviderSocketWithOptionsRequest
579 {
580 #[inline]
581 unsafe fn encode(
582 self,
583 encoder: &mut fidl::encoding::Encoder<'_, D>,
584 offset: usize,
585 _depth: fidl::encoding::Depth,
586 ) -> fidl::Result<()> {
587 encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
588 fidl::encoding::Encode::<ProviderSocketWithOptionsRequest, D>::encode(
590 (
591 <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
592 <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
593 <fidl_fuchsia_posix_socket__common::SocketCreationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
594 ),
595 encoder, offset, _depth
596 )
597 }
598 }
599 unsafe impl<
600 D: fidl::encoding::ResourceDialect,
601 T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
602 T1: fidl::encoding::Encode<ProtocolAssociation, D>,
603 T2: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SocketCreationOptions, D>,
604 > fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D> for (T0, T1, T2)
605 {
606 #[inline]
607 unsafe fn encode(
608 self,
609 encoder: &mut fidl::encoding::Encoder<'_, D>,
610 offset: usize,
611 depth: fidl::encoding::Depth,
612 ) -> fidl::Result<()> {
613 encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
614 unsafe {
617 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
618 (ptr as *mut u64).write_unaligned(0);
619 }
620 self.0.encode(encoder, offset + 0, depth)?;
622 self.1.encode(encoder, offset + 8, depth)?;
623 self.2.encode(encoder, offset + 24, depth)?;
624 Ok(())
625 }
626 }
627
628 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
629 for ProviderSocketWithOptionsRequest
630 {
631 #[inline(always)]
632 fn new_empty() -> Self {
633 Self {
634 domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
635 proto: fidl::new_empty!(ProtocolAssociation, D),
636 opts: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SocketCreationOptions, D),
637 }
638 }
639
640 #[inline]
641 unsafe fn decode(
642 &mut self,
643 decoder: &mut fidl::encoding::Decoder<'_, D>,
644 offset: usize,
645 _depth: fidl::encoding::Depth,
646 ) -> fidl::Result<()> {
647 decoder.debug_check_bounds::<Self>(offset);
648 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
650 let padval = unsafe { (ptr as *const u64).read_unaligned() };
651 let mask = 0xffffffffffff0000u64;
652 let maskedval = padval & mask;
653 if maskedval != 0 {
654 return Err(fidl::Error::NonZeroPadding {
655 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
656 });
657 }
658 fidl::decode!(
659 fidl_fuchsia_posix_socket__common::Domain,
660 D,
661 &mut self.domain,
662 decoder,
663 offset + 0,
664 _depth
665 )?;
666 fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
667 fidl::decode!(
668 fidl_fuchsia_posix_socket__common::SocketCreationOptions,
669 D,
670 &mut self.opts,
671 decoder,
672 offset + 24,
673 _depth
674 )?;
675 Ok(())
676 }
677 }
678
679 impl fidl::encoding::ValueTypeMarker for SocketRecvMsgRequest {
680 type Borrowed<'a> = &'a Self;
681 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
682 value
683 }
684 }
685
686 unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgRequest {
687 type Owned = Self;
688
689 #[inline(always)]
690 fn inline_align(_context: fidl::encoding::Context) -> usize {
691 4
692 }
693
694 #[inline(always)]
695 fn inline_size(_context: fidl::encoding::Context) -> usize {
696 12
697 }
698 }
699
700 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgRequest, D>
701 for &SocketRecvMsgRequest
702 {
703 #[inline]
704 unsafe fn encode(
705 self,
706 encoder: &mut fidl::encoding::Encoder<'_, D>,
707 offset: usize,
708 _depth: fidl::encoding::Depth,
709 ) -> fidl::Result<()> {
710 encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
711 fidl::encoding::Encode::<SocketRecvMsgRequest, D>::encode(
713 (
714 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_addr),
715 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_len),
716 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_control),
717 <fidl_fuchsia_posix_socket__common::RecvMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
718 ),
719 encoder, offset, _depth
720 )
721 }
722 }
723 unsafe impl<
724 D: fidl::encoding::ResourceDialect,
725 T0: fidl::encoding::Encode<bool, D>,
726 T1: fidl::encoding::Encode<u32, D>,
727 T2: fidl::encoding::Encode<bool, D>,
728 T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::RecvMsgFlags, D>,
729 > fidl::encoding::Encode<SocketRecvMsgRequest, D> for (T0, T1, T2, T3)
730 {
731 #[inline]
732 unsafe fn encode(
733 self,
734 encoder: &mut fidl::encoding::Encoder<'_, D>,
735 offset: usize,
736 depth: fidl::encoding::Depth,
737 ) -> fidl::Result<()> {
738 encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
739 unsafe {
742 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
743 (ptr as *mut u32).write_unaligned(0);
744 }
745 unsafe {
746 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
747 (ptr as *mut u32).write_unaligned(0);
748 }
749 self.0.encode(encoder, offset + 0, depth)?;
751 self.1.encode(encoder, offset + 4, depth)?;
752 self.2.encode(encoder, offset + 8, depth)?;
753 self.3.encode(encoder, offset + 10, depth)?;
754 Ok(())
755 }
756 }
757
758 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgRequest {
759 #[inline(always)]
760 fn new_empty() -> Self {
761 Self {
762 want_addr: fidl::new_empty!(bool, D),
763 data_len: fidl::new_empty!(u32, D),
764 want_control: fidl::new_empty!(bool, D),
765 flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::RecvMsgFlags, D),
766 }
767 }
768
769 #[inline]
770 unsafe fn decode(
771 &mut self,
772 decoder: &mut fidl::encoding::Decoder<'_, D>,
773 offset: usize,
774 _depth: fidl::encoding::Depth,
775 ) -> fidl::Result<()> {
776 decoder.debug_check_bounds::<Self>(offset);
777 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
779 let padval = unsafe { (ptr as *const u32).read_unaligned() };
780 let mask = 0xffffff00u32;
781 let maskedval = padval & mask;
782 if maskedval != 0 {
783 return Err(fidl::Error::NonZeroPadding {
784 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
785 });
786 }
787 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
788 let padval = unsafe { (ptr as *const u32).read_unaligned() };
789 let mask = 0xff00u32;
790 let maskedval = padval & mask;
791 if maskedval != 0 {
792 return Err(fidl::Error::NonZeroPadding {
793 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
794 });
795 }
796 fidl::decode!(bool, D, &mut self.want_addr, decoder, offset + 0, _depth)?;
797 fidl::decode!(u32, D, &mut self.data_len, decoder, offset + 4, _depth)?;
798 fidl::decode!(bool, D, &mut self.want_control, decoder, offset + 8, _depth)?;
799 fidl::decode!(
800 fidl_fuchsia_posix_socket__common::RecvMsgFlags,
801 D,
802 &mut self.flags,
803 decoder,
804 offset + 10,
805 _depth
806 )?;
807 Ok(())
808 }
809 }
810
811 impl fidl::encoding::ValueTypeMarker for SocketSendMsgRequest {
812 type Borrowed<'a> = &'a Self;
813 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
814 value
815 }
816 }
817
818 unsafe impl fidl::encoding::TypeMarker for SocketSendMsgRequest {
819 type Owned = Self;
820
821 #[inline(always)]
822 fn inline_align(_context: fidl::encoding::Context) -> usize {
823 8
824 }
825
826 #[inline(always)]
827 fn inline_size(_context: fidl::encoding::Context) -> usize {
828 56
829 }
830 }
831
832 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketSendMsgRequest, D>
833 for &SocketSendMsgRequest
834 {
835 #[inline]
836 unsafe fn encode(
837 self,
838 encoder: &mut fidl::encoding::Encoder<'_, D>,
839 offset: usize,
840 _depth: fidl::encoding::Depth,
841 ) -> fidl::Result<()> {
842 encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
843 fidl::encoding::Encode::<SocketSendMsgRequest, D>::encode(
845 (
846 <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
847 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
848 <fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
849 <fidl_fuchsia_posix_socket__common::SendMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
850 ),
851 encoder, offset, _depth
852 )
853 }
854 }
855 unsafe impl<
856 D: fidl::encoding::ResourceDialect,
857 T0: fidl::encoding::Encode<
858 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
859 D,
860 >,
861 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
862 T2: fidl::encoding::Encode<
863 fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
864 D,
865 >,
866 T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SendMsgFlags, D>,
867 > fidl::encoding::Encode<SocketSendMsgRequest, D> for (T0, T1, T2, T3)
868 {
869 #[inline]
870 unsafe fn encode(
871 self,
872 encoder: &mut fidl::encoding::Encoder<'_, D>,
873 offset: usize,
874 depth: fidl::encoding::Depth,
875 ) -> fidl::Result<()> {
876 encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
877 unsafe {
880 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
881 (ptr as *mut u64).write_unaligned(0);
882 }
883 self.0.encode(encoder, offset + 0, depth)?;
885 self.1.encode(encoder, offset + 16, depth)?;
886 self.2.encode(encoder, offset + 32, depth)?;
887 self.3.encode(encoder, offset + 48, depth)?;
888 Ok(())
889 }
890 }
891
892 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketSendMsgRequest {
893 #[inline(always)]
894 fn new_empty() -> Self {
895 Self {
896 addr: fidl::new_empty!(
897 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
898 D
899 ),
900 data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
901 control: fidl::new_empty!(
902 fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
903 D
904 ),
905 flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SendMsgFlags, D),
906 }
907 }
908
909 #[inline]
910 unsafe fn decode(
911 &mut self,
912 decoder: &mut fidl::encoding::Decoder<'_, D>,
913 offset: usize,
914 _depth: fidl::encoding::Depth,
915 ) -> fidl::Result<()> {
916 decoder.debug_check_bounds::<Self>(offset);
917 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
919 let padval = unsafe { (ptr as *const u64).read_unaligned() };
920 let mask = 0xffffffffffff0000u64;
921 let maskedval = padval & mask;
922 if maskedval != 0 {
923 return Err(fidl::Error::NonZeroPadding {
924 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
925 });
926 }
927 fidl::decode!(
928 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
929 D,
930 &mut self.addr,
931 decoder,
932 offset + 0,
933 _depth
934 )?;
935 fidl::decode!(
936 fidl::encoding::UnboundedVector<u8>,
937 D,
938 &mut self.data,
939 decoder,
940 offset + 16,
941 _depth
942 )?;
943 fidl::decode!(
944 fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
945 D,
946 &mut self.control,
947 decoder,
948 offset + 32,
949 _depth
950 )?;
951 fidl::decode!(
952 fidl_fuchsia_posix_socket__common::SendMsgFlags,
953 D,
954 &mut self.flags,
955 decoder,
956 offset + 48,
957 _depth
958 )?;
959 Ok(())
960 }
961 }
962
963 impl fidl::encoding::ValueTypeMarker for SocketSetIcmpv6FilterRequest {
964 type Borrowed<'a> = &'a Self;
965 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
966 value
967 }
968 }
969
970 unsafe impl fidl::encoding::TypeMarker for SocketSetIcmpv6FilterRequest {
971 type Owned = Self;
972
973 #[inline(always)]
974 fn inline_align(_context: fidl::encoding::Context) -> usize {
975 4
976 }
977
978 #[inline(always)]
979 fn inline_size(_context: fidl::encoding::Context) -> usize {
980 32
981 }
982 #[inline(always)]
983 fn encode_is_copy() -> bool {
984 true
985 }
986
987 #[inline(always)]
988 fn decode_is_copy() -> bool {
989 true
990 }
991 }
992
993 unsafe impl<D: fidl::encoding::ResourceDialect>
994 fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for &SocketSetIcmpv6FilterRequest
995 {
996 #[inline]
997 unsafe fn encode(
998 self,
999 encoder: &mut fidl::encoding::Encoder<'_, D>,
1000 offset: usize,
1001 _depth: fidl::encoding::Depth,
1002 ) -> fidl::Result<()> {
1003 encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
1004 unsafe {
1005 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1007 (buf_ptr as *mut SocketSetIcmpv6FilterRequest)
1008 .write_unaligned((self as *const SocketSetIcmpv6FilterRequest).read());
1009 }
1012 Ok(())
1013 }
1014 }
1015 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
1016 fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for (T0,)
1017 {
1018 #[inline]
1019 unsafe fn encode(
1020 self,
1021 encoder: &mut fidl::encoding::Encoder<'_, D>,
1022 offset: usize,
1023 depth: fidl::encoding::Depth,
1024 ) -> fidl::Result<()> {
1025 encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
1026 self.0.encode(encoder, offset + 0, depth)?;
1030 Ok(())
1031 }
1032 }
1033
1034 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1035 for SocketSetIcmpv6FilterRequest
1036 {
1037 #[inline(always)]
1038 fn new_empty() -> Self {
1039 Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
1040 }
1041
1042 #[inline]
1043 unsafe fn decode(
1044 &mut self,
1045 decoder: &mut fidl::encoding::Decoder<'_, D>,
1046 offset: usize,
1047 _depth: fidl::encoding::Depth,
1048 ) -> fidl::Result<()> {
1049 decoder.debug_check_bounds::<Self>(offset);
1050 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1051 unsafe {
1054 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1055 }
1056 Ok(())
1057 }
1058 }
1059
1060 impl fidl::encoding::ValueTypeMarker for SocketSetIpHeaderIncludedRequest {
1061 type Borrowed<'a> = &'a Self;
1062 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1063 value
1064 }
1065 }
1066
1067 unsafe impl fidl::encoding::TypeMarker for SocketSetIpHeaderIncludedRequest {
1068 type Owned = Self;
1069
1070 #[inline(always)]
1071 fn inline_align(_context: fidl::encoding::Context) -> usize {
1072 1
1073 }
1074
1075 #[inline(always)]
1076 fn inline_size(_context: fidl::encoding::Context) -> usize {
1077 1
1078 }
1079 }
1080
1081 unsafe impl<D: fidl::encoding::ResourceDialect>
1082 fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D>
1083 for &SocketSetIpHeaderIncludedRequest
1084 {
1085 #[inline]
1086 unsafe fn encode(
1087 self,
1088 encoder: &mut fidl::encoding::Encoder<'_, D>,
1089 offset: usize,
1090 _depth: fidl::encoding::Depth,
1091 ) -> fidl::Result<()> {
1092 encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
1093 fidl::encoding::Encode::<SocketSetIpHeaderIncludedRequest, D>::encode(
1095 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1096 encoder,
1097 offset,
1098 _depth,
1099 )
1100 }
1101 }
1102 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1103 fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D> for (T0,)
1104 {
1105 #[inline]
1106 unsafe fn encode(
1107 self,
1108 encoder: &mut fidl::encoding::Encoder<'_, D>,
1109 offset: usize,
1110 depth: fidl::encoding::Depth,
1111 ) -> fidl::Result<()> {
1112 encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
1113 self.0.encode(encoder, offset + 0, depth)?;
1117 Ok(())
1118 }
1119 }
1120
1121 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1122 for SocketSetIpHeaderIncludedRequest
1123 {
1124 #[inline(always)]
1125 fn new_empty() -> Self {
1126 Self { value: fidl::new_empty!(bool, D) }
1127 }
1128
1129 #[inline]
1130 unsafe fn decode(
1131 &mut self,
1132 decoder: &mut fidl::encoding::Decoder<'_, D>,
1133 offset: usize,
1134 _depth: fidl::encoding::Depth,
1135 ) -> fidl::Result<()> {
1136 decoder.debug_check_bounds::<Self>(offset);
1137 fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1139 Ok(())
1140 }
1141 }
1142
1143 impl fidl::encoding::ValueTypeMarker for SocketSetIpv6ChecksumRequest {
1144 type Borrowed<'a> = &'a Self;
1145 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1146 value
1147 }
1148 }
1149
1150 unsafe impl fidl::encoding::TypeMarker for SocketSetIpv6ChecksumRequest {
1151 type Owned = Self;
1152
1153 #[inline(always)]
1154 fn inline_align(_context: fidl::encoding::Context) -> usize {
1155 8
1156 }
1157
1158 #[inline(always)]
1159 fn inline_size(_context: fidl::encoding::Context) -> usize {
1160 16
1161 }
1162 }
1163
1164 unsafe impl<D: fidl::encoding::ResourceDialect>
1165 fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for &SocketSetIpv6ChecksumRequest
1166 {
1167 #[inline]
1168 unsafe fn encode(
1169 self,
1170 encoder: &mut fidl::encoding::Encoder<'_, D>,
1171 offset: usize,
1172 _depth: fidl::encoding::Depth,
1173 ) -> fidl::Result<()> {
1174 encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1175 fidl::encoding::Encode::<SocketSetIpv6ChecksumRequest, D>::encode(
1177 (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1178 &self.config,
1179 ),),
1180 encoder,
1181 offset,
1182 _depth,
1183 )
1184 }
1185 }
1186 unsafe impl<
1187 D: fidl::encoding::ResourceDialect,
1188 T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1189 > fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for (T0,)
1190 {
1191 #[inline]
1192 unsafe fn encode(
1193 self,
1194 encoder: &mut fidl::encoding::Encoder<'_, D>,
1195 offset: usize,
1196 depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1199 self.0.encode(encoder, offset + 0, depth)?;
1203 Ok(())
1204 }
1205 }
1206
1207 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1208 for SocketSetIpv6ChecksumRequest
1209 {
1210 #[inline(always)]
1211 fn new_empty() -> Self {
1212 Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1213 }
1214
1215 #[inline]
1216 unsafe fn decode(
1217 &mut self,
1218 decoder: &mut fidl::encoding::Decoder<'_, D>,
1219 offset: usize,
1220 _depth: fidl::encoding::Depth,
1221 ) -> fidl::Result<()> {
1222 decoder.debug_check_bounds::<Self>(offset);
1223 fidl::decode!(
1225 Ipv6ChecksumConfiguration,
1226 D,
1227 &mut self.config,
1228 decoder,
1229 offset + 0,
1230 _depth
1231 )?;
1232 Ok(())
1233 }
1234 }
1235
1236 impl fidl::encoding::ValueTypeMarker for SocketGetIcmpv6FilterResponse {
1237 type Borrowed<'a> = &'a Self;
1238 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1239 value
1240 }
1241 }
1242
1243 unsafe impl fidl::encoding::TypeMarker for SocketGetIcmpv6FilterResponse {
1244 type Owned = Self;
1245
1246 #[inline(always)]
1247 fn inline_align(_context: fidl::encoding::Context) -> usize {
1248 4
1249 }
1250
1251 #[inline(always)]
1252 fn inline_size(_context: fidl::encoding::Context) -> usize {
1253 32
1254 }
1255 #[inline(always)]
1256 fn encode_is_copy() -> bool {
1257 true
1258 }
1259
1260 #[inline(always)]
1261 fn decode_is_copy() -> bool {
1262 true
1263 }
1264 }
1265
1266 unsafe impl<D: fidl::encoding::ResourceDialect>
1267 fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D>
1268 for &SocketGetIcmpv6FilterResponse
1269 {
1270 #[inline]
1271 unsafe fn encode(
1272 self,
1273 encoder: &mut fidl::encoding::Encoder<'_, D>,
1274 offset: usize,
1275 _depth: fidl::encoding::Depth,
1276 ) -> fidl::Result<()> {
1277 encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1278 unsafe {
1279 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1281 (buf_ptr as *mut SocketGetIcmpv6FilterResponse)
1282 .write_unaligned((self as *const SocketGetIcmpv6FilterResponse).read());
1283 }
1286 Ok(())
1287 }
1288 }
1289 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
1290 fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D> for (T0,)
1291 {
1292 #[inline]
1293 unsafe fn encode(
1294 self,
1295 encoder: &mut fidl::encoding::Encoder<'_, D>,
1296 offset: usize,
1297 depth: fidl::encoding::Depth,
1298 ) -> fidl::Result<()> {
1299 encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1300 self.0.encode(encoder, offset + 0, depth)?;
1304 Ok(())
1305 }
1306 }
1307
1308 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1309 for SocketGetIcmpv6FilterResponse
1310 {
1311 #[inline(always)]
1312 fn new_empty() -> Self {
1313 Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
1314 }
1315
1316 #[inline]
1317 unsafe fn decode(
1318 &mut self,
1319 decoder: &mut fidl::encoding::Decoder<'_, D>,
1320 offset: usize,
1321 _depth: fidl::encoding::Depth,
1322 ) -> fidl::Result<()> {
1323 decoder.debug_check_bounds::<Self>(offset);
1324 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1325 unsafe {
1328 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1329 }
1330 Ok(())
1331 }
1332 }
1333
1334 impl fidl::encoding::ValueTypeMarker for SocketGetInfoResponse {
1335 type Borrowed<'a> = &'a Self;
1336 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1337 value
1338 }
1339 }
1340
1341 unsafe impl fidl::encoding::TypeMarker for SocketGetInfoResponse {
1342 type Owned = Self;
1343
1344 #[inline(always)]
1345 fn inline_align(_context: fidl::encoding::Context) -> usize {
1346 8
1347 }
1348
1349 #[inline(always)]
1350 fn inline_size(_context: fidl::encoding::Context) -> usize {
1351 24
1352 }
1353 }
1354
1355 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketGetInfoResponse, D>
1356 for &SocketGetInfoResponse
1357 {
1358 #[inline]
1359 unsafe fn encode(
1360 self,
1361 encoder: &mut fidl::encoding::Encoder<'_, D>,
1362 offset: usize,
1363 _depth: fidl::encoding::Depth,
1364 ) -> fidl::Result<()> {
1365 encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1366 fidl::encoding::Encode::<SocketGetInfoResponse, D>::encode(
1368 (
1369 <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
1370 <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
1371 ),
1372 encoder, offset, _depth
1373 )
1374 }
1375 }
1376 unsafe impl<
1377 D: fidl::encoding::ResourceDialect,
1378 T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
1379 T1: fidl::encoding::Encode<ProtocolAssociation, D>,
1380 > fidl::encoding::Encode<SocketGetInfoResponse, D> for (T0, T1)
1381 {
1382 #[inline]
1383 unsafe fn encode(
1384 self,
1385 encoder: &mut fidl::encoding::Encoder<'_, D>,
1386 offset: usize,
1387 depth: fidl::encoding::Depth,
1388 ) -> fidl::Result<()> {
1389 encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1390 unsafe {
1393 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1394 (ptr as *mut u64).write_unaligned(0);
1395 }
1396 self.0.encode(encoder, offset + 0, depth)?;
1398 self.1.encode(encoder, offset + 8, depth)?;
1399 Ok(())
1400 }
1401 }
1402
1403 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketGetInfoResponse {
1404 #[inline(always)]
1405 fn new_empty() -> Self {
1406 Self {
1407 domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
1408 proto: fidl::new_empty!(ProtocolAssociation, D),
1409 }
1410 }
1411
1412 #[inline]
1413 unsafe fn decode(
1414 &mut self,
1415 decoder: &mut fidl::encoding::Decoder<'_, D>,
1416 offset: usize,
1417 _depth: fidl::encoding::Depth,
1418 ) -> fidl::Result<()> {
1419 decoder.debug_check_bounds::<Self>(offset);
1420 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1422 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1423 let mask = 0xffffffffffff0000u64;
1424 let maskedval = padval & mask;
1425 if maskedval != 0 {
1426 return Err(fidl::Error::NonZeroPadding {
1427 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1428 });
1429 }
1430 fidl::decode!(
1431 fidl_fuchsia_posix_socket__common::Domain,
1432 D,
1433 &mut self.domain,
1434 decoder,
1435 offset + 0,
1436 _depth
1437 )?;
1438 fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
1439 Ok(())
1440 }
1441 }
1442
1443 impl fidl::encoding::ValueTypeMarker for SocketGetIpHeaderIncludedResponse {
1444 type Borrowed<'a> = &'a Self;
1445 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1446 value
1447 }
1448 }
1449
1450 unsafe impl fidl::encoding::TypeMarker for SocketGetIpHeaderIncludedResponse {
1451 type Owned = Self;
1452
1453 #[inline(always)]
1454 fn inline_align(_context: fidl::encoding::Context) -> usize {
1455 1
1456 }
1457
1458 #[inline(always)]
1459 fn inline_size(_context: fidl::encoding::Context) -> usize {
1460 1
1461 }
1462 }
1463
1464 unsafe impl<D: fidl::encoding::ResourceDialect>
1465 fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D>
1466 for &SocketGetIpHeaderIncludedResponse
1467 {
1468 #[inline]
1469 unsafe fn encode(
1470 self,
1471 encoder: &mut fidl::encoding::Encoder<'_, D>,
1472 offset: usize,
1473 _depth: fidl::encoding::Depth,
1474 ) -> fidl::Result<()> {
1475 encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1476 fidl::encoding::Encode::<SocketGetIpHeaderIncludedResponse, D>::encode(
1478 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1479 encoder,
1480 offset,
1481 _depth,
1482 )
1483 }
1484 }
1485 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1486 fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D> for (T0,)
1487 {
1488 #[inline]
1489 unsafe fn encode(
1490 self,
1491 encoder: &mut fidl::encoding::Encoder<'_, D>,
1492 offset: usize,
1493 depth: fidl::encoding::Depth,
1494 ) -> fidl::Result<()> {
1495 encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1496 self.0.encode(encoder, offset + 0, depth)?;
1500 Ok(())
1501 }
1502 }
1503
1504 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1505 for SocketGetIpHeaderIncludedResponse
1506 {
1507 #[inline(always)]
1508 fn new_empty() -> Self {
1509 Self { value: fidl::new_empty!(bool, D) }
1510 }
1511
1512 #[inline]
1513 unsafe fn decode(
1514 &mut self,
1515 decoder: &mut fidl::encoding::Decoder<'_, D>,
1516 offset: usize,
1517 _depth: fidl::encoding::Depth,
1518 ) -> fidl::Result<()> {
1519 decoder.debug_check_bounds::<Self>(offset);
1520 fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1522 Ok(())
1523 }
1524 }
1525
1526 impl fidl::encoding::ValueTypeMarker for SocketGetIpv6ChecksumResponse {
1527 type Borrowed<'a> = &'a Self;
1528 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1529 value
1530 }
1531 }
1532
1533 unsafe impl fidl::encoding::TypeMarker for SocketGetIpv6ChecksumResponse {
1534 type Owned = Self;
1535
1536 #[inline(always)]
1537 fn inline_align(_context: fidl::encoding::Context) -> usize {
1538 8
1539 }
1540
1541 #[inline(always)]
1542 fn inline_size(_context: fidl::encoding::Context) -> usize {
1543 16
1544 }
1545 }
1546
1547 unsafe impl<D: fidl::encoding::ResourceDialect>
1548 fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D>
1549 for &SocketGetIpv6ChecksumResponse
1550 {
1551 #[inline]
1552 unsafe fn encode(
1553 self,
1554 encoder: &mut fidl::encoding::Encoder<'_, D>,
1555 offset: usize,
1556 _depth: fidl::encoding::Depth,
1557 ) -> fidl::Result<()> {
1558 encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1559 fidl::encoding::Encode::<SocketGetIpv6ChecksumResponse, D>::encode(
1561 (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1562 &self.config,
1563 ),),
1564 encoder,
1565 offset,
1566 _depth,
1567 )
1568 }
1569 }
1570 unsafe impl<
1571 D: fidl::encoding::ResourceDialect,
1572 T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1573 > fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D> for (T0,)
1574 {
1575 #[inline]
1576 unsafe fn encode(
1577 self,
1578 encoder: &mut fidl::encoding::Encoder<'_, D>,
1579 offset: usize,
1580 depth: fidl::encoding::Depth,
1581 ) -> fidl::Result<()> {
1582 encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1583 self.0.encode(encoder, offset + 0, depth)?;
1587 Ok(())
1588 }
1589 }
1590
1591 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1592 for SocketGetIpv6ChecksumResponse
1593 {
1594 #[inline(always)]
1595 fn new_empty() -> Self {
1596 Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1597 }
1598
1599 #[inline]
1600 unsafe fn decode(
1601 &mut self,
1602 decoder: &mut fidl::encoding::Decoder<'_, D>,
1603 offset: usize,
1604 _depth: fidl::encoding::Depth,
1605 ) -> fidl::Result<()> {
1606 decoder.debug_check_bounds::<Self>(offset);
1607 fidl::decode!(
1609 Ipv6ChecksumConfiguration,
1610 D,
1611 &mut self.config,
1612 decoder,
1613 offset + 0,
1614 _depth
1615 )?;
1616 Ok(())
1617 }
1618 }
1619
1620 impl fidl::encoding::ValueTypeMarker for SocketRecvMsgResponse {
1621 type Borrowed<'a> = &'a Self;
1622 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1623 value
1624 }
1625 }
1626
1627 unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgResponse {
1628 type Owned = Self;
1629
1630 #[inline(always)]
1631 fn inline_align(_context: fidl::encoding::Context) -> usize {
1632 8
1633 }
1634
1635 #[inline(always)]
1636 fn inline_size(_context: fidl::encoding::Context) -> usize {
1637 56
1638 }
1639 }
1640
1641 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgResponse, D>
1642 for &SocketRecvMsgResponse
1643 {
1644 #[inline]
1645 unsafe fn encode(
1646 self,
1647 encoder: &mut fidl::encoding::Encoder<'_, D>,
1648 offset: usize,
1649 _depth: fidl::encoding::Depth,
1650 ) -> fidl::Result<()> {
1651 encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1652 fidl::encoding::Encode::<SocketRecvMsgResponse, D>::encode(
1654 (
1655 <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
1656 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1657 <fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
1658 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.truncated),
1659 ),
1660 encoder, offset, _depth
1661 )
1662 }
1663 }
1664 unsafe impl<
1665 D: fidl::encoding::ResourceDialect,
1666 T0: fidl::encoding::Encode<
1667 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1668 D,
1669 >,
1670 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1671 T2: fidl::encoding::Encode<
1672 fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1673 D,
1674 >,
1675 T3: fidl::encoding::Encode<u32, D>,
1676 > fidl::encoding::Encode<SocketRecvMsgResponse, D> for (T0, T1, T2, T3)
1677 {
1678 #[inline]
1679 unsafe fn encode(
1680 self,
1681 encoder: &mut fidl::encoding::Encoder<'_, D>,
1682 offset: usize,
1683 depth: fidl::encoding::Depth,
1684 ) -> fidl::Result<()> {
1685 encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1686 unsafe {
1689 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
1690 (ptr as *mut u64).write_unaligned(0);
1691 }
1692 self.0.encode(encoder, offset + 0, depth)?;
1694 self.1.encode(encoder, offset + 16, depth)?;
1695 self.2.encode(encoder, offset + 32, depth)?;
1696 self.3.encode(encoder, offset + 48, depth)?;
1697 Ok(())
1698 }
1699 }
1700
1701 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgResponse {
1702 #[inline(always)]
1703 fn new_empty() -> Self {
1704 Self {
1705 addr: fidl::new_empty!(
1706 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1707 D
1708 ),
1709 data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1710 control: fidl::new_empty!(
1711 fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1712 D
1713 ),
1714 truncated: fidl::new_empty!(u32, D),
1715 }
1716 }
1717
1718 #[inline]
1719 unsafe fn decode(
1720 &mut self,
1721 decoder: &mut fidl::encoding::Decoder<'_, D>,
1722 offset: usize,
1723 _depth: fidl::encoding::Depth,
1724 ) -> fidl::Result<()> {
1725 decoder.debug_check_bounds::<Self>(offset);
1726 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
1728 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1729 let mask = 0xffffffff00000000u64;
1730 let maskedval = padval & mask;
1731 if maskedval != 0 {
1732 return Err(fidl::Error::NonZeroPadding {
1733 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
1734 });
1735 }
1736 fidl::decode!(
1737 fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1738 D,
1739 &mut self.addr,
1740 decoder,
1741 offset + 0,
1742 _depth
1743 )?;
1744 fidl::decode!(
1745 fidl::encoding::UnboundedVector<u8>,
1746 D,
1747 &mut self.data,
1748 decoder,
1749 offset + 16,
1750 _depth
1751 )?;
1752 fidl::decode!(
1753 fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1754 D,
1755 &mut self.control,
1756 decoder,
1757 offset + 32,
1758 _depth
1759 )?;
1760 fidl::decode!(u32, D, &mut self.truncated, decoder, offset + 48, _depth)?;
1761 Ok(())
1762 }
1763 }
1764
1765 impl fidl::encoding::ValueTypeMarker for Ipv6ChecksumConfiguration {
1766 type Borrowed<'a> = &'a Self;
1767 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1768 value
1769 }
1770 }
1771
1772 unsafe impl fidl::encoding::TypeMarker for Ipv6ChecksumConfiguration {
1773 type Owned = Self;
1774
1775 #[inline(always)]
1776 fn inline_align(_context: fidl::encoding::Context) -> usize {
1777 8
1778 }
1779
1780 #[inline(always)]
1781 fn inline_size(_context: fidl::encoding::Context) -> usize {
1782 16
1783 }
1784 }
1785
1786 unsafe impl<D: fidl::encoding::ResourceDialect>
1787 fidl::encoding::Encode<Ipv6ChecksumConfiguration, D> for &Ipv6ChecksumConfiguration
1788 {
1789 #[inline]
1790 unsafe fn encode(
1791 self,
1792 encoder: &mut fidl::encoding::Encoder<'_, D>,
1793 offset: usize,
1794 _depth: fidl::encoding::Depth,
1795 ) -> fidl::Result<()> {
1796 encoder.debug_check_bounds::<Ipv6ChecksumConfiguration>(offset);
1797 encoder.write_num::<u64>(self.ordinal(), offset);
1798 match self {
1799 Ipv6ChecksumConfiguration::Disabled(ref val) => {
1800 fidl::encoding::encode_in_envelope::<Empty, D>(
1801 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1802 encoder,
1803 offset + 8,
1804 _depth,
1805 )
1806 }
1807 Ipv6ChecksumConfiguration::Offset(ref val) => {
1808 fidl::encoding::encode_in_envelope::<i32, D>(
1809 <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
1810 encoder,
1811 offset + 8,
1812 _depth,
1813 )
1814 }
1815 }
1816 }
1817 }
1818
1819 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1820 for Ipv6ChecksumConfiguration
1821 {
1822 #[inline(always)]
1823 fn new_empty() -> Self {
1824 Self::Disabled(fidl::new_empty!(Empty, D))
1825 }
1826
1827 #[inline]
1828 unsafe fn decode(
1829 &mut self,
1830 decoder: &mut fidl::encoding::Decoder<'_, D>,
1831 offset: usize,
1832 mut depth: fidl::encoding::Depth,
1833 ) -> fidl::Result<()> {
1834 decoder.debug_check_bounds::<Self>(offset);
1835 #[allow(unused_variables)]
1836 let next_out_of_line = decoder.next_out_of_line();
1837 let handles_before = decoder.remaining_handles();
1838 let (ordinal, inlined, num_bytes, num_handles) =
1839 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1840
1841 let member_inline_size = match ordinal {
1842 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1843 2 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1844 _ => return Err(fidl::Error::UnknownUnionTag),
1845 };
1846
1847 if inlined != (member_inline_size <= 4) {
1848 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1849 }
1850 let _inner_offset;
1851 if inlined {
1852 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1853 _inner_offset = offset + 8;
1854 } else {
1855 depth.increment()?;
1856 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1857 }
1858 match ordinal {
1859 1 => {
1860 #[allow(irrefutable_let_patterns)]
1861 if let Ipv6ChecksumConfiguration::Disabled(_) = self {
1862 } else {
1864 *self = Ipv6ChecksumConfiguration::Disabled(fidl::new_empty!(Empty, D));
1866 }
1867 #[allow(irrefutable_let_patterns)]
1868 if let Ipv6ChecksumConfiguration::Disabled(ref mut val) = self {
1869 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1870 } else {
1871 unreachable!()
1872 }
1873 }
1874 2 => {
1875 #[allow(irrefutable_let_patterns)]
1876 if let Ipv6ChecksumConfiguration::Offset(_) = self {
1877 } else {
1879 *self = Ipv6ChecksumConfiguration::Offset(fidl::new_empty!(i32, D));
1881 }
1882 #[allow(irrefutable_let_patterns)]
1883 if let Ipv6ChecksumConfiguration::Offset(ref mut val) = self {
1884 fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
1885 } else {
1886 unreachable!()
1887 }
1888 }
1889 ordinal => panic!("unexpected ordinal {:?}", ordinal),
1890 }
1891 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1892 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1893 }
1894 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1895 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1896 }
1897 Ok(())
1898 }
1899 }
1900
1901 impl fidl::encoding::ValueTypeMarker for ProtocolAssociation {
1902 type Borrowed<'a> = &'a Self;
1903 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1904 value
1905 }
1906 }
1907
1908 unsafe impl fidl::encoding::TypeMarker for ProtocolAssociation {
1909 type Owned = Self;
1910
1911 #[inline(always)]
1912 fn inline_align(_context: fidl::encoding::Context) -> usize {
1913 8
1914 }
1915
1916 #[inline(always)]
1917 fn inline_size(_context: fidl::encoding::Context) -> usize {
1918 16
1919 }
1920 }
1921
1922 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProtocolAssociation, D>
1923 for &ProtocolAssociation
1924 {
1925 #[inline]
1926 unsafe fn encode(
1927 self,
1928 encoder: &mut fidl::encoding::Encoder<'_, D>,
1929 offset: usize,
1930 _depth: fidl::encoding::Depth,
1931 ) -> fidl::Result<()> {
1932 encoder.debug_check_bounds::<ProtocolAssociation>(offset);
1933 encoder.write_num::<u64>(self.ordinal(), offset);
1934 match self {
1935 ProtocolAssociation::Unassociated(ref val) => {
1936 fidl::encoding::encode_in_envelope::<Empty, D>(
1937 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1938 encoder,
1939 offset + 8,
1940 _depth,
1941 )
1942 }
1943 ProtocolAssociation::Associated(ref val) => {
1944 fidl::encoding::encode_in_envelope::<u8, D>(
1945 <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
1946 encoder,
1947 offset + 8,
1948 _depth,
1949 )
1950 }
1951 }
1952 }
1953 }
1954
1955 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProtocolAssociation {
1956 #[inline(always)]
1957 fn new_empty() -> Self {
1958 Self::Unassociated(fidl::new_empty!(Empty, D))
1959 }
1960
1961 #[inline]
1962 unsafe fn decode(
1963 &mut self,
1964 decoder: &mut fidl::encoding::Decoder<'_, D>,
1965 offset: usize,
1966 mut depth: fidl::encoding::Depth,
1967 ) -> fidl::Result<()> {
1968 decoder.debug_check_bounds::<Self>(offset);
1969 #[allow(unused_variables)]
1970 let next_out_of_line = decoder.next_out_of_line();
1971 let handles_before = decoder.remaining_handles();
1972 let (ordinal, inlined, num_bytes, num_handles) =
1973 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1974
1975 let member_inline_size = match ordinal {
1976 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1977 2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1978 _ => return Err(fidl::Error::UnknownUnionTag),
1979 };
1980
1981 if inlined != (member_inline_size <= 4) {
1982 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1983 }
1984 let _inner_offset;
1985 if inlined {
1986 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1987 _inner_offset = offset + 8;
1988 } else {
1989 depth.increment()?;
1990 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1991 }
1992 match ordinal {
1993 1 => {
1994 #[allow(irrefutable_let_patterns)]
1995 if let ProtocolAssociation::Unassociated(_) = self {
1996 } else {
1998 *self = ProtocolAssociation::Unassociated(fidl::new_empty!(Empty, D));
2000 }
2001 #[allow(irrefutable_let_patterns)]
2002 if let ProtocolAssociation::Unassociated(ref mut val) = self {
2003 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2004 } else {
2005 unreachable!()
2006 }
2007 }
2008 2 => {
2009 #[allow(irrefutable_let_patterns)]
2010 if let ProtocolAssociation::Associated(_) = self {
2011 } else {
2013 *self = ProtocolAssociation::Associated(fidl::new_empty!(u8, D));
2015 }
2016 #[allow(irrefutable_let_patterns)]
2017 if let ProtocolAssociation::Associated(ref mut val) = self {
2018 fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
2019 } else {
2020 unreachable!()
2021 }
2022 }
2023 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2024 }
2025 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2026 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2027 }
2028 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2029 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2030 }
2031 Ok(())
2032 }
2033 }
2034}