45 const char *name_str = NULL;
46 const char *val_str = NULL;
48 const char *id_str = NULL;
49 const char *cred_str = NULL;
50 const char *flag_str = NULL;
58 if (! json_is_object (root))
61 "Error json is not array nor object!\n");
65 unpack_state = json_unpack (root,
66 "{s:s, s?s, s?s, s:s, s:s, s?s!}",
79 if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) ||
83 "Error json object has a wrong format!\n");
99 if ((NULL != cred_str) && (0 != strlen (cred_str)))
106 if ((NULL == id_str) || (0 == strlen (id_str)))
107 memset (&attr->
id, 0, sizeof (attr->
id));
180 if (! json_is_object (root))
183 "Error json is not array nor object!\n");
187 unpack_state = json_unpack (root,
195 if (0 != unpack_state)
198 "Error json object has a wrong format!\n");
292 const char *name_str = NULL;
294 const char *id_str = NULL;
297 char *val_str = NULL;
304 if (! json_is_object (root))
307 "Error json is not array nor object!\n");
311 unpack_state = json_unpack (root,
312 "{s:s, s?s, s:s, s:o!}",
321 if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_json) ||
325 "Error json object has a wrong format!\n");
328 if (json_is_string (val_json)) {
331 val_str = json_dumps (val_json, JSON_COMPACT);
345 if ((NULL == id_str) || (0 == strlen (id_str)))
346 memset (&cred->
id, 0, sizeof (cred->
id));
static int ret
Return value of the commandline.
static size_t data_size
Number of bytes in data.
uint32_t data
The data value.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static char * type_str
Attribute type.
functions to parse JSON objects into GNUnet objects
Identity attribute definitions.
reclaim service; implements identity and personal data sharing for GNUnet
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
int GNUNET_RECLAIM_credential_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an credential to the binary representation.
int GNUNET_RECLAIM_attribute_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an attribute to the binary representation.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_new(const char *name, uint32_t type, const void *data, size_t data_size)
Create a new credential.
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_credential(struct GNUNET_RECLAIM_Credential **cred)
JSON Specification for credential claims.
static void clean_attr(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
static int parse_credential(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a credential claim.
static int parse_attr(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a claim.
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_attribute(struct GNUNET_RECLAIM_Attribute **attr)
JSON Specification for Reclaim claims.
static void clean_credential(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_ticket(struct GNUNET_RECLAIM_Ticket **ticket)
JSON Specification for Reclaim tickets.
static int parse_ticket(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a ticket.
static void clean_ticket(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Entry in parser specification for GNUNET_JSON_parse().
void * ptr
Pointer, details specific to the parser.
void * cls
Closure for parser and cleaner.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_Identifier id
ID.
The authorization ticket.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_IDENTITY_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_IDENTITY_PublicKey identity
The ticket issuer (= the user)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model