|
2 | 2 | // License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | 3 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. |
4 | 4 |
|
5 | | -use crate::v1::net::Ipv6Prefix; |
6 | | -use oxnet::Ipv6Net; |
7 | | -use schemars::JsonSchema; |
8 | | -use serde::{Deserialize, Serialize}; |
9 | | - |
10 | | -#[derive( |
11 | | - Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, JsonSchema, |
12 | | -)] |
13 | | -pub struct PathVector { |
14 | | - pub destination: Ipv6Net, |
15 | | - pub path: Vec<String>, |
16 | | -} |
17 | | - |
18 | | -/// THIS TYPE IS FOR DDM PROTOCOL VERSION 2. IT SHALL NEVER CHANGE. THIS TYPE |
19 | | -/// CAN BE REMOVED WHEN DDMV2 CLIENTS AND SERVERS NO LONGER EXIST BUT ITS |
20 | | -/// DEFINITION SHALL NEVER CHANGE. |
21 | | -#[derive( |
22 | | - Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, JsonSchema, |
23 | | -)] |
24 | | -pub struct PathVectorV2 { |
25 | | - pub destination: Ipv6Prefix, |
26 | | - pub path: Vec<String>, |
27 | | -} |
28 | | - |
29 | | -impl From<PathVectorV2> for PathVector { |
30 | | - fn from(value: PathVectorV2) -> Self { |
31 | | - PathVector { |
32 | | - destination: Ipv6Net::new_unchecked( |
33 | | - value.destination.addr, |
34 | | - value.destination.len, |
35 | | - ), |
36 | | - path: value.path, |
37 | | - } |
38 | | - } |
39 | | -} |
40 | | - |
41 | | -impl From<PathVector> for PathVectorV2 { |
42 | | - fn from(value: PathVector) -> Self { |
43 | | - PathVectorV2 { |
44 | | - destination: Ipv6Prefix { |
45 | | - addr: value.destination.addr(), |
46 | | - len: value.destination.width(), |
47 | | - }, |
48 | | - path: value.path, |
49 | | - } |
50 | | - } |
51 | | -} |
| 5 | +pub use ddm_protocol::v3::PathVector; |
0 commit comments