aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_tun_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-26 14:34:39 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-26 14:34:39 +0000
commit0c9ca79b2eb820c3266e9117f3ba9179cbdc2ff1 (patch)
tree434cab0d8aa45a4edc2cf9bd91c89bf3f2d5061b /src/include/gnunet_tun_lib.h
parentaeb922926c639ffdd992f96cd125e47bb0e2c301 (diff)
downloadgnunet-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.h42
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
61GNUNET_NETWORK_STRUCT_BEGIN 67GNUNET_NETWORK_STRUCT_BEGIN
@@ -653,8 +659,8 @@ struct GNUNET_TUN_DnsRecordLine
653 * ICMP header. 659 * ICMP header.
654 */ 660 */
655struct GNUNET_TUN_IcmpHeader { 661struct 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 */
780void 786void
781GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, 787GNUNET_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 */
794void 800void
795GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, 801GNUNET_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 */
808void 814void
809GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, const char *netmask, 815GNUNET_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 */
821void 828void
822GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, 829GNUNET_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/**