How does the zone index relate to the scope_id in the sockaddr_in6 structure?
The functionality appears to differ between platforms and I'd love to know how they relate. Windows for example has a SCOPE_ID structure (as well as just a 32-bit value). Mac OSX only has a 32-bit value. Obviously the 32-bit value is the way to go but how exactly is it laid out? Is it still the top 4 bits are the "level"? How does network byte order affect this?
Also I assume that, under windows, the zone index given in the ip address (eg FF80::1%1) translates directly to the bottom 28 bits of the aforementioned structure. How does it work under Mac OSX that uses names rather than numbers (eg FF80::1%en0). Do I encode it as a four CC? Equally I seem to recall that linux uses 4 characters which couldn't possibly fit in 28-bits.
So can someone explain this mess to me? I really am going to need to write a tutorial on all this when I'm finished because there is precious little info about ipv6 around the net.
Edit: Is the scope_id in network byte order? I'm just looking at the scope_id returned from a recvfrom and it appears to be in little-endian order ... that can't be right can it?