Olsrd IP data-type

The most obvious difference when working on IPv6 contra IPv4, from the developers point of view, is the address size. While IPv4 uses 32-bit addresses IPv6 addresses are made up of 128 bits. To make this difference transparent the following data-type is defined in olsr_protocol.h:

union olsr_ip_addr
{
  olsr_u32_t v4;
  struct in6_addr v6;
};

This union is used whenever dealing with IP addresses in olsrd. To be able to work easily with olsr_ip_address data-types two macros are defined in olsr_protocol.h:

COPY_IP(to, from)
Copies an IP address as pointed to by from to the memory area pointed to by to.

COMP_IP(ip1, ip2)
Compares the address pointed to by ip1 with the address pointed to by ip2.

This is very convenient when working on this transparent IP address data-type.



Subsections

Andreas 2004-07-29