if (0 == rd_count)
{
/* Could not find record to remove */
- rrc->op_res = 1;
+ rrc->op_res = RECORD_REMOVE_RESULT_NO_RECORDS;
return;
}
if (GNUNET_SYSERR == found)
{
/* Could not find record to remove */
- rrc->op_res = 2;
+ rrc->op_res = RECORD_REMOVE_RESULT_RECORD_NOT_FOUND;
return;
}
name))
{
/* Could not remove records from database */
- rrc->op_res = 3;
+ rrc->op_res = RECORD_REMOVE_RESULT_FAILED_TO_SIGN; /* ??? */
return;
}
- rrc->op_res = 0;
+ rrc->op_res = RECORD_REMOVE_RESULT_SUCCESS;
return;
}
&dummy_signature))
{
/* Could not put records into database */
- rrc->op_res = 4;
+ rrc->op_res = RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE;
return;
}
- rrc->op_res = 0;
+ rrc->op_res = RECORD_REMOVE_RESULT_SUCCESS;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received new private key for zone `%s'\n",
- GNUNET_short_h2s(&pubkey_hash));
+ GNUNET_short_h2s (&pubkey_hash));
cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
cc->privkey = GNUNET_CRYPTO_rsa_decode_key (pkey_tmp, key_len);
cc->zone = pubkey_hash;
name_tmp, (GNUNET_OK == res) ? "OK" : "FAIL");
if (GNUNET_OK != res)
/* Could not remove entry from database */
- res = 4;
+ res = RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE;
else
- res = 0;
+ res = RECORD_REMOVE_RESULT_SUCCESS;
}
else
{
};
+/**
+ * Removal of the record succeeded.
+ */
+#define RECORD_REMOVE_RESULT_SUCCESS 0
+
+/**
+ * There are NO records for the given name.
+ */
+#define RECORD_REMOVE_RESULT_NO_RECORDS 1
+
+/**
+ * The specific record that was to be removed was
+ * not found.
+ */
+#define RECORD_REMOVE_RESULT_RECORD_NOT_FOUND 2
+
+/**
+ * Internal error, failed to sign the remaining records.
+ */
+#define RECORD_REMOVE_RESULT_FAILED_TO_SIGN 3
+
+/**
+ * Internal error, failed to store the updated record set
+ */
+#define RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE 4
+
/**
* Remove a record from the namestore response
*/
struct GNUNET_NAMESTORE_Header gns_header;
/**
- * result:
- * 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
+ * Result code (see RECORD_REMOVE_RESULT_*). In network byte order.
*/
int32_t op_result;
};
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;