aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_tun_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-17 19:06:15 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-17 19:06:15 +0000
commit9d077316ac3c6a18a4b13e90d7549188c2fe1f81 (patch)
treea6bc44ee81a35cf43ffe9c9968dfdc8de82711dd /src/include/gnunet_tun_lib.h
parent87509e6096da2f4c7a8359da338574f939d01f13 (diff)
downloadgnunet-9d077316ac3c6a18a4b13e90d7549188c2fe1f81.tar.gz
gnunet-9d077316ac3c6a18a4b13e90d7549188c2fe1f81.zip
-renaming TUN structs to follow namnig conventions
Diffstat (limited to 'src/include/gnunet_tun_lib.h')
-rw-r--r--src/include/gnunet_tun_lib.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h
index ca521db3b..dc6f01e1e 100644
--- a/src/include/gnunet_tun_lib.h
+++ b/src/include/gnunet_tun_lib.h
@@ -23,32 +23,35 @@
23 * @brief standard TCP/IP network structs and IP checksum calculations for TUN interaction 23 * @brief standard TCP/IP network structs and IP checksum calculations for TUN interaction
24 * @author Philipp Toelke 24 * @author Philipp Toelke
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 *
27 * TODO:
28 * - currently does not follow our naming conventions
29 */ 26 */
30#ifndef TCPIP_TUN_H 27#ifndef GNUNET_TUN_LIB_H
31#define TCPIP_TUN_H 28#define GNUNET_TUN_LIB_H
32 29
33#include "platform.h"
34#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
35 31
36 32
37/* see http://www.iana.org/assignments/ethernet-numbers */ 33/* see http://www.iana.org/assignments/ethernet-numbers */
38#ifndef ETH_P_IPV4 34#ifndef ETH_P_IPV4
35/**
36 * Number for IPv4
37 */
39#define ETH_P_IPV4 0x0800 38#define ETH_P_IPV4 0x0800
40#endif 39#endif
41 40
42#ifndef ETH_P_IPV6 41#ifndef ETH_P_IPV6
42/**
43 * Number for IPv6
44 */
43#define ETH_P_IPV6 0x86DD 45#define ETH_P_IPV6 0x86DD
44#endif 46#endif
45 47
46 48
47GNUNET_NETWORK_STRUCT_BEGIN 49GNUNET_NETWORK_STRUCT_BEGIN
50
48/** 51/**
49 * Header from Linux TUN interface. 52 * Header from Linux TUN interface.
50 */ 53 */
51struct tun_header 54struct GNUNET_TUN_Layer2PacketHeader
52{ 55{
53 /** 56 /**
54 * Some flags (unused). 57 * Some flags (unused).
@@ -65,7 +68,7 @@ struct tun_header
65/** 68/**
66 * Standard IPv4 header. 69 * Standard IPv4 header.
67 */ 70 */
68struct ip4_header 71struct GNUNET_TUN_IPv4Header
69{ 72{
70 unsigned header_length:4 GNUNET_PACKED; 73 unsigned header_length:4 GNUNET_PACKED;
71 unsigned version:4 GNUNET_PACKED; 74 unsigned version:4 GNUNET_PACKED;
@@ -81,10 +84,11 @@ struct ip4_header
81 struct in_addr destination_address GNUNET_PACKED; 84 struct in_addr destination_address GNUNET_PACKED;
82}; 85};
83 86
87
84/** 88/**
85 * Standard IPv6 header. 89 * Standard IPv6 header.
86 */ 90 */
87struct ip6_header 91struct GNUNET_TUN_IPv6Header
88{ 92{
89 unsigned traffic_class_h:4 GNUNET_PACKED; 93 unsigned traffic_class_h:4 GNUNET_PACKED;
90 unsigned version:4 GNUNET_PACKED; 94 unsigned version:4 GNUNET_PACKED;
@@ -97,12 +101,11 @@ struct ip6_header
97 struct in6_addr destination_address GNUNET_PACKED; 101 struct in6_addr destination_address GNUNET_PACKED;
98}; 102};
99 103
100#define TCP_FLAG_SYN 2
101 104
102/** 105/**
103 * TCP packet header (FIXME: rename!) 106 * TCP packet header (FIXME: rename!)
104 */ 107 */
105struct tcp_packet 108struct GNUNET_TUN_TcpHeader
106{ 109{
107 unsigned spt:16 GNUNET_PACKED; 110 unsigned spt:16 GNUNET_PACKED;
108 unsigned dpt:16 GNUNET_PACKED; 111 unsigned dpt:16 GNUNET_PACKED;
@@ -116,10 +119,11 @@ struct tcp_packet
116 unsigned urg:16 GNUNET_PACKED; 119 unsigned urg:16 GNUNET_PACKED;
117}; 120};
118 121
122
119/** 123/**
120 * UDP packet header (FIXME: rename!) 124 * UDP packet header (FIXME: rename!)
121 */ 125 */
122struct udp_packet 126struct GNUNET_TUN_UdpHeader
123{ 127{
124 uint16_t spt GNUNET_PACKED; 128 uint16_t spt GNUNET_PACKED;
125 uint16_t dpt GNUNET_PACKED; 129 uint16_t dpt GNUNET_PACKED;
@@ -127,10 +131,11 @@ struct udp_packet
127 uint16_t crc GNUNET_PACKED; 131 uint16_t crc GNUNET_PACKED;
128}; 132};
129 133
134
130/** 135/**
131 * DNS header. 136 * DNS header.
132 */ 137 */
133struct dns_header 138struct GNUNET_TUN_DnsHeader
134{ 139{
135 uint16_t id GNUNET_PACKED; 140 uint16_t id GNUNET_PACKED;
136 uint16_t flags GNUNET_PACKED; 141 uint16_t flags GNUNET_PACKED;
@@ -139,13 +144,8 @@ struct dns_header
139 uint16_t nscount GNUNET_PACKED; 144 uint16_t nscount GNUNET_PACKED;
140 uint16_t arcount GNUNET_PACKED; 145 uint16_t arcount GNUNET_PACKED;
141}; 146};
142GNUNET_NETWORK_STRUCT_END
143
144
145
146
147
148 147
148GNUNET_NETWORK_STRUCT_END
149 149
150 150
151#endif 151#endif