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));
178 if (! json_is_object (root))
181 "Error json is not array nor object!\n");
185 unpack_state = json_unpack (root,
189 if (0 != unpack_state)
192 "Error json object has a wrong format!\n");
258 const char *name_str = NULL;
260 const char *id_str = NULL;
263 char *val_str = NULL;
270 if (! json_is_object (root))
273 "Error json is not array nor object!\n");
277 unpack_state = json_unpack (root,
278 "{s:s, s?s, s:s, s:o!}",
287 if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_json) ||
291 "Error json object has a wrong format!\n");
294 if (json_is_string (val_json))
300 val_str = json_dumps (val_json, JSON_COMPACT);
314 if ((NULL == id_str) || (0 == strlen (id_str)))
315 memset (&
cred->id, 0, sizeof (
cred->id));
static int ret
Final status code.
static gnutls_certificate_credentials_t cred
The credential.
static char * data
The data to insert into the dht.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
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.
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
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_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
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.
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.
The authorization ticket.
char gns_name[63 *2+2]
The ticket.