bpfd_api/
bpfd.v1.rs

1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct BytecodeImage {
4    #[prost(string, tag = "1")]
5    pub url: ::prost::alloc::string::String,
6    #[prost(int32, tag = "2")]
7    pub image_pull_policy: i32,
8    #[prost(string, optional, tag = "3")]
9    pub username: ::core::option::Option<::prost::alloc::string::String>,
10    #[prost(string, optional, tag = "4")]
11    pub password: ::core::option::Option<::prost::alloc::string::String>,
12}
13/// BytecodeLocation is either:
14/// - Parameters to pull an eBPF program stored in an OCI container image.
15/// - Local file path for an image.
16#[allow(clippy::derive_partial_eq_without_eq)]
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct BytecodeLocation {
19    #[prost(oneof = "bytecode_location::Location", tags = "2, 3")]
20    pub location: ::core::option::Option<bytecode_location::Location>,
21}
22/// Nested message and enum types in `BytecodeLocation`.
23pub mod bytecode_location {
24    #[allow(clippy::derive_partial_eq_without_eq)]
25    #[derive(Clone, PartialEq, ::prost::Oneof)]
26    pub enum Location {
27        #[prost(message, tag = "2")]
28        Image(super::BytecodeImage),
29        #[prost(string, tag = "3")]
30        File(::prost::alloc::string::String),
31    }
32}
33#[allow(clippy::derive_partial_eq_without_eq)]
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct KernelProgramInfo {
36    /// Name as seen by the kernel. May be truncated version of user enter
37    #[prost(uint32, tag = "1")]
38    pub id: u32,
39    /// name since limited to 16 byte by kernel
40    #[prost(string, tag = "2")]
41    pub name: ::prost::alloc::string::String,
42    #[prost(uint32, tag = "3")]
43    pub program_type: u32,
44    #[prost(string, tag = "4")]
45    pub loaded_at: ::prost::alloc::string::String,
46    #[prost(string, tag = "5")]
47    pub tag: ::prost::alloc::string::String,
48    #[prost(bool, tag = "6")]
49    pub gpl_compatible: bool,
50    #[prost(uint32, repeated, tag = "7")]
51    pub map_ids: ::prost::alloc::vec::Vec<u32>,
52    #[prost(uint32, tag = "8")]
53    pub btf_id: u32,
54    #[prost(uint32, tag = "9")]
55    pub bytes_xlated: u32,
56    #[prost(bool, tag = "10")]
57    pub jited: bool,
58    #[prost(uint32, tag = "11")]
59    pub bytes_jited: u32,
60    #[prost(uint32, tag = "12")]
61    pub bytes_memlock: u32,
62    #[prost(uint32, tag = "13")]
63    pub verified_insns: u32,
64}
65#[allow(clippy::derive_partial_eq_without_eq)]
66#[derive(Clone, PartialEq, ::prost::Message)]
67pub struct ProgramInfo {
68    /// Name entered by user
69    #[prost(string, tag = "1")]
70    pub name: ::prost::alloc::string::String,
71    #[prost(message, optional, tag = "2")]
72    pub bytecode: ::core::option::Option<BytecodeLocation>,
73    #[prost(message, optional, tag = "3")]
74    pub attach: ::core::option::Option<AttachInfo>,
75    #[prost(map = "string, bytes", tag = "4")]
76    pub global_data: ::std::collections::HashMap<
77        ::prost::alloc::string::String,
78        ::prost::alloc::vec::Vec<u8>,
79    >,
80    #[prost(uint32, optional, tag = "5")]
81    pub map_owner_id: ::core::option::Option<u32>,
82    #[prost(string, tag = "6")]
83    pub map_pin_path: ::prost::alloc::string::String,
84    #[prost(string, repeated, tag = "7")]
85    pub map_used_by: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
86    #[prost(map = "string, string", tag = "8")]
87    pub metadata: ::std::collections::HashMap<
88        ::prost::alloc::string::String,
89        ::prost::alloc::string::String,
90    >,
91}
92#[allow(clippy::derive_partial_eq_without_eq)]
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct XdpAttachInfo {
95    #[prost(int32, tag = "1")]
96    pub priority: i32,
97    #[prost(string, tag = "2")]
98    pub iface: ::prost::alloc::string::String,
99    #[prost(int32, tag = "3")]
100    pub position: i32,
101    #[prost(int32, repeated, tag = "4")]
102    pub proceed_on: ::prost::alloc::vec::Vec<i32>,
103}
104#[allow(clippy::derive_partial_eq_without_eq)]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct TcAttachInfo {
107    #[prost(int32, tag = "1")]
108    pub priority: i32,
109    #[prost(string, tag = "2")]
110    pub iface: ::prost::alloc::string::String,
111    #[prost(int32, tag = "3")]
112    pub position: i32,
113    #[prost(string, tag = "4")]
114    pub direction: ::prost::alloc::string::String,
115    #[prost(int32, repeated, tag = "5")]
116    pub proceed_on: ::prost::alloc::vec::Vec<i32>,
117}
118#[allow(clippy::derive_partial_eq_without_eq)]
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct TracepointAttachInfo {
121    #[prost(string, tag = "1")]
122    pub tracepoint: ::prost::alloc::string::String,
123}
124#[allow(clippy::derive_partial_eq_without_eq)]
125#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct KprobeAttachInfo {
127    #[prost(string, tag = "1")]
128    pub fn_name: ::prost::alloc::string::String,
129    #[prost(uint64, tag = "2")]
130    pub offset: u64,
131    #[prost(bool, tag = "3")]
132    pub retprobe: bool,
133    #[prost(string, optional, tag = "4")]
134    pub namespace: ::core::option::Option<::prost::alloc::string::String>,
135}
136#[allow(clippy::derive_partial_eq_without_eq)]
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct UprobeAttachInfo {
139    #[prost(string, optional, tag = "1")]
140    pub fn_name: ::core::option::Option<::prost::alloc::string::String>,
141    #[prost(uint64, tag = "2")]
142    pub offset: u64,
143    #[prost(string, tag = "3")]
144    pub target: ::prost::alloc::string::String,
145    #[prost(bool, tag = "4")]
146    pub retprobe: bool,
147    #[prost(int32, optional, tag = "5")]
148    pub pid: ::core::option::Option<i32>,
149    #[prost(string, optional, tag = "6")]
150    pub namespace: ::core::option::Option<::prost::alloc::string::String>,
151}
152#[allow(clippy::derive_partial_eq_without_eq)]
153#[derive(Clone, PartialEq, ::prost::Message)]
154pub struct AttachInfo {
155    #[prost(oneof = "attach_info::Info", tags = "2, 3, 4, 5, 6")]
156    pub info: ::core::option::Option<attach_info::Info>,
157}
158/// Nested message and enum types in `AttachInfo`.
159pub mod attach_info {
160    #[allow(clippy::derive_partial_eq_without_eq)]
161    #[derive(Clone, PartialEq, ::prost::Oneof)]
162    pub enum Info {
163        #[prost(message, tag = "2")]
164        XdpAttachInfo(super::XdpAttachInfo),
165        #[prost(message, tag = "3")]
166        TcAttachInfo(super::TcAttachInfo),
167        #[prost(message, tag = "4")]
168        TracepointAttachInfo(super::TracepointAttachInfo),
169        #[prost(message, tag = "5")]
170        KprobeAttachInfo(super::KprobeAttachInfo),
171        #[prost(message, tag = "6")]
172        UprobeAttachInfo(super::UprobeAttachInfo),
173    }
174}
175#[allow(clippy::derive_partial_eq_without_eq)]
176#[derive(Clone, PartialEq, ::prost::Message)]
177pub struct LoadRequest {
178    #[prost(message, optional, tag = "1")]
179    pub bytecode: ::core::option::Option<BytecodeLocation>,
180    #[prost(string, tag = "2")]
181    pub name: ::prost::alloc::string::String,
182    #[prost(uint32, tag = "3")]
183    pub program_type: u32,
184    #[prost(message, optional, tag = "4")]
185    pub attach: ::core::option::Option<AttachInfo>,
186    #[prost(map = "string, string", tag = "5")]
187    pub metadata: ::std::collections::HashMap<
188        ::prost::alloc::string::String,
189        ::prost::alloc::string::String,
190    >,
191    #[prost(map = "string, bytes", tag = "6")]
192    pub global_data: ::std::collections::HashMap<
193        ::prost::alloc::string::String,
194        ::prost::alloc::vec::Vec<u8>,
195    >,
196    #[prost(string, optional, tag = "7")]
197    pub uuid: ::core::option::Option<::prost::alloc::string::String>,
198    #[prost(uint32, optional, tag = "8")]
199    pub map_owner_id: ::core::option::Option<u32>,
200}
201#[allow(clippy::derive_partial_eq_without_eq)]
202#[derive(Clone, PartialEq, ::prost::Message)]
203pub struct LoadResponse {
204    #[prost(message, optional, tag = "1")]
205    pub info: ::core::option::Option<ProgramInfo>,
206    #[prost(message, optional, tag = "2")]
207    pub kernel_info: ::core::option::Option<KernelProgramInfo>,
208}
209#[allow(clippy::derive_partial_eq_without_eq)]
210#[derive(Clone, PartialEq, ::prost::Message)]
211pub struct UnloadRequest {
212    #[prost(uint32, tag = "1")]
213    pub id: u32,
214}
215#[allow(clippy::derive_partial_eq_without_eq)]
216#[derive(Clone, PartialEq, ::prost::Message)]
217pub struct UnloadResponse {}
218#[allow(clippy::derive_partial_eq_without_eq)]
219#[derive(Clone, PartialEq, ::prost::Message)]
220pub struct ListRequest {
221    #[prost(uint32, optional, tag = "1")]
222    pub program_type: ::core::option::Option<u32>,
223    #[prost(bool, optional, tag = "2")]
224    pub bpfd_programs_only: ::core::option::Option<bool>,
225    #[prost(map = "string, string", tag = "3")]
226    pub match_metadata: ::std::collections::HashMap<
227        ::prost::alloc::string::String,
228        ::prost::alloc::string::String,
229    >,
230}
231#[allow(clippy::derive_partial_eq_without_eq)]
232#[derive(Clone, PartialEq, ::prost::Message)]
233pub struct ListResponse {
234    #[prost(message, repeated, tag = "3")]
235    pub results: ::prost::alloc::vec::Vec<list_response::ListResult>,
236}
237/// Nested message and enum types in `ListResponse`.
238pub mod list_response {
239    #[allow(clippy::derive_partial_eq_without_eq)]
240    #[derive(Clone, PartialEq, ::prost::Message)]
241    pub struct ListResult {
242        #[prost(message, optional, tag = "1")]
243        pub info: ::core::option::Option<super::ProgramInfo>,
244        #[prost(message, optional, tag = "2")]
245        pub kernel_info: ::core::option::Option<super::KernelProgramInfo>,
246    }
247}
248#[allow(clippy::derive_partial_eq_without_eq)]
249#[derive(Clone, PartialEq, ::prost::Message)]
250pub struct PullBytecodeRequest {
251    #[prost(message, optional, tag = "1")]
252    pub image: ::core::option::Option<BytecodeImage>,
253}
254#[allow(clippy::derive_partial_eq_without_eq)]
255#[derive(Clone, PartialEq, ::prost::Message)]
256pub struct PullBytecodeResponse {}
257#[allow(clippy::derive_partial_eq_without_eq)]
258#[derive(Clone, PartialEq, ::prost::Message)]
259pub struct GetRequest {
260    #[prost(uint32, tag = "1")]
261    pub id: u32,
262}
263#[allow(clippy::derive_partial_eq_without_eq)]
264#[derive(Clone, PartialEq, ::prost::Message)]
265pub struct GetResponse {
266    #[prost(message, optional, tag = "1")]
267    pub info: ::core::option::Option<ProgramInfo>,
268    #[prost(message, optional, tag = "2")]
269    pub kernel_info: ::core::option::Option<KernelProgramInfo>,
270}
271/// Generated client implementations.
272pub mod bpfd_client {
273    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
274    use tonic::codegen::*;
275    use tonic::codegen::http::Uri;
276    #[derive(Debug, Clone)]
277    pub struct BpfdClient<T> {
278        inner: tonic::client::Grpc<T>,
279    }
280    impl<T> BpfdClient<T>
281    where
282        T: tonic::client::GrpcService<tonic::body::BoxBody>,
283        T::Error: Into<StdError>,
284        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
285        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
286    {
287        pub fn new(inner: T) -> Self {
288            let inner = tonic::client::Grpc::new(inner);
289            Self { inner }
290        }
291        pub fn with_origin(inner: T, origin: Uri) -> Self {
292            let inner = tonic::client::Grpc::with_origin(inner, origin);
293            Self { inner }
294        }
295        pub fn with_interceptor<F>(
296            inner: T,
297            interceptor: F,
298        ) -> BpfdClient<InterceptedService<T, F>>
299        where
300            F: tonic::service::Interceptor,
301            T::ResponseBody: Default,
302            T: tonic::codegen::Service<
303                http::Request<tonic::body::BoxBody>,
304                Response = http::Response<
305                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
306                >,
307            >,
308            <T as tonic::codegen::Service<
309                http::Request<tonic::body::BoxBody>,
310            >>::Error: Into<StdError> + Send + Sync,
311        {
312            BpfdClient::new(InterceptedService::new(inner, interceptor))
313        }
314        /// Compress requests with the given encoding.
315        ///
316        /// This requires the server to support it otherwise it might respond with an
317        /// error.
318        #[must_use]
319        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
320            self.inner = self.inner.send_compressed(encoding);
321            self
322        }
323        /// Enable decompressing responses.
324        #[must_use]
325        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
326            self.inner = self.inner.accept_compressed(encoding);
327            self
328        }
329        /// Limits the maximum size of a decoded message.
330        ///
331        /// Default: `4MB`
332        #[must_use]
333        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
334            self.inner = self.inner.max_decoding_message_size(limit);
335            self
336        }
337        /// Limits the maximum size of an encoded message.
338        ///
339        /// Default: `usize::MAX`
340        #[must_use]
341        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
342            self.inner = self.inner.max_encoding_message_size(limit);
343            self
344        }
345        pub async fn load(
346            &mut self,
347            request: impl tonic::IntoRequest<super::LoadRequest>,
348        ) -> std::result::Result<tonic::Response<super::LoadResponse>, tonic::Status> {
349            self.inner
350                .ready()
351                .await
352                .map_err(|e| {
353                    tonic::Status::new(
354                        tonic::Code::Unknown,
355                        format!("Service was not ready: {}", e.into()),
356                    )
357                })?;
358            let codec = tonic::codec::ProstCodec::default();
359            let path = http::uri::PathAndQuery::from_static("/bpfd.v1.Bpfd/Load");
360            let mut req = request.into_request();
361            req.extensions_mut().insert(GrpcMethod::new("bpfd.v1.Bpfd", "Load"));
362            self.inner.unary(req, path, codec).await
363        }
364        pub async fn unload(
365            &mut self,
366            request: impl tonic::IntoRequest<super::UnloadRequest>,
367        ) -> std::result::Result<tonic::Response<super::UnloadResponse>, tonic::Status> {
368            self.inner
369                .ready()
370                .await
371                .map_err(|e| {
372                    tonic::Status::new(
373                        tonic::Code::Unknown,
374                        format!("Service was not ready: {}", e.into()),
375                    )
376                })?;
377            let codec = tonic::codec::ProstCodec::default();
378            let path = http::uri::PathAndQuery::from_static("/bpfd.v1.Bpfd/Unload");
379            let mut req = request.into_request();
380            req.extensions_mut().insert(GrpcMethod::new("bpfd.v1.Bpfd", "Unload"));
381            self.inner.unary(req, path, codec).await
382        }
383        pub async fn list(
384            &mut self,
385            request: impl tonic::IntoRequest<super::ListRequest>,
386        ) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status> {
387            self.inner
388                .ready()
389                .await
390                .map_err(|e| {
391                    tonic::Status::new(
392                        tonic::Code::Unknown,
393                        format!("Service was not ready: {}", e.into()),
394                    )
395                })?;
396            let codec = tonic::codec::ProstCodec::default();
397            let path = http::uri::PathAndQuery::from_static("/bpfd.v1.Bpfd/List");
398            let mut req = request.into_request();
399            req.extensions_mut().insert(GrpcMethod::new("bpfd.v1.Bpfd", "List"));
400            self.inner.unary(req, path, codec).await
401        }
402        pub async fn pull_bytecode(
403            &mut self,
404            request: impl tonic::IntoRequest<super::PullBytecodeRequest>,
405        ) -> std::result::Result<
406            tonic::Response<super::PullBytecodeResponse>,
407            tonic::Status,
408        > {
409            self.inner
410                .ready()
411                .await
412                .map_err(|e| {
413                    tonic::Status::new(
414                        tonic::Code::Unknown,
415                        format!("Service was not ready: {}", e.into()),
416                    )
417                })?;
418            let codec = tonic::codec::ProstCodec::default();
419            let path = http::uri::PathAndQuery::from_static(
420                "/bpfd.v1.Bpfd/PullBytecode",
421            );
422            let mut req = request.into_request();
423            req.extensions_mut().insert(GrpcMethod::new("bpfd.v1.Bpfd", "PullBytecode"));
424            self.inner.unary(req, path, codec).await
425        }
426        pub async fn get(
427            &mut self,
428            request: impl tonic::IntoRequest<super::GetRequest>,
429        ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status> {
430            self.inner
431                .ready()
432                .await
433                .map_err(|e| {
434                    tonic::Status::new(
435                        tonic::Code::Unknown,
436                        format!("Service was not ready: {}", e.into()),
437                    )
438                })?;
439            let codec = tonic::codec::ProstCodec::default();
440            let path = http::uri::PathAndQuery::from_static("/bpfd.v1.Bpfd/Get");
441            let mut req = request.into_request();
442            req.extensions_mut().insert(GrpcMethod::new("bpfd.v1.Bpfd", "Get"));
443            self.inner.unary(req, path, codec).await
444        }
445    }
446}
447/// Generated server implementations.
448pub mod bpfd_server {
449    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
450    use tonic::codegen::*;
451    /// Generated trait containing gRPC methods that should be implemented for use with BpfdServer.
452    #[async_trait]
453    pub trait Bpfd: Send + Sync + 'static {
454        async fn load(
455            &self,
456            request: tonic::Request<super::LoadRequest>,
457        ) -> std::result::Result<tonic::Response<super::LoadResponse>, tonic::Status>;
458        async fn unload(
459            &self,
460            request: tonic::Request<super::UnloadRequest>,
461        ) -> std::result::Result<tonic::Response<super::UnloadResponse>, tonic::Status>;
462        async fn list(
463            &self,
464            request: tonic::Request<super::ListRequest>,
465        ) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status>;
466        async fn pull_bytecode(
467            &self,
468            request: tonic::Request<super::PullBytecodeRequest>,
469        ) -> std::result::Result<
470            tonic::Response<super::PullBytecodeResponse>,
471            tonic::Status,
472        >;
473        async fn get(
474            &self,
475            request: tonic::Request<super::GetRequest>,
476        ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status>;
477    }
478    #[derive(Debug)]
479    pub struct BpfdServer<T: Bpfd> {
480        inner: _Inner<T>,
481        accept_compression_encodings: EnabledCompressionEncodings,
482        send_compression_encodings: EnabledCompressionEncodings,
483        max_decoding_message_size: Option<usize>,
484        max_encoding_message_size: Option<usize>,
485    }
486    struct _Inner<T>(Arc<T>);
487    impl<T: Bpfd> BpfdServer<T> {
488        pub fn new(inner: T) -> Self {
489            Self::from_arc(Arc::new(inner))
490        }
491        pub fn from_arc(inner: Arc<T>) -> Self {
492            let inner = _Inner(inner);
493            Self {
494                inner,
495                accept_compression_encodings: Default::default(),
496                send_compression_encodings: Default::default(),
497                max_decoding_message_size: None,
498                max_encoding_message_size: None,
499            }
500        }
501        pub fn with_interceptor<F>(
502            inner: T,
503            interceptor: F,
504        ) -> InterceptedService<Self, F>
505        where
506            F: tonic::service::Interceptor,
507        {
508            InterceptedService::new(Self::new(inner), interceptor)
509        }
510        /// Enable decompressing requests with the given encoding.
511        #[must_use]
512        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
513            self.accept_compression_encodings.enable(encoding);
514            self
515        }
516        /// Compress responses with the given encoding, if the client supports it.
517        #[must_use]
518        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
519            self.send_compression_encodings.enable(encoding);
520            self
521        }
522        /// Limits the maximum size of a decoded message.
523        ///
524        /// Default: `4MB`
525        #[must_use]
526        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
527            self.max_decoding_message_size = Some(limit);
528            self
529        }
530        /// Limits the maximum size of an encoded message.
531        ///
532        /// Default: `usize::MAX`
533        #[must_use]
534        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
535            self.max_encoding_message_size = Some(limit);
536            self
537        }
538    }
539    impl<T, B> tonic::codegen::Service<http::Request<B>> for BpfdServer<T>
540    where
541        T: Bpfd,
542        B: Body + Send + 'static,
543        B::Error: Into<StdError> + Send + 'static,
544    {
545        type Response = http::Response<tonic::body::BoxBody>;
546        type Error = std::convert::Infallible;
547        type Future = BoxFuture<Self::Response, Self::Error>;
548        fn poll_ready(
549            &mut self,
550            _cx: &mut Context<'_>,
551        ) -> Poll<std::result::Result<(), Self::Error>> {
552            Poll::Ready(Ok(()))
553        }
554        fn call(&mut self, req: http::Request<B>) -> Self::Future {
555            let inner = self.inner.clone();
556            match req.uri().path() {
557                "/bpfd.v1.Bpfd/Load" => {
558                    #[allow(non_camel_case_types)]
559                    struct LoadSvc<T: Bpfd>(pub Arc<T>);
560                    impl<T: Bpfd> tonic::server::UnaryService<super::LoadRequest>
561                    for LoadSvc<T> {
562                        type Response = super::LoadResponse;
563                        type Future = BoxFuture<
564                            tonic::Response<Self::Response>,
565                            tonic::Status,
566                        >;
567                        fn call(
568                            &mut self,
569                            request: tonic::Request<super::LoadRequest>,
570                        ) -> Self::Future {
571                            let inner = Arc::clone(&self.0);
572                            let fut = async move {
573                                <T as Bpfd>::load(&inner, request).await
574                            };
575                            Box::pin(fut)
576                        }
577                    }
578                    let accept_compression_encodings = self.accept_compression_encodings;
579                    let send_compression_encodings = self.send_compression_encodings;
580                    let max_decoding_message_size = self.max_decoding_message_size;
581                    let max_encoding_message_size = self.max_encoding_message_size;
582                    let inner = self.inner.clone();
583                    let fut = async move {
584                        let inner = inner.0;
585                        let method = LoadSvc(inner);
586                        let codec = tonic::codec::ProstCodec::default();
587                        let mut grpc = tonic::server::Grpc::new(codec)
588                            .apply_compression_config(
589                                accept_compression_encodings,
590                                send_compression_encodings,
591                            )
592                            .apply_max_message_size_config(
593                                max_decoding_message_size,
594                                max_encoding_message_size,
595                            );
596                        let res = grpc.unary(method, req).await;
597                        Ok(res)
598                    };
599                    Box::pin(fut)
600                }
601                "/bpfd.v1.Bpfd/Unload" => {
602                    #[allow(non_camel_case_types)]
603                    struct UnloadSvc<T: Bpfd>(pub Arc<T>);
604                    impl<T: Bpfd> tonic::server::UnaryService<super::UnloadRequest>
605                    for UnloadSvc<T> {
606                        type Response = super::UnloadResponse;
607                        type Future = BoxFuture<
608                            tonic::Response<Self::Response>,
609                            tonic::Status,
610                        >;
611                        fn call(
612                            &mut self,
613                            request: tonic::Request<super::UnloadRequest>,
614                        ) -> Self::Future {
615                            let inner = Arc::clone(&self.0);
616                            let fut = async move {
617                                <T as Bpfd>::unload(&inner, request).await
618                            };
619                            Box::pin(fut)
620                        }
621                    }
622                    let accept_compression_encodings = self.accept_compression_encodings;
623                    let send_compression_encodings = self.send_compression_encodings;
624                    let max_decoding_message_size = self.max_decoding_message_size;
625                    let max_encoding_message_size = self.max_encoding_message_size;
626                    let inner = self.inner.clone();
627                    let fut = async move {
628                        let inner = inner.0;
629                        let method = UnloadSvc(inner);
630                        let codec = tonic::codec::ProstCodec::default();
631                        let mut grpc = tonic::server::Grpc::new(codec)
632                            .apply_compression_config(
633                                accept_compression_encodings,
634                                send_compression_encodings,
635                            )
636                            .apply_max_message_size_config(
637                                max_decoding_message_size,
638                                max_encoding_message_size,
639                            );
640                        let res = grpc.unary(method, req).await;
641                        Ok(res)
642                    };
643                    Box::pin(fut)
644                }
645                "/bpfd.v1.Bpfd/List" => {
646                    #[allow(non_camel_case_types)]
647                    struct ListSvc<T: Bpfd>(pub Arc<T>);
648                    impl<T: Bpfd> tonic::server::UnaryService<super::ListRequest>
649                    for ListSvc<T> {
650                        type Response = super::ListResponse;
651                        type Future = BoxFuture<
652                            tonic::Response<Self::Response>,
653                            tonic::Status,
654                        >;
655                        fn call(
656                            &mut self,
657                            request: tonic::Request<super::ListRequest>,
658                        ) -> Self::Future {
659                            let inner = Arc::clone(&self.0);
660                            let fut = async move {
661                                <T as Bpfd>::list(&inner, request).await
662                            };
663                            Box::pin(fut)
664                        }
665                    }
666                    let accept_compression_encodings = self.accept_compression_encodings;
667                    let send_compression_encodings = self.send_compression_encodings;
668                    let max_decoding_message_size = self.max_decoding_message_size;
669                    let max_encoding_message_size = self.max_encoding_message_size;
670                    let inner = self.inner.clone();
671                    let fut = async move {
672                        let inner = inner.0;
673                        let method = ListSvc(inner);
674                        let codec = tonic::codec::ProstCodec::default();
675                        let mut grpc = tonic::server::Grpc::new(codec)
676                            .apply_compression_config(
677                                accept_compression_encodings,
678                                send_compression_encodings,
679                            )
680                            .apply_max_message_size_config(
681                                max_decoding_message_size,
682                                max_encoding_message_size,
683                            );
684                        let res = grpc.unary(method, req).await;
685                        Ok(res)
686                    };
687                    Box::pin(fut)
688                }
689                "/bpfd.v1.Bpfd/PullBytecode" => {
690                    #[allow(non_camel_case_types)]
691                    struct PullBytecodeSvc<T: Bpfd>(pub Arc<T>);
692                    impl<T: Bpfd> tonic::server::UnaryService<super::PullBytecodeRequest>
693                    for PullBytecodeSvc<T> {
694                        type Response = super::PullBytecodeResponse;
695                        type Future = BoxFuture<
696                            tonic::Response<Self::Response>,
697                            tonic::Status,
698                        >;
699                        fn call(
700                            &mut self,
701                            request: tonic::Request<super::PullBytecodeRequest>,
702                        ) -> Self::Future {
703                            let inner = Arc::clone(&self.0);
704                            let fut = async move {
705                                <T as Bpfd>::pull_bytecode(&inner, request).await
706                            };
707                            Box::pin(fut)
708                        }
709                    }
710                    let accept_compression_encodings = self.accept_compression_encodings;
711                    let send_compression_encodings = self.send_compression_encodings;
712                    let max_decoding_message_size = self.max_decoding_message_size;
713                    let max_encoding_message_size = self.max_encoding_message_size;
714                    let inner = self.inner.clone();
715                    let fut = async move {
716                        let inner = inner.0;
717                        let method = PullBytecodeSvc(inner);
718                        let codec = tonic::codec::ProstCodec::default();
719                        let mut grpc = tonic::server::Grpc::new(codec)
720                            .apply_compression_config(
721                                accept_compression_encodings,
722                                send_compression_encodings,
723                            )
724                            .apply_max_message_size_config(
725                                max_decoding_message_size,
726                                max_encoding_message_size,
727                            );
728                        let res = grpc.unary(method, req).await;
729                        Ok(res)
730                    };
731                    Box::pin(fut)
732                }
733                "/bpfd.v1.Bpfd/Get" => {
734                    #[allow(non_camel_case_types)]
735                    struct GetSvc<T: Bpfd>(pub Arc<T>);
736                    impl<T: Bpfd> tonic::server::UnaryService<super::GetRequest>
737                    for GetSvc<T> {
738                        type Response = super::GetResponse;
739                        type Future = BoxFuture<
740                            tonic::Response<Self::Response>,
741                            tonic::Status,
742                        >;
743                        fn call(
744                            &mut self,
745                            request: tonic::Request<super::GetRequest>,
746                        ) -> Self::Future {
747                            let inner = Arc::clone(&self.0);
748                            let fut = async move {
749                                <T as Bpfd>::get(&inner, request).await
750                            };
751                            Box::pin(fut)
752                        }
753                    }
754                    let accept_compression_encodings = self.accept_compression_encodings;
755                    let send_compression_encodings = self.send_compression_encodings;
756                    let max_decoding_message_size = self.max_decoding_message_size;
757                    let max_encoding_message_size = self.max_encoding_message_size;
758                    let inner = self.inner.clone();
759                    let fut = async move {
760                        let inner = inner.0;
761                        let method = GetSvc(inner);
762                        let codec = tonic::codec::ProstCodec::default();
763                        let mut grpc = tonic::server::Grpc::new(codec)
764                            .apply_compression_config(
765                                accept_compression_encodings,
766                                send_compression_encodings,
767                            )
768                            .apply_max_message_size_config(
769                                max_decoding_message_size,
770                                max_encoding_message_size,
771                            );
772                        let res = grpc.unary(method, req).await;
773                        Ok(res)
774                    };
775                    Box::pin(fut)
776                }
777                _ => {
778                    Box::pin(async move {
779                        Ok(
780                            http::Response::builder()
781                                .status(200)
782                                .header("grpc-status", "12")
783                                .header("content-type", "application/grpc")
784                                .body(empty_body())
785                                .unwrap(),
786                        )
787                    })
788                }
789            }
790        }
791    }
792    impl<T: Bpfd> Clone for BpfdServer<T> {
793        fn clone(&self) -> Self {
794            let inner = self.inner.clone();
795            Self {
796                inner,
797                accept_compression_encodings: self.accept_compression_encodings,
798                send_compression_encodings: self.send_compression_encodings,
799                max_decoding_message_size: self.max_decoding_message_size,
800                max_encoding_message_size: self.max_encoding_message_size,
801            }
802        }
803    }
804    impl<T: Bpfd> Clone for _Inner<T> {
805        fn clone(&self) -> Self {
806            Self(Arc::clone(&self.0))
807        }
808    }
809    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
810        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
811            write!(f, "{:?}", self.0)
812        }
813    }
814    impl<T: Bpfd> tonic::server::NamedService for BpfdServer<T> {
815        const NAME: &'static str = "bpfd.v1.Bpfd";
816    }
817}