diff options
author | Greg Hudson <ghudson@mit.edu> | 2013-02-11 21:07:54 -0500 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2013-02-13 15:53:29 -0500 |
commit | 80f53c8b2c745e75dc9d22acba63812d8533c133 (patch) | |
tree | 258cbc960e82ffacea2e634ebcef4d6a9685ff99 /src/include/k5-json.h | |
parent | 61116eb28a7520dda1e5febba95ac6ba1e70e6ac (diff) | |
download | krb5-80f53c8b2c745e75dc9d22acba63812d8533c133.tar.gz krb5-80f53c8b2c745e75dc9d22acba63812d8533c133.tar.xz krb5-80f53c8b2c745e75dc9d22acba63812d8533c133.zip |
Add k5_json_array_fmt and use it in export_cred.c
Add a template-based array constructor for convenient marshalling of
structured values as JSON array values. Use it to simplify
export_cred.c.
Diffstat (limited to 'src/include/k5-json.h')
-rw-r--r-- | src/include/k5-json.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/k5-json.h b/src/include/k5-json.h index 4b9b8fec3b..b01b8b847e 100644 --- a/src/include/k5-json.h +++ b/src/include/k5-json.h @@ -109,6 +109,9 @@ typedef struct k5_json_null_st *k5_json_null; int k5_json_null_create(k5_json_null *null_out); +/* Create a null value as a k5_json_value, for polymorphic convenience. */ +int k5_json_null_create_val(k5_json_value *val_out); + /* * Boolean */ @@ -136,6 +139,21 @@ void k5_json_array_set(k5_json_array array, size_t idx, k5_json_value val); k5_json_value k5_json_array_get(k5_json_array array, size_t idx); /* + * Create an array from a template and a variable argument list. template + * characters are: + * v: a k5_json_value argument is read, retained, and stored + * n: no argument is read; a null value is stored + * b: an int argument is read and stored as a boolean value + * i: an int argument is read and stored as a number value + * L: a long long argument is read and stored as a number value + * s: a const char * argument is read and stored as a null or string value + * B: const void * and size_t arguments are read and stored as a base64 + * string value + */ +int +k5_json_array_fmt(k5_json_array *array_out, const char *template, ...); + +/* * Object */ |