#include "gnunet_util_lib.h"
#include "gnunet_crypto_lib.h"
#include "gnunet_constants.h"
+#include "gnunet_dnsparser_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_signatures.h"
#include "gnunet_namestore_service.h"
*/
struct GNUNET_NAMESTORE_QueueEntry
{
+
+ /**
+ * Kept in a DLL.
+ */
struct GNUNET_NAMESTORE_QueueEntry *next;
+
+ /**
+ * Kept in a DLL.
+ */
struct GNUNET_NAMESTORE_QueueEntry *prev;
struct GNUNET_NAMESTORE_Handle *nsh;
*/
struct GNUNET_NAMESTORE_ZoneIterator
{
+
+ /**
+ * Kept in a DLL.
+ */
struct GNUNET_NAMESTORE_ZoneIterator *next;
+
+ /**
+ * Kept in a DLL.
+ */
struct GNUNET_NAMESTORE_ZoneIterator *prev;
uint32_t op_id;
};
+
+/**
+ * Convert a type name (i.e. "AAAA") to the corresponding number.
+ *
+ * @param typename name to convert
+ * @return corresponding number, UINT32_MAX on error
+ */
+uint32_t
+GNUNET_NAMESTORE_typename_to_number (const char *typename)
+{
+ static struct {
+ const char *name;
+ uint32_t number;
+ } map[] = {
+ { "A", GNUNET_DNSPARSER_TYPE_A },
+ { "NS", GNUNET_DNSPARSER_TYPE_NS },
+ { "CNAME", GNUNET_DNSPARSER_TYPE_CNAME },
+ { "SOA", GNUNET_DNSPARSER_TYPE_SOA },
+ { "PTR", GNUNET_DNSPARSER_TYPE_PTR },
+ { "MX", GNUNET_DNSPARSER_TYPE_MX },
+ { "TXT", GNUNET_DNSPARSER_TYPE_TXT },
+ { "AAAA", GNUNET_DNSPARSER_TYPE_AAAA },
+ { "PKEY", GNUNET_GNS_TYPE_PKEY },
+ { "PSEU", GNUNET_GNS_TYPE_PSEU },
+ { NULL, UINT32_MAX }
+ };
+ unsigned int i;
+
+ i=0;
+ while ( (map[i].name != NULL) &&
+ (0 != strcasecmp (typename, map[i].name)) )
+ i++;
+ return map[i].number;
+}
+
+
/**
* Disconnect from service and then reconnect.
*
if (h->th != NULL)
{
GNUNET_CLIENT_notify_transmit_ready_cancel(h->th);
+ h->th = NULL;
}
+ if (h->client != NULL)
+ {
+ struct DisconnectContext *d_ctx = GNUNET_malloc (sizeof (struct DisconnectContext));
+ d_ctx->h = h;
+ d_ctx->drop = drop;
- struct DisconnectContext *d_ctx = GNUNET_malloc (sizeof (struct DisconnectContext));
- d_ctx->h = h;
- d_ctx->drop = drop;
-
- h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, sizeof (struct DisconnectMessage),
+ h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, sizeof (struct DisconnectMessage),
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_NO, &transmit_disconnect_to_namestore,
d_ctx);
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not send disconnect notification to namestore service, we are not connected!\n");
+ if (GNUNET_YES == drop)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NAMESTORE will not drop content\n");
+ GNUNET_SCHEDULER_add_now (&clean_up_task, h);
+ }
}