[AFS3-std] Encoding IPvN addresses (was Re: first draft: ubik update proposal)

Jeffrey Hutzelman jhutz@cmu.edu
Mon, 07 Feb 2011 16:44:10 -0500


--On Monday, February 07, 2011 03:02:11 PM -0500 Chaskiel Grundman 
<cg2v@andrew.cmu.edu> wrote:

>
>
> On Mon, 7 Feb 2011, Derrick Brashear wrote:
>
>> How about this? If this is agreement i can write up a draft.
>>
>> enum ippack { IPv4=1, IPv6Bytes=2, IPv6Shorts=3, IPV6Ints=4 };
> We need to define a single canonical form of ipv6 address. it's up to the
> endpoints to translate whatever their in6_addr is to/from that form. Other
> than that, this is the right idea.

And, we can't just use xdr_union, because that makes the type 
non-extensible -- xdr_union will fail if it receives an unknown 
discriminator value.  To be extensible, we need to actually encode the 
length on the wire, and have an unknown discriminator handler that reads 
off the length and the other bits and either throws them away or hands them 
to the application somehow.