aboutsummaryrefslogtreecommitdiff
path: root/src/gns/namestore_stub_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/namestore_stub_api.c')
-rw-r--r--src/gns/namestore_stub_api.c180
1 files changed, 38 insertions, 142 deletions
diff --git a/src/gns/namestore_stub_api.c b/src/gns/namestore_stub_api.c
index 29a785a8a..d08de04cb 100644
--- a/src/gns/namestore_stub_api.c
+++ b/src/gns/namestore_stub_api.c
@@ -146,56 +146,40 @@ struct GNUNET_NAMESTORE_QueueEntry *
146GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, 146GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h,
147 const GNUNET_HashCode *zone, 147 const GNUNET_HashCode *zone,
148 const char *name, 148 const char *name,
149 uint32_t record_type,
150 struct GNUNET_TIME_Absolute expiration, 149 struct GNUNET_TIME_Absolute expiration,
151 enum GNUNET_NAMESTORE_RecordFlags flags, 150 unsigned int rd_count,
152 size_t data_size, 151 const struct GNUNET_NAMESTORE_RecordData *rd,
153 const void *data, 152 const struct GNUNET_CRYPTO_RsaSignature *signature,
154 GNUNET_NAMESTORE_ContinuationWithStatus cont, 153 GNUNET_NAMESTORE_ContinuationWithStatus cont,
155 void *cont_cls) 154 void *cont_cls)
156{ 155{
157 struct GNUNET_NAMESTORE_QueueEntry *qe; 156 struct GNUNET_NAMESTORE_QueueEntry *qe;
158 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry)); 157 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
159 158 //FIXME
160 struct GNUNET_NAMESTORE_SimpleRecord *sr;
161 sr = GNUNET_malloc(sizeof(struct GNUNET_NAMESTORE_SimpleRecord));
162 sr->name = name;
163 sr->record_type = record_type;
164 sr->expiration = expiration;
165 sr->flags = flags;
166 sr->data_size = data_size;
167 sr->data = data;
168 GNUNET_CONTAINER_DLL_insert(h->records_head, h->records_tail, sr);
169 return qe; 159 return qe;
170} 160}
171 161
172/** 162int
173 * Store a signature in the namestore. 163GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
174 * 164 const char *name,
175 * @param h handle to the namestore 165 unsigned int rd_count,
176 * @param zone hash of the public key of the zone 166 const struct GNUNET_NAMESTORE_RecordData *rd,
177 * @param name name that is being mapped (at most 255 characters long) 167 const struct GNUNET_CRYPTO_RsaSignature *signature)
178 * @param record_type type of the record (A, AAAA, PKEY, etc.) 168{
179 * @param expiration expiration time for the content 169 return GNUNET_OK;
180 * @param flags flags for the content 170}
181 * @param data_size number of bytes in data 171
182 * @param data value, semantics depend on 'record_type' (see RFCs for DNS and
183 * GNS specification for GNS extensions)
184 * @param cont continuation to call when done
185 * @param cont_cls closure for cont
186 * @return handle to abort the request
187 */
188struct GNUNET_NAMESTORE_QueueEntry * 172struct GNUNET_NAMESTORE_QueueEntry *
189GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h, 173GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h,
190 const GNUNET_HashCode *zone, 174 const struct GNUNET_CRYPTO_RsaPrivateKey *pkey,
191 const char *name, 175 const char *name,
192 struct GNUNET_CRYPTO_RsaSignature sig, 176 const struct GNUNET_NAMESTORE_RecordData *rd,
193 GNUNET_NAMESTORE_ContinuationWithStatus cont, 177 GNUNET_NAMESTORE_ContinuationWithStatus cont,
194 void *cont_cls) 178 void *cont_cls)
195{ 179{
196 struct GNUNET_NAMESTORE_QueueEntry *qe; 180 struct GNUNET_NAMESTORE_QueueEntry *qe;
197 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry)); 181 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
198 182 //FIXME
199 return qe; 183 return qe;
200} 184}
201 185
@@ -217,30 +201,16 @@ GNUNET_NAMESTORE_signature_put (struct GNUNET_NAMESTORE_Handle *h,
217 */ 201 */
218struct GNUNET_NAMESTORE_QueueEntry * 202struct GNUNET_NAMESTORE_QueueEntry *
219GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h, 203GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h,
220 const GNUNET_HashCode *zone, 204 const struct GNUNET_CRYPTO_RsaPrivateKey *pkey,
221 const char *name, 205 const char *name,
222 uint32_t record_type, 206 const struct GNUNET_NAMESTORE_RecordData *rd,
223 size_t size, 207 GNUNET_NAMESTORE_ContinuationWithStatus cont,
224 const void *data,
225 GNUNET_NAMESTORE_ContinuationWithStatus cont,
226 void *cont_cls) 208 void *cont_cls)
227{ 209{
228 struct GNUNET_NAMESTORE_QueueEntry *qe; 210 struct GNUNET_NAMESTORE_QueueEntry *qe;
229 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry)); 211 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
230 212
231 struct GNUNET_NAMESTORE_SimpleRecord *iter; 213 //FIXME
232 for (iter=h->records_head; iter != NULL; iter=iter->next)
233 {
234 if (strcmp ( iter->name, name ) &&
235 iter->record_type == record_type &&
236 GNUNET_CRYPTO_hash_cmp (iter->zone, zone))
237 break;
238 }
239 if (iter)
240 GNUNET_CONTAINER_DLL_remove(h->records_head,
241 h->records_tail,
242 iter);
243
244 return qe; 214 return qe;
245} 215}
246 216
@@ -268,107 +238,33 @@ GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
268 struct GNUNET_NAMESTORE_QueueEntry *qe; 238 struct GNUNET_NAMESTORE_QueueEntry *qe;
269 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry)); 239 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
270 240
271 struct GNUNET_NAMESTORE_SimpleRecord *iter; 241 //FIXME
272 for (iter=h->records_head; iter != NULL; iter=iter->next)
273 {
274 if (strcmp(iter->name, name))
275 continue;
276
277 if (iter->record_type != record_type)
278 continue;
279
280 proc(proc_cls, iter->zone, iter->name, iter->record_type,
281 iter->expiration,
282 iter->flags,
283 iter->data_size /*size*/,
284 iter->data /* data */);
285 }
286 proc(proc_cls, zone, name, record_type,
287 GNUNET_TIME_absolute_get_forever(), 0, 0, NULL); /*TERMINATE*/
288
289 return qe; 242 return qe;
290} 243}
291 244
292struct GNUNET_NAMESTORE_QueueEntry * 245struct GNUNET_NAMESTORE_ZoneIterator *
293GNUNET_NAMESTORE_lookup_signature (struct GNUNET_NAMESTORE_Handle *h, 246GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h,
294 const GNUNET_HashCode *zone, 247 const GNUNET_HashCode *zone,
295 const char* name, 248 enum GNUNET_NAMESTORE_RecordFlags must_have_flags,
296 GNUNET_NAMESTORE_SignatureProcessor proc, 249 enum GNUNET_NAMESTORE_RecordFlags must_not_have_flags,
297 void *proc_cls) 250 GNUNET_NAMESTORE_RecordProcessor proc,
251 void *proc_cls)
298{ 252{
299 return NULL; 253 struct GNUNET_NAMESTORE_ZoneIterator *it;
254 it = GNUNET_malloc(sizeof(struct GNUNET_NAMESTORE_ZoneIterator));
255 return it;
300} 256}
301 257
302
303/**
304 * Get the hash of a record (what will be signed in the Stree for
305 * the record).
306 *
307 * @param zone hash of the public key of the zone
308 * @param name name that is being mapped (at most 255 characters long)
309 * @param record_type type of the record (A, AAAA, PKEY, etc.)
310 * @param expiration expiration time for the content
311 * @param flags flags for the content
312 * @param data_size number of bytes in data
313 * @param data value, semantics depend on 'record_type' (see RFCs for DNS and.
314 * GNS specification for GNS extensions)
315 * @param record_hash hash of the record (set)
316 */
317void 258void
318GNUNET_NAMESTORE_record_hash (struct GNUNET_NAMESTORE_Handle *h, 259GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it)
319 const GNUNET_HashCode *zone,
320 const char *name,
321 uint32_t record_type,
322 struct GNUNET_TIME_Absolute expiration,
323 enum GNUNET_NAMESTORE_RecordFlags flags,
324 size_t data_size,
325 const void *data,
326 GNUNET_HashCode *record_hash)
327{ 260{
328 char* teststring = "namestore-stub";
329 GNUNET_CRYPTO_hash(teststring, strlen(teststring), record_hash);
330} 261}
331 262
332 263void
333/** 264GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
334 * Get all records of a zone.
335 *
336 * @param h handle to the namestore
337 * @param zone zone to access
338 * @param proc function to call on a random value; it
339 * will be called repeatedly with a value (if available)
340 * and always once at the end with a zone and name of NULL.
341 * @param proc_cls closure for proc
342 * @return a handle that can be used to
343 * cancel
344 */
345struct GNUNET_NAMESTORE_QueueEntry *
346GNUNET_NAMESTORE_zone_transfer (struct GNUNET_NAMESTORE_Handle *h,
347 const GNUNET_HashCode *zone,
348 GNUNET_NAMESTORE_RecordProcessor proc,
349 void *proc_cls)
350{ 265{
351 struct GNUNET_NAMESTORE_QueueEntry *qe;
352 qe = GNUNET_malloc(sizeof (struct GNUNET_NAMESTORE_QueueEntry));
353 return qe;
354} 266}
355 267
356struct GNUNET_NAMESTORE_ZoneIterator *
357GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h,
358 const GNUNET_HashCode *zone,
359 GNUNET_NAMESTORE_RecordProcessor proc,
360 void *proc_cls);
361
362int
363GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it);
364
365void
366GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it);
367
368void
369GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
370
371
372/** 268/**
373 * Cancel a namestore operation. The final callback from the 269 * Cancel a namestore operation. The final callback from the
374 * operation must not have been done yet. 270 * operation must not have been done yet.