fidl_fuchsia_hardware_qualcomm_fastrpc__common/
fidl_fuchsia_hardware_qualcomm_fastrpc__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type Capability = u32;
12
13/// See this header for error definitions:
14/// https://github.com/quic/fastrpc/blob/main/inc/AEEStdErr.h
15pub type Error = i32;
16
17pub type PayloadBufferId = u32;
18
19pub const MAX_CAPABILITIES_COUNT: u32 = 256;
20
21pub const MAX_PAYLOAD_BUFFER_SET: u8 = 100;
22
23/// A FastRPC argument that lives in the shared |payload_buffer|.
24#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25#[repr(C)]
26pub struct Argument {
27    /// The start offset of the argument within the |payload_buffer|.
28    pub offset: u64,
29    /// Length of the argument.
30    pub length: u64,
31}
32
33impl fidl::Persistable for Argument {}
34
35#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36#[repr(C)]
37pub struct RemoteDomainGetPayloadBufferSetRequest {
38    pub count: u8,
39}
40
41impl fidl::Persistable for RemoteDomainGetPayloadBufferSetRequest {}
42
43#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44#[repr(C)]
45pub struct SecureFastRpcAllocateRequest {
46    pub size: u64,
47}
48
49impl fidl::Persistable for SecureFastRpcAllocateRequest {}
50
51#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct SecureFastRpcGetCapabilitiesResponse {
53    pub capabilities: Vec<u32>,
54}
55
56impl fidl::Persistable for SecureFastRpcGetCapabilitiesResponse {}
57
58#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59#[repr(C)]
60pub struct SecureFastRpcGetChannelIdResponse {
61    pub channel_id: u32,
62}
63
64impl fidl::Persistable for SecureFastRpcGetChannelIdResponse {}
65
66pub mod remote_domain_ordinals {
67    pub const CLOSE: u64 = 0x473dffa51d061668;
68    pub const GET_PAYLOAD_BUFFER_SET: u64 = 0x3f056fd2e96d72e5;
69    pub const INVOKE: u64 = 0x771f1fe030d80529;
70}
71
72pub mod secure_fast_rpc_ordinals {
73    pub const GET_CHANNEL_ID: u64 = 0x77919bc7c190139a;
74    pub const ALLOCATE: u64 = 0x5443b2d8b251e878;
75    pub const GET_CAPABILITIES: u64 = 0x69bfeede998f5368;
76    pub const ATTACH_ROOT_DOMAIN: u64 = 0x6bde390dfc4c57ed;
77    pub const CREATE_STATIC_DOMAIN: u64 = 0x740a08a1456bc858;
78}
79
80mod internal {
81    use super::*;
82
83    impl fidl::encoding::ValueTypeMarker for Argument {
84        type Borrowed<'a> = &'a Self;
85        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
86            value
87        }
88    }
89
90    unsafe impl fidl::encoding::TypeMarker for Argument {
91        type Owned = Self;
92
93        #[inline(always)]
94        fn inline_align(_context: fidl::encoding::Context) -> usize {
95            8
96        }
97
98        #[inline(always)]
99        fn inline_size(_context: fidl::encoding::Context) -> usize {
100            16
101        }
102        #[inline(always)]
103        fn encode_is_copy() -> bool {
104            true
105        }
106
107        #[inline(always)]
108        fn decode_is_copy() -> bool {
109            true
110        }
111    }
112
113    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Argument, D> for &Argument {
114        #[inline]
115        unsafe fn encode(
116            self,
117            encoder: &mut fidl::encoding::Encoder<'_, D>,
118            offset: usize,
119            _depth: fidl::encoding::Depth,
120        ) -> fidl::Result<()> {
121            encoder.debug_check_bounds::<Argument>(offset);
122            unsafe {
123                // Copy the object into the buffer.
124                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
125                (buf_ptr as *mut Argument).write_unaligned((self as *const Argument).read());
126                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
127                // done second because the memcpy will write garbage to these bytes.
128            }
129            Ok(())
130        }
131    }
132    unsafe impl<
133            D: fidl::encoding::ResourceDialect,
134            T0: fidl::encoding::Encode<u64, D>,
135            T1: fidl::encoding::Encode<u64, D>,
136        > fidl::encoding::Encode<Argument, D> for (T0, T1)
137    {
138        #[inline]
139        unsafe fn encode(
140            self,
141            encoder: &mut fidl::encoding::Encoder<'_, D>,
142            offset: usize,
143            depth: fidl::encoding::Depth,
144        ) -> fidl::Result<()> {
145            encoder.debug_check_bounds::<Argument>(offset);
146            // Zero out padding regions. There's no need to apply masks
147            // because the unmasked parts will be overwritten by fields.
148            // Write the fields.
149            self.0.encode(encoder, offset + 0, depth)?;
150            self.1.encode(encoder, offset + 8, depth)?;
151            Ok(())
152        }
153    }
154
155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Argument {
156        #[inline(always)]
157        fn new_empty() -> Self {
158            Self { offset: fidl::new_empty!(u64, D), length: fidl::new_empty!(u64, D) }
159        }
160
161        #[inline]
162        unsafe fn decode(
163            &mut self,
164            decoder: &mut fidl::encoding::Decoder<'_, D>,
165            offset: usize,
166            _depth: fidl::encoding::Depth,
167        ) -> fidl::Result<()> {
168            decoder.debug_check_bounds::<Self>(offset);
169            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
170            // Verify that padding bytes are zero.
171            // Copy from the buffer into the object.
172            unsafe {
173                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
174            }
175            Ok(())
176        }
177    }
178
179    impl fidl::encoding::ValueTypeMarker for RemoteDomainGetPayloadBufferSetRequest {
180        type Borrowed<'a> = &'a Self;
181        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
182            value
183        }
184    }
185
186    unsafe impl fidl::encoding::TypeMarker for RemoteDomainGetPayloadBufferSetRequest {
187        type Owned = Self;
188
189        #[inline(always)]
190        fn inline_align(_context: fidl::encoding::Context) -> usize {
191            1
192        }
193
194        #[inline(always)]
195        fn inline_size(_context: fidl::encoding::Context) -> usize {
196            1
197        }
198        #[inline(always)]
199        fn encode_is_copy() -> bool {
200            true
201        }
202
203        #[inline(always)]
204        fn decode_is_copy() -> bool {
205            true
206        }
207    }
208
209    unsafe impl<D: fidl::encoding::ResourceDialect>
210        fidl::encoding::Encode<RemoteDomainGetPayloadBufferSetRequest, D>
211        for &RemoteDomainGetPayloadBufferSetRequest
212    {
213        #[inline]
214        unsafe fn encode(
215            self,
216            encoder: &mut fidl::encoding::Encoder<'_, D>,
217            offset: usize,
218            _depth: fidl::encoding::Depth,
219        ) -> fidl::Result<()> {
220            encoder.debug_check_bounds::<RemoteDomainGetPayloadBufferSetRequest>(offset);
221            unsafe {
222                // Copy the object into the buffer.
223                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
224                (buf_ptr as *mut RemoteDomainGetPayloadBufferSetRequest).write_unaligned(
225                    (self as *const RemoteDomainGetPayloadBufferSetRequest).read(),
226                );
227                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
228                // done second because the memcpy will write garbage to these bytes.
229            }
230            Ok(())
231        }
232    }
233    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
234        fidl::encoding::Encode<RemoteDomainGetPayloadBufferSetRequest, D> for (T0,)
235    {
236        #[inline]
237        unsafe fn encode(
238            self,
239            encoder: &mut fidl::encoding::Encoder<'_, D>,
240            offset: usize,
241            depth: fidl::encoding::Depth,
242        ) -> fidl::Result<()> {
243            encoder.debug_check_bounds::<RemoteDomainGetPayloadBufferSetRequest>(offset);
244            // Zero out padding regions. There's no need to apply masks
245            // because the unmasked parts will be overwritten by fields.
246            // Write the fields.
247            self.0.encode(encoder, offset + 0, depth)?;
248            Ok(())
249        }
250    }
251
252    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
253        for RemoteDomainGetPayloadBufferSetRequest
254    {
255        #[inline(always)]
256        fn new_empty() -> Self {
257            Self { count: fidl::new_empty!(u8, D) }
258        }
259
260        #[inline]
261        unsafe fn decode(
262            &mut self,
263            decoder: &mut fidl::encoding::Decoder<'_, D>,
264            offset: usize,
265            _depth: fidl::encoding::Depth,
266        ) -> fidl::Result<()> {
267            decoder.debug_check_bounds::<Self>(offset);
268            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
269            // Verify that padding bytes are zero.
270            // Copy from the buffer into the object.
271            unsafe {
272                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
273            }
274            Ok(())
275        }
276    }
277
278    impl fidl::encoding::ValueTypeMarker for SecureFastRpcAllocateRequest {
279        type Borrowed<'a> = &'a Self;
280        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
281            value
282        }
283    }
284
285    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcAllocateRequest {
286        type Owned = Self;
287
288        #[inline(always)]
289        fn inline_align(_context: fidl::encoding::Context) -> usize {
290            8
291        }
292
293        #[inline(always)]
294        fn inline_size(_context: fidl::encoding::Context) -> usize {
295            8
296        }
297        #[inline(always)]
298        fn encode_is_copy() -> bool {
299            true
300        }
301
302        #[inline(always)]
303        fn decode_is_copy() -> bool {
304            true
305        }
306    }
307
308    unsafe impl<D: fidl::encoding::ResourceDialect>
309        fidl::encoding::Encode<SecureFastRpcAllocateRequest, D> for &SecureFastRpcAllocateRequest
310    {
311        #[inline]
312        unsafe fn encode(
313            self,
314            encoder: &mut fidl::encoding::Encoder<'_, D>,
315            offset: usize,
316            _depth: fidl::encoding::Depth,
317        ) -> fidl::Result<()> {
318            encoder.debug_check_bounds::<SecureFastRpcAllocateRequest>(offset);
319            unsafe {
320                // Copy the object into the buffer.
321                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
322                (buf_ptr as *mut SecureFastRpcAllocateRequest)
323                    .write_unaligned((self as *const SecureFastRpcAllocateRequest).read());
324                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
325                // done second because the memcpy will write garbage to these bytes.
326            }
327            Ok(())
328        }
329    }
330    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
331        fidl::encoding::Encode<SecureFastRpcAllocateRequest, D> for (T0,)
332    {
333        #[inline]
334        unsafe fn encode(
335            self,
336            encoder: &mut fidl::encoding::Encoder<'_, D>,
337            offset: usize,
338            depth: fidl::encoding::Depth,
339        ) -> fidl::Result<()> {
340            encoder.debug_check_bounds::<SecureFastRpcAllocateRequest>(offset);
341            // Zero out padding regions. There's no need to apply masks
342            // because the unmasked parts will be overwritten by fields.
343            // Write the fields.
344            self.0.encode(encoder, offset + 0, depth)?;
345            Ok(())
346        }
347    }
348
349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
350        for SecureFastRpcAllocateRequest
351    {
352        #[inline(always)]
353        fn new_empty() -> Self {
354            Self { size: fidl::new_empty!(u64, D) }
355        }
356
357        #[inline]
358        unsafe fn decode(
359            &mut self,
360            decoder: &mut fidl::encoding::Decoder<'_, D>,
361            offset: usize,
362            _depth: fidl::encoding::Depth,
363        ) -> fidl::Result<()> {
364            decoder.debug_check_bounds::<Self>(offset);
365            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
366            // Verify that padding bytes are zero.
367            // Copy from the buffer into the object.
368            unsafe {
369                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
370            }
371            Ok(())
372        }
373    }
374
375    impl fidl::encoding::ValueTypeMarker for SecureFastRpcGetCapabilitiesResponse {
376        type Borrowed<'a> = &'a Self;
377        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
378            value
379        }
380    }
381
382    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcGetCapabilitiesResponse {
383        type Owned = Self;
384
385        #[inline(always)]
386        fn inline_align(_context: fidl::encoding::Context) -> usize {
387            8
388        }
389
390        #[inline(always)]
391        fn inline_size(_context: fidl::encoding::Context) -> usize {
392            16
393        }
394    }
395
396    unsafe impl<D: fidl::encoding::ResourceDialect>
397        fidl::encoding::Encode<SecureFastRpcGetCapabilitiesResponse, D>
398        for &SecureFastRpcGetCapabilitiesResponse
399    {
400        #[inline]
401        unsafe fn encode(
402            self,
403            encoder: &mut fidl::encoding::Encoder<'_, D>,
404            offset: usize,
405            _depth: fidl::encoding::Depth,
406        ) -> fidl::Result<()> {
407            encoder.debug_check_bounds::<SecureFastRpcGetCapabilitiesResponse>(offset);
408            // Delegate to tuple encoding.
409            fidl::encoding::Encode::<SecureFastRpcGetCapabilitiesResponse, D>::encode(
410                (<fidl::encoding::Vector<u32, 256> as fidl::encoding::ValueTypeMarker>::borrow(
411                    &self.capabilities,
412                ),),
413                encoder,
414                offset,
415                _depth,
416            )
417        }
418    }
419    unsafe impl<
420            D: fidl::encoding::ResourceDialect,
421            T0: fidl::encoding::Encode<fidl::encoding::Vector<u32, 256>, D>,
422        > fidl::encoding::Encode<SecureFastRpcGetCapabilitiesResponse, D> for (T0,)
423    {
424        #[inline]
425        unsafe fn encode(
426            self,
427            encoder: &mut fidl::encoding::Encoder<'_, D>,
428            offset: usize,
429            depth: fidl::encoding::Depth,
430        ) -> fidl::Result<()> {
431            encoder.debug_check_bounds::<SecureFastRpcGetCapabilitiesResponse>(offset);
432            // Zero out padding regions. There's no need to apply masks
433            // because the unmasked parts will be overwritten by fields.
434            // Write the fields.
435            self.0.encode(encoder, offset + 0, depth)?;
436            Ok(())
437        }
438    }
439
440    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
441        for SecureFastRpcGetCapabilitiesResponse
442    {
443        #[inline(always)]
444        fn new_empty() -> Self {
445            Self { capabilities: fidl::new_empty!(fidl::encoding::Vector<u32, 256>, D) }
446        }
447
448        #[inline]
449        unsafe fn decode(
450            &mut self,
451            decoder: &mut fidl::encoding::Decoder<'_, D>,
452            offset: usize,
453            _depth: fidl::encoding::Depth,
454        ) -> fidl::Result<()> {
455            decoder.debug_check_bounds::<Self>(offset);
456            // Verify that padding bytes are zero.
457            fidl::decode!(fidl::encoding::Vector<u32, 256>, D, &mut self.capabilities, decoder, offset + 0, _depth)?;
458            Ok(())
459        }
460    }
461
462    impl fidl::encoding::ValueTypeMarker for SecureFastRpcGetChannelIdResponse {
463        type Borrowed<'a> = &'a Self;
464        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
465            value
466        }
467    }
468
469    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcGetChannelIdResponse {
470        type Owned = Self;
471
472        #[inline(always)]
473        fn inline_align(_context: fidl::encoding::Context) -> usize {
474            4
475        }
476
477        #[inline(always)]
478        fn inline_size(_context: fidl::encoding::Context) -> usize {
479            4
480        }
481        #[inline(always)]
482        fn encode_is_copy() -> bool {
483            true
484        }
485
486        #[inline(always)]
487        fn decode_is_copy() -> bool {
488            true
489        }
490    }
491
492    unsafe impl<D: fidl::encoding::ResourceDialect>
493        fidl::encoding::Encode<SecureFastRpcGetChannelIdResponse, D>
494        for &SecureFastRpcGetChannelIdResponse
495    {
496        #[inline]
497        unsafe fn encode(
498            self,
499            encoder: &mut fidl::encoding::Encoder<'_, D>,
500            offset: usize,
501            _depth: fidl::encoding::Depth,
502        ) -> fidl::Result<()> {
503            encoder.debug_check_bounds::<SecureFastRpcGetChannelIdResponse>(offset);
504            unsafe {
505                // Copy the object into the buffer.
506                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
507                (buf_ptr as *mut SecureFastRpcGetChannelIdResponse)
508                    .write_unaligned((self as *const SecureFastRpcGetChannelIdResponse).read());
509                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
510                // done second because the memcpy will write garbage to these bytes.
511            }
512            Ok(())
513        }
514    }
515    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
516        fidl::encoding::Encode<SecureFastRpcGetChannelIdResponse, D> for (T0,)
517    {
518        #[inline]
519        unsafe fn encode(
520            self,
521            encoder: &mut fidl::encoding::Encoder<'_, D>,
522            offset: usize,
523            depth: fidl::encoding::Depth,
524        ) -> fidl::Result<()> {
525            encoder.debug_check_bounds::<SecureFastRpcGetChannelIdResponse>(offset);
526            // Zero out padding regions. There's no need to apply masks
527            // because the unmasked parts will be overwritten by fields.
528            // Write the fields.
529            self.0.encode(encoder, offset + 0, depth)?;
530            Ok(())
531        }
532    }
533
534    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
535        for SecureFastRpcGetChannelIdResponse
536    {
537        #[inline(always)]
538        fn new_empty() -> Self {
539            Self { channel_id: fidl::new_empty!(u32, D) }
540        }
541
542        #[inline]
543        unsafe fn decode(
544            &mut self,
545            decoder: &mut fidl::encoding::Decoder<'_, D>,
546            offset: usize,
547            _depth: fidl::encoding::Depth,
548        ) -> fidl::Result<()> {
549            decoder.debug_check_bounds::<Self>(offset);
550            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
551            // Verify that padding bytes are zero.
552            // Copy from the buffer into the object.
553            unsafe {
554                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
555            }
556            Ok(())
557        }
558    }
559}