diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-09-27 20:54:53 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-09-27 20:54:53 +0000 |
commit | afee959fde9dc953c1b9153ba2134848b422fde0 (patch) | |
tree | 77ed9e0c5ccb09442a60193f69a2cdc26e34fdab /src/dht/dht.h | |
parent | 0faa3eaa142563dc765f21e71dfe6960bb631036 (diff) | |
download | gnunet-afee959fde9dc953c1b9153ba2134848b422fde0.tar.gz gnunet-afee959fde9dc953c1b9153ba2134848b422fde0.zip |
nonews
Diffstat (limited to 'src/dht/dht.h')
-rw-r--r-- | src/dht/dht.h | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h new file mode 100644 index 000000000..c8e2baff1 --- /dev/null +++ b/src/dht/dht.h | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2001, 2002, 2003, 2004, 2009, 2011 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 3, 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 | * @author Christian Grothoff | ||
23 | * @author Nathan Evans | ||
24 | * @file dht/dht.h | ||
25 | */ | ||
26 | |||
27 | #ifndef DHT_H_ | ||
28 | #define DHT_H_ | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Message which indicates the DHT should cancel outstanding | ||
33 | * requests and discard any state. | ||
34 | */ | ||
35 | struct GNUNET_DHT_ClientGetStopMessage | ||
36 | { | ||
37 | /** | ||
38 | * Type: GNUNET_MESSAGE_TYPE_DHT_GET_STOP | ||
39 | */ | ||
40 | struct GNUNET_MessageHeader header; | ||
41 | |||
42 | /** | ||
43 | * Always zero. | ||
44 | */ | ||
45 | uint32_t reserved GNUNET_PACKED; | ||
46 | |||
47 | /** | ||
48 | * Unique ID identifying this request | ||
49 | */ | ||
50 | uint64_t unique_id GNUNET_PACKED; | ||
51 | |||
52 | /** | ||
53 | * Key of this request | ||
54 | */ | ||
55 | GNUNET_HashCode key; | ||
56 | |||
57 | }; | ||
58 | |||
59 | |||
60 | /** | ||
61 | * DHT GET message sent from clients to service. Indicates that a GET | ||
62 | * request should be issued. | ||
63 | */ | ||
64 | struct GNUNET_DHT_ClientGetMessage | ||
65 | { | ||
66 | /** | ||
67 | * Type: GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET | ||
68 | */ | ||
69 | struct GNUNET_MessageHeader header; | ||
70 | |||
71 | /** | ||
72 | * Message options, actually an 'enum GNUNET_DHT_RouteOption' value. | ||
73 | */ | ||
74 | uint32_t options GNUNET_PACKED; | ||
75 | |||
76 | /** | ||
77 | * Replication level for this message | ||
78 | */ | ||
79 | uint32_t desired_replication_level GNUNET_PACKED; | ||
80 | |||
81 | /** | ||
82 | * The type for the data for the GET request; actually an 'enum | ||
83 | * GNUNET_BLOCK_Type'. | ||
84 | */ | ||
85 | uint32_t type; | ||
86 | |||
87 | /** | ||
88 | * The key to search for | ||
89 | */ | ||
90 | GNUNET_HashCode key; | ||
91 | |||
92 | /** | ||
93 | * Unique ID identifying this request, if 0 then | ||
94 | * the client will not expect a response | ||
95 | */ | ||
96 | uint64_t unique_id GNUNET_PACKED; | ||
97 | |||
98 | /* Possibly followed by xquery, copied to end of this dealy do */ | ||
99 | |||
100 | }; | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Reply to a GET send from the service to a client. | ||
105 | */ | ||
106 | struct GNUNET_DHT_ClientResultMessage | ||
107 | { | ||
108 | /** | ||
109 | * Type: GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT | ||
110 | */ | ||
111 | struct GNUNET_MessageHeader header; | ||
112 | |||
113 | /** | ||
114 | * The type for the data. | ||
115 | */ | ||
116 | uint32_t type; | ||
117 | |||
118 | /** | ||
119 | * Number of peers recorded in the outgoing path from source to the | ||
120 | * storgage location of this message. | ||
121 | */ | ||
122 | uint32_t put_path_length GNUNET_PACKED; | ||
123 | |||
124 | /** | ||
125 | * The number of peer identities recorded from the storage location | ||
126 | * to this peer. | ||
127 | */ | ||
128 | uint32_t get_path_length GNUNET_PACKED; | ||
129 | |||
130 | /** | ||
131 | * Unique ID of the matching GET request. | ||
132 | */ | ||
133 | uint64_t unique_id GNUNET_PACKED; | ||
134 | |||
135 | /** | ||
136 | * When does this entry expire? | ||
137 | */ | ||
138 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
139 | |||
140 | /** | ||
141 | * The key that was searched for | ||
142 | */ | ||
143 | GNUNET_HashCode key; | ||
144 | |||
145 | /* put path, get path and actual data are copied to end of this dealy do */ | ||
146 | |||
147 | }; | ||
148 | |||
149 | |||
150 | /** | ||
151 | * Message to insert data into the DHT, sent from clients to DHT service. | ||
152 | */ | ||
153 | struct GNUNET_DHT_ClientPutMessage | ||
154 | { | ||
155 | /** | ||
156 | * Type: GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT | ||
157 | */ | ||
158 | struct GNUNET_MessageHeader header; | ||
159 | |||
160 | /** | ||
161 | * The type of data to insert. | ||
162 | */ | ||
163 | uint32_t type GNUNET_PACKED; | ||
164 | |||
165 | /** | ||
166 | * Message options, actually an 'enum GNUNET_DHT_RouteOption' value. | ||
167 | */ | ||
168 | uint32_t options GNUNET_PACKED; | ||
169 | |||
170 | /** | ||
171 | * Replication level for this message | ||
172 | */ | ||
173 | uint32_t desired_replication_level GNUNET_PACKED; | ||
174 | |||
175 | /** | ||
176 | * How long should this data persist? | ||
177 | */ | ||
178 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
179 | |||
180 | /** | ||
181 | * The key to store the value under. | ||
182 | */ | ||
183 | GNUNET_HashCode key; | ||
184 | |||
185 | /* DATA copied to end of this message */ | ||
186 | |||
187 | }; | ||
188 | |||
189 | |||
190 | #endif | ||