Revert "save the dns-tunnel"
[oweals/gnunet.git] / src / vpn / gnunet-service-dns-p.h
1 #ifndef GN_DNS_SERVICE_P_H
2 #define GN_DNS_SERVICE_P_H
3
4 #include "gnunet_common.h"
5
6 struct query_packet {
7         struct GNUNET_MessageHeader hdr;
8
9         /**
10          * The IP-Address this query was originally sent to
11          */
12         unsigned orig_to:32 GNUNET_PACKED;
13         /**
14          * The IP-Address this query was originally sent from
15          */
16         unsigned orig_from:32 GNUNET_PACKED;
17         /**
18          * The UDP-Portthis query was originally sent from
19          */
20         unsigned src_port:16 GNUNET_PACKED;
21
22         unsigned char data[1]; /* The DNS-Packet */
23 };
24
25 struct query_packet_list {
26         struct query_packet_list* next GNUNET_PACKED;
27         struct query_packet_list* prev GNUNET_PACKED;
28         struct query_packet pkt;
29 };
30
31 enum GNUNET_DNS_ANSWER_Subtype {
32     /**
33      * Answers of this type contain a dns-packet that just has to be transmitted
34      */
35     GNUNET_DNS_ANSWER_TYPE_IP,
36
37     /**
38      * Answers of this type contain an incomplete dns-packet. The IP-Address
39      * is all 0s. The addroffset points to it.
40      */
41     GNUNET_DNS_ANSWER_TYPE_SERVICE,
42
43     /**
44      * Answers of this type contain an incomplete dns-packet as answer to a
45      * PTR-Query. The resolved name is not allocated. The addroffset points to it.
46      */
47     GNUNET_DNS_ANSWER_TYPE_REV,
48
49     /**
50      * Answers of this type contains an IP6-Address but traffic to this IP should
51      * be routed through the GNUNet.
52      */
53     GNUNET_DNS_ANSWER_TYPE_REMOTE_AAAA,
54
55     /**
56      * Answers of this type contains an IP4-Address but traffic to this IP should
57      * be routed through the GNUNet.
58      */
59     GNUNET_DNS_ANSWER_TYPE_REMOTE_A
60 };
61
62 struct GNUNET_vpn_service_descriptor {
63     GNUNET_HashCode peer GNUNET_PACKED;
64     GNUNET_HashCode service_descriptor GNUNET_PACKED;
65     uint64_t ports GNUNET_PACKED;
66     uint32_t service_type GNUNET_PACKED;
67 };
68
69 struct answer_packet {
70     /* General data */
71     struct GNUNET_MessageHeader hdr;
72     enum GNUNET_DNS_ANSWER_Subtype subtype GNUNET_PACKED;
73
74     unsigned from:32 GNUNET_PACKED;
75     unsigned to:32 GNUNET_PACKED;
76     unsigned dst_port:16 GNUNET_PACKED;
77     /* -- */
78
79     /* Data for GNUNET_DNS_ANSWER_TYPE_SERVICE */
80     struct GNUNET_vpn_service_descriptor service_descr;
81     /* -- */
82
83     /* Data for GNUNET_DNS_ANSWER_TYPE_REV */
84     /* The offsett in octets from the beginning of the struct to the field
85      * in data where the IP-Address has to go. */
86     uint16_t addroffset GNUNET_PACKED;
87     /* -- */
88
89     /* Data for GNUNET_DNS_ANSWER_TYPE_REMOTE */
90     /* either 4 or 16 */
91     char addrsize;
92     unsigned char addr[16];
93     /* -- */
94
95     unsigned char data[1];
96 };
97
98 struct answer_packet_list {
99         struct answer_packet_list* next GNUNET_PACKED;
100         struct answer_packet_list* prev GNUNET_PACKED;
101         struct answer_packet pkt;
102 };
103
104 #endif