-typedef void (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls,
- int32_t success,
- const char *emsg);
-
-
-/**
- * Flags that can be set for a record.
- */
-enum GNUNET_NAMESTORE_RecordFlags
-{
-
- /**
- * No special options.
- */
- GNUNET_NAMESTORE_RF_NONE = 0,
-
- /**
- * This peer is the authority for this record; it must thus
- * not be deleted (other records can be deleted if we run
- * out of space).
- */
- GNUNET_NAMESTORE_RF_AUTHORITY = 1,
-
- /**
- * This is a private record of this peer and it should
- * thus not be handed out to other peers.
- */
- GNUNET_NAMESTORE_RF_PRIVATE = 2,
-
- /**
- * This record was added by the system
- * and is pending user confimation
- */
- GNUNET_NAMESTORE_RF_PENDING = 4,
-
- /**
- * This expiration time of the record is a relative
- * time (not an absolute time).
- */
- GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION = 8,
-
- /**
- * This record should not be used unless all (other) records with an absolute
- * expiration time have expired.
- */
- GNUNET_NAMESTORE_RF_SHADOW_RECORD = 16
-
- /**
- * When comparing flags for record equality for removal,
- * which flags should must match (in addition to the type,
- * name, expiration value and data of the record)? All flags
- * that are not listed here will be ignored for this purpose.
- * (for example, we don't expect that users will remember to
- * pass the '--private' option when removing a record from
- * the namestore, hence we don't require this particular option
- * to match upon removal). See also
- * 'GNUNET_NAMESTORE_records_cmp'.
- */
-#define GNUNET_NAMESTORE_RF_RCMP_FLAGS (GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)
-};
-
-
-/**
- * A GNS record.
- */
-struct GNUNET_NAMESTORE_RecordData
-{
-
- /**
- * Binary value stored in the DNS record.
- * FIXME: goofy API: sometimes 'data' is individually
- * 'malloc'ed, sometimes it points into some existing
- * data area (so sometimes this should be a 'void *',
- * sometimes a 'const void *'). This is unclean. We
- * should go over the code and make sure that 'data'
- * is NEVER individually alloc'ed here but always points
- * to some "other" location.
- */
- const void *data;
-
- /**
- * Expiration time for the DNS record. Can be relative
- * or absolute, depending on 'flags'.
- */
- uint64_t expiration_time;
-
- /**
- * Number of bytes in 'data'.
- */
- size_t data_size;
-
- /**
- * Type of the GNS/DNS record.
- */
- uint32_t record_type;
-
- /**
- * Flags for the record.
- */
- enum GNUNET_NAMESTORE_RecordFlags flags;
-};
-
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-
-/**
- * Information we have in an encrypted block with record data (i.e. in the DHT).
- */
-struct GNUNET_NAMESTORE_Block
-{
-
- /**
- * Signature of the block.
- */
- struct GNUNET_CRYPTO_EccSignature signature;
-
- /**
- * Derived key used for signing; hash of this is the query.
- */
- struct GNUNET_CRYPTO_EccPublicKey derived_key;
-
- /**
- * Number of bytes signed; also specifies the number of bytes
- * of encrypted data that follow.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Expiration time of the block.
- */
- struct GNUNET_TIME_AbsoluteNBO expiration_time;
-
- /* followed by encrypted data */
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Store an item in the namestore. If the item is already present,
- * it is replaced with the new record.
- *
- * @param h handle to the namestore
- * @param block block to store
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- * @return handle to abort the request
- */
-struct GNUNET_NAMESTORE_QueueEntry *
-GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h,
- const struct GNUNET_NAMESTORE_Block *block,
- GNUNET_NAMESTORE_ContinuationWithStatus cont,
- void *cont_cls);