if (GNUNET_YES == initialized)
return;
initialized = GNUNET_YES;
- GNUNET_PLUGIN_load_all ("libgnunet_plugin_attribute_", NULL,
+ GNUNET_PLUGIN_load_all ("libgnunet_plugin_identity_attribute_", NULL,
&add_plugin, NULL);
}
* @return #GNUNET_OK on success
*/
int
-GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
const char *s,
void **data,
size_t *data_size)
* @return NULL on error, otherwise human-readable representation of the claim
*/
char *
-GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
const void* data,
size_t data_size)
{
* @return the exported block API
*/
void *
-libgnunet_plugin_attribute_type_gnuid_init (void *cls)
+libgnunet_plugin_identity_attribute_gnuid_init (void *cls)
{
struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api;
* @return NULL
*/
void *
-libgnunet_plugin_attribute_type_gnuid_done (void *cls)
+libgnunet_plugin_identity_attribute_gnuid_done (void *cls)
{
struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls;
*/
static char* consume_ticket;
+/**
+ * Attribute type
+ */
+static char* type_str;
+
/**
* Ticket to revoke
*/
const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr)
{
- char *claim;
+ char *value_str;
if (NULL == identity)
{
GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
ret = 1;
return;
}
- claim = GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (attr->type,
+ value_str = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type,
attr->data,
attr->data_size);
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "%s: %s\n", attr->name, claim);
+ "%s: %s\n", attr->name, value_str);
}
static void
iter_finished (void *cls)
{
- struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr;
+ struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim;
+ char *data;
+ size_t data_size;
+ int type;
attr_iterator = NULL;
if (list)
NULL);
return;
}
- attr = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name,
- GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
- attr_value,
- strlen (attr_value) + 1);
+ if (NULL == type_str)
+ type = GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING;
+ else
+ type = GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (type_str);
+
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_IDENTITY_ATTRIBUTE_string_to_value (type,
+ attr_value,
+ (void**)&data,
+ &data_size));
+ claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name,
+ type,
+ data,
+ data_size);
idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle,
pkey,
- attr,
+ claim,
&store_attr_cont,
NULL);
NULL,
gettext_noop ("Revoke a ticket"),
&revoke_ticket),
+ GNUNET_GETOPT_option_string ('t',
+ "type",
+ NULL,
+ gettext_noop ("Type of attribute"),
+ &type_str),
GNUNET_GETOPT_OPTION_END
};
GNUNET_PROGRAM_run (argc, argv, "ct",
* @return #GNUNET_OK on success
*/
int
-GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
const char *s,
void **data,
size_t *data_size);
* @return NULL on error, otherwise human-readable representation of the claim
*/
char *
-GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
const void* data,
size_t data_size);