-Merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api
[oweals/gnunet.git] / src / dns / dns.h
1 /*
2       This file is part of GNUnet
3       Copyright (C) 2012 GNUnet e.V.
4
5       GNUnet is free software: you can redistribute it and/or modify it
6       under the terms of the GNU Affero General Public License as published
7       by the Free Software Foundation, either version 3 of the License,
8       or (at your option) any later version.
9
10       GNUnet is distributed in the hope that it will be useful, but
11       WITHOUT ANY WARRANTY; without even the implied warranty of
12       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13       Affero General Public License for more details.
14      
15       You should have received a copy of the GNU Affero General Public License
16       along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 /**
20  * @file dns/dns.h
21  * @brief IPC messages between DNS API and DNS service
22  * @author Christian Grothoff
23  */
24 #ifndef DNS_H
25 #define DNS_H
26
27 GNUNET_NETWORK_STRUCT_BEGIN
28
29
30 /**
31  * Message from client to DNS service to register itself.
32  */
33 struct GNUNET_DNS_Register
34 {
35   /**
36     * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_INIT
37    */
38   struct GNUNET_MessageHeader header;
39
40   /**
41    * NBO encoding of `enum GNUNET_DNS_Flags` for the client.
42    */
43   uint32_t flags GNUNET_PACKED;
44 };
45
46
47 /**
48  * Message from DNS service to client: please handle a request.
49  */
50 struct GNUNET_DNS_Request
51 {
52   /**
53     * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST
54    */
55   struct GNUNET_MessageHeader header;
56
57   /**
58    * Always zero.
59    */
60   uint32_t reserved GNUNET_PACKED;
61
62   /**
63    * Unique request ID.
64    */
65   uint64_t request_id GNUNET_PACKED;
66
67   /* followed by original DNS request (without UDP header) */
68
69 };
70
71
72 /**
73  * Message from client to DNS service: here is my reply.
74  */
75 struct GNUNET_DNS_Response
76 {
77   /**
78    * Header of type #GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE
79    */
80   struct GNUNET_MessageHeader header;
81
82   /**
83    * Zero to drop, 1 for no change (no payload), 2 for update (message has payload).
84    */
85   uint32_t drop_flag GNUNET_PACKED;
86
87   /**
88    * Unique request ID.
89    */
90   uint64_t request_id GNUNET_PACKED;
91
92   /* followed by original DNS request (without UDP header) */
93
94 };
95
96
97 GNUNET_NETWORK_STRUCT_END
98
99 #endif