#include "gnunet_dnsparser_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_signatures.h"
+#include "gnunet_gns_service.h"
#include "gnunet_namestore_service.h"
#include "namestore.h"
const char *emsg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s'\n",
- "RECORD_STORE_RESPONSE");
+ "Received `%s' with result %i\n",
+ "RECORD_STORE_RESPONSE",
+ ntohl (msg->op_result));
/* TODO: add actual error message from namestore to response... */
res = ntohl (msg->op_result);
if (GNUNET_SYSERR == res)
size_t name_len;
size_t rd_len;
unsigned int rd_count;
+ int found;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s'\n",
rd_count = ntohs (msg->rd_count);
msg_len = ntohs (msg->gns_header.header.size);
name_len = ntohs (msg->name_len);
- GNUNET_break (0 == ntohs (msg->reserved));
+ found = ntohs (msg->found);
exp_msg_len = sizeof (struct LabelLookupResponseMessage) + name_len + rd_len;
if (msg_len != exp_msg_len)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
+ if (GNUNET_NO == found)
+ {
+ /* label was not in namestore */
+ if (NULL != qe->proc)
+ qe->proc (qe->proc_cls,
+ &msg->private_key,
+ name,
+ 0, NULL);
+ return GNUNET_OK;
+ }
+
rd_tmp = &name[name_len];
{
struct GNUNET_GNSRECORD_Data rd[rd_count];
case GNUNET_NO:
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Namestore has no result for zone to name mapping \n");
- break;
+ if (NULL != qe->proc)
+ qe->proc (qe->proc_cls, &msg->zone, NULL, 0, NULL);
+ return GNUNET_NO;
case GNUNET_YES:
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Namestore has result for zone to name mapping \n");
* @param rd_count number of records in the 'rd' array
* @param rd array of records with data to store
* @param cont continuation to call when done
- * @param cont_cls closure for 'cont'
+ * @param cont_cls closure for @a cont
* @return handle to abort the request
*/
struct GNUNET_NAMESTORE_QueueEntry *
return qe;
}
+/**
+ * Set the desired nick name for a zone
+ *
+ * @param h handle to the namestore
+ * @param pkey private key of the zone
+ * @param nick the nick name to set
+ * @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_set_nick (struct GNUNET_NAMESTORE_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
+ const char *nick,
+ GNUNET_NAMESTORE_ContinuationWithStatus cont,
+ void *cont_cls)
+{
+ struct GNUNET_GNSRECORD_Data rd;
+
+ memset (&rd, 0, sizeof (rd));
+ rd.data = nick;
+ rd.data_size = strlen (nick) +1;
+ rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
+ rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
+ rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
+ return GNUNET_NAMESTORE_records_store(h, pkey, GNUNET_GNS_MASTERZONE_STR, 1, &rd, cont, cont_cls);
+}
+
/**
* Lookup an item in the namestore.