1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Subscribe {
4 #[prost(message, optional, tag = "1")]
5 pub header: ::core::option::Option<SlimHeader>,
6 #[prost(string, tag = "2")]
7 pub component_0: ::prost::alloc::string::String,
8 #[prost(string, tag = "3")]
9 pub component_1: ::prost::alloc::string::String,
10 #[prost(string, tag = "4")]
11 pub component_2: ::prost::alloc::string::String,
12}
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct Unsubscribe {
15 #[prost(message, optional, tag = "1")]
16 pub header: ::core::option::Option<SlimHeader>,
17 #[prost(string, tag = "2")]
18 pub component_0: ::prost::alloc::string::String,
19 #[prost(string, tag = "3")]
20 pub component_1: ::prost::alloc::string::String,
21 #[prost(string, tag = "4")]
22 pub component_2: ::prost::alloc::string::String,
23}
24#[derive(Clone, PartialEq, ::prost::Message)]
25pub struct Publish {
26 #[prost(message, optional, tag = "1")]
27 pub header: ::core::option::Option<SlimHeader>,
28 #[prost(message, optional, tag = "2")]
29 pub session: ::core::option::Option<SessionHeader>,
30 #[prost(message, optional, tag = "3")]
31 pub msg: ::core::option::Option<Content>,
32}
33#[derive(Clone, Copy, PartialEq, ::prost::Message)]
38pub struct SlimHeader {
39 #[prost(message, optional, tag = "1")]
40 pub source: ::core::option::Option<Name>,
41 #[prost(message, optional, tag = "2")]
42 pub destination: ::core::option::Option<Name>,
43 #[prost(uint32, tag = "3")]
44 pub fanout: u32,
45 #[prost(uint64, optional, tag = "4")]
46 pub recv_from: ::core::option::Option<u64>,
47 #[prost(uint64, optional, tag = "5")]
48 pub forward_to: ::core::option::Option<u64>,
49 #[prost(uint64, optional, tag = "6")]
50 pub incoming_conn: ::core::option::Option<u64>,
51 #[prost(bool, optional, tag = "7")]
52 pub error: ::core::option::Option<bool>,
53}
54#[derive(Clone, Copy, PartialEq, ::prost::Message)]
55pub struct Name {
56 #[prost(uint64, tag = "1")]
57 pub component_0: u64,
58 #[prost(uint64, tag = "2")]
59 pub component_1: u64,
60 #[prost(uint64, tag = "3")]
61 pub component_2: u64,
62 #[prost(uint64, tag = "4")]
63 pub component_3: u64,
64}
65#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct OriginalName {
69 #[prost(string, tag = "1")]
70 pub component_0: ::prost::alloc::string::String,
71 #[prost(string, tag = "2")]
72 pub component_1: ::prost::alloc::string::String,
73 #[prost(string, tag = "3")]
74 pub component_2: ::prost::alloc::string::String,
75 #[prost(uint64, tag = "4")]
76 pub component_3: u64,
77}
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct SessionHeader {
80 #[prost(enumeration = "SessionType", tag = "1")]
81 pub session_type: i32,
82 #[prost(enumeration = "SessionMessageType", tag = "2")]
83 pub session_message_type: i32,
84 #[prost(uint32, tag = "3")]
85 pub session_id: u32,
86 #[prost(uint32, tag = "4")]
87 pub message_id: u32,
88 #[prost(message, optional, tag = "5")]
89 pub source: ::core::option::Option<OriginalName>,
90 #[prost(message, optional, tag = "6")]
91 pub destination: ::core::option::Option<OriginalName>,
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct Content {
95 #[prost(string, tag = "1")]
96 pub content_type: ::prost::alloc::string::String,
97 #[prost(bytes = "vec", tag = "2")]
98 pub blob: ::prost::alloc::vec::Vec<u8>,
99}
100#[derive(Clone, PartialEq, ::prost::Message)]
101pub struct Message {
102 #[prost(map = "string, string", tag = "4")]
103 pub metadata: ::std::collections::HashMap<
104 ::prost::alloc::string::String,
105 ::prost::alloc::string::String,
106 >,
107 #[prost(oneof = "message::MessageType", tags = "1, 2, 3")]
108 pub message_type: ::core::option::Option<message::MessageType>,
109}
110pub mod message {
112 #[derive(Clone, PartialEq, ::prost::Oneof)]
113 pub enum MessageType {
114 #[prost(message, tag = "1")]
115 Subscribe(super::Subscribe),
116 #[prost(message, tag = "2")]
117 Unsubscribe(super::Unsubscribe),
118 #[prost(message, tag = "3")]
119 Publish(super::Publish),
120 }
121}
122#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
123#[repr(i32)]
124pub enum SessionType {
125 SessionUnknown = 0,
126 SessionPointToPoint = 1,
127 SessionMulticast = 2,
128}
129impl SessionType {
130 pub fn as_str_name(&self) -> &'static str {
135 match self {
136 Self::SessionUnknown => "SESSION_UNKNOWN",
137 Self::SessionPointToPoint => "SESSION_POINT_TO_POINT",
138 Self::SessionMulticast => "SESSION_MULTICAST",
139 }
140 }
141 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
143 match value {
144 "SESSION_UNKNOWN" => Some(Self::SessionUnknown),
145 "SESSION_POINT_TO_POINT" => Some(Self::SessionPointToPoint),
146 "SESSION_MULTICAST" => Some(Self::SessionMulticast),
147 _ => None,
148 }
149 }
150}
151#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
152#[repr(i32)]
153pub enum SessionMessageType {
154 Unspecified = 0,
155 P2PMsg = 1,
156 P2PReliable = 2,
157 P2PAck = 3,
158 MulticastMsg = 4,
159 RtxRequest = 5,
160 RtxReply = 6,
161 BeaconMulticast = 7,
162 ChannelDiscoveryRequest = 8,
163 ChannelDiscoveryReply = 9,
164 ChannelJoinRequest = 10,
165 ChannelJoinReply = 11,
166 ChannelLeaveRequest = 12,
167 ChannelLeaveReply = 13,
168 ChannelMlsCommit = 14,
169 ChannelMlsWelcome = 15,
170 ChannelMlsProposal = 16,
171 ChannelMlsAck = 17,
172}
173impl SessionMessageType {
174 pub fn as_str_name(&self) -> &'static str {
179 match self {
180 Self::Unspecified => "UNSPECIFIED",
181 Self::P2PMsg => "P_2_P_MSG",
182 Self::P2PReliable => "P_2_P_RELIABLE",
183 Self::P2PAck => "P_2_P_ACK",
184 Self::MulticastMsg => "MULTICAST_MSG",
185 Self::RtxRequest => "RTX_REQUEST",
186 Self::RtxReply => "RTX_REPLY",
187 Self::BeaconMulticast => "BEACON_MULTICAST",
188 Self::ChannelDiscoveryRequest => "CHANNEL_DISCOVERY_REQUEST",
189 Self::ChannelDiscoveryReply => "CHANNEL_DISCOVERY_REPLY",
190 Self::ChannelJoinRequest => "CHANNEL_JOIN_REQUEST",
191 Self::ChannelJoinReply => "CHANNEL_JOIN_REPLY",
192 Self::ChannelLeaveRequest => "CHANNEL_LEAVE_REQUEST",
193 Self::ChannelLeaveReply => "CHANNEL_LEAVE_REPLY",
194 Self::ChannelMlsCommit => "CHANNEL_MLS_COMMIT",
195 Self::ChannelMlsWelcome => "CHANNEL_MLS_WELCOME",
196 Self::ChannelMlsProposal => "CHANNEL_MLS_PROPOSAL",
197 Self::ChannelMlsAck => "CHANNEL_MLS_ACK",
198 }
199 }
200 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
202 match value {
203 "UNSPECIFIED" => Some(Self::Unspecified),
204 "P_2_P_MSG" => Some(Self::P2PMsg),
205 "P_2_P_RELIABLE" => Some(Self::P2PReliable),
206 "P_2_P_ACK" => Some(Self::P2PAck),
207 "MULTICAST_MSG" => Some(Self::MulticastMsg),
208 "RTX_REQUEST" => Some(Self::RtxRequest),
209 "RTX_REPLY" => Some(Self::RtxReply),
210 "BEACON_MULTICAST" => Some(Self::BeaconMulticast),
211 "CHANNEL_DISCOVERY_REQUEST" => Some(Self::ChannelDiscoveryRequest),
212 "CHANNEL_DISCOVERY_REPLY" => Some(Self::ChannelDiscoveryReply),
213 "CHANNEL_JOIN_REQUEST" => Some(Self::ChannelJoinRequest),
214 "CHANNEL_JOIN_REPLY" => Some(Self::ChannelJoinReply),
215 "CHANNEL_LEAVE_REQUEST" => Some(Self::ChannelLeaveRequest),
216 "CHANNEL_LEAVE_REPLY" => Some(Self::ChannelLeaveReply),
217 "CHANNEL_MLS_COMMIT" => Some(Self::ChannelMlsCommit),
218 "CHANNEL_MLS_WELCOME" => Some(Self::ChannelMlsWelcome),
219 "CHANNEL_MLS_PROPOSAL" => Some(Self::ChannelMlsProposal),
220 "CHANNEL_MLS_ACK" => Some(Self::ChannelMlsAck),
221 _ => None,
222 }
223 }
224}
225pub mod data_plane_service_client {
227 #![allow(
228 unused_variables,
229 dead_code,
230 missing_docs,
231 clippy::wildcard_imports,
232 clippy::let_unit_value,
233 )]
234 use tonic::codegen::*;
235 use tonic::codegen::http::Uri;
236 #[derive(Debug, Clone)]
237 pub struct DataPlaneServiceClient<T> {
238 inner: tonic::client::Grpc<T>,
239 }
240 impl DataPlaneServiceClient<tonic::transport::Channel> {
241 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
243 where
244 D: TryInto<tonic::transport::Endpoint>,
245 D::Error: Into<StdError>,
246 {
247 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
248 Ok(Self::new(conn))
249 }
250 }
251 impl<T> DataPlaneServiceClient<T>
252 where
253 T: tonic::client::GrpcService<tonic::body::Body>,
254 T::Error: Into<StdError>,
255 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
256 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
257 {
258 pub fn new(inner: T) -> Self {
259 let inner = tonic::client::Grpc::new(inner);
260 Self { inner }
261 }
262 pub fn with_origin(inner: T, origin: Uri) -> Self {
263 let inner = tonic::client::Grpc::with_origin(inner, origin);
264 Self { inner }
265 }
266 pub fn with_interceptor<F>(
267 inner: T,
268 interceptor: F,
269 ) -> DataPlaneServiceClient<InterceptedService<T, F>>
270 where
271 F: tonic::service::Interceptor,
272 T::ResponseBody: Default,
273 T: tonic::codegen::Service<
274 http::Request<tonic::body::Body>,
275 Response = http::Response<
276 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
277 >,
278 >,
279 <T as tonic::codegen::Service<
280 http::Request<tonic::body::Body>,
281 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
282 {
283 DataPlaneServiceClient::new(InterceptedService::new(inner, interceptor))
284 }
285 #[must_use]
290 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
291 self.inner = self.inner.send_compressed(encoding);
292 self
293 }
294 #[must_use]
296 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
297 self.inner = self.inner.accept_compressed(encoding);
298 self
299 }
300 #[must_use]
304 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
305 self.inner = self.inner.max_decoding_message_size(limit);
306 self
307 }
308 #[must_use]
312 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
313 self.inner = self.inner.max_encoding_message_size(limit);
314 self
315 }
316 pub async fn open_channel(
317 &mut self,
318 request: impl tonic::IntoStreamingRequest<Message = super::Message>,
319 ) -> std::result::Result<
320 tonic::Response<tonic::codec::Streaming<super::Message>>,
321 tonic::Status,
322 > {
323 self.inner
324 .ready()
325 .await
326 .map_err(|e| {
327 tonic::Status::unknown(
328 format!("Service was not ready: {}", e.into()),
329 )
330 })?;
331 let codec = tonic::codec::ProstCodec::default();
332 let path = http::uri::PathAndQuery::from_static(
333 "/dataplane.proto.v1.DataPlaneService/OpenChannel",
334 );
335 let mut req = request.into_streaming_request();
336 req.extensions_mut()
337 .insert(
338 GrpcMethod::new("dataplane.proto.v1.DataPlaneService", "OpenChannel"),
339 );
340 self.inner.streaming(req, path, codec).await
341 }
342 }
343}
344pub mod data_plane_service_server {
346 #![allow(
347 unused_variables,
348 dead_code,
349 missing_docs,
350 clippy::wildcard_imports,
351 clippy::let_unit_value,
352 )]
353 use tonic::codegen::*;
354 #[async_trait]
356 pub trait DataPlaneService: std::marker::Send + std::marker::Sync + 'static {
357 type OpenChannelStream: tonic::codegen::tokio_stream::Stream<
359 Item = std::result::Result<super::Message, tonic::Status>,
360 >
361 + std::marker::Send
362 + 'static;
363 async fn open_channel(
364 &self,
365 request: tonic::Request<tonic::Streaming<super::Message>>,
366 ) -> std::result::Result<
367 tonic::Response<Self::OpenChannelStream>,
368 tonic::Status,
369 >;
370 }
371 #[derive(Debug)]
372 pub struct DataPlaneServiceServer<T> {
373 inner: Arc<T>,
374 accept_compression_encodings: EnabledCompressionEncodings,
375 send_compression_encodings: EnabledCompressionEncodings,
376 max_decoding_message_size: Option<usize>,
377 max_encoding_message_size: Option<usize>,
378 }
379 impl<T> DataPlaneServiceServer<T> {
380 pub fn new(inner: T) -> Self {
381 Self::from_arc(Arc::new(inner))
382 }
383 pub fn from_arc(inner: Arc<T>) -> Self {
384 Self {
385 inner,
386 accept_compression_encodings: Default::default(),
387 send_compression_encodings: Default::default(),
388 max_decoding_message_size: None,
389 max_encoding_message_size: None,
390 }
391 }
392 pub fn with_interceptor<F>(
393 inner: T,
394 interceptor: F,
395 ) -> InterceptedService<Self, F>
396 where
397 F: tonic::service::Interceptor,
398 {
399 InterceptedService::new(Self::new(inner), interceptor)
400 }
401 #[must_use]
403 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
404 self.accept_compression_encodings.enable(encoding);
405 self
406 }
407 #[must_use]
409 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
410 self.send_compression_encodings.enable(encoding);
411 self
412 }
413 #[must_use]
417 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
418 self.max_decoding_message_size = Some(limit);
419 self
420 }
421 #[must_use]
425 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
426 self.max_encoding_message_size = Some(limit);
427 self
428 }
429 }
430 impl<T, B> tonic::codegen::Service<http::Request<B>> for DataPlaneServiceServer<T>
431 where
432 T: DataPlaneService,
433 B: Body + std::marker::Send + 'static,
434 B::Error: Into<StdError> + std::marker::Send + 'static,
435 {
436 type Response = http::Response<tonic::body::Body>;
437 type Error = std::convert::Infallible;
438 type Future = BoxFuture<Self::Response, Self::Error>;
439 fn poll_ready(
440 &mut self,
441 _cx: &mut Context<'_>,
442 ) -> Poll<std::result::Result<(), Self::Error>> {
443 Poll::Ready(Ok(()))
444 }
445 fn call(&mut self, req: http::Request<B>) -> Self::Future {
446 match req.uri().path() {
447 "/dataplane.proto.v1.DataPlaneService/OpenChannel" => {
448 #[allow(non_camel_case_types)]
449 struct OpenChannelSvc<T: DataPlaneService>(pub Arc<T>);
450 impl<
451 T: DataPlaneService,
452 > tonic::server::StreamingService<super::Message>
453 for OpenChannelSvc<T> {
454 type Response = super::Message;
455 type ResponseStream = T::OpenChannelStream;
456 type Future = BoxFuture<
457 tonic::Response<Self::ResponseStream>,
458 tonic::Status,
459 >;
460 fn call(
461 &mut self,
462 request: tonic::Request<tonic::Streaming<super::Message>>,
463 ) -> Self::Future {
464 let inner = Arc::clone(&self.0);
465 let fut = async move {
466 <T as DataPlaneService>::open_channel(&inner, request).await
467 };
468 Box::pin(fut)
469 }
470 }
471 let accept_compression_encodings = self.accept_compression_encodings;
472 let send_compression_encodings = self.send_compression_encodings;
473 let max_decoding_message_size = self.max_decoding_message_size;
474 let max_encoding_message_size = self.max_encoding_message_size;
475 let inner = self.inner.clone();
476 let fut = async move {
477 let method = OpenChannelSvc(inner);
478 let codec = tonic::codec::ProstCodec::default();
479 let mut grpc = tonic::server::Grpc::new(codec)
480 .apply_compression_config(
481 accept_compression_encodings,
482 send_compression_encodings,
483 )
484 .apply_max_message_size_config(
485 max_decoding_message_size,
486 max_encoding_message_size,
487 );
488 let res = grpc.streaming(method, req).await;
489 Ok(res)
490 };
491 Box::pin(fut)
492 }
493 _ => {
494 Box::pin(async move {
495 let mut response = http::Response::new(
496 tonic::body::Body::default(),
497 );
498 let headers = response.headers_mut();
499 headers
500 .insert(
501 tonic::Status::GRPC_STATUS,
502 (tonic::Code::Unimplemented as i32).into(),
503 );
504 headers
505 .insert(
506 http::header::CONTENT_TYPE,
507 tonic::metadata::GRPC_CONTENT_TYPE,
508 );
509 Ok(response)
510 })
511 }
512 }
513 }
514 }
515 impl<T> Clone for DataPlaneServiceServer<T> {
516 fn clone(&self) -> Self {
517 let inner = self.inner.clone();
518 Self {
519 inner,
520 accept_compression_encodings: self.accept_compression_encodings,
521 send_compression_encodings: self.send_compression_encodings,
522 max_decoding_message_size: self.max_decoding_message_size,
523 max_encoding_message_size: self.max_encoding_message_size,
524 }
525 }
526 }
527 pub const SERVICE_NAME: &str = "dataplane.proto.v1.DataPlaneService";
529 impl<T> tonic::server::NamedService for DataPlaneServiceServer<T> {
530 const NAME: &'static str = SERVICE_NAME;
531 }
532}