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 AddressFamilyorpub enum SubsequentAddressFamilylocated atsrc/address_family.rs. - We use
CamelCaseconvention 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 AddressTypelocated atsrc/address_family.rs. - The name is convention is as follow:
{$AddressFamily}{$SubsequentAddressFamily}. - In
impl AddressTypeadjustpub const fn address_familyandpub const fn subsequent_address_familyto return the correct AddressFamily and $SubsequentAddressFamily for the new type. If not, the compiler will throw an error. - In
impl AddressTypeadjustfrom_afi_safito return the newly defined{$AddressFamily}{$SubsequentAddressFamily}for the given AFI and SAFI. - Write tests! See
test_address_type_check_ret_afi_safiandtest_address_type_try_from.
Dependencies
~0.8–1.7MB
~36K SLoC