Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork175
Description
Currently, we provide the following IP address types:
uefi-raw
:struct Ipv4Address
- 4 raw bytesstruct Ipv6Address
- 16 raw bytesunion IpAddress
- untagged union, can be either v4 or v6 address, but no way to tell without out-of-band data
uefi
:struct IpAddress
- 16 raw bytes. Compatible with theuefi_raw::IpAddress
union, but implemented differently. No way to tell which type of address it is without out-of-band data
And these builtin types are in
core::net
:struct Ipv4Addr
- opaque struct, but essentially 4 raw bytesstruct Ipv6Addr
- opaque struct, but essentially 16 raw bytesenum IpAddr
- tagged enum containing eitherIpv4Addr
orIpv6Addr
The types inuefi-raw
correctly match the spec, so there's nothing we need to change there.
Inuefi
however, I think it might make sense to switch to thecore::net
types in the public API, and drop ourIpAddress
. Thecore::net
types are not ABI-compatible with the UEFI types, so internally we'll need to translate between them. This should be a very low-cost operation though.
Using theIpAddr
enum provides a better experience than using an untagged enum that requires a separate flag to indicate which type of address it contains. We could define our own enum of course, but usingcore::net
makes it easier to integrate with other Rust code by using a shared type.
This change would be an API break, but it only affects a fairly small part of the library (theSimpleNetwork
andpxe::BaseCode
protocols).