diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-09 11:10:25 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-09 11:10:25 +0000 |
commit | 54eccc36f12430505b3b946f88ac61087cc82793 (patch) | |
tree | 722953a28bdbac53d006cb0fcb622473ed6dcc50 /src/dht/dht.h | |
parent | 513a6ef355fcbabeb1953055185608ed4dacbe69 (diff) | |
download | gnunet-54eccc36f12430505b3b946f88ac61087cc82793.tar.gz gnunet-54eccc36f12430505b3b946f88ac61087cc82793.zip |
breaking DHT code
Diffstat (limited to 'src/dht/dht.h')
-rw-r--r-- | src/dht/dht.h | 95 |
1 files changed, 25 insertions, 70 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h index 6c2f4cbd8..38503cfe2 100644 --- a/src/dht/dht.h +++ b/src/dht/dht.h | |||
@@ -30,11 +30,11 @@ | |||
30 | #define DEBUG_DHT GNUNET_NO | 30 | #define DEBUG_DHT GNUNET_NO |
31 | 31 | ||
32 | typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls, | 32 | typedef void (*GNUNET_DHT_MessageReceivedHandler) (void *cls, |
33 | struct GNUNET_MessageHeader | 33 | const struct GNUNET_MessageHeader |
34 | * msg); | 34 | * msg); |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Generic DHT message, wrapper for other message types | 37 | * FIXME. |
38 | */ | 38 | */ |
39 | struct GNUNET_DHT_StopMessage | 39 | struct GNUNET_DHT_StopMessage |
40 | { | 40 | { |
@@ -44,9 +44,14 @@ struct GNUNET_DHT_StopMessage | |||
44 | struct GNUNET_MessageHeader header; | 44 | struct GNUNET_MessageHeader header; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Always zero. | ||
48 | */ | ||
49 | uint32_t reserved GNUNET_PACKED; | ||
50 | |||
51 | /** | ||
47 | * Unique ID identifying this request | 52 | * Unique ID identifying this request |
48 | */ | 53 | */ |
49 | uint64_t unique_id; | 54 | uint64_t unique_id GNUNET_PACKED; |
50 | 55 | ||
51 | }; | 56 | }; |
52 | 57 | ||
@@ -62,34 +67,32 @@ struct GNUNET_DHT_Message | |||
62 | struct GNUNET_MessageHeader header; | 67 | struct GNUNET_MessageHeader header; |
63 | 68 | ||
64 | /** | 69 | /** |
70 | * Message options | ||
71 | */ | ||
72 | uint32_t options GNUNET_PACKED; | ||
73 | |||
74 | /** | ||
65 | * The key to search for | 75 | * The key to search for |
66 | */ | 76 | */ |
67 | GNUNET_HashCode key; | 77 | GNUNET_HashCode key; |
68 | 78 | ||
69 | /** | 79 | /** |
70 | * Replication level for this message | 80 | * Unique ID identifying this request |
71 | */ | 81 | */ |
72 | uint16_t desired_replication_level; | 82 | uint64_t unique_id GNUNET_PACKED; |
73 | 83 | ||
74 | /** | 84 | /** |
75 | * Message options | 85 | * Replication level for this message |
76 | */ | 86 | */ |
77 | uint16_t options; | 87 | uint32_t desired_replication_level GNUNET_PACKED; |
78 | 88 | ||
79 | /** | 89 | /** |
80 | * Is this message uniquely identified? If so it will | 90 | * Is this message uniquely identified? If so it will |
81 | * be fire and forget, if not we will wait for a receipt | 91 | * be fire and forget, if not we will wait for a receipt |
82 | * from the service. | 92 | * from the service. |
83 | */ | 93 | */ |
84 | uint16_t unique; | 94 | uint32_t unique GNUNET_PACKED; |
85 | |||
86 | 95 | ||
87 | /** | ||
88 | * Unique ID identifying this request | ||
89 | */ | ||
90 | uint64_t unique_id; | ||
91 | |||
92 | /* */ | ||
93 | /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */ | 96 | /* GNUNET_MessageHeader *enc actual DHT message, copied to end of this dealy do */ |
94 | 97 | ||
95 | }; | 98 | }; |
@@ -107,17 +110,17 @@ struct GNUNET_DHT_PutMessage | |||
107 | /** | 110 | /** |
108 | * The type of data to insert. | 111 | * The type of data to insert. |
109 | */ | 112 | */ |
110 | size_t type; | 113 | size_t type GNUNET_PACKED; |
111 | 114 | ||
112 | /** | 115 | /** |
113 | * The size of the data, appended to the end of this message. | 116 | * How long should this data persist? |
114 | */ | 117 | */ |
115 | size_t data_size; | 118 | struct GNUNET_TIME_AbsoluteNBO expiration; |
116 | 119 | ||
117 | /** | 120 | /** |
118 | * How long should this data persist? | 121 | * The size of the data, appended to the end of this message. |
119 | */ | 122 | */ |
120 | struct GNUNET_TIME_Absolute expiration; | 123 | size_t data_size GNUNET_PACKED; |
121 | 124 | ||
122 | }; | 125 | }; |
123 | 126 | ||
@@ -135,7 +138,7 @@ struct GNUNET_DHT_GetMessage | |||
135 | /** | 138 | /** |
136 | * The type for the data for the GET request | 139 | * The type for the data for the GET request |
137 | */ | 140 | */ |
138 | size_t type; | 141 | uint32_t type; |
139 | 142 | ||
140 | }; | 143 | }; |
141 | 144 | ||
@@ -152,7 +155,7 @@ struct GNUNET_DHT_GetResultMessage | |||
152 | /** | 155 | /** |
153 | * The type for the data for the GET request | 156 | * The type for the data for the GET request |
154 | */ | 157 | */ |
155 | size_t type; | 158 | uint32_t type; |
156 | 159 | ||
157 | /** | 160 | /** |
158 | * The key to search for | 161 | * The key to search for |
@@ -164,55 +167,7 @@ struct GNUNET_DHT_GetResultMessage | |||
164 | */ | 167 | */ |
165 | struct GNUNET_TIME_Absolute expiration; | 168 | struct GNUNET_TIME_Absolute expiration; |
166 | 169 | ||
167 | /** | ||
168 | * The size of the data, appended to the end of this message. | ||
169 | */ | ||
170 | size_t data_size; | ||
171 | |||
172 | }; | ||
173 | |||
174 | /** | ||
175 | * Message to issue find peer request to the DHT | ||
176 | */ | ||
177 | struct GNUNET_DHT_FindPeerMessage | ||
178 | { | ||
179 | /** | ||
180 | * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER | ||
181 | */ | ||
182 | struct GNUNET_MessageHeader header; | ||
183 | |||
184 | /** | ||
185 | * Size of inject message (may be zero) | ||
186 | */ | ||
187 | size_t msg_len; | ||
188 | |||
189 | /* Followed by message to inject at found peers */ | ||
190 | |||
191 | }; | 170 | }; |
192 | 171 | ||
193 | /** | ||
194 | * Message to return data from the DHT | ||
195 | */ | ||
196 | struct GNUNET_DHT_FindPeerResultMessage | ||
197 | { | ||
198 | /** | ||
199 | * Type: GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT | ||
200 | */ | ||
201 | struct GNUNET_MessageHeader header; | ||
202 | |||
203 | /** | ||
204 | * The peer that was found | ||
205 | */ | ||
206 | struct GNUNET_PeerIdentity peer; | ||
207 | |||
208 | /** | ||
209 | * The size of the return message from the peer | ||
210 | * (defaults to HELLO for the peer), | ||
211 | * appended to the end of this message, 0 if | ||
212 | * no message. | ||
213 | */ | ||
214 | size_t data_size; | ||
215 | |||
216 | }; | ||
217 | 172 | ||
218 | #endif /* DHT_H_ */ | 173 | #endif /* DHT_H_ */ |