along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ */
/**
* @author Philipp Toelke
/**
* Header from Linux TUN interface.
*/
-struct GNUNET_TUN_Layer2PacketHeader
-{
+struct GNUNET_TUN_Layer2PacketHeader {
/**
* Some flags (unused).
*/
/**
* Standard IPv4 header.
*/
-struct GNUNET_TUN_IPv4Header
-{
+struct GNUNET_TUN_IPv4Header {
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int header_length : 4 GNUNET_PACKED;
unsigned int version : 4 GNUNET_PACKED;
/**
* Standard IPv6 header.
*/
-struct GNUNET_TUN_IPv6Header
-{
+struct GNUNET_TUN_IPv6Header {
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int traffic_class_h : 4 GNUNET_PACKED;
unsigned int version : 4 GNUNET_PACKED;
/**
* TCP packet header.
*/
-struct GNUNET_TUN_TcpHeader
-{
+struct GNUNET_TUN_TcpHeader {
/**
* Source port (in NBO).
*/
/**
* UDP packet header.
*/
-struct GNUNET_TUN_UdpHeader
-{
+struct GNUNET_TUN_UdpHeader {
/**
* Source port (in NBO).
*/
/**
* DNS flags (largely RFC 1035 / RFC 2136).
*/
-struct GNUNET_TUN_DnsFlags
-{
+struct GNUNET_TUN_DnsFlags {
#if __BYTE_ORDER == __LITTLE_ENDIAN
/**
* Set to 1 if recursion is desired (client -> server)
*/
unsigned int recursion_available : 1 GNUNET_PACKED;
#elif __BYTE_ORDER == __BIG_ENDIAN
-
/**
* query:0, response:1
*/
#else
#error byteorder undefined
#endif
-
} GNUNET_GCC_STRUCT_LAYOUT;
/**
* DNS header.
*/
-struct GNUNET_TUN_DnsHeader
-{
+struct GNUNET_TUN_DnsHeader {
/**
* Unique identifier for the request/response.
*/
/**
* Payload of DNS SOA record (header).
*/
-struct GNUNET_TUN_DnsSoaRecord
-{
+struct GNUNET_TUN_DnsSoaRecord {
/**
* The version number of the original copy of the zone. (NBO)
*/
/**
* Payload of DNS SRV record (header).
*/
-struct GNUNET_TUN_DnsSrvRecord
-{
-
+struct GNUNET_TUN_DnsSrvRecord {
/**
* Preference for this entry (lower value is higher preference). Clients
* will contact hosts from the lowest-priority group first and fall back
/**
* Payload of DNS CERT record.
*/
-struct GNUNET_TUN_DnsCertRecord
-{
-
+struct GNUNET_TUN_DnsCertRecord {
/**
* Certificate type
*/
* Payload of DNSSEC TLSA record.
* http://datatracker.ietf.org/doc/draft-ietf-dane-protocol/
*/
-struct GNUNET_TUN_DnsTlsaRecord
-{
-
+struct GNUNET_TUN_DnsTlsaRecord {
/**
* Certificate usage
* 0: CA cert
/**
* Payload of GNS VPN record
*/
-struct GNUNET_TUN_GnsVpnRecord
-{
+struct GNUNET_TUN_GnsVpnRecord {
/**
* The peer to contact
*/
/**
* DNS query prefix.
*/
-struct GNUNET_TUN_DnsQueryLine
-{
+struct GNUNET_TUN_DnsQueryLine {
/**
* Desired type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
*/
/**
* General DNS record prefix.
*/
-struct GNUNET_TUN_DnsRecordLine
-{
+struct GNUNET_TUN_DnsRecordLine {
/**
* Record type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
*/
/**
* ICMP header.
*/
-struct GNUNET_TUN_IcmpHeader
-{
+struct GNUNET_TUN_IcmpHeader {
uint8_t type;
uint8_t code;
uint16_t crc GNUNET_PACKED;
- union
- {
+ union {
/**
* ICMP Echo (request/reply)
*/
- struct
- {
+ struct {
uint16_t identifier GNUNET_PACKED;
uint16_t sequence_number GNUNET_PACKED;
} echo;
/**
* ICMP Destination Unreachable (RFC 1191)
*/
- struct ih_pmtu
- {
+ struct ih_pmtu {
uint16_t empty GNUNET_PACKED;
uint16_t next_hop_mtu GNUNET_PACKED;
/* followed by original IP header + first 8 bytes of original IP datagram
* MTU for packets that are too big (IPv6).
*/
uint32_t packet_too_big_mtu GNUNET_PACKED;
-
} quench;
};
* @param dst destination IP address to use
*/
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);
+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);
/**
* @param dst destination IP address to use
*/
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);
+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);
/**
* Calculate IPv4 TCP checksum.
* @param payload_length number of bytes of TCP @a payload
*/
void
-GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
- struct GNUNET_TUN_TcpHeader *tcp,
- const void *payload,
- uint16_t payload_length);
+GNUNET_TUN_calculate_tcp4_checksum(const struct GNUNET_TUN_IPv4Header *ip,
+ struct GNUNET_TUN_TcpHeader *tcp,
+ const void *payload,
+ uint16_t payload_length);
/**
* Calculate IPv6 TCP checksum.
* @param payload_length number of bytes of TCP payload
*/
void
-GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip,
- struct GNUNET_TUN_TcpHeader *tcp,
- const void *payload,
- uint16_t payload_length);
+GNUNET_TUN_calculate_tcp6_checksum(const struct GNUNET_TUN_IPv6Header *ip,
+ struct GNUNET_TUN_TcpHeader *tcp,
+ const void *payload,
+ uint16_t payload_length);
/**
* Calculate IPv4 UDP checksum.
* @param payload_length number of bytes of UDP @a payload
*/
void
-GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
- struct GNUNET_TUN_UdpHeader *udp,
- const void *payload,
- uint16_t payload_length);
+GNUNET_TUN_calculate_udp4_checksum(const struct GNUNET_TUN_IPv4Header *ip,
+ struct GNUNET_TUN_UdpHeader *udp,
+ const void *payload,
+ uint16_t payload_length);
/**
* @param payload_length number of bytes of @a payload
*/
void
-GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip,
- struct GNUNET_TUN_UdpHeader *udp,
- const void *payload,
- uint16_t payload_length);
+GNUNET_TUN_calculate_udp6_checksum(const struct GNUNET_TUN_IPv6Header *ip,
+ struct GNUNET_TUN_UdpHeader *udp,
+ const void *payload,
+ uint16_t payload_length);
/**
* @param payload_length number of bytes of @a payload
*/
void
-GNUNET_TUN_calculate_icmp_checksum (struct GNUNET_TUN_IcmpHeader *icmp,
- const void *payload,
- uint16_t payload_length);
+GNUNET_TUN_calculate_icmp_checksum(struct GNUNET_TUN_IcmpHeader *icmp,
+ const void *payload,
+ uint16_t payload_length);
/**
* bytes long.
*/
void
-GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip,
- uint16_t port,
- char *rxstr);
+GNUNET_TUN_ipv4toregexsearch(const struct in_addr *ip,
+ uint16_t port,
+ char *rxstr);
/**
* bytes long.
*/
void
-GNUNET_TUN_ipv6toregexsearch (const struct in6_addr *ipv6,
- uint16_t port,
- char *rxstr);
+GNUNET_TUN_ipv6toregexsearch(const struct in6_addr *ipv6,
+ uint16_t port,
+ char *rxstr);
/**
* @return regular expression, NULL on error
*/
char *
-GNUNET_TUN_ipv6policy2regex (const char *policy);
+GNUNET_TUN_ipv6policy2regex(const char *policy);
/**
* @return regular expression, NULL on error
*/
char *
-GNUNET_TUN_ipv4policy2regex (const char *policy);
+GNUNET_TUN_ipv4policy2regex(const char *policy);
/**
* @param[out] hc corresponding hash
*/
void
-GNUNET_TUN_service_name_to_hash (const char *service_name,
- struct GNUNET_HashCode *hc);
+GNUNET_TUN_service_name_to_hash(const char *service_name,
+ struct GNUNET_HashCode *hc);
/**
* @return #GNUNET_YES if they are equal
*/
int
-GNUNET_TUN_sockaddr_cmp (const struct sockaddr *sa,
- const struct sockaddr *sb,
- int include_port);
+GNUNET_TUN_sockaddr_cmp(const struct sockaddr *sa,
+ const struct sockaddr *sb,
+ int include_port);
/**
* @param[out] cadet_port CADET port to use
*/
void
-GNUNET_TUN_compute_service_cadet_port (const struct GNUNET_HashCode *desc,
- uint16_t ip_port,
- struct GNUNET_HashCode *cadet_port);
+GNUNET_TUN_compute_service_cadet_port(const struct GNUNET_HashCode *desc,
+ uint16_t ip_port,
+ struct GNUNET_HashCode *cadet_port);
#endif