1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ControlMessage {
4 #[prost(string, tag = "1")]
5 pub message_id: ::prost::alloc::string::String,
6 #[prost(
7 oneof = "control_message::Payload",
8 tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20"
9 )]
10 pub payload: ::core::option::Option<control_message::Payload>,
11}
12pub mod control_message {
14 #[derive(Clone, PartialEq, ::prost::Oneof)]
15 pub enum Payload {
16 #[prost(message, tag = "2")]
17 ConfigCommand(super::ConfigurationCommand),
18 #[prost(message, tag = "3")]
19 Ack(super::Ack),
20 #[prost(message, tag = "4")]
21 RouteListRequest(super::RouteListRequest),
22 #[prost(message, tag = "5")]
23 RouteListResponse(super::RouteListResponse),
24 #[prost(message, tag = "6")]
25 ConnectionListRequest(super::ConnectionListRequest),
26 #[prost(message, tag = "7")]
27 ConnectionListResponse(super::ConnectionListResponse),
28 #[prost(message, tag = "8")]
29 RegisterNodeRequest(super::RegisterNodeRequest),
30 #[prost(message, tag = "9")]
31 RegisterNodeResponse(super::RegisterNodeResponse),
32 #[prost(message, tag = "10")]
33 DeregisterNodeRequest(super::DeregisterNodeRequest),
34 #[prost(message, tag = "11")]
35 DeregisterNodeResponse(super::DeregisterNodeResponse),
36 #[prost(message, tag = "20")]
37 ConfigCommandAck(super::ConfigurationCommandAck),
38 }
39}
40#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
41pub struct Connection {
42 #[prost(string, tag = "1")]
43 pub link_id: ::prost::alloc::string::String,
44 #[prost(string, tag = "2")]
45 pub config_data: ::prost::alloc::string::String,
46}
47#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
48pub struct ConnectionAck {
49 #[prost(string, tag = "1")]
50 pub link_id: ::prost::alloc::string::String,
51 #[prost(bool, tag = "2")]
52 pub success: bool,
53 #[prost(string, tag = "3")]
54 pub error_msg: ::prost::alloc::string::String,
55}
56#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
57pub struct Route {
58 #[prost(message, optional, tag = "1")]
59 pub name: ::core::option::Option<::slim_datapath::api::proto::dataplane::v1::Name>,
60 #[prost(string, optional, tag = "2")]
61 pub link_id: ::core::option::Option<::prost::alloc::string::String>,
62 #[prost(enumeration = "ConnectionDirection", optional, tag = "3")]
63 pub direction: ::core::option::Option<i32>,
64}
65#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
66pub struct RouteAck {
67 #[prost(message, optional, tag = "1")]
68 pub route: ::core::option::Option<Route>,
69 #[prost(bool, tag = "2")]
70 pub success: bool,
71 #[prost(string, tag = "3")]
72 pub error_msg: ::prost::alloc::string::String,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct ConfigurationCommand {
76 #[prost(message, repeated, tag = "1")]
77 pub connections_to_create: ::prost::alloc::vec::Vec<Connection>,
78 #[prost(message, repeated, tag = "2")]
79 pub routes_to_set: ::prost::alloc::vec::Vec<Route>,
80 #[prost(message, repeated, tag = "3")]
81 pub routes_to_delete: ::prost::alloc::vec::Vec<Route>,
82 #[prost(string, repeated, tag = "4")]
83 pub connections_to_delete: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
84 #[prost(bool, tag = "5")]
85 pub reconcile: bool,
86}
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct ConfigurationCommandAck {
89 #[prost(string, tag = "1")]
90 pub original_message_id: ::prost::alloc::string::String,
91 #[prost(message, repeated, tag = "2")]
92 pub connections_status: ::prost::alloc::vec::Vec<ConnectionAck>,
93 #[prost(message, repeated, tag = "3")]
94 pub routes_status: ::prost::alloc::vec::Vec<RouteAck>,
95}
96#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
97pub struct Ack {
98 #[prost(string, tag = "1")]
99 pub original_message_id: ::prost::alloc::string::String,
100 #[prost(bool, tag = "2")]
101 pub success: bool,
102 #[prost(string, repeated, tag = "3")]
103 pub messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
104}
105#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
106pub struct RouteListRequest {}
107#[derive(Clone, PartialEq, ::prost::Message)]
108pub struct RouteListResponse {
109 #[prost(string, tag = "1")]
110 pub original_message_id: ::prost::alloc::string::String,
111 #[prost(message, repeated, tag = "2")]
112 pub entries: ::prost::alloc::vec::Vec<RouteEntry>,
113 #[prost(bool, tag = "3")]
114 pub done: bool,
115}
116#[derive(Clone, PartialEq, ::prost::Message)]
117pub struct RouteEntry {
118 #[prost(message, optional, tag = "1")]
119 pub name: ::core::option::Option<::slim_datapath::api::proto::dataplane::v1::Name>,
120 #[prost(message, repeated, tag = "2")]
121 pub connections: ::prost::alloc::vec::Vec<ConnectionEntry>,
122}
123#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
124pub struct ConnectionEntry {
125 #[prost(uint64, tag = "1")]
126 pub id: u64,
127 #[prost(enumeration = "ConnectionType", tag = "2")]
128 pub connection_type: i32,
129 #[prost(string, tag = "3")]
130 pub config_data: ::prost::alloc::string::String,
131 #[prost(string, optional, tag = "4")]
132 pub link_id: ::core::option::Option<::prost::alloc::string::String>,
133 #[prost(enumeration = "ConnectionDirection", tag = "5")]
134 pub direction: i32,
135}
136#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
137pub struct ConnectionListRequest {}
138#[derive(Clone, PartialEq, ::prost::Message)]
139pub struct ConnectionListResponse {
140 #[prost(string, tag = "1")]
141 pub original_message_id: ::prost::alloc::string::String,
142 #[prost(message, repeated, tag = "2")]
143 pub entries: ::prost::alloc::vec::Vec<ConnectionEntry>,
144 #[prost(bool, tag = "3")]
145 pub done: bool,
146}
147#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
148pub struct Node {
149 #[prost(string, tag = "1")]
150 pub id: ::prost::alloc::string::String,
151}
152#[derive(Clone, PartialEq, ::prost::Message)]
153pub struct ConnectionDetails {
154 #[prost(string, tag = "1")]
155 pub endpoint: ::prost::alloc::string::String,
156 #[prost(string, optional, tag = "2")]
157 pub external_endpoint: ::core::option::Option<::prost::alloc::string::String>,
158 #[prost(message, optional, tag = "3")]
159 pub spire_mtls: ::core::option::Option<connection_details::SpireMtls>,
160 #[prost(message, optional, tag = "4")]
161 pub metadata: ::core::option::Option<::prost_types::Struct>,
162}
163pub mod connection_details {
165 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
166 pub struct SpireMtls {
167 #[prost(string, tag = "1")]
168 pub socket_path: ::prost::alloc::string::String,
169 #[prost(string, optional, tag = "2")]
170 pub trust_domain: ::core::option::Option<::prost::alloc::string::String>,
171 }
172}
173#[derive(Clone, PartialEq, ::prost::Message)]
174pub struct RegisterNodeRequest {
175 #[prost(string, tag = "1")]
176 pub node_id: ::prost::alloc::string::String,
177 #[prost(message, repeated, tag = "2")]
178 pub connection_details: ::prost::alloc::vec::Vec<ConnectionDetails>,
179 #[prost(string, optional, tag = "3")]
180 pub group_name: ::core::option::Option<::prost::alloc::string::String>,
181 #[prost(message, repeated, tag = "4")]
184 pub connections: ::prost::alloc::vec::Vec<ConnectionEntry>,
185 #[prost(message, repeated, tag = "5")]
187 pub routes: ::prost::alloc::vec::Vec<Route>,
188}
189#[derive(Clone, PartialEq, ::prost::Message)]
190pub struct RegisterNodeResponse {
191 #[prost(string, tag = "1")]
192 pub original_message_id: ::prost::alloc::string::String,
193 #[prost(bool, tag = "2")]
194 pub success: bool,
195 #[prost(message, repeated, tag = "3")]
197 pub connections: ::prost::alloc::vec::Vec<Connection>,
198 #[prost(message, repeated, tag = "4")]
199 pub routes: ::prost::alloc::vec::Vec<Route>,
200}
201#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
202pub struct DeregisterNodeRequest {
203 #[prost(message, optional, tag = "1")]
204 pub node: ::core::option::Option<Node>,
205}
206#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
207pub struct DeregisterNodeResponse {
208 #[prost(string, tag = "1")]
209 pub original_message_id: ::prost::alloc::string::String,
210 #[prost(bool, tag = "2")]
211 pub success: bool,
212}
213#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
214#[repr(i32)]
215pub enum ConnectionType {
216 Local = 0,
217 Remote = 1,
218}
219impl ConnectionType {
220 pub fn as_str_name(&self) -> &'static str {
225 match self {
226 Self::Local => "CONNECTION_TYPE_LOCAL",
227 Self::Remote => "CONNECTION_TYPE_REMOTE",
228 }
229 }
230 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
232 match value {
233 "CONNECTION_TYPE_LOCAL" => Some(Self::Local),
234 "CONNECTION_TYPE_REMOTE" => Some(Self::Remote),
235 _ => None,
236 }
237 }
238}
239#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
240#[repr(i32)]
241pub enum ConnectionDirection {
242 Outgoing = 0,
243 Incoming = 1,
244}
245impl ConnectionDirection {
246 pub fn as_str_name(&self) -> &'static str {
251 match self {
252 Self::Outgoing => "CONNECTION_DIRECTION_OUTGOING",
253 Self::Incoming => "CONNECTION_DIRECTION_INCOMING",
254 }
255 }
256 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
258 match value {
259 "CONNECTION_DIRECTION_OUTGOING" => Some(Self::Outgoing),
260 "CONNECTION_DIRECTION_INCOMING" => Some(Self::Incoming),
261 _ => None,
262 }
263 }
264}
265pub mod controller_service_client {
267 #![allow(
268 unused_variables,
269 dead_code,
270 missing_docs,
271 clippy::wildcard_imports,
272 clippy::let_unit_value,
273 )]
274 use tonic::codegen::*;
275 use tonic::codegen::http::Uri;
276 #[derive(Debug, Clone)]
277 pub struct ControllerServiceClient<T> {
278 inner: tonic::client::Grpc<T>,
279 }
280 impl ControllerServiceClient<tonic::transport::Channel> {
281 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
283 where
284 D: TryInto<tonic::transport::Endpoint>,
285 D::Error: Into<StdError>,
286 {
287 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
288 Ok(Self::new(conn))
289 }
290 }
291 impl<T> ControllerServiceClient<T>
292 where
293 T: tonic::client::GrpcService<tonic::body::Body>,
294 T::Error: Into<StdError>,
295 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
296 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
297 {
298 pub fn new(inner: T) -> Self {
299 let inner = tonic::client::Grpc::new(inner);
300 Self { inner }
301 }
302 pub fn with_origin(inner: T, origin: Uri) -> Self {
303 let inner = tonic::client::Grpc::with_origin(inner, origin);
304 Self { inner }
305 }
306 pub fn with_interceptor<F>(
307 inner: T,
308 interceptor: F,
309 ) -> ControllerServiceClient<InterceptedService<T, F>>
310 where
311 F: tonic::service::Interceptor,
312 T::ResponseBody: Default,
313 T: tonic::codegen::Service<
314 http::Request<tonic::body::Body>,
315 Response = http::Response<
316 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
317 >,
318 >,
319 <T as tonic::codegen::Service<
320 http::Request<tonic::body::Body>,
321 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
322 {
323 ControllerServiceClient::new(InterceptedService::new(inner, interceptor))
324 }
325 #[must_use]
330 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
331 self.inner = self.inner.send_compressed(encoding);
332 self
333 }
334 #[must_use]
336 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
337 self.inner = self.inner.accept_compressed(encoding);
338 self
339 }
340 #[must_use]
344 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
345 self.inner = self.inner.max_decoding_message_size(limit);
346 self
347 }
348 #[must_use]
352 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
353 self.inner = self.inner.max_encoding_message_size(limit);
354 self
355 }
356 pub async fn open_control_channel(
357 &mut self,
358 request: impl tonic::IntoStreamingRequest<Message = super::ControlMessage>,
359 ) -> std::result::Result<
360 tonic::Response<tonic::codec::Streaming<super::ControlMessage>>,
361 tonic::Status,
362 > {
363 self.inner
364 .ready()
365 .await
366 .map_err(|e| {
367 tonic::Status::unknown(
368 format!("Service was not ready: {}", e.into()),
369 )
370 })?;
371 let codec = tonic_prost::ProstCodec::default();
372 let path = http::uri::PathAndQuery::from_static(
373 "/controller.proto.v1.ControllerService/OpenControlChannel",
374 );
375 let mut req = request.into_streaming_request();
376 req.extensions_mut()
377 .insert(
378 GrpcMethod::new(
379 "controller.proto.v1.ControllerService",
380 "OpenControlChannel",
381 ),
382 );
383 self.inner.streaming(req, path, codec).await
384 }
385 }
386}
387pub mod controller_service_server {
389 #![allow(
390 unused_variables,
391 dead_code,
392 missing_docs,
393 clippy::wildcard_imports,
394 clippy::let_unit_value,
395 )]
396 use tonic::codegen::*;
397 #[async_trait]
399 pub trait ControllerService: std::marker::Send + std::marker::Sync + 'static {
400 type OpenControlChannelStream: tonic::codegen::tokio_stream::Stream<
402 Item = std::result::Result<super::ControlMessage, tonic::Status>,
403 >
404 + std::marker::Send
405 + 'static;
406 async fn open_control_channel(
407 &self,
408 request: tonic::Request<tonic::Streaming<super::ControlMessage>>,
409 ) -> std::result::Result<
410 tonic::Response<Self::OpenControlChannelStream>,
411 tonic::Status,
412 >;
413 }
414 #[derive(Debug)]
415 pub struct ControllerServiceServer<T> {
416 inner: Arc<T>,
417 accept_compression_encodings: EnabledCompressionEncodings,
418 send_compression_encodings: EnabledCompressionEncodings,
419 max_decoding_message_size: Option<usize>,
420 max_encoding_message_size: Option<usize>,
421 }
422 impl<T> ControllerServiceServer<T> {
423 pub fn new(inner: T) -> Self {
424 Self::from_arc(Arc::new(inner))
425 }
426 pub fn from_arc(inner: Arc<T>) -> Self {
427 Self {
428 inner,
429 accept_compression_encodings: Default::default(),
430 send_compression_encodings: Default::default(),
431 max_decoding_message_size: None,
432 max_encoding_message_size: None,
433 }
434 }
435 pub fn with_interceptor<F>(
436 inner: T,
437 interceptor: F,
438 ) -> InterceptedService<Self, F>
439 where
440 F: tonic::service::Interceptor,
441 {
442 InterceptedService::new(Self::new(inner), interceptor)
443 }
444 #[must_use]
446 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
447 self.accept_compression_encodings.enable(encoding);
448 self
449 }
450 #[must_use]
452 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
453 self.send_compression_encodings.enable(encoding);
454 self
455 }
456 #[must_use]
460 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
461 self.max_decoding_message_size = Some(limit);
462 self
463 }
464 #[must_use]
468 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
469 self.max_encoding_message_size = Some(limit);
470 self
471 }
472 }
473 impl<T, B> tonic::codegen::Service<http::Request<B>> for ControllerServiceServer<T>
474 where
475 T: ControllerService,
476 B: Body + std::marker::Send + 'static,
477 B::Error: Into<StdError> + std::marker::Send + 'static,
478 {
479 type Response = http::Response<tonic::body::Body>;
480 type Error = std::convert::Infallible;
481 type Future = BoxFuture<Self::Response, Self::Error>;
482 fn poll_ready(
483 &mut self,
484 _cx: &mut Context<'_>,
485 ) -> Poll<std::result::Result<(), Self::Error>> {
486 Poll::Ready(Ok(()))
487 }
488 fn call(&mut self, req: http::Request<B>) -> Self::Future {
489 match req.uri().path() {
490 "/controller.proto.v1.ControllerService/OpenControlChannel" => {
491 #[allow(non_camel_case_types)]
492 struct OpenControlChannelSvc<T: ControllerService>(pub Arc<T>);
493 impl<
494 T: ControllerService,
495 > tonic::server::StreamingService<super::ControlMessage>
496 for OpenControlChannelSvc<T> {
497 type Response = super::ControlMessage;
498 type ResponseStream = T::OpenControlChannelStream;
499 type Future = BoxFuture<
500 tonic::Response<Self::ResponseStream>,
501 tonic::Status,
502 >;
503 fn call(
504 &mut self,
505 request: tonic::Request<
506 tonic::Streaming<super::ControlMessage>,
507 >,
508 ) -> Self::Future {
509 let inner = Arc::clone(&self.0);
510 let fut = async move {
511 <T as ControllerService>::open_control_channel(
512 &inner,
513 request,
514 )
515 .await
516 };
517 Box::pin(fut)
518 }
519 }
520 let accept_compression_encodings = self.accept_compression_encodings;
521 let send_compression_encodings = self.send_compression_encodings;
522 let max_decoding_message_size = self.max_decoding_message_size;
523 let max_encoding_message_size = self.max_encoding_message_size;
524 let inner = self.inner.clone();
525 let fut = async move {
526 let method = OpenControlChannelSvc(inner);
527 let codec = tonic_prost::ProstCodec::default();
528 let mut grpc = tonic::server::Grpc::new(codec)
529 .apply_compression_config(
530 accept_compression_encodings,
531 send_compression_encodings,
532 )
533 .apply_max_message_size_config(
534 max_decoding_message_size,
535 max_encoding_message_size,
536 );
537 let res = grpc.streaming(method, req).await;
538 Ok(res)
539 };
540 Box::pin(fut)
541 }
542 _ => {
543 Box::pin(async move {
544 let mut response = http::Response::new(
545 tonic::body::Body::default(),
546 );
547 let headers = response.headers_mut();
548 headers
549 .insert(
550 tonic::Status::GRPC_STATUS,
551 (tonic::Code::Unimplemented as i32).into(),
552 );
553 headers
554 .insert(
555 http::header::CONTENT_TYPE,
556 tonic::metadata::GRPC_CONTENT_TYPE,
557 );
558 Ok(response)
559 })
560 }
561 }
562 }
563 }
564 impl<T> Clone for ControllerServiceServer<T> {
565 fn clone(&self) -> Self {
566 let inner = self.inner.clone();
567 Self {
568 inner,
569 accept_compression_encodings: self.accept_compression_encodings,
570 send_compression_encodings: self.send_compression_encodings,
571 max_decoding_message_size: self.max_decoding_message_size,
572 max_encoding_message_size: self.max_encoding_message_size,
573 }
574 }
575 }
576 pub const SERVICE_NAME: &str = "controller.proto.v1.ControllerService";
578 impl<T> tonic::server::NamedService for ControllerServiceServer<T> {
579 const NAME: &'static str = SERVICE_NAME;
580 }
581}