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