EVL Anonymization

Table of Contents

Products, services and company names referenced in this document may be either trademarks or registered trademarks of their respective owners.

Copyright © 2017–2020 EVL Tool, s.r.o.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.

IP Addresses Functions

Typical IPv4 manipulation usage within a mapping:

// convert and assign IPv4 string into unsigned integer
out->ipv4_uint = str_to_ipv4(in->ipv4_string);
// or the other way
out->ipv4_string = ipv4_to_str(in->ipv4_uint);

Typical IPv6 manipulation usage within a mapping:

// suppose in->ipv6_string = "4567::123"
out->ipv6_normalized = ipv6_normalize(in->ipv6_string);
    // return "4567:0000:0000:0000:0000:0000:0000:0123"

// suppose in->ipv6_string = "0000:0000:0000:0004:5678:9098:0000:0654"
out->ipv6_compressed = ipv6_compress(in->ipv6_string);
    // return "::4:5678:9098:0000:654"

Or one can distinguish both IP versions:

if ( is_valid_ipv4(in->ip_string) ) {
  // act on IPv4
else if ( is_valid_ipv6(in->ip_string) ) {
  // act on IPv6
else {
  // act when neither is valid 

There are these two rules in all IP manipulation functions described in this section:

  • When the first argument is a pointer, the function returns also a pointer.
  • When the first argument is ‘nullptr’, the function returns ‘nullptr’ as well.

IPv4 Functions

(since EVL 2.4)




convert string to uint32,


convert uint32 to ipv4 string,


to check whether the string is valid IPv4.

IPv6 Functions

(since EVL 2.4)


convert string to uint128,


convert uint128 to ipv6 string,


to check whether the string is valid IPv6,


convert string to normalized IPv6 string,


convert string to compressed IPv6 string,


To get normalized and compressed IPv6:

// suppose in->ipv6_string = "0000:0000:22::0003:4"
out->ipv6_normalized = ipv6_normalize(in->ipv6_string);
    // "0000:0000:0022:0000:0000:0000:0003:0004"
out->ipv6_compressed = ipv6_compress(in->ipv6_string);
    // "0:0:22::3:4"