diff options
Diffstat (limited to 'src/include/gnunet_tun_lib.h')
-rw-r--r-- | src/include/gnunet_tun_lib.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index 3bb1ea359..c670a19fb 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -46,6 +46,18 @@ | |||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | /** | ||
50 | * Maximum regex string length for use with GNUNET_TUN_ipv4toregex | ||
51 | */ | ||
52 | #define GNUNET_TUN_IPV4_REGEXLEN 32 + 6 | ||
53 | |||
54 | |||
55 | /** | ||
56 | * Maximum regex string length for use with GNUNET_TUN_ipv6toregex | ||
57 | */ | ||
58 | #define GNUNET_TUN_IPV6_REGEXLEN 128 + 6 | ||
59 | |||
60 | |||
49 | GNUNET_NETWORK_STRUCT_BEGIN | 61 | GNUNET_NETWORK_STRUCT_BEGIN |
50 | 62 | ||
51 | /** | 63 | /** |
@@ -417,4 +429,31 @@ GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, | |||
417 | uint16_t payload_length); | 429 | uint16_t payload_length); |
418 | 430 | ||
419 | 431 | ||
432 | /** | ||
433 | * Create a regex in 'rxstr' from the given 'ip' and 'netmask'. | ||
434 | * | ||
435 | * @param ip IPv4 representation. | ||
436 | * @param netmask netmask for the ip. | ||
437 | * @param rxstr generated regex, must be at least GNUNET_REGEX_IPV4_REGEXLEN | ||
438 | * bytes long. | ||
439 | */ | ||
440 | void | ||
441 | GNUNET_TUN_ipv4toregex (const struct in_addr *ip, const char *netmask, | ||
442 | char *rxstr); | ||
443 | |||
444 | |||
445 | /** | ||
446 | * Create a regex in 'rxstr' from the given 'ipv6' and 'prefixlen'. | ||
447 | * | ||
448 | * @param ipv6 IPv6 representation. | ||
449 | * @param prefixlen length of the ipv6 prefix. | ||
450 | * @param rxstr generated regex, must be at least GNUNET_REGEX_IPV6_REGEXLEN | ||
451 | * bytes long. | ||
452 | */ | ||
453 | void | ||
454 | GNUNET_TUN_ipv6toregex (const struct in6_addr *ipv6, | ||
455 | unsigned int prefixlen, char *rxstr); | ||
456 | |||
457 | |||
458 | |||
420 | #endif | 459 | #endif |