7 releases (4 breaking)
0.5.0 | Nov 5, 2024 |
---|---|
0.4.1 | Aug 8, 2024 |
0.3.1 | Oct 10, 2024 |
0.3.0 | Jan 31, 2024 |
0.1.0 | Mar 5, 2023 |
#1369 in Network programming
224 downloads per month
Used in 6 crates
(5 directly)
39KB
623 lines
NetGauze IANA package
Collection of generic IANA definitions that are not specific to a single protocol.
Developer documentation
Adding support for new address and subsequent address families
Adding support for Address Family (AFI) or Subsequent Address Family (SAFI)
- New address families are added to the
pub enum AddressFamily
orpub enum SubsequentAddressFamily
located atsrc/address_family.rs
. - We use
CamelCase
convention for address families. - Please document the RFC and IANA codes for the address family.
Adding support for Address Type
Since not all AddressFamily
and SubsequentAddressFamily
are valid combinations, we introduce an
enum pub enum AddressType
that defines a set of valid combination to ensure only
valid AFI/SAFI are used at compile time.
- Add the name to
pub enum AddressType
located atsrc/address_family.rs
. - The name is convention is as follow:
{$AddressFamily}{$SubsequentAddressFamily}
. - In
impl AddressType
adjustpub const fn address_family
andpub const fn subsequent_address_family
to return the correct AddressFamily and $SubsequentAddressFamily for the new type. If not, the compiler will throw an error. - In
impl AddressType
adjustfrom_afi_safi
to return the newly defined{$AddressFamily}{$SubsequentAddressFamily}
for the given AFI and SAFI. - Write tests! See
test_address_type_check_ret_afi_safi
andtest_address_type_try_from
.
Dependencies
~0.8–1.7MB
~36K SLoC