![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Avro binary format encoding/decoding with JSON conversion. More...
#include "nilorea/n_common.h"#include "nilorea/n_str.h"#include "nilorea/n_list.h"#include "nilorea/n_hash.h"#include "nilorea/n_log.h"#include <cJSON.h>
Include dependency graph for n_avro.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | AVRO_FIELD |
| Avro schema field (for records) More... | |
| struct | AVRO_READER |
| Avro read cursor for decoding. More... | |
| struct | AVRO_SCHEMA |
| Avro schema definition. More... | |
Macros | |
| #define | AVRO_MAGIC "Obj\x01" |
| Avro object container file magic bytes. | |
| #define | AVRO_MAGIC_LEN 4 |
| Avro magic length. | |
| #define | AVRO_SYNC_LEN 16 |
| Avro sync marker length. | |
Enumerations | |
| enum | AVRO_TYPE { AVRO_NULL = 0 , AVRO_BOOLEAN , AVRO_INT , AVRO_LONG , AVRO_FLOAT , AVRO_DOUBLE , AVRO_BYTES , AVRO_STRING , AVRO_RECORD , AVRO_ENUM , AVRO_ARRAY , AVRO_MAP , AVRO_UNION , AVRO_FIXED } |
| Avro schema type enumeration. More... | |
Functions | |
| cJSON * | avro_decode_container (const AVRO_SCHEMA *schema, const N_STR *avro_data) |
| Decode an Avro container format N_STR into a cJSON array of records. | |
| cJSON * | avro_decode_datum (AVRO_READER *reader, const AVRO_SCHEMA *schema) |
| Decode an Avro binary datum into cJSON according to schema. | |
| int | avro_decode_long (AVRO_READER *reader, int64_t *value) |
| Decode a zig-zag varint from reader into a 64-bit signed integer. | |
| N_STR * | avro_encode_container (const AVRO_SCHEMA *schema, const cJSON *records) |
| Encode a cJSON array of records into Avro container format N_STR. | |
| int | avro_encode_datum (N_STR **dest, const AVRO_SCHEMA *schema, const cJSON *json) |
| Encode a cJSON value as Avro binary according to schema. | |
| int | avro_encode_long (N_STR **dest, int64_t value) |
| Encode a 64-bit signed integer as zig-zag varint into N_STR. | |
| int | avro_file_to_json (const char *avro_filename, const char *schema_filename, const char *json_filename) |
| Read an Avro object container file and produce a JSON file using a schema file. | |
| int | avro_json_to_file (const char *avro_filename, const char *schema_filename, const char *json_filename) |
| Write an Avro object container file from a JSON file and schema file. | |
| N_STR * | avro_nstr_avro_to_json (const N_STR *schema_nstr, const N_STR *avro_nstr) |
| Convert Avro N_STR to JSON N_STR using schema N_STR (all in-memory) | |
| N_STR * | avro_nstr_json_to_avro (const N_STR *schema_nstr, const N_STR *json_nstr) |
| Convert JSON N_STR to Avro N_STR using schema N_STR (all in-memory) | |
| void | avro_schema_free (AVRO_SCHEMA **schema) |
| Free an Avro schema. | |
| AVRO_SCHEMA * | avro_schema_from_cjson (const cJSON *json) |
| Parse an Avro schema from a cJSON object. | |
| AVRO_SCHEMA * | avro_schema_parse (const char *json_str) |
| Parse an Avro schema from a JSON string. | |
| AVRO_SCHEMA * | avro_schema_parse_nstr (const N_STR *schema_nstr) |
| Parse schema from N_STR. | |
| char * | avro_schema_to_json (const AVRO_SCHEMA *schema) |
| Convert an Avro schema back to JSON string (caller must free) | |
Avro binary format encoding/decoding with JSON conversion.
Definition in file n_avro.h.