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