1macro_rules! id_newtype {
8 ($(#[$m:meta])* $vis:vis $name:ident) => {
9 $(#[$m])*
10 #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
11 $vis struct $name(pub u16);
12
13 impl From<u16> for $name {
14 fn from(v: u16) -> Self { Self(v) }
15 }
16 impl From<$name> for u16 {
17 fn from(v: $name) -> u16 { v.0 }
18 }
19 };
20}
21
22id_newtype!(
23 pub SignalType
25);
26id_newtype!(
27 pub MessageType
29);
30id_newtype!(
31 pub DataItemType
33);
34id_newtype!(
35 pub ExtensionId
37);
38
39impl SignalType {
40 pub const PEER_DISCOVERY: Self = Self(1);
41 pub const PEER_OFFER: Self = Self(2);
42}
43
44impl MessageType {
45 pub const SESSION_INITIALIZATION: Self = Self(1);
46 pub const SESSION_INITIALIZATION_RESPONSE: Self = Self(2);
47 pub const SESSION_UPDATE: Self = Self(3);
48 pub const SESSION_UPDATE_RESPONSE: Self = Self(4);
49 pub const SESSION_TERMINATION: Self = Self(5);
50 pub const SESSION_TERMINATION_RESPONSE: Self = Self(6);
51 pub const DESTINATION_UP: Self = Self(7);
52 pub const DESTINATION_UP_RESPONSE: Self = Self(8);
53 pub const DESTINATION_ANNOUNCE: Self = Self(9);
54 pub const DESTINATION_ANNOUNCE_RESPONSE: Self = Self(10);
55 pub const DESTINATION_DOWN: Self = Self(11);
56 pub const DESTINATION_DOWN_RESPONSE: Self = Self(12);
57 pub const DESTINATION_UPDATE: Self = Self(13);
58 pub const LINK_CHARACTERISTICS_REQUEST: Self = Self(14);
59 pub const LINK_CHARACTERISTICS_RESPONSE: Self = Self(15);
60 pub const HEARTBEAT: Self = Self(16);
61}
62
63impl DataItemType {
64 pub const STATUS: Self = Self(1);
65 pub const IPV4_CONNECTION_POINT: Self = Self(2);
66 pub const IPV6_CONNECTION_POINT: Self = Self(3);
67 pub const PEER_TYPE: Self = Self(4);
68 pub const HEARTBEAT_INTERVAL: Self = Self(5);
69 pub const EXTENSIONS_SUPPORTED: Self = Self(6);
70 pub const MAC_ADDRESS: Self = Self(7);
71 pub const IPV4_ADDRESS: Self = Self(8);
72 pub const IPV6_ADDRESS: Self = Self(9);
73 pub const IPV4_ATTACHED_SUBNET: Self = Self(10);
74 pub const IPV6_ATTACHED_SUBNET: Self = Self(11);
75 pub const MAXIMUM_DATA_RATE_RECEIVE: Self = Self(12);
76 pub const MAXIMUM_DATA_RATE_TRANSMIT: Self = Self(13);
77 pub const CURRENT_DATA_RATE_RECEIVE: Self = Self(14);
78 pub const CURRENT_DATA_RATE_TRANSMIT: Self = Self(15);
79 pub const LATENCY: Self = Self(16);
80 pub const RESOURCES: Self = Self(17);
81 pub const RELATIVE_LINK_QUALITY_RECEIVE: Self = Self(18);
82 pub const RELATIVE_LINK_QUALITY_TRANSMIT: Self = Self(19);
83 pub const MTU: Self = Self(20);
84}