#include "namestore.h"
-#define LOG(kind,...) GNUNET_log_from (kind, "gns-api",__VA_ARGS__)
-
-/**
- * Maximum length of any name, including 0-termination.
- */
-#define MAX_NAME_LEN 256
+#define LOG(kind,...) GNUNET_log_from (kind, "namestore-api",__VA_ARGS__)
/**
const struct RecordRemoveResponseMessage* msg,
size_t size)
{
- int res;
int ret;
const char *emsg;
/* Operation done, remove */
LOG (GNUNET_ERROR_TYPE_DEBUG, "Received `%s'\n",
"RECORD_REMOVE_RESPONSE");
- /*
- * results:
- * 0 : successful
- * 1 : No records for entry
- * 2 : Could not find record to remove
- * 3 : Failed to create new signature
- * 4 : Failed to put new set of records in database
- */
- res = ntohl (msg->op_result);
- switch (res)
+ switch (ntohl (msg->op_result))
{
- case 0:
+ case RECORD_REMOVE_RESULT_SUCCESS:
ret = GNUNET_OK;
emsg = NULL;
break;
- case 1:
+ case RECORD_REMOVE_RESULT_NO_RECORDS:
ret = GNUNET_NO;
emsg = NULL;
break;
- case 2:
+ case RECORD_REMOVE_RESULT_RECORD_NOT_FOUND:
ret = GNUNET_NO;
emsg = NULL;
break;
- case 3:
+ case RECORD_REMOVE_RESULT_FAILED_TO_SIGN:
ret = GNUNET_SYSERR;
emsg = _("Failed to create new signature");
break;
- case 4:
+ case RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE:
ret = GNUNET_SYSERR;
emsg = _("Failed to put new set of records in database");
break;
+ case RECORD_REMOVE_RESULT_FAILED_TO_REMOVE:
+ ret = GNUNET_SYSERR;
+ emsg = _("Failed to remove records from database");
+ break;
+ case RECORD_REMOVE_RESULT_FAILED_ACCESS_DATABASE:
+ ret = GNUNET_SYSERR;
+ emsg = _("Failed to access database");
+ break;
+ case RECORD_REMOVE_RESULT_FAILED_INTERNAL_ERROR:
+ ret = GNUNET_SYSERR;
+ emsg = _("unknown internal error in namestore");
+ break;
default:
GNUNET_break (0);
- ret = GNUNET_SYSERR;
- emsg = _("Protocol error");
if (NULL != qe->cont)
qe->cont (qe->cont_cls, GNUNET_SYSERR, _("Protocol error"));
return GNUNET_NO;
{
size_t rd_ser_len;
size_t name_len;
- char * name_tmp;
- char * rd_ser;
+ char *name_tmp;
+ char *rd_ser;
struct GNUNET_CRYPTO_RsaSignaturePurpose *sig_purpose;
struct GNUNET_TIME_AbsoluteNBO *expire_tmp;
struct GNUNET_TIME_AbsoluteNBO expire_nbo = GNUNET_TIME_absolute_hton (freshness);
rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
sig_len = sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + rd_ser_len + name_len;
{
- char sig_buf[rd_ser_len] GNUNET_ALIGN;
+ char sig_buf[sig_len] GNUNET_ALIGN;
sig_purpose = (struct GNUNET_CRYPTO_RsaSignaturePurpose *) sig_buf;
sig_purpose->size = htonl (sig_len);