summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-09-12 12:21:44 +0100
committerHugo Landau <hlandau@openssl.org>2024-02-02 11:49:34 +0000
commitb3706fd7e23c59e0f2e737ec29a5df77e585d878 (patch)
tree49d95bd4df136d880512562b57986b4f67a8d203
parent0f4f9902cceacd9739c0eceae6f1926545ad8e42 (diff)
QLOG: JSON Encoder: Rename JSON_ENC
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22037)
-rw-r--r--include/internal/json_enc.h81
-rw-r--r--ssl/quic/json_enc.c100
-rw-r--r--ssl/quic/qlog.c19
-rw-r--r--test/json_test.c42
4 files changed, 121 insertions, 121 deletions
diff --git a/include/internal/json_enc.h b/include/internal/json_enc.h
index b5ee8361e0..9c13d0622d 100644
--- a/include/internal/json_enc.h
+++ b/include/internal/json_enc.h
@@ -7,8 +7,8 @@
* https://www.openssl.org/source/license.html
*/
-#ifndef JSON_ENC_H
-# define JSON_ENC_H
+#ifndef OSSL_JSON_ENC_H
+# define OSSL_JSON_ENC_H
# include <openssl/bio.h>
@@ -26,7 +26,7 @@ struct json_write_buf {
size_t alloc, cur;
};
-typedef struct json_enc_st {
+typedef struct ossl_json_enc_st {
uint32_t flags;
/* error: 1 if an error has occurred. */
/* state: current state. */
@@ -37,7 +37,7 @@ typedef struct json_enc_st {
unsigned char stack_small[16];
struct json_write_buf wbuf;
size_t stack_end_byte, stack_bytes;
-} JSON_ENC;
+} OSSL_JSON_ENC;
/*
* ossl_json_init
@@ -45,28 +45,29 @@ typedef struct json_enc_st {
*
* Initialises a JSON encoder.
*
- * If the flag JSON_FLAG_SEQ is passed, the output is in JSON-SEQ. The caller
- * should use the encoder as though it is encoding members of a JSON array (but
- * without calling ossl_json_array_begin() or ossl_json_array_end()). Each
- * top-level JSON item (e.g. JSON object) encoded will be separated correctly as
- * per the JSON-SEQ format.
+ * If the flag OSSL_JSON_FLAG_SEQ is passed, the output is in JSON-SEQ. The
+ * caller should use the encoder as though it is encoding members of a JSON
+ * array (but without calling ossl_json_array_begin() or ossl_json_array_end()).
+ * Each top-level JSON item (e.g. JSON object) encoded will be separated
+ * correctly as per the JSON-SEQ format.
*
- * If the flag JSON_FLAG_SEQ is not passed, the output is in JSON format.
- * Generally the caller should encode only a single output item (e.g.
- * a JSON object).
+ * If the flag OSSL_JSON_FLAG_SEQ is not passed, the output is in JSON format.
+ * Generally the caller should encode only a single output item (e.g. a JSON
+ * object).
*
- * By default, JSON output is maximally compact. If JSON_FLAG_PRETTY is set,
- * JSON/JSON-SEQ output is spaced for optimal human readability.
+ * By default, JSON output is maximally compact. If OSSL_JSON_FLAG_PRETTY is
+ * set, JSON/JSON-SEQ output is spaced for optimal human readability.
*
- * If JSON_FLAG_IJSON is set, integers outside the range `[-2**53 + 1, 2**53 -
- * 1]` are automatically converted to decimal strings before serialization.
+ * If OSSL_JSON_FLAG_IJSON is set, integers outside the range `[-2**53 + 1,
+ * 2**53 - 1]` are automatically converted to decimal strings before
+ * serialization.
*/
-#define JSON_FLAG_NONE 0
-#define JSON_FLAG_SEQ (1U << 0)
-#define JSON_FLAG_PRETTY (1U << 1)
-#define JSON_FLAG_IJSON (1U << 2)
+#define OSSL_JSON_FLAG_NONE 0
+#define OSSL_JSON_FLAG_SEQ (1U << 0)
+#define OSSL_JSON_FLAG_PRETTY (1U << 1)
+#define OSSL_JSON_FLAG_IJSON (1U << 2)
-int ossl_json_init(JSON_ENC *json, BIO *bio, uint32_t flags);
+int ossl_json_init(OSSL_JSON_ENC *json, BIO *bio, uint32_t flags);
/*
* ossl_json_cleanup
@@ -74,7 +75,7 @@ int ossl_json_init(JSON_ENC *json, BIO *bio, uint32_t flags);
*
* Destroys a JSON encoder.
*/
-void ossl_json_cleanup(JSON_ENC *json);
+void ossl_json_cleanup(OSSL_JSON_ENC *json);
/*
* ossl_json_reset
@@ -92,7 +93,7 @@ void ossl_json_cleanup(JSON_ENC *json);
*
* Automatically calls ossl_json_flush().
*/
-int ossl_json_reset(JSON_ENC *json);
+int ossl_json_reset(OSSL_JSON_ENC *json);
/*
* ossl_json_flush
@@ -103,7 +104,7 @@ int ossl_json_reset(JSON_ENC *json);
* autonomously as buffers are filled, but the caller must use this function
* to guarantee all data has been flushed.
*/
-int ossl_json_flush(JSON_ENC *json);
+int ossl_json_flush(OSSL_JSON_ENC *json);
/*
* ossl_json_flush_cleanup
@@ -113,7 +114,7 @@ int ossl_json_flush(JSON_ENC *json);
* ossl_json_cleanup regardless of the result. The result of the flush call is
* returned.
*/
-int ossl_json_flush_cleanup(JSON_ENC *json);
+int ossl_json_flush_cleanup(OSSL_JSON_ENC *json);
/*
* ossl_json_set_sink
@@ -121,7 +122,7 @@ int ossl_json_flush_cleanup(JSON_ENC *json);
*
* Changes the sink used by the JSON encoder.
*/
-int ossl_json_set_sink(JSON_ENC *json, BIO *bio);
+int ossl_json_set_sink(OSSL_JSON_ENC *json, BIO *bio);
/*
* ossl_json_in_error
@@ -143,7 +144,7 @@ int ossl_json_set_sink(JSON_ENC *json, BIO *bio);
* flushing. It is expected that errors will ordinarily be either caller errors
* (programming errors) or BIO errors.
*/
-int ossl_json_in_error(JSON_ENC *json);
+int ossl_json_in_error(OSSL_JSON_ENC *json);
/*
* JSON Builder Calls
@@ -172,54 +173,54 @@ int ossl_json_in_error(JSON_ENC *json);
*/
/* Begin a new JSON object. */
-void ossl_json_object_begin(JSON_ENC *json);
+void ossl_json_object_begin(OSSL_JSON_ENC *json);
/* End a JSON obejct. Must be matched with a call to ossl_json_object_begin(). */
-void ossl_json_object_end(JSON_ENC *json);
+void ossl_json_object_end(OSSL_JSON_ENC *json);
/* Begin a new JSON array. */
-void ossl_json_array_begin(JSON_ENC *json);
+void ossl_json_array_begin(OSSL_JSON_ENC *json);
/* End a JSON array. Must be matched with a call to ossl_json_array_end(). */
-void ossl_json_array_end(JSON_ENC *json);
+void ossl_json_array_end(OSSL_JSON_ENC *json);
/*
* Encode a JSON key within an object. Pass a zero-terminated string, which can
* be freed immediately following the call to this function.
*/
-void ossl_json_key(JSON_ENC *json, const char *key);
+void ossl_json_key(OSSL_JSON_ENC *json, const char *key);
/* Encode a JSON 'null' value. */
-void ossl_json_null(JSON_ENC *json);
+void ossl_json_null(OSSL_JSON_ENC *json);
/* Encode a JSON boolean value. */
-void ossl_json_bool(JSON_ENC *json, int value);
+void ossl_json_bool(OSSL_JSON_ENC *json, int value);
/* Encode a JSON integer from a uint64_t. */
-void ossl_json_u64(JSON_ENC *json, uint64_t value);
+void ossl_json_u64(OSSL_JSON_ENC *json, uint64_t value);
/* Encode a JSON integer from an int64_t. */
-void ossl_json_i64(JSON_ENC *json, int64_t value);
+void ossl_json_i64(OSSL_JSON_ENC *json, int64_t value);
/* Encode a JSON number from a 64-bit floating point value. */
-void ossl_json_f64(JSON_ENC *json, double value);
+void ossl_json_f64(OSSL_JSON_ENC *json, double value);
/*
* Encode a JSON UTF-8 string from a zero-terminated string. The string passed
* can be freed immediately following the call to this function.
*/
-void ossl_json_str(JSON_ENC *json, const char *str);
+void ossl_json_str(OSSL_JSON_ENC *json, const char *str);
/*
* Encode a JSON UTF-8 string from a string with the given length. The string
* passed can be freed immediately following the call to this function.
*/
-void ossl_json_str_len(JSON_ENC *json, const char *str, size_t str_len);
+void ossl_json_str_len(OSSL_JSON_ENC *json, const char *str, size_t str_len);
/*
* Encode binary data as a lowercase hex string. data_len is the data length in
* bytes.
*/
-void ossl_json_str_hex(JSON_ENC *json, const void *data, size_t data_len);
+void ossl_json_str_hex(OSSL_JSON_ENC *json, const void *data, size_t data_len);
#endif
diff --git a/ssl/quic/json_enc.c b/ssl/quic/json_enc.c
index 80dfdb0265..a95244f499 100644
--- a/ssl/quic/json_enc.c
+++ b/ssl/quic/json_enc.c
@@ -105,11 +105,11 @@ static int wbuf_flush(struct json_write_buf *wbuf)
}
/*
- * JSON_ENC: Stack Management
- * ==========================
+ * OSSL_JSON_ENC: Stack Management
+ * ===============================
*/
-static int json_ensure_stack_size(JSON_ENC *json, size_t num_bytes)
+static int json_ensure_stack_size(OSSL_JSON_ENC *json, size_t num_bytes)
{
unsigned char *stack;
@@ -133,7 +133,7 @@ static int json_ensure_stack_size(JSON_ENC *json, size_t num_bytes)
}
/* Push one bit onto the stack. Returns 0 on allocation failure. */
-static int json_push(JSON_ENC *json, unsigned int v)
+static int json_push(OSSL_JSON_ENC *json, unsigned int v)
{
if (v > 1)
return 0;
@@ -166,7 +166,7 @@ static int json_push(JSON_ENC *json, unsigned int v)
* Pop a bit from the stack. Returns 0 if stack is empty. Use json_peek() to get
* the value before calling this.
*/
-static int json_pop(JSON_ENC *json)
+static int json_pop(OSSL_JSON_ENC *json)
{
if (json->stack_end_byte == 0 && json->stack_end_bit == 0)
return 0;
@@ -184,7 +184,7 @@ static int json_pop(JSON_ENC *json)
/*
* Returns the bit on the top of the stack, or -1 if the stack is empty.
*/
-static int json_peek(JSON_ENC *json)
+static int json_peek(OSSL_JSON_ENC *json)
{
size_t obyte, obit;
@@ -204,8 +204,8 @@ static int json_peek(JSON_ENC *json)
}
/*
- * JSON_ENC: Initialisation
- * ========================
+ * OSSL_JSON_ENC: Initialisation
+ * =============================
*/
enum {
@@ -214,22 +214,22 @@ enum {
STATE_PRE_COMMA
};
-static ossl_inline int in_ijson(const JSON_ENC *json)
+static ossl_inline int in_ijson(const OSSL_JSON_ENC *json)
{
- return (json->flags & JSON_FLAG_IJSON) != 0;
+ return (json->flags & OSSL_JSON_FLAG_IJSON) != 0;
}
-static ossl_inline int in_seq(const JSON_ENC *json)
+static ossl_inline int in_seq(const OSSL_JSON_ENC *json)
{
- return (json->flags & JSON_FLAG_SEQ) != 0;
+ return (json->flags & OSSL_JSON_FLAG_SEQ) != 0;
}
-static ossl_inline int in_pretty(const JSON_ENC *json)
+static ossl_inline int in_pretty(const OSSL_JSON_ENC *json)
{
- return (json->flags & JSON_FLAG_PRETTY) != 0;
+ return (json->flags & OSSL_JSON_FLAG_PRETTY) != 0;
}
-int ossl_json_init(JSON_ENC *json, BIO *bio, uint32_t flags)
+int ossl_json_init(OSSL_JSON_ENC *json, BIO *bio, uint32_t flags)
{
memset(json, 0, sizeof(*json));
json->flags = flags;
@@ -241,7 +241,7 @@ int ossl_json_init(JSON_ENC *json, BIO *bio, uint32_t flags)
return ossl_json_reset(json);
}
-void ossl_json_cleanup(JSON_ENC *json)
+void ossl_json_cleanup(OSSL_JSON_ENC *json)
{
wbuf_cleanup(&json->wbuf);
@@ -251,7 +251,7 @@ void ossl_json_cleanup(JSON_ENC *json)
json->stack = NULL;
}
-int ossl_json_flush_cleanup(JSON_ENC *json)
+int ossl_json_flush_cleanup(OSSL_JSON_ENC *json)
{
int ok = ossl_json_flush(json);
@@ -259,7 +259,7 @@ int ossl_json_flush_cleanup(JSON_ENC *json)
return ok;
}
-int ossl_json_reset(JSON_ENC *json)
+int ossl_json_reset(OSSL_JSON_ENC *json)
{
wbuf_clean(&json->wbuf);
json->stack_end_byte = 0;
@@ -268,18 +268,18 @@ int ossl_json_reset(JSON_ENC *json)
return 1;
}
-int ossl_json_flush(JSON_ENC *json)
+int ossl_json_flush(OSSL_JSON_ENC *json)
{
return wbuf_flush(&json->wbuf);
}
-int ossl_json_set_sink(JSON_ENC *json, BIO *bio)
+int ossl_json_set_sink(OSSL_JSON_ENC *json, BIO *bio)
{
wbuf_set_bio(&json->wbuf, bio);
return 1;
}
-int ossl_json_in_error(JSON_ENC *json)
+int ossl_json_in_error(OSSL_JSON_ENC *json)
{
return json->error;
}
@@ -289,20 +289,20 @@ int ossl_json_in_error(JSON_ENC *json)
* ==================
*/
-static void json_write_qstring(JSON_ENC *json, const char *str);
-static void json_indent(JSON_ENC *json);
+static void json_write_qstring(OSSL_JSON_ENC *json, const char *str);
+static void json_indent(OSSL_JSON_ENC *json);
-static ossl_inline int json_in_error(const JSON_ENC *json)
+static ossl_inline int json_in_error(const OSSL_JSON_ENC *json)
{
return json->error;
}
-static void json_raise_error(JSON_ENC *json)
+static void json_raise_error(OSSL_JSON_ENC *json)
{
json->error = 1;
}
-static void json_undefer(JSON_ENC *json)
+static void json_undefer(OSSL_JSON_ENC *json)
{
if (!json->defer_indent)
return;
@@ -310,7 +310,7 @@ static void json_undefer(JSON_ENC *json)
json_indent(json);
}
-static void json_write_char(JSON_ENC *json, char ch)
+static void json_write_char(OSSL_JSON_ENC *json, char ch)
{
if (json_in_error(json))
return;
@@ -320,7 +320,7 @@ static void json_write_char(JSON_ENC *json, char ch)
json_raise_error(json);
}
-static void json_write_str(JSON_ENC *json, const char *s)
+static void json_write_str(OSSL_JSON_ENC *json, const char *s)
{
if (json_in_error(json))
return;
@@ -330,7 +330,7 @@ static void json_write_str(JSON_ENC *json, const char *s)
json_raise_error(json);
}
-static void json_indent(JSON_ENC *json)
+static void json_indent(OSSL_JSON_ENC *json)
{
size_t i, depth;
@@ -346,7 +346,7 @@ static void json_indent(JSON_ENC *json)
json_write_str(json, " ");
}
-static int json_pre_item(JSON_ENC *json)
+static int json_pre_item(OSSL_JSON_ENC *json)
{
int s;
@@ -388,7 +388,7 @@ static int json_pre_item(JSON_ENC *json)
return 1;
}
-static void json_post_item(JSON_ENC *json)
+static void json_post_item(OSSL_JSON_ENC *json)
{
int s = json_peek(json);
@@ -403,7 +403,7 @@ static void json_post_item(JSON_ENC *json)
*
* type: 0=object, 1=array.
*/
-static void composite_begin(JSON_ENC *json, int type, char ch)
+static void composite_begin(OSSL_JSON_ENC *json, int type, char ch)
{
if (!json_pre_item(json)
|| !json_push(json, type))
@@ -418,7 +418,7 @@ static void composite_begin(JSON_ENC *json, int type, char ch)
*
* type: 0=object, 1=array. Errors on mismatch.
*/
-static void composite_end(JSON_ENC *json, int type, char ch)
+static void composite_end(OSSL_JSON_ENC *json, int type, char ch)
{
int was_defer = json->defer_indent;
@@ -446,27 +446,27 @@ static void composite_end(JSON_ENC *json, int type, char ch)
}
/* Begin a new JSON object. */
-void ossl_json_object_begin(JSON_ENC *json)
+void ossl_json_object_begin(OSSL_JSON_ENC *json)
{
composite_begin(json, 0, '{');
json->state = STATE_PRE_KEY;
}
/* End a JSON obejct. Must be matched with a call to ossl_json_object_begin(). */
-void ossl_json_object_end(JSON_ENC *json)
+void ossl_json_object_end(OSSL_JSON_ENC *json)
{
composite_end(json, 0, '}');
}
/* Begin a new JSON array. */
-void ossl_json_array_begin(JSON_ENC *json)
+void ossl_json_array_begin(OSSL_JSON_ENC *json)
{
composite_begin(json, 1, '[');
json->state = STATE_PRE_ITEM;
}
/* End a JSON array. Must be matched with a call to ossl_json_array_end(). */
-void ossl_json_array_end(JSON_ENC *json)
+void ossl_json_array_end(OSSL_JSON_ENC *json)
{
composite_end(json, 1, ']');
}
@@ -475,7 +475,7 @@ void ossl_json_array_end(JSON_ENC *json)
* Encode a JSON key within an object. Pass a zero-terminated string, which can
* be freed immediately following the call to this function.
*/
-void ossl_json_key(JSON_ENC *json, const char *key)
+void ossl_json_key(OSSL_JSON_ENC *json, const char *key)
{
if (json_in_error(json))
return;
@@ -509,7 +509,7 @@ void ossl_json_key(JSON_ENC *json, const char *key)
}
/* Encode a JSON 'null' value. */
-void ossl_json_null(JSON_ENC *json)
+void ossl_json_null(OSSL_JSON_ENC *json)
{
if (!json_pre_item(json))
return;
@@ -518,7 +518,7 @@ void ossl_json_null(JSON_ENC *json)
json_post_item(json);
}
-void ossl_json_bool(JSON_ENC *json, int v)
+void ossl_json_bool(OSSL_JSON_ENC *json, int v)
{
if (!json_pre_item(json))
return;
@@ -530,7 +530,7 @@ void ossl_json_bool(JSON_ENC *json, int v)
#define POW_53 (((int64_t)1) << 53)
/* Encode a JSON integer from a uint64_t. */
-static void json_u64(JSON_ENC *json, uint64_t v, int noquote)
+static void json_u64(OSSL_JSON_ENC *json, uint64_t v, int noquote)
{
char buf[22], *p = buf + sizeof(buf) - 1;
int quote = !noquote && in_ijson(json) && v > (uint64_t)(POW_53 - 1);
@@ -555,13 +555,13 @@ static void json_u64(JSON_ENC *json, uint64_t v, int noquote)
json_post_item(json);
}
-void ossl_json_u64(JSON_ENC *json, uint64_t v)
+void ossl_json_u64(OSSL_JSON_ENC *json, uint64_t v)
{
json_u64(json, v, 0);
}
/* Encode a JSON integer from an int64_t. */
-void ossl_json_i64(JSON_ENC *json, int64_t value)
+void ossl_json_i64(OSSL_JSON_ENC *json, int64_t value)
{
uint64_t uv;
int quote;
@@ -592,7 +592,7 @@ void ossl_json_i64(JSON_ENC *json, int64_t value)
}
/* Encode a JSON number from a 64-bit floating point value. */
-void ossl_json_f64(JSON_ENC *json, double value)
+void ossl_json_f64(OSSL_JSON_ENC *json, double value)
{
char buf[32];
@@ -619,7 +619,7 @@ static ossl_inline int hex_digit(int v)
}
static ossl_inline void
-json_write_qstring_inner(JSON_ENC *json, const char *str, size_t str_len,
+json_write_qstring_inner(OSSL_JSON_ENC *json, const char *str, size_t str_len,
int nul_term)
{
char c, *o, obuf[7];
@@ -668,18 +668,18 @@ json_write_qstring_inner(JSON_ENC *json, const char *str, size_t str_len,
}
static void
-json_write_qstring(JSON_ENC *json, const char *str)
+json_write_qstring(OSSL_JSON_ENC *json, const char *str)
{
json_write_qstring_inner(json, str, 0, 1);
}
static void
-json_write_qstring_len(JSON_ENC *json, const char *str, size_t str_len)
+json_write_qstring_len(OSSL_JSON_ENC *json, const char *str, size_t str_len)
{
json_write_qstring_inner(json, str, str_len, 0);
}
-void ossl_json_str(JSON_ENC *json, const char *str)
+void ossl_json_str(OSSL_JSON_ENC *json, const char *str)
{
if (!json_pre_item(json))
return;
@@ -688,7 +688,7 @@ void ossl_json_str(JSON_ENC *json, const char *str)
json_post_item(json);
}
-void ossl_json_str_len(JSON_ENC *json, const char *str, size_t str_len)
+void ossl_json_str_len(OSSL_JSON_ENC *json, const char *str, size_t str_len)
{
if (!json_pre_item(json))
return;
@@ -701,7 +701,7 @@ void ossl_json_str_len(JSON_ENC *json, const char *str, size_t str_len)
* Encode binary data as a lowercase hex string. data_len is the data length in
* bytes.
*/
-void ossl_json_str_hex(JSON_ENC *json, const void *data, size_t data_len)
+void ossl_json_str_hex(OSSL_JSON_ENC *json, const void *data, size_t data_len)
{
const unsigned char *b = data, *end = b + data_len;
unsigned char c;
diff --git a/ssl/quic/qlog.c b/ssl/quic/qlog.c
index 33ed4e0986..7815f2af39 100644
--- a/ssl/quic/qlog.c
+++ b/ssl/quic/qlog.c
@@ -30,18 +30,16 @@ static ossl_unused ossl_inline void bit_set(size_t *p, uint32_t bit_no, int enab
p[bit_no / BITS_PER_WORD] &= mask;
}
-/* TODO abort */
-
struct qlog_st {
QLOG_TRACE_INFO info;
- BIO *bio;
- size_t enabled[NUM_ENABLED_W];
- uint32_t event_type;
- const char *event_cat, *event_name, *event_combined_name;
- OSSL_TIME event_time, prev_event_time;
- JSON_ENC json;
- int header_done, first_event_done;
+ BIO *bio;
+ size_t enabled[NUM_ENABLED_W];
+ uint32_t event_type;
+ const char *event_cat, *event_name, *event_combined_name;
+ OSSL_TIME event_time, prev_event_time;
+ OSSL_JSON_ENC json;
+ int header_done, first_event_done;
};
static OSSL_TIME default_now(void *arg)
@@ -78,7 +76,8 @@ QLOG *ossl_qlog_new(const QLOG_TRACE_INFO *info)
&& (qlog->info.group_id = OPENSSL_strdup(info->group_id)) == NULL)
goto err;
- if (!ossl_json_init(&qlog->json, NULL, JSON_FLAG_IJSON | JSON_FLAG_SEQ))
+ if (!ossl_json_init(&qlog->json, NULL,
+ OSSL_JSON_FLAG_IJSON | OSSL_JSON_FLAG_SEQ))
goto err;
if (qlog->info.now_cb == NULL)
diff --git a/test/json_test.c b/test/json_test.c
index aba1094759..97ab9aa646 100644
--- a/test/json_test.c
+++ b/test/json_test.c
@@ -14,10 +14,10 @@
#include "internal/json_enc.h"
struct helper {
- JSON_ENC j;
- int init;
- uint32_t flags;
- BIO *mem_bio;
+ OSSL_JSON_ENC j;
+ int init;
+ uint32_t flags;
+ BIO *mem_bio;
};
static int helper_ensure(struct helper *h)
@@ -81,24 +81,24 @@ typedef const struct script_info *(*info_func)(void);
enum {
OPK_END,
- OPK_CALL, /* (JSON_ENC *) */
- OPK_CALL_P, /* (JSON_ENC *, const void *) */
- OPK_CALL_I, /* (JSON_ENC *, int) */
- OPK_CALL_U64, /* (JSON_ENC *, uint64_t) */
- OPK_CALL_I64, /* (JSON_ENC *, int64_t) */
- OPK_CALL_D, /* (JSON_ENC *, double) */
- OPK_CALL_PZ, /* (JSON_ENC *, const void *, size_t) */
- OPK_ASSERT_ERROR, /* (JSON_ENC *, int expect_error) */
+ OPK_CALL, /* (OSSL_JSON_ENC *) */
+ OPK_CALL_P, /* (OSSL_JSON_ENC *, const void *) */
+ OPK_CALL_I, /* (OSSL_JSON_ENC *, int) */
+ OPK_CALL_U64, /* (OSSL_JSON_ENC *, uint64_t) */
+ OPK_CALL_I64, /* (OSSL_JSON_ENC *, int64_t) */
+ OPK_CALL_D, /* (OSSL_JSON_ENC *, double) */
+ OPK_CALL_PZ, /* (OSSL_JSON_ENC *, const void *, size_t) */
+ OPK_ASSERT_ERROR, /* (OSSL_JSON_ENC *, int expect_error) */
OPK_INIT_FLAGS, /* (uint32_t flags) */
};
-typedef void (*fp_type)(JSON_ENC *);
-typedef void (*fp_p_type)(JSON_ENC *, const void *);
-typedef void (*fp_i_type)(JSON_ENC *, int);
-typedef void (*fp_u64_type)(JSON_ENC *, uint64_t);
-typedef void (*fp_i64_type)(JSON_ENC *, int64_t);
-typedef void (*fp_d_type)(JSON_ENC *, double);
-typedef void (*fp_pz_type)(JSON_ENC *, const void *, size_t);
+typedef void (*fp_type)(OSSL_JSON_ENC *);
+typedef void (*fp_p_type)(OSSL_JSON_ENC *, const void *);
+typedef void (*fp_i_type)(OSSL_JSON_ENC *, int);
+typedef void (*fp_u64_type)(OSSL_JSON_ENC *, uint64_t);
+typedef void (*fp_i64_type)(OSSL_JSON_ENC *, int64_t);
+typedef void (*fp_d_type)(OSSL_JSON_ENC *, double);
+typedef void (*fp_pz_type)(OSSL_JSON_ENC *, const void *, size_t);
#define OP_END() OP_U64(OPK_END)
#define OP_CALL(f) OP_U64(OPK_CALL) OP_FP(f)
@@ -430,7 +430,7 @@ BEGIN_SCRIPT(err_utf8, "error test: only basic ASCII supported", 0)
OP_ASSERT_ERROR(1)
END_SCRIPT_EXPECTING_S("\"")
-BEGIN_SCRIPT(ijson_int, "I-JSON: large integer", JSON_FLAG_IJSON)
+BEGIN_SCRIPT(ijson_int, "I-JSON: large integer", OSSL_JSON_FLAG_IJSON)
OPJ_BEGIN_A()
OPJ_U64(1)
OPJ_I64(-1)
@@ -450,7 +450,7 @@ BEGIN_SCRIPT(multi_item, "multiple top level items", 0)
OPJ_END_A()
END_SCRIPT_EXPECTING_S("nullnull[][]")
-BEGIN_SCRIPT(seq, "JSON-SEQ", JSON_FLAG_SEQ)
+BEGIN_SCRIPT(seq, "JSON-SEQ", OSSL_JSON_FLAG_SEQ)
OPJ_NULL()
OPJ_NULL()
OPJ_NULL()