diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-20 08:32:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-20 08:32:50 +0000 |
commit | 21a2b4f95b4488645ba5a6254fcb8919c4915f73 (patch) | |
tree | 00c92cb7103cc14fba7e63e8dee99fe711856863 /src/include/gnunet_tun_lib.h | |
parent | 5533b105943b4f6dd688c1758350cd83ebeab3b9 (diff) | |
download | gnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.tar.gz gnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.zip |
continuing refactoring of regex library structure, disambiguating symbol names between old regex library which is now internal and the public API; moving IP-to-regex conversion functions to tun library, as only vpn is using those to begin with
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 |