diff options
Diffstat (limited to 'src/include/gnunet_strings_lib.h')
-rw-r--r-- | src/include/gnunet_strings_lib.h | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 2e6f599d1..e0a299ac3 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2001-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -469,6 +469,72 @@ GNUNET_STRINGS_get_utf8_args (int argc, | |||
469 | char *const **u8argv); | 469 | char *const **u8argv); |
470 | 470 | ||
471 | 471 | ||
472 | /* ***************** IPv4/IPv6 parsing ****************** */ | ||
473 | |||
474 | /** | ||
475 | * @brief IPV4 network in CIDR notation. | ||
476 | */ | ||
477 | struct GNUNET_STRINGS_IPv4NetworkPolicy | ||
478 | { | ||
479 | /** | ||
480 | * IPv4 address. | ||
481 | */ | ||
482 | struct in_addr network; | ||
483 | |||
484 | /** | ||
485 | * IPv4 netmask. | ||
486 | */ | ||
487 | struct in_addr netmask; | ||
488 | }; | ||
489 | |||
490 | /** | ||
491 | |||
492 | * @brief network in CIDR notation for IPV6. | ||
493 | */ | ||
494 | struct GNUNET_STRINGS_IPv6NetworkPolicy | ||
495 | { | ||
496 | /** | ||
497 | * IPv6 address. | ||
498 | */ | ||
499 | struct in6_addr network; | ||
500 | |||
501 | /** | ||
502 | * IPv6 netmask. | ||
503 | */ | ||
504 | struct in6_addr netmask; | ||
505 | }; | ||
506 | |||
507 | |||
508 | /** | ||
509 | * Parse an IPv4 network policy. The argument specifies a list of | ||
510 | * subnets. The format is <tt>[network/netmask;]*</tt> (no whitespace, | ||
511 | * must be terminated with a semicolon). The network must be given in | ||
512 | * dotted-decimal notation. The netmask can be given in CIDR notation | ||
513 | * (/16) or in dotted-decimal (/255.255.0.0). | ||
514 | * | ||
515 | * @param routeList a string specifying the IPv4 subnets | ||
516 | * @return the converted list, terminated with all zeros; | ||
517 | * NULL if the synatx is flawed | ||
518 | */ | ||
519 | struct GNUNET_STRINGS_IPv4NetworkPolicy * | ||
520 | GNUNET_STRINGS_parse_ipv4_policy (const char *routeList); | ||
521 | |||
522 | |||
523 | /** | ||
524 | * Parse an IPv6 network policy. The argument specifies a list of | ||
525 | * subnets. The format is <tt>[network/netmask;]*</tt> (no whitespace, | ||
526 | * must be terminated with a semicolon). The network must be given in | ||
527 | * colon-hex notation. The netmask must be given in CIDR notation | ||
528 | * (/16) or can be omitted to specify a single host. | ||
529 | * | ||
530 | * @param routeListX a string specifying the policy | ||
531 | * @return the converted list, 0-terminated, NULL if the synatx is flawed | ||
532 | */ | ||
533 | struct GNUNET_STRINGS_IPv6NetworkPolicy * | ||
534 | GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX); | ||
535 | |||
536 | |||
537 | |||
472 | #if 0 /* keep Emacsens' auto-indent happy */ | 538 | #if 0 /* keep Emacsens' auto-indent happy */ |
473 | { | 539 | { |
474 | #endif | 540 | #endif |