The ovm_ipv6_t type

The ovm_ipv6_t type is the OrchIDS type of IPv6 addresses.

It is defined this way in src/lang.h:

typedef struct ovm_ipv6_s ovm_ipv6_t;
struct ovm_ipv6_s
  gc_header_t gc;
  struct in6_addr ipv6addr;

This is a type of garbage-collectable data. To allocate a new object of type ovm_ipv6_t, use the function:

ovm_var_t *ovm_ipv6_new(gc_t *gc_ctx);

This creates a new uninitialized ovm_ipv6_t object. Its return type is the universal type ovm_var_t instead of ovm_ipv6_t, for practical reasons. Calling res the result, one always has TYPE(res)==T_IPV6.

The result is created white, and much be gc_touch()ed before storing it into a garbage-collectable object.

The returned ovm_ipv6_t object res is modifiable. One can read from or write from it by using the IPV6() macro, e.g.:

struct in6_addr addr;
for (i=0 ; i<16 ; i++)
    addr.s6_addr[i] = IPV6(res).s6_addr[i];
    IPV6(res).s6_addr[i] = addr.s6_addr[i];