diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-26 14:34:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-26 14:34:39 +0000 |
commit | 0c9ca79b2eb820c3266e9117f3ba9179cbdc2ff1 (patch) | |
tree | 434cab0d8aa45a4edc2cf9bd91c89bf3f2d5061b /src/include/gnunet_tun_lib.h | |
parent | aeb922926c639ffdd992f96cd125e47bb0e2c301 (diff) | |
download | gnunet-0c9ca79b2eb820c3266e9117f3ba9179cbdc2ff1.tar.gz gnunet-0c9ca79b2eb820c3266e9117f3ba9179cbdc2ff1.zip |
-converting regular expressions of vpn/pt to non-binary format and adding proper policy parsing
Diffstat (limited to 'src/include/gnunet_tun_lib.h')
-rw-r--r-- | src/include/gnunet_tun_lib.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index 17cec8d12..efadc4d14 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -47,15 +47,21 @@ | |||
47 | 47 | ||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Maximum regex string length for use with GNUNET_TUN_ipv4toregexsearch | 50 | * Maximum regex string length for use with #GNUNET_TUN_ipv4toregexsearch. |
51 | * | ||
52 | * 8 bytes for IPv4, 4 bytes for port, 1 byte for "4", 2 bytes for "-", | ||
53 | * one byte for 0-termination. | ||
51 | */ | 54 | */ |
52 | #define GNUNET_TUN_IPV4_REGEXLEN 32 + 6 | 55 | #define GNUNET_TUN_IPV4_REGEXLEN 16 |
53 | 56 | ||
54 | 57 | ||
55 | /** | 58 | /** |
56 | * Maximum regex string length for use with GNUNET_TUN_ipv6toregexsearch | 59 | * Maximum regex string length for use with #GNUNET_TUN_ipv6toregexsearch |
60 | * | ||
61 | * 32 bytes for IPv4, 4 bytes for port, 1 byte for "4", 2 bytes for "-", | ||
62 | * one byte for 0-termination. | ||
57 | */ | 63 | */ |
58 | #define GNUNET_TUN_IPV6_REGEXLEN 128 + 6 | 64 | #define GNUNET_TUN_IPV6_REGEXLEN 40 |
59 | 65 | ||
60 | 66 | ||
61 | GNUNET_NETWORK_STRUCT_BEGIN | 67 | GNUNET_NETWORK_STRUCT_BEGIN |
@@ -653,8 +659,8 @@ struct GNUNET_TUN_DnsRecordLine | |||
653 | * ICMP header. | 659 | * ICMP header. |
654 | */ | 660 | */ |
655 | struct GNUNET_TUN_IcmpHeader { | 661 | struct GNUNET_TUN_IcmpHeader { |
656 | uint8_t type; | 662 | uint8_t type; |
657 | uint8_t code; | 663 | uint8_t code; |
658 | uint16_t crc GNUNET_PACKED; | 664 | uint16_t crc GNUNET_PACKED; |
659 | 665 | ||
660 | union { | 666 | union { |
@@ -677,8 +683,8 @@ struct GNUNET_TUN_IcmpHeader { | |||
677 | 683 | ||
678 | /** | 684 | /** |
679 | * ICMP Redirect | 685 | * ICMP Redirect |
680 | */ | 686 | */ |
681 | struct in_addr redirect_gateway_address GNUNET_PACKED; | 687 | struct in_addr redirect_gateway_address GNUNET_PACKED; |
682 | 688 | ||
683 | /** | 689 | /** |
684 | * MTU for packets that are too big (IPv6). | 690 | * MTU for packets that are too big (IPv6). |
@@ -775,7 +781,7 @@ GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, | |||
775 | * @param ip ipv6 header fully initialized | 781 | * @param ip ipv6 header fully initialized |
776 | * @param udp UDP header (initialized except for CRC) | 782 | * @param udp UDP header (initialized except for CRC) |
777 | * @param payload the UDP payload | 783 | * @param payload the UDP payload |
778 | * @param payload_length number of bytes of UDP payload | 784 | * @param payload_length number of bytes of @a payload |
779 | */ | 785 | */ |
780 | void | 786 | void |
781 | GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, | 787 | GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, |
@@ -789,7 +795,7 @@ GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, | |||
789 | * | 795 | * |
790 | * @param icmp IMCP header (initialized except for CRC) | 796 | * @param icmp IMCP header (initialized except for CRC) |
791 | * @param payload the ICMP payload | 797 | * @param payload the ICMP payload |
792 | * @param payload_length number of bytes of ICMP payload | 798 | * @param payload_length number of bytes of @a payload |
793 | */ | 799 | */ |
794 | void | 800 | void |
795 | GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, | 801 | GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, |
@@ -798,29 +804,31 @@ GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, | |||
798 | 804 | ||
799 | 805 | ||
800 | /** | 806 | /** |
801 | * Create a regex in @a rxstr from the given @a ip and @a netmask. | 807 | * Create a regex in @a rxstr from the given @a ip and @a port. |
802 | * | 808 | * |
803 | * @param ip IPv4 representation. | 809 | * @param ip IPv4 representation. |
804 | * @param netmask netmask for the ip. | 810 | * @param port destination port |
805 | * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV4_REGEXLEN | 811 | * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV4_REGEXLEN |
806 | * bytes long. | 812 | * bytes long. |
807 | */ | 813 | */ |
808 | void | 814 | void |
809 | GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, const char *netmask, | 815 | GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, |
810 | char *rxstr); | 816 | uint16_t port, |
817 | char *rxstr); | ||
811 | 818 | ||
812 | 819 | ||
813 | /** | 820 | /** |
814 | * Create a regex in @a rxstr from the given @a ipv6 and @a prefixlen. | 821 | * Create a regex in @a rxstr from the given @a ipv6 and @a port. |
815 | * | 822 | * |
816 | * @param ipv6 IPv6 representation. | 823 | * @param ipv6 IPv6 representation. |
817 | * @param prefixlen length of the ipv6 prefix. | 824 | * @param port destination port |
818 | * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV6_REGEXLEN | 825 | * @param rxstr generated regex, must be at least #GNUNET_TUN_IPV6_REGEXLEN |
819 | * bytes long. | 826 | * bytes long. |
820 | */ | 827 | */ |
821 | void | 828 | void |
822 | GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, | 829 | GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, |
823 | unsigned int prefixlen, char *rxstr); | 830 | uint16_t port, |
831 | char *rxstr); | ||
824 | 832 | ||
825 | 833 | ||
826 | /** | 834 | /** |