61 uint16_t be_port = htons (ip_port);
82 uint16_t payload_length,
83 const struct in_addr *src,
84 const struct in_addr *dst)
117 uint16_t payload_length,
118 const struct in6_addr *src,
119 const struct in6_addr *dst)
138 uint16_t payload_length)
152 sizeof(
struct in_addr) * 2);
153 tmp = htons (IPPROTO_TCP);
168 uint16_t payload_length)
180 2 *
sizeof(
struct in6_addr));
183 tmp = htonl (IPPROTO_TCP);
196 uint16_t payload_length)
211 sizeof(
struct in_addr) * 2);
212 tmp = htons (IPPROTO_UDP);
227 uint16_t payload_length)
241 sizeof(
struct in6_addr) * 2);
257 uint16_t payload_length)
280 const struct sockaddr *sb,
283 if (sa->sa_family != sb->sa_family)
286 switch (sa->sa_family)
289 const struct sockaddr_in *sa4 = (
const struct sockaddr_in *) sa;
290 const struct sockaddr_in *sb4 = (
const struct sockaddr_in *) sb;
291 if ((include_port) && (sa4->sin_port != sb4->sin_port))
293 return(sa4->sin_addr.s_addr == sb4->sin_addr.s_addr);
297 const struct sockaddr_in6 *sa6 = (
const struct sockaddr_in6 *) sa;
298 const struct sockaddr_in6 *sb6 = (
const struct sockaddr_in6 *) sb;
300 if ((include_port) && (sa6->sin6_port != sb6->sin6_port))
303 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 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 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).
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
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_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#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_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.
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)