GNUnet 0.21.1
gnunet_tun_lib.h File Reference

Standard TCP/IP network structs and IP checksum calculations for TUN interaction. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_TUN_Layer2PacketHeader
 Header from Linux TUN interface. More...
 
struct  GNUNET_TUN_IPv4Header
 Standard IPv4 header. More...
 
struct  GNUNET_TUN_IPv6Header
 Standard IPv6 header. More...
 
struct  GNUNET_TUN_TcpHeader
 TCP packet header. More...
 
struct  GNUNET_TUN_UdpHeader
 UDP packet header. More...
 
struct  GNUNET_TUN_DnsFlags
 DNS flags (largely RFC 1035 / RFC 2136). More...
 
struct  GNUNET_TUN_DnsHeader
 DNS header. More...
 
struct  GNUNET_TUN_DnsSoaRecord
 Payload of DNS SOA record (header). More...
 
struct  GNUNET_TUN_DnsSrvRecord
 Payload of DNS SRV record (header). More...
 
struct  GNUNET_TUN_DnsUriRecord
 Payload of DNS URI record (header). More...
 
struct  GNUNET_TUN_DnsCertRecord
 Payload of DNS CERT record. More...
 
struct  GNUNET_TUN_DnsTlsaRecord
 Payload of DNSSEC TLSA record. More...
 
struct  GNUNET_TUN_GnsVpnRecord
 Payload of GNS VPN record. More...
 
struct  GNUNET_TUN_DnsQueryLine
 DNS query prefix. More...
 
struct  GNUNET_TUN_DnsRecordLine
 General DNS record prefix. More...
 
struct  GNUNET_TUN_IcmpHeader
 ICMP header. More...
 

Macros

#define ETH_P_IPV4   0x0800
 Number for IPv4. More...
 
#define ETH_P_IPV6   0x86DD
 Number for IPv6. More...
 
#define GNUNET_TUN_IPV4_REGEXLEN   16
 Maximum regex string length for use with GNUNET_TUN_ipv4toregexsearch. More...
 
#define GNUNET_TUN_IPV6_REGEXLEN   40
 Maximum regex string length for use with GNUNET_TUN_ipv6toregexsearch. More...
 
#define GNUNET_TUN_TCP_FLAGS_FIN   1
 TCP flags. More...
 
#define GNUNET_TUN_TCP_FLAGS_SYN   2
 
#define GNUNET_TUN_TCP_FLAGS_RST   4
 
#define GNUNET_TUN_TCP_FLAGS_PSH   8
 
#define GNUNET_TUN_TCP_FLAGS_ACK   16
 
#define GNUNET_TUN_TCP_FLAGS_URG   32
 
#define GNUNET_TUN_TCP_FLAGS_ECE   64
 
#define GNUNET_TUN_TCP_FLAGS_CWR   128
 
