2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to you under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
* implied. See the License for the specific language governing
15
* permissions and limitations under the License.
22
#define CLOSE_EXTERN }
27
#include <avro/platform.h>
30
#include <avro/basics.h>
32
typedef struct avro_obj_t *avro_schema_t;
34
avro_schema_t avro_schema_string(void);
35
avro_schema_t avro_schema_bytes(void);
36
avro_schema_t avro_schema_int(void);
37
avro_schema_t avro_schema_long(void);
38
avro_schema_t avro_schema_float(void);
39
avro_schema_t avro_schema_double(void);
40
avro_schema_t avro_schema_boolean(void);
41
avro_schema_t avro_schema_null(void);
43
avro_schema_t avro_schema_record(const char *name, const char *space);
44
avro_schema_t avro_schema_record_field_get(const avro_schema_t
45
record, const char *field_name);
46
const char *avro_schema_record_field_name(const avro_schema_t schema, int index);
47
int avro_schema_record_field_get_index(const avro_schema_t schema,
48
const char *field_name);
49
avro_schema_t avro_schema_record_field_get_by_index
50
(const avro_schema_t record, int index);
51
int avro_schema_record_field_append(const avro_schema_t record,
52
const char *field_name,
53
const avro_schema_t type);
54
size_t avro_schema_record_size(const avro_schema_t record);
56
avro_schema_t avro_schema_enum(const char *name);
57
const char *avro_schema_enum_get(const avro_schema_t enump,
59
int avro_schema_enum_get_by_name(const avro_schema_t enump,
60
const char *symbol_name);
61
int avro_schema_enum_symbol_append(const avro_schema_t
62
enump, const char *symbol);
64
avro_schema_t avro_schema_fixed(const char *name, const int64_t len);
65
int64_t avro_schema_fixed_size(const avro_schema_t fixed);
67
avro_schema_t avro_schema_map(const avro_schema_t values);
68
avro_schema_t avro_schema_map_values(avro_schema_t map);
70
avro_schema_t avro_schema_array(const avro_schema_t items);
71
avro_schema_t avro_schema_array_items(avro_schema_t array);
73
avro_schema_t avro_schema_union(void);
74
size_t avro_schema_union_size(const avro_schema_t union_schema);
75
int avro_schema_union_append(const avro_schema_t
76
union_schema, const avro_schema_t schema);
77
avro_schema_t avro_schema_union_branch(avro_schema_t union_schema,
79
avro_schema_t avro_schema_union_branch_by_name
80
(avro_schema_t union_schema, int *branch_index, const char *name);
82
avro_schema_t avro_schema_link(avro_schema_t schema);
83
avro_schema_t avro_schema_link_target(avro_schema_t schema);
85
typedef struct avro_schema_error_t_ *avro_schema_error_t;
87
int avro_schema_from_json(const char *jsontext, int32_t unused1,
88
avro_schema_t *schema, avro_schema_error_t *unused2);
90
/* jsontext does not need to be NUL terminated. length must *NOT*
91
* include the NUL terminator, if one is present. */
92
int avro_schema_from_json_length(const char *jsontext, size_t length,
93
avro_schema_t *schema);
95
/* A helper macro for loading a schema from a string literal. The
96
* literal must be declared as a char[], not a char *, since we use the
97
* sizeof operator to determine its length. */
98
#define avro_schema_from_json_literal(json, schema) \
99
(avro_schema_from_json_length((json), sizeof((json))-1, (schema)))
101
int avro_schema_to_specific(avro_schema_t schema, const char *prefix);
103
avro_schema_t avro_schema_get_subschema(const avro_schema_t schema,
105
const char *avro_schema_name(const avro_schema_t schema);
106
const char *avro_schema_type_name(const avro_schema_t schema);
107
avro_schema_t avro_schema_copy(avro_schema_t schema);
108
int avro_schema_equal(avro_schema_t a, avro_schema_t b);
110
avro_schema_t avro_schema_incref(avro_schema_t schema);
111
int avro_schema_decref(avro_schema_t schema);
113
int avro_schema_match(avro_schema_t writers_schema,
114
avro_schema_t readers_schema);