Skip to main content

endhost_api_models/
lib.rs

1// Copyright 2025 Anapaya Systems
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//   http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//! Endhost API models library.
15
16use scion_proto::{
17    address::IsdAsn,
18    path::{SegmentsError, segment::SegmentsPage},
19};
20
21use crate::underlays::Underlays;
22
23pub mod underlays;
24
25/// Underlay discovery trait.
26pub trait UnderlayDiscovery: Send + Sync {
27    /// List the underlays available to reach the given ISD-AS.
28    fn list_underlays(&self, isd_as: IsdAsn) -> Underlays;
29}
30
31/// Path discovery trait.
32#[async_trait::async_trait]
33pub trait PathDiscovery: Send + Sync {
34    /// List path segments between the given source and destination ISD-ASes.
35    async fn list_segments(
36        &self,
37        src: IsdAsn,
38        dst: IsdAsn,
39        page_size: i32,
40        page_token: String,
41    ) -> Result<SegmentsPage, SegmentsError>;
42}