diff options
Diffstat (limited to 'src/include/gnunet_strings_lib.h')
-rw-r--r-- | src/include/gnunet_strings_lib.h | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index e0a299ac3..8bb8cfb06 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -471,6 +471,28 @@ GNUNET_STRINGS_get_utf8_args (int argc, | |||
471 | 471 | ||
472 | /* ***************** IPv4/IPv6 parsing ****************** */ | 472 | /* ***************** IPv4/IPv6 parsing ****************** */ |
473 | 473 | ||
474 | struct GNUNET_STRINGS_PortPolicy | ||
475 | { | ||
476 | |||
477 | /** | ||
478 | * Starting port range (0 if none given). | ||
479 | */ | ||
480 | uint16_t start_port; | ||
481 | |||
482 | /** | ||
483 | * End of port range (0 if none given). | ||
484 | */ | ||
485 | uint16_t end_port; | ||
486 | |||
487 | /** | ||
488 | * #GNUNET_YES if the port range should be negated | ||
489 | * ("!" in policy). | ||
490 | */ | ||
491 | int negate_portrange; | ||
492 | |||
493 | }; | ||
494 | |||
495 | |||
474 | /** | 496 | /** |
475 | * @brief IPV4 network in CIDR notation. | 497 | * @brief IPV4 network in CIDR notation. |
476 | */ | 498 | */ |
@@ -485,10 +507,16 @@ struct GNUNET_STRINGS_IPv4NetworkPolicy | |||
485 | * IPv4 netmask. | 507 | * IPv4 netmask. |
486 | */ | 508 | */ |
487 | struct in_addr netmask; | 509 | struct in_addr netmask; |
510 | |||
511 | /** | ||
512 | * Policy for port access. | ||
513 | */ | ||
514 | struct GNUNET_STRINGS_PortPolicy pp; | ||
515 | |||
488 | }; | 516 | }; |
489 | 517 | ||
490 | /** | ||
491 | 518 | ||
519 | /** | ||
492 | * @brief network in CIDR notation for IPV6. | 520 | * @brief network in CIDR notation for IPV6. |
493 | */ | 521 | */ |
494 | struct GNUNET_STRINGS_IPv6NetworkPolicy | 522 | struct GNUNET_STRINGS_IPv6NetworkPolicy |
@@ -502,30 +530,37 @@ struct GNUNET_STRINGS_IPv6NetworkPolicy | |||
502 | * IPv6 netmask. | 530 | * IPv6 netmask. |
503 | */ | 531 | */ |
504 | struct in6_addr netmask; | 532 | struct in6_addr netmask; |
533 | |||
534 | /** | ||
535 | * Policy for port access. | ||
536 | */ | ||
537 | struct GNUNET_STRINGS_PortPolicy pp; | ||
538 | |||
505 | }; | 539 | }; |
506 | 540 | ||
507 | 541 | ||
508 | /** | 542 | /** |
509 | * Parse an IPv4 network policy. The argument specifies a list of | 543 | * Parse an IPv4 network policy. The argument specifies a list of |
510 | * subnets. The format is <tt>[network/netmask;]*</tt> (no whitespace, | 544 | * subnets. The format is <tt>(network[/netmask][:[!]SPORT-DPORT];)*</tt> |
511 | * must be terminated with a semicolon). The network must be given in | 545 | * (no whitespace, must be terminated with a semicolon). The network |
512 | * dotted-decimal notation. The netmask can be given in CIDR notation | 546 | * must be given in dotted-decimal notation. The netmask can be given |
513 | * (/16) or in dotted-decimal (/255.255.0.0). | 547 | * in CIDR notation (/16) or in dotted-decimal (/255.255.0.0). |
514 | * | 548 | * |
515 | * @param routeList a string specifying the IPv4 subnets | 549 | * @param routeListX a string specifying the IPv4 subnets |
516 | * @return the converted list, terminated with all zeros; | 550 | * @return the converted list, terminated with all zeros; |
517 | * NULL if the synatx is flawed | 551 | * NULL if the synatx is flawed |
518 | */ | 552 | */ |
519 | struct GNUNET_STRINGS_IPv4NetworkPolicy * | 553 | struct GNUNET_STRINGS_IPv4NetworkPolicy * |
520 | GNUNET_STRINGS_parse_ipv4_policy (const char *routeList); | 554 | GNUNET_STRINGS_parse_ipv4_policy (const char *routeListX); |
521 | 555 | ||
522 | 556 | ||
523 | /** | 557 | /** |
524 | * Parse an IPv6 network policy. The argument specifies a list of | 558 | * Parse an IPv6 network policy. The argument specifies a list of |
525 | * subnets. The format is <tt>[network/netmask;]*</tt> (no whitespace, | 559 | * subnets. The format is <tt>(network[/netmask[:[!]SPORT[-DPORT]]];)*</tt> |
526 | * must be terminated with a semicolon). The network must be given in | 560 | * (no whitespace, must be terminated with a semicolon). The network |
527 | * colon-hex notation. The netmask must be given in CIDR notation | 561 | * must be given in colon-hex notation. The netmask must be given in |
528 | * (/16) or can be omitted to specify a single host. | 562 | * CIDR notation (/16) or can be omitted to specify a single host. |
563 | * Note that the netmask is mandatory if ports are specified. | ||
529 | * | 564 | * |
530 | * @param routeListX a string specifying the policy | 565 | * @param routeListX a string specifying the policy |
531 | * @return the converted list, 0-terminated, NULL if the synatx is flawed | 566 | * @return the converted list, 0-terminated, NULL if the synatx is flawed |