21 #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22 #error "Only <gnunet_util_lib.h> can be included directly."
41 #ifndef GNUNET_TUN_LIB_H
42 #define GNUNET_TUN_LIB_H
50 #define ETH_P_IPV4 0x0800
57 #define ETH_P_IPV6 0x86DD
68 #define GNUNET_TUN_IPV4_REGEXLEN 16
77 #define GNUNET_TUN_IPV6_REGEXLEN 40
104 #if __BYTE_ORDER == __LITTLE_ENDIAN
107 #elif __BYTE_ORDER == __BIG_ENDIAN
111 #error byteorder undefined
161 #if __BYTE_ORDER == __LITTLE_ENDIAN
166 #elif __BYTE_ORDER == __BIG_ENDIAN
171 #error byteorder undefined
203 #define GNUNET_TUN_TCP_FLAGS_FIN 1
204 #define GNUNET_TUN_TCP_FLAGS_SYN 2
205 #define GNUNET_TUN_TCP_FLAGS_RST 4
206 #define GNUNET_TUN_TCP_FLAGS_PSH 8
207 #define GNUNET_TUN_TCP_FLAGS_ACK 16
208 #define GNUNET_TUN_TCP_FLAGS_URG 32
209 #define GNUNET_TUN_TCP_FLAGS_ECE 64
210 #define GNUNET_TUN_TCP_FLAGS_CWR 128
236 #if __BYTE_ORDER == __LITTLE_ENDIAN
245 #elif __BYTE_ORDER == __BIG_ENDIAN
255 #error byteorder undefined
311 #define GNUNET_TUN_DNS_CLASS_INTERNET 1
312 #define GNUNET_TUN_DNS_CLASS_CHAOS 3
313 #define GNUNET_TUN_DNS_CLASS_HESIOD 4
315 #define GNUNET_TUN_DNS_OPCODE_QUERY 0
316 #define GNUNET_TUN_DNS_OPCODE_INVERSE_QUERY 1
317 #define GNUNET_TUN_DNS_OPCODE_STATUS 2
323 #define GNUNET_TUN_DNS_RETURN_CODE_NO_ERROR 0
324 #define GNUNET_TUN_DNS_RETURN_CODE_FORMAT_ERROR 1
325 #define GNUNET_TUN_DNS_RETURN_CODE_SERVER_FAILURE 2
326 #define GNUNET_TUN_DNS_RETURN_CODE_NAME_ERROR 3
327 #define GNUNET_TUN_DNS_RETURN_CODE_NOT_IMPLEMENTED 4
328 #define GNUNET_TUN_DNS_RETURN_CODE_REFUSED 5
333 #define GNUNET_TUN_DNS_RETURN_CODE_YXDOMAIN 6
334 #define GNUNET_TUN_DNS_RETURN_CODE_YXRRSET 7
335 #define GNUNET_TUN_DNS_RETURN_CODE_NXRRSET 8
336 #define GNUNET_TUN_DNS_RETURN_CODE_NOT_AUTH 9
337 #define GNUNET_TUN_DNS_RETURN_CODE_NOT_ZONE 10
345 #if __BYTE_ORDER == __LITTLE_ENDIAN
395 #elif __BYTE_ORDER == __BIG_ENDIAN
447 #error byteorder undefined
685 #define GNUNET_TUN_ICMPTYPE_ECHO_REPLY 0
686 #define GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE 3
687 #define GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH 4
688 #define GNUNET_TUN_ICMPTYPE_REDIRECT_MESSAGE 5
689 #define GNUNET_TUN_ICMPTYPE_ECHO_REQUEST 8
690 #define GNUNET_TUN_ICMPTYPE_ROUTER_ADVERTISEMENT 9
691 #define GNUNET_TUN_ICMPTYPE_ROUTER_SOLICITATION 10
692 #define GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED 11
694 #define GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE 1
695 #define GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG 2
696 #define GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED 3
697 #define GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM 4
698 #define GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST 128
699 #define GNUNET_TUN_ICMPTYPE6_ECHO_REPLY 129
762 uint16_t payload_length,
763 const struct in_addr *src,
764 const struct in_addr *dst);
780 uint16_t payload_length,
781 const struct in6_addr *src,
782 const struct in6_addr *dst);
796 uint16_t payload_length);
810 uint16_t payload_length);
824 uint16_t payload_length);
839 uint16_t payload_length);
852 uint16_t payload_length);
932 const struct sockaddr *sb,
static uint16_t port
Port number.
static unsigned long long payload
How much data are we currently storing in the database?
static struct GNUNET_CADET_Port * cadet_port
Listen port for incoming requests.
static char * service_name
Option -s: service name (hash to get service descriptor)
static int udp
Option -u: UDP requested.
static int ipv6
Option -6: IPv6 requested.
static int tcp
Option -t: TCP requested.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
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.
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.
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.
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.
void GNUNET_TUN_calculate_icmp_checksum(struct GNUNET_TUN_IcmpHeader *icmp, const void *payload, uint16_t payload_length)
Calculate ICMP checksum.
char * GNUNET_TUN_ipv4policy2regex(const char *policy)
Convert an exit policy to a regular expression.
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...
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.
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 th...
int GNUNET_TUN_sockaddr_cmp(const struct sockaddr *sa, const struct sockaddr *sb, int include_port)
Check if two sockaddrs are equal.
struct GNUNET_TUN_IPv4Header GNUNET_GCC_STRUCT_LAYOUT
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.
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.
char * GNUNET_TUN_ipv6policy2regex(const char *policy)
Convert an exit policy to a regular expression.
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.
The identity of the host (wraps the signing key of the peer).
Payload of DNS CERT record.
uint16_t cert_type
Certificate type.
uint16_t cert_tag
Certificate KeyTag.
uint8_t algorithm
Algorithm.
DNS flags (largely RFC 1035 / RFC 2136).
unsigned int checking_disabled
See RFC 4035.
unsigned int zero
Always zero.
unsigned int message_truncated
Set to 1 if message is truncated.
unsigned int query_or_response
query:0, response:1
unsigned int return_code
See GNUNET_TUN_DNS_RETURN_CODE_ defines.
unsigned int recursion_available
Set to 1 if recursion is available (server -> client)
unsigned int opcode
See GNUNET_TUN_DNS_OPCODE_ defines.
unsigned int recursion_desired
Set to 1 if recursion is desired (client -> server)
unsigned int authenticated_data
Response has been cryptographically verified, RFC 4035.
unsigned int authoritative_answer
Set to 1 if this is an authoritative answer.
uint16_t type
Desired type (GNUNET_DNSPARSER_TYPE_XXX).
uint16_t dns_traffic_class
Desired class (usually GNUNET_TUN_DNS_CLASS_INTERNET).
General DNS record prefix.
uint32_t ttl
Expiration for the record (in seconds).
uint16_t dns_traffic_class
Record class (usually GNUNET_TUN_DNS_CLASS_INTERNET).
uint16_t type
Record type (GNUNET_DNSPARSER_TYPE_XXX).
uint16_t data_len
Number of bytes of data that follow.
Payload of DNS SOA record (header).
uint32_t minimum
The bit minimum TTL field that should be exported with any RR from this zone.
uint32_t expire
Time value that specifies the upper limit on the time interval that can elapse before the zone is no ...
uint32_t refresh
Time interval before the zone should be refreshed.
uint32_t serial
The version number of the original copy of the zone.
uint32_t retry
Time interval that should elapse before a failed refresh should be retried.
Payload of DNS SRV record (header).
uint16_t prio
Preference for this entry (lower value is higher preference).
uint16_t weight
Relative weight for records with the same priority.
uint16_t port
TCP or UDP port of the service.
Payload of DNSSEC TLSA record.
uint8_t selector
Selector What part will be matched against the cert presented by server 0: Full cert (in binary) 1: F...
uint8_t matching_type
Matching type (of selected content) 0: exact match 1: SHA-256 hash 2: SHA-512 hash.
uint8_t usage
Certificate usage 0: CA cert 1: Entity cert 2: Trust anchor 3: domain-issued cert.
Payload of GNS VPN record.
struct GNUNET_PeerIdentity peer
The peer to contact.
uint16_t proto
The protocol to use.