#define GNUNET_TUN_DNS_CLASS_INTERNET   1
 A few common DNS classes (ok, only one is common, but I list a couple more to make it clear what we're talking about here). More...
 
#define GNUNET_TUN_DNS_CLASS_CHAOS   3
 
#define GNUNET_TUN_DNS_CLASS_HESIOD   4
 
#define GNUNET_TUN_DNS_OPCODE_QUERY   0
 
#define GNUNET_TUN_DNS_OPCODE_INVERSE_QUERY   1
 
#define GNUNET_TUN_DNS_OPCODE_STATUS   2
 
#define GNUNET_TUN_DNS_RETURN_CODE_NO_ERROR   0
 RFC 1035 codes. More...
 
#define GNUNET_TUN_DNS_RETURN_CODE_FORMAT_ERROR   1
 
#define GNUNET_TUN_DNS_RETURN_CODE_SERVER_FAILURE   2
 
#define GNUNET_TUN_DNS_RETURN_CODE_NAME_ERROR   3
 
#define GNUNET_TUN_DNS_RETURN_CODE_NOT_IMPLEMENTED   4
 
#define GNUNET_TUN_DNS_RETURN_CODE_REFUSED   5
 
#define GNUNET_TUN_DNS_RETURN_CODE_YXDOMAIN   6
 RFC 2136 codes. More...
 
#define GNUNET_TUN_DNS_RETURN_CODE_YXRRSET   7
 
#define GNUNET_TUN_DNS_RETURN_CODE_NXRRSET   8
 
#define GNUNET_TUN_DNS_RETURN_CODE_NOT_AUTH   9
 
#define GNUNET_TUN_DNS_RETURN_CODE_NOT_ZONE   10
 
#define GNUNET_TUN_ICMPTYPE_ECHO_REPLY   0
 
#define GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE   3
 
#define GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH   4
 
#define GNUNET_TUN_ICMPTYPE_REDIRECT_MESSAGE   5
 
#define GNUNET_TUN_ICMPTYPE_ECHO_REQUEST   8
 
#define GNUNET_TUN_ICMPTYPE_ROUTER_ADVERTISEMENT   9
 
#define GNUNET_TUN_ICMPTYPE_ROUTER_SOLICITATION   10
 
#define GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED   11
 
#define GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE   1
 
#define GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG   2
 
#define GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED   3
 
#define GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM   4
 
#define GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST   128
 
#define GNUNET_TUN_ICMPTYPE6_ECHO_REPLY   129
 

Functions

GNUNET_NETWORK_STRUCT_END void GNUNET_TUN_initialize_ipv4_header (struct GNUNET_TUN_IPv4Header *ip, uint8_t protocol, uint16_t payload_length, const struct in_addr *src, const struct in_addr *dst)
 Initialize an IPv4 header. More...
 
void GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip, uint8_t protocol, uint16_t payload_length, const struct in6_addr *src, const struct in6_addr *dst)
 Initialize an IPv6 header. More...
 
void GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, struct GNUNET_TUN_TcpHeader *tcp, const void *payload, uint16_t payload_length)
 Calculate IPv4 TCP checksum. More...
 
void GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, struct GNUNET_TUN_TcpHeader *tcp, const void *payload, uint16_t payload_length)
 Calculate IPv6 TCP checksum. More...
 
void GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip, struct GNUNET_TUN_UdpHeader *udp, const void *payload, uint16_t payload_length)
 Calculate IPv4 UDP checksum. More...
 
void GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, struct GNUNET_TUN_UdpHeader *udp, const void *payload, uint16_t payload_length)
 Calculate IPv6 UDP checksum. More...
 
void GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp, const void *payload, uint16_t payload_length)
 Calculate ICMP checksum. More...
 
void GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, uint16_t port, char *rxstr)
 Create a regex in rxstr from the given ip and port. More...
 
void GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6, uint16_t port, char *rxstr)
 Create a regex in rxstr from the given ipv6 and port. More...
 
char * GNUNET_TUN_ipv6policy2regex (const char *policy)
 Convert an exit policy to a regular expression. More...
 
char * GNUNET_TUN_ipv4policy2regex (const char *policy)
 Convert an exit policy to a regular expression. More...
 
void GNUNET_TUN_service_name_to_hash (const char *service_name, struct GNUNET_HashCode *hc)
 Hash the service name of a hosted service to the hash code that is used to identify the service on the network. More...
 
int GNUNET_TUN_sockaddr_cmp (const struct sockaddr *sa, const struct sockaddr *sb, int include_port)
 Check if two sockaddrs are equal. More...
 
void GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc, uint16_t ip_port, struct GNUNET_HashCode *cadet_port)
 Compute the CADET port given a service descriptor (returned from GNUNET_TUN_service_name_to_hash) and a TCP/UDP port ip_port. More...
 

Variables

struct GNUNET_TUN_IPv4Header GNUNET_GCC_STRUCT_LAYOUT
 

Detailed Description

Standard TCP/IP network structs and IP checksum calculations for TUN interaction.

Definition in file gnunet_tun_lib.h.