27#ifndef __NILOREA_AVRO__
28#define __NILOREA_AVRO__
48#define AVRO_MAGIC "Obj\x01"
50#define AVRO_MAGIC_LEN 4
52#define AVRO_SYNC_LEN 16
156int avro_json_to_file(
const char* avro_filename,
const char* schema_filename,
const char* json_filename);
159int avro_file_to_json(
const char* avro_filename,
const char* schema_filename,
const char* json_filename);
size_t nb_symbols
number of enum symbols
AVRO_SCHEMA ** union_branches
union branch schemas
char * name
name (for record, enum, fixed)
AVRO_SCHEMA * items
item schema (for array)
AVRO_SCHEMA * values
value schema (for map)
AVRO_FIELD * fields
namespace (for record, enum)
size_t pos
current position
size_t fixed_size
fixed size
AVRO_SCHEMA * schema
field schema
AVRO_TYPE type
schema type
const unsigned char * data
data buffer
size_t nb_branches
number of union branches
char ** symbols
enum symbols
size_t nb_fields
number of fields (for record)
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)
AVRO_TYPE
Avro schema type enumeration.
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.
N_STR * avro_encode_container(const AVRO_SCHEMA *schema, const cJSON *records)
Encode a cJSON array of records into Avro container format N_STR.
AVRO_SCHEMA * avro_schema_from_cjson(const cJSON *json)
Parse an Avro schema from a cJSON object.
int avro_encode_datum(N_STR **dest, const AVRO_SCHEMA *schema, const cJSON *json)
Encode a cJSON value as Avro binary according to schema.
AVRO_SCHEMA * avro_schema_parse_nstr(const N_STR *schema_nstr)
Parse schema from N_STR.
AVRO_SCHEMA * avro_schema_parse(const char *json_str)
Parse an Avro schema from a JSON string.
int avro_decode_long(AVRO_READER *reader, int64_t *value)
Decode a zig-zag varint from reader into a 64-bit signed integer.
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.
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)
char * avro_schema_to_json(const AVRO_SCHEMA *schema)
Convert an Avro schema back to JSON string (caller must free)
void avro_schema_free(AVRO_SCHEMA **schema)
Free an Avro 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_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.
Avro schema field (for records)
Avro read cursor for decoding.
A box including a string and his lenght.
Common headers and low-level functions & define.
Hash functions and table.
List structures and definitions.
N_STR and string function declaration.