File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,14 @@ class TINS_API IPv6Address {
230
230
*/
231
231
bool is_multicast () const ;
232
232
233
+ /* *
234
+ * \brief Return true if this is a Link-Local unicast IPv6 address.
235
+ *
236
+ * This method returns true if this address is in the address range
237
+ * fe80::/10, false otherwise
238
+ */
239
+ bool is_local_unicast () const ;
240
+
233
241
/* *
234
242
* \brief Returns the size of an IPv6 Address.
235
243
*
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ namespace Tins {
57
57
58
58
const IPv6Address loopback_address = " ::1" ;
59
59
const AddressRange<IPv6Address> multicast_range = IPv6Address(" ff00::" ) / 8 ;
60
+ const AddressRange<IPv6Address> local_unicast_range = IPv6Address(" fe80::" ) / 10 ;
60
61
61
62
IPv6Address IPv6Address::from_prefix_length (uint32_t prefix_length) {
62
63
IPv6Address address;
@@ -138,6 +139,10 @@ bool IPv6Address::is_multicast() const {
138
139
return multicast_range.contains (*this );
139
140
}
140
141
142
+ bool IPv6Address::is_local_unicast () const {
143
+ return local_unicast_range.contains (*this );
144
+ }
145
+
141
146
ostream& operator <<(ostream& os, const IPv6Address& addr) {
142
147
return os << addr.to_string ();
143
148
}
You can’t perform that action at this time.
0 commit comments