Lines Matching refs:Address

33     src_addr: Address,
34 dst_addr: Address,
40 pub struct Address(pub [u8; ADDR_SIZE]); struct
42 impl Address { impl
44 pub const UNSPECIFIED: Address = Address([0x00; ADDR_SIZE]);
47 pub const BROADCAST: Address = Address([0xff; ADDR_SIZE]);
50 pub const MULTICAST_ALL_SYSTEMS: Address = Address([224, 0, 0, 1]);
53 pub const MULTICAST_ALL_ROUTERS: Address = Address([224, 0, 0, 2]);
56 pub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address { in new() argument
57 Address([a0, a1, a2, a3]) in new()
64 pub fn from_bytes(data: &[u8]) -> Address { in from_bytes() argument
67 Address(bytes) in from_bytes()
114 impl From<::std::net::Ipv4Addr> for Address { implementation
115 fn from(x: ::std::net::Ipv4Addr) -> Address { in from() argument
116 Address(x.octets()) in from()
121 impl From<Address> for ::std::net::Ipv4Addr {
122 fn from(Address(x): Address) -> ::std::net::Ipv4Addr { in from()
127 impl fmt::Display for Address { implementation
135 impl defmt::Format for Address { implementation
152 address: Address,
162 pub const fn new(address: Address, prefix_len: u8) -> Cidr { in new() argument
173 pub fn from_netmask(addr: Address, netmask: Address) -> Result<Cidr> { in from_netmask() argument
186 pub const fn address(&self) -> Address { in address() argument
196 pub const fn netmask(&self) -> Address { in netmask() argument
198 return Address([0, 0, 0, 0]); in netmask()
209 Address(data) in netmask()
213 pub fn broadcast(&self) -> Option<Address> { in broadcast() argument
229 Some(Address(data)) in broadcast()
242 address: Address(network), in network()
249 pub fn contains_addr(&self, addr: &Address) -> bool { in contains_addr()
436 pub fn src_addr(&self) -> Address { in src_addr() argument
438 Address::from_bytes(&data[field::SRC_ADDR]) in src_addr()
443 pub fn dst_addr(&self) -> Address { in dst_addr() argument
445 Address::from_bytes(&data[field::DST_ADDR]) in dst_addr()
582 pub fn set_src_addr(&mut self, value: Address) { in set_src_addr() argument
589 pub fn set_dst_addr(&mut self, value: Address) { in set_dst_addr() argument
623 pub src_addr: Address,
624 pub dst_addr: Address,
823 assert_eq!(packet.src_addr(), Address([0x11, 0x12, 0x13, 0x14])); in test_deconstruct()
824 assert_eq!(packet.dst_addr(), Address([0x21, 0x22, 0x23, 0x24])); in test_deconstruct()
845 packet.set_src_addr(Address([0x11, 0x12, 0x13, 0x14])); in test_construct()
846 packet.set_dst_addr(Address([0x21, 0x22, 0x23, 0x24])); in test_construct()
886 src_addr: Address([0x11, 0x12, 0x13, 0x14]), in packet_repr()
887 dst_addr: Address([0x21, 0x22, 0x23, 0x24]), in packet_repr()
934 assert!(Address::UNSPECIFIED.is_unspecified()); in test_unspecified()
935 assert!(!Address::UNSPECIFIED.is_broadcast()); in test_unspecified()
936 assert!(!Address::UNSPECIFIED.is_multicast()); in test_unspecified()
937 assert!(!Address::UNSPECIFIED.is_link_local()); in test_unspecified()
938 assert!(!Address::UNSPECIFIED.is_loopback()); in test_unspecified()
943 assert!(!Address::BROADCAST.is_unspecified()); in test_broadcast()
944 assert!(Address::BROADCAST.is_broadcast()); in test_broadcast()
945 assert!(!Address::BROADCAST.is_multicast()); in test_broadcast()
946 assert!(!Address::BROADCAST.is_link_local()); in test_broadcast()
947 assert!(!Address::BROADCAST.is_loopback()); in test_broadcast()
952 let cidr = Cidr::new(Address::new(192, 168, 1, 10), 24); in test_cidr()
985 for addr in inside_subnet.iter().map(|a| Address::from_bytes(a)) { in test_cidr()
989 for addr in outside_subnet.iter().map(|a| Address::from_bytes(a)) { in test_cidr()
995 .map(|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) in test_cidr()
1002 .map(|&(a, p)| Cidr::new(Address::new(a[0], a[1], a[2], a[3]), p)) in test_cidr()
1008 assert!(cidr_without_prefix.contains_addr(&Address::new(127, 0, 0, 1))); in test_cidr()
1013 assert!(Cidr::from_netmask(Address([0, 0, 0, 0]), Address([1, 0, 2, 0])).is_err()); in test_cidr_from_netmask()
1014 assert!(Cidr::from_netmask(Address([0, 0, 0, 0]), Address([0, 0, 0, 0])).is_err()); in test_cidr_from_netmask()
1016 Cidr::from_netmask(Address([0, 0, 0, 1]), Address([255, 255, 255, 0])).unwrap(), in test_cidr_from_netmask()
1017 Cidr::new(Address([0, 0, 0, 1]), 24) in test_cidr_from_netmask()
1020 Cidr::from_netmask(Address([192, 168, 0, 1]), Address([255, 255, 0, 0])).unwrap(), in test_cidr_from_netmask()
1021 Cidr::new(Address([192, 168, 0, 1]), 16) in test_cidr_from_netmask()
1024 Cidr::from_netmask(Address([172, 16, 0, 1]), Address([255, 240, 0, 0])).unwrap(), in test_cidr_from_netmask()
1025 Cidr::new(Address([172, 16, 0, 1]), 12) in test_cidr_from_netmask()
1028 Cidr::from_netmask(Address([255, 255, 255, 1]), Address([255, 255, 255, 0])).unwrap(), in test_cidr_from_netmask()
1029 Cidr::new(Address([255, 255, 255, 1]), 24) in test_cidr_from_netmask()
1032 Cidr::from_netmask(Address([255, 255, 255, 255]), Address([255, 255, 255, 255])) in test_cidr_from_netmask()
1034 Cidr::new(Address([255, 255, 255, 255]), 32) in test_cidr_from_netmask()
1041 Cidr::new(Address([0, 0, 0, 0]), 0).netmask(), in test_cidr_netmask()
1042 Address([0, 0, 0, 0]) in test_cidr_netmask()
1045 Cidr::new(Address([0, 0, 0, 1]), 24).netmask(), in test_cidr_netmask()
1046 Address([255, 255, 255, 0]) in test_cidr_netmask()
1049 Cidr::new(Address([0, 0, 0, 0]), 32).netmask(), in test_cidr_netmask()
1050 Address([255, 255, 255, 255]) in test_cidr_netmask()
1053 Cidr::new(Address([127, 0, 0, 0]), 8).netmask(), in test_cidr_netmask()
1054 Address([255, 0, 0, 0]) in test_cidr_netmask()
1057 Cidr::new(Address([192, 168, 0, 0]), 16).netmask(), in test_cidr_netmask()
1058 Address([255, 255, 0, 0]) in test_cidr_netmask()
1061 Cidr::new(Address([192, 168, 1, 1]), 16).netmask(), in test_cidr_netmask()
1062 Address([255, 255, 0, 0]) in test_cidr_netmask()
1065 Cidr::new(Address([192, 168, 1, 1]), 17).netmask(), in test_cidr_netmask()
1066 Address([255, 255, 128, 0]) in test_cidr_netmask()
1069 Cidr::new(Address([172, 16, 0, 0]), 12).netmask(), in test_cidr_netmask()
1070 Address([255, 240, 0, 0]) in test_cidr_netmask()
1073 Cidr::new(Address([255, 255, 255, 1]), 24).netmask(), in test_cidr_netmask()
1074 Address([255, 255, 255, 0]) in test_cidr_netmask()
1077 Cidr::new(Address([255, 255, 255, 255]), 32).netmask(), in test_cidr_netmask()
1078 Address([255, 255, 255, 255]) in test_cidr_netmask()
1085 Cidr::new(Address([0, 0, 0, 0]), 0).broadcast().unwrap(), in test_cidr_broadcast()
1086 Address([255, 255, 255, 255]) in test_cidr_broadcast()
1089 Cidr::new(Address([0, 0, 0, 1]), 24).broadcast().unwrap(), in test_cidr_broadcast()
1090 Address([0, 0, 0, 255]) in test_cidr_broadcast()
1092 assert_eq!(Cidr::new(Address([0, 0, 0, 0]), 32).broadcast(), None); in test_cidr_broadcast()
1094 Cidr::new(Address([127, 0, 0, 0]), 8).broadcast().unwrap(), in test_cidr_broadcast()
1095 Address([127, 255, 255, 255]) in test_cidr_broadcast()
1098 Cidr::new(Address([192, 168, 0, 0]), 16) in test_cidr_broadcast()
1101 Address([192, 168, 255, 255]) in test_cidr_broadcast()
1104 Cidr::new(Address([192, 168, 1, 1]), 16) in test_cidr_broadcast()
1107 Address([192, 168, 255, 255]) in test_cidr_broadcast()
1110 Cidr::new(Address([192, 168, 1, 1]), 17) in test_cidr_broadcast()
1113 Address([192, 168, 127, 255]) in test_cidr_broadcast()
1116 Cidr::new(Address([172, 16, 0, 1]), 12).broadcast().unwrap(), in test_cidr_broadcast()
1117 Address([172, 31, 255, 255]) in test_cidr_broadcast()
1120 Cidr::new(Address([255, 255, 255, 1]), 24) in test_cidr_broadcast()
1123 Address([255, 255, 255, 255]) in test_cidr_broadcast()
1126 Cidr::new(Address([255, 255, 255, 254]), 31).broadcast(), in test_cidr_broadcast()
1130 Cidr::new(Address([255, 255, 255, 255]), 32).broadcast(), in test_cidr_broadcast()
1138 Cidr::new(Address([0, 0, 0, 0]), 0).network(), in test_cidr_network()
1139 Cidr::new(Address([0, 0, 0, 0]), 0) in test_cidr_network()
1142 Cidr::new(Address([0, 0, 0, 1]), 24).network(), in test_cidr_network()
1143 Cidr::new(Address([0, 0, 0, 0]), 24) in test_cidr_network()
1146 Cidr::new(Address([0, 0, 0, 0]), 32).network(), in test_cidr_network()
1147 Cidr::new(Address([0, 0, 0, 0]), 32) in test_cidr_network()
1150 Cidr::new(Address([127, 0, 0, 0]), 8).network(), in test_cidr_network()
1151 Cidr::new(Address([127, 0, 0, 0]), 8) in test_cidr_network()
1154 Cidr::new(Address([192, 168, 0, 0]), 16).network(), in test_cidr_network()
1155 Cidr::new(Address([192, 168, 0, 0]), 16) in test_cidr_network()
1158 Cidr::new(Address([192, 168, 1, 1]), 16).network(), in test_cidr_network()
1159 Cidr::new(Address([192, 168, 0, 0]), 16) in test_cidr_network()
1162 Cidr::new(Address([192, 168, 1, 1]), 17).network(), in test_cidr_network()
1163 Cidr::new(Address([192, 168, 0, 0]), 17) in test_cidr_network()
1166 Cidr::new(Address([172, 16, 0, 1]), 12).network(), in test_cidr_network()
1167 Cidr::new(Address([172, 16, 0, 0]), 12) in test_cidr_network()
1170 Cidr::new(Address([255, 255, 255, 1]), 24).network(), in test_cidr_network()
1171 Cidr::new(Address([255, 255, 255, 0]), 24) in test_cidr_network()
1174 Cidr::new(Address([255, 255, 255, 255]), 32).network(), in test_cidr_network()
1175 Cidr::new(Address([255, 255, 255, 255]), 32) in test_cidr_network()