xref: /freebsd/contrib/libcbor/src/cbor/callbacks.c (revision e7437ae907c89bf85a99c5cbb7ddd194a1ff1354)
1 /*
2  * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
3  *
4  * libcbor is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7 
8 #include "callbacks.h"
9 
10 #define CBOR_DUMMY_CALLBACK \
11   {}
12 
13 void cbor_null_uint8_callback(void *_ctx, uint8_t _val) CBOR_DUMMY_CALLBACK
14 
15     void cbor_null_uint16_callback(void *_ctx,
16                                    uint16_t _val) CBOR_DUMMY_CALLBACK
17 
18     void cbor_null_uint32_callback(void *_ctx,
19                                    uint32_t _val) CBOR_DUMMY_CALLBACK
20 
21     void cbor_null_uint64_callback(void *_ctx,
22                                    uint64_t _val) CBOR_DUMMY_CALLBACK
23 
24     void cbor_null_negint8_callback(void *_ctx,
25                                     uint8_t _val) CBOR_DUMMY_CALLBACK
26 
27     void cbor_null_negint16_callback(void *_ctx,
28                                      uint16_t _val) CBOR_DUMMY_CALLBACK
29 
30     void cbor_null_negint32_callback(void *_ctx,
31                                      uint32_t _val) CBOR_DUMMY_CALLBACK
32 
33     void cbor_null_negint64_callback(void *_ctx,
34                                      uint64_t _val) CBOR_DUMMY_CALLBACK
35 
36     void cbor_null_string_callback(void *_ctx, cbor_data _val,
37                                    size_t _val2) CBOR_DUMMY_CALLBACK
38 
39     void cbor_null_string_start_callback(void *_ctx) CBOR_DUMMY_CALLBACK
40 
41     void cbor_null_byte_string_callback(void *_ctx, cbor_data _val,
42                                         size_t _val2) CBOR_DUMMY_CALLBACK
43 
44     void cbor_null_byte_string_start_callback(void *_ctx) CBOR_DUMMY_CALLBACK
45 
46     void cbor_null_array_start_callback(void *_ctx,
47                                         size_t _val) CBOR_DUMMY_CALLBACK
48 
49     void cbor_null_indef_array_start_callback(void *_ctx) CBOR_DUMMY_CALLBACK
50 
51     void cbor_null_map_start_callback(void *_ctx,
52                                       size_t _val) CBOR_DUMMY_CALLBACK
53 
54     void cbor_null_indef_map_start_callback(void *_ctx) CBOR_DUMMY_CALLBACK
55 
56     void cbor_null_tag_callback(void *_ctx, uint64_t _val) CBOR_DUMMY_CALLBACK
57 
58     void cbor_null_float2_callback(void *_ctx, float _val) CBOR_DUMMY_CALLBACK
59 
60     void cbor_null_float4_callback(void *_ctx, float _val) CBOR_DUMMY_CALLBACK
61 
62     void cbor_null_float8_callback(void *_ctx, double _val) CBOR_DUMMY_CALLBACK
63 
64     void cbor_null_null_callback(void *_ctx) CBOR_DUMMY_CALLBACK
65 
66     void cbor_null_undefined_callback(void *_ctx) CBOR_DUMMY_CALLBACK
67 
68     void cbor_null_boolean_callback(void *_ctx, bool _val) CBOR_DUMMY_CALLBACK
69 
70     void cbor_null_indef_break_callback(void *_ctx) CBOR_DUMMY_CALLBACK
71 
72     CBOR_EXPORT const struct cbor_callbacks cbor_empty_callbacks = {
73         /* Type 0 - Unsigned integers */
74         .uint8 = cbor_null_uint8_callback,
75         .uint16 = cbor_null_uint16_callback,
76         .uint32 = cbor_null_uint32_callback,
77         .uint64 = cbor_null_uint64_callback,
78 
79         /* Type 1 - Negative integers */
80         .negint8 = cbor_null_negint8_callback,
81         .negint16 = cbor_null_negint16_callback,
82         .negint32 = cbor_null_negint32_callback,
83         .negint64 = cbor_null_negint64_callback,
84 
85         /* Type 2 - Byte strings */
86         .byte_string_start = cbor_null_byte_string_start_callback,
87         .byte_string = cbor_null_byte_string_callback,
88 
89         /* Type 3 - Strings */
90         .string_start = cbor_null_string_start_callback,
91         .string = cbor_null_string_callback,
92 
93         /* Type 4 - Arrays */
94         .indef_array_start = cbor_null_indef_array_start_callback,
95         .array_start = cbor_null_array_start_callback,
96 
97         /* Type 5 - Maps */
98         .indef_map_start = cbor_null_indef_map_start_callback,
99         .map_start = cbor_null_map_start_callback,
100 
101         /* Type 6 - Tags */
102         .tag = cbor_null_tag_callback,
103 
104         /* Type 7 - Floats & misc */
105         /* Type names cannot be member names */
106         .float2 = cbor_null_float2_callback,
107         /* 2B float is not supported in standard C */
108         .float4 = cbor_null_float4_callback,
109         .float8 = cbor_null_float8_callback,
110         .undefined = cbor_null_undefined_callback,
111         .null = cbor_null_null_callback,
112         .boolean = cbor_null_boolean_callback,
113 
114         /* Shared indefinites */
115         .indef_break = cbor_null_indef_break_callback,
116 };
117