Fixes and documentation
[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 struct answer_packet {
45     struct GNUNET_MessageHeader hdr;
46     enum GNUNET_DNS_ANSWER_Subtype subtype GNUNET_PACKED;
47
48     unsigned from:32 GNUNET_PACKED;
49     unsigned to:32 GNUNET_PACKED;
50     unsigned dst_port:16 GNUNET_PACKED;
51
52     /* Only sensible when subtype == GNUNET_DNS_ANSWER_TYPE_SERVICE */
53     GNUNET_HashCode peer;
54     GNUNET_HashCode service_descriptor;
55     uint64_t ports;
56     uint32_t service_type;
57
58     /* The offsett in octets from the beginning of the struct to the field
59      * in data where the IP-Address has to go. */
60     unsigned addroffset:16 GNUNET_PACKED;
61
62     unsigned char data[1];
63 };
64
65 struct answer_packet_list {
66         struct answer_packet_list* next GNUNET_PACKED;
67         struct answer_packet_list* prev GNUNET_PACKED;
68         struct answer_packet pkt;
69 };
70
71 #endif