49 uint16_t payload_length,
50 const struct in_addr *src,
51 const struct in_addr *dst)
84 uint16_t payload_length,
85 const struct in6_addr *src,
86 const struct in6_addr *dst)
105 uint16_t payload_length)
119 sizeof(
struct in_addr) * 2);
120 tmp = htons (IPPROTO_TCP);
135 uint16_t payload_length)
147 2 *
sizeof(
struct in6_addr));
150 tmp = htonl (IPPROTO_TCP);
163 uint16_t payload_length)
178 sizeof(
struct in_addr) * 2);
179 tmp = htons (IPPROTO_UDP);
194 uint16_t payload_length)
208 sizeof(
struct in6_addr) * 2);
224 uint16_t payload_length)
247 const struct sockaddr *sb,
250 if (sa->sa_family != sb->sa_family)
253 switch (sa->sa_family)
256 const struct sockaddr_in *sa4 = (
const struct sockaddr_in *) sa;
257 const struct sockaddr_in *sb4 = (
const struct sockaddr_in *) sb;
258 if ((include_port) && (sa4->sin_port != sb4->sin_port))
260 return(sa4->sin_addr.s_addr == sb4->sin_addr.s_addr);
264 const struct sockaddr_in6 *sa6 = (
const struct sockaddr_in6 *) sa;
265 const struct sockaddr_in6 *sb6 = (
const struct sockaddr_in6 *) sb;
267 if ((include_port) && (sa6->sin6_port != sb6->sin6_port))
270 0 == memcmp (&sa6->sin6_addr, &sb6->sin6_addr,
sizeof(
struct
static unsigned long long payload
How much data are we currently storing in the database?
static int udp
Option -u: UDP requested.
static int tcp
Option -t: TCP requested.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
uint16_t GNUNET_CRYPTO_crc16_n(const void *buf, size_t len)
Calculate the checksum of a buffer in one step.
uint16_t GNUNET_CRYPTO_crc16_finish(uint32_t sum)
Convert results from GNUNET_CRYPTO_crc16_step to final crc16.
uint32_t GNUNET_CRYPTO_crc16_step(uint32_t sum, const void *buf, size_t len)
Perform an incremental step in a CRC16 (for TCP/IP) calculation.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
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_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.
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.
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.
int GNUNET_TUN_sockaddr_cmp(const struct sockaddr *sa, const struct sockaddr *sb, int include_port)
Check if two sockaddrs are equal.
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_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.
#define FRESH_TTL
IP TTL we use for packets that we assemble (8 bit unsigned integer)