diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-02 14:28:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-02 14:28:33 +0000 |
commit | 71aa26a1b0669d6909c27c7dc291a3e08d65e122 (patch) | |
tree | 3a1a090c27ff2849b327098f17256712cf947a35 /src/dns | |
parent | 13fef3b77277dcc312c9d6ea02e18b5fbdd874b0 (diff) | |
download | gnunet-71aa26a1b0669d6909c27c7dc291a3e08d65e122.tar.gz gnunet-71aa26a1b0669d6909c27c7dc291a3e08d65e122.zip |
-implementing new DNS client API
Diffstat (limited to 'src/dns')
-rw-r--r-- | src/dns/dns_new.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/src/dns/dns_new.h b/src/dns/dns_new.h new file mode 100644 index 000000000..4f3493db2 --- /dev/null +++ b/src/dns/dns_new.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file dns/dns_new.h | ||
23 | * @brief IPC messages between DNS API and DNS service | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef DNS_NEW_H | ||
27 | #define DNS_NEW_H | ||
28 | |||
29 | GNUNET_NETWORK_STRUCT_BEGIN | ||
30 | |||
31 | /** | ||
32 | * Message from DNS service to client: please handle a request. | ||
33 | */ | ||
34 | struct GNUNET_DNS_Request | ||
35 | { | ||
36 | /** | ||
37 | * Header of type GNUNET_MESSAGE_TYPE_DNS_CLIENT_REQUEST | ||
38 | */ | ||
39 | struct GNUNET_MessageHeader header; | ||
40 | |||
41 | /** | ||
42 | * A DNS type (GNUNET_DNS_TYPE_*) | ||
43 | */ | ||
44 | uint16_t dns_type GNUNET_PACKED; | ||
45 | |||
46 | /** | ||
47 | * A DNS class (usually 1). | ||
48 | */ | ||
49 | uint16_t dns_class GNUNET_PACKED; | ||
50 | |||
51 | /** | ||
52 | * Unique request ID. | ||
53 | */ | ||
54 | uint64_t request_id GNUNET_PACKED; | ||
55 | |||
56 | /** | ||
57 | * TTL if rdata is present, otherwise 0. | ||
58 | */ | ||
59 | uint32_t dns_ttl GNUNET_PACKED; | ||
60 | |||
61 | /** | ||
62 | * Number of bytes of rdata that follow at the end. | ||
63 | */ | ||
64 | uint16_t rdata_length GNUNET_PACKED; | ||
65 | |||
66 | /** | ||
67 | * Number of bytes of the name that follow right now (including 0-termination). | ||
68 | */ | ||
69 | uint16_t name_length GNUNET_PACKED; | ||
70 | |||
71 | /* followed by char name[name_length] */ | ||
72 | |||
73 | /* followed by char rdata[rdata_length] */ | ||
74 | |||
75 | }; | ||
76 | |||
77 | |||
78 | /** | ||
79 | * Message from client to DNS service: here is my reply. | ||
80 | */ | ||
81 | struct GNUNET_DNS_Response | ||
82 | { | ||
83 | /** | ||
84 | * Header of type GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE | ||
85 | */ | ||
86 | struct GNUNET_MessageHeader header; | ||
87 | |||
88 | /** | ||
89 | * TTL if rdata is present, otherwise 0. | ||
90 | */ | ||
91 | uint32_t dns_ttl GNUNET_PACKED; | ||
92 | |||
93 | /** | ||
94 | * Unique request ID, matches the original request. | ||
95 | */ | ||
96 | uint64_t request_id GNUNET_PACKED; | ||
97 | |||
98 | /** | ||
99 | * 1 to drop request, 0 to forward if there is no response | ||
100 | * or to answer if there is a response. | ||
101 | */ | ||
102 | uint16_t drop_flag GNUNET_PACKED; | ||
103 | |||
104 | /** | ||
105 | * Number of bytes of rdata that follow at the end. | ||
106 | */ | ||
107 | uint16_t rdata_length GNUNET_PACKED; | ||
108 | |||
109 | /* followed by char rdata[rdata_length] */ | ||
110 | |||
111 | }; | ||
112 | |||
113 | |||
114 | GNUNET_NETWORK_STRUCT_END | ||
115 | |||
116 | #endif | ||