snowflake-connector-python 5.2.0__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. snowflake/connector/__init__.py +148 -0
  2. snowflake/connector/_common/__init__.py +0 -0
  3. snowflake/connector/_common/extras.py +134 -0
  4. snowflake/connector/_common/telemetry.py +221 -0
  5. snowflake/connector/_common/wif_util.py +92 -0
  6. snowflake/connector/_core/sf_core_python.cp315-win_amd64.pyd +0 -0
  7. snowflake/connector/_core/sf_core_python.pyi +79 -0
  8. snowflake/connector/_internal/__init__.py +6 -0
  9. snowflake/connector/_internal/_private_key_helper.py +31 -0
  10. snowflake/connector/_internal/api_client/__init__.py +93 -0
  11. snowflake/connector/_internal/api_client/bridge.py +41 -0
  12. snowflake/connector/_internal/api_client/client_api.py +976 -0
  13. snowflake/connector/_internal/arrow.py +47 -0
  14. snowflake/connector/_internal/arrow_context.py +240 -0
  15. snowflake/connector/_internal/arrow_stream_async.py +266 -0
  16. snowflake/connector/_internal/arrow_stream_iterator.cp311-win_amd64.pyd +0 -0
  17. snowflake/connector/_internal/arrow_stream_iterator.cp312-win_amd64.pyd +0 -0
  18. snowflake/connector/_internal/arrow_stream_iterator.cp313-win_amd64.pyd +0 -0
  19. snowflake/connector/_internal/arrow_stream_iterator.cp314-win_amd64.pyd +0 -0
  20. snowflake/connector/_internal/arrow_stream_iterator.cp314t-win_amd64.pyd +0 -0
  21. snowflake/connector/_internal/arrow_stream_iterator.cp315-win_amd64.pyd +0 -0
  22. snowflake/connector/_internal/arrow_stream_iterator.pyi +42 -0
  23. snowflake/connector/_internal/arrow_stream_utils.py +171 -0
  24. snowflake/connector/_internal/authenticator_type.py +53 -0
  25. snowflake/connector/_internal/backward_compatibility.py +245 -0
  26. snowflake/connector/_internal/binding_converters.py +741 -0
  27. snowflake/connector/_internal/config_utils.py +71 -0
  28. snowflake/connector/_internal/connection/__init__.py +39 -0
  29. snowflake/connector/_internal/connection/connection.py +616 -0
  30. snowflake/connector/_internal/connection/connection_types.py +13 -0
  31. snowflake/connector/_internal/connection/constants.py +25 -0
  32. snowflake/connector/_internal/connection/decorators.py +31 -0
  33. snowflake/connector/_internal/connection/freezable_proxy.py +104 -0
  34. snowflake/connector/_internal/connection/queries.py +10 -0
  35. snowflake/connector/_internal/connection_config_mixin.py +755 -0
  36. snowflake/connector/_internal/cursor/__init__.py +25 -0
  37. snowflake/connector/_internal/cursor/base.py +732 -0
  38. snowflake/connector/_internal/cursor/cursor_types.py +13 -0
  39. snowflake/connector/_internal/cursor/decorators.py +56 -0
  40. snowflake/connector/_internal/cursor/query_result.py +202 -0
  41. snowflake/connector/_internal/cursor/query_result_waiter.py +98 -0
  42. snowflake/connector/_internal/cursor/result_metadata.py +255 -0
  43. snowflake/connector/_internal/cursor/result_set_wrapper.py +66 -0
  44. snowflake/connector/_internal/decorators.py +539 -0
  45. snowflake/connector/_internal/error_kinds.py +111 -0
  46. snowflake/connector/_internal/errorcode.py +35 -0
  47. snowflake/connector/_internal/errorhandler.py +278 -0
  48. snowflake/connector/_internal/fips.py +28 -0
  49. snowflake/connector/_internal/logging/__init__.py +52 -0
  50. snowflake/connector/_internal/logging/config.py +134 -0
  51. snowflake/connector/_internal/logging/core_logger.py +218 -0
  52. snowflake/connector/_internal/logging/native_extension_logger.py +144 -0
  53. snowflake/connector/_internal/logout_config_mapping.py +187 -0
  54. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ArrayConverter.cpp +57 -0
  55. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ArrayConverter.hpp +29 -0
  56. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ArrowTableConverter.cpp +943 -0
  57. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ArrowTableConverter.hpp +63 -0
  58. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/BinaryConverter.cpp +18 -0
  59. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/BinaryConverter.hpp +26 -0
  60. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/BooleanConverter.cpp +21 -0
  61. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/BooleanConverter.hpp +23 -0
  62. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowIterator.cpp +118 -0
  63. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowIterator.hpp +116 -0
  64. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowStreamIterator.cpp +323 -0
  65. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowStreamIterator.hpp +133 -0
  66. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowStreamTableIterator.cpp +275 -0
  67. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/CArrowStreamTableIterator.hpp +168 -0
  68. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ConverterUtil.cpp +439 -0
  69. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ConverterUtil.hpp +30 -0
  70. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DateConverter.cpp +48 -0
  71. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DateConverter.hpp +46 -0
  72. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DecFloatConverter.cpp +76 -0
  73. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DecFloatConverter.hpp +35 -0
  74. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DecimalConverter.cpp +90 -0
  75. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/DecimalConverter.hpp +63 -0
  76. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.cpp +62 -0
  77. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.hpp +28 -0
  78. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/FloatConverter.cpp +29 -0
  79. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/FloatConverter.hpp +35 -0
  80. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/IColumnConverter.hpp +17 -0
  81. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/IntConverter.cpp +23 -0
  82. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/IntConverter.hpp +41 -0
  83. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/IntervalConverter.cpp +65 -0
  84. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/IntervalConverter.hpp +54 -0
  85. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/LICENSE.txt +209 -0
  86. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/MapConverter.cpp +79 -0
  87. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/MapConverter.hpp +30 -0
  88. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ObjectConverter.cpp +52 -0
  89. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/ObjectConverter.hpp +29 -0
  90. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Python/Common.cpp +8 -0
  91. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Python/Common.hpp +117 -0
  92. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Python/Helpers.cpp +54 -0
  93. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Python/Helpers.hpp +34 -0
  94. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/SnowflakeType.cpp +33 -0
  95. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/SnowflakeType.hpp +48 -0
  96. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/StringConverter.cpp +18 -0
  97. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/StringConverter.hpp +26 -0
  98. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/TimeConverter.cpp +39 -0
  99. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/TimeConverter.hpp +31 -0
  100. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/TimeStampConverter.cpp +326 -0
  101. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/TimeStampConverter.hpp +138 -0
  102. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Util/macros.hpp +14 -0
  103. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Util/time.cpp +65 -0
  104. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/Util/time.hpp +68 -0
  105. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/arrow_stream_iterator.cpp +13278 -0
  106. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/arrow_stream_iterator.pyx +204 -0
  107. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_accessors.h +109 -0
  108. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_alloc.h +125 -0
  109. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_assert.h +45 -0
  110. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_builder.h +1914 -0
  111. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_emitter.h +208 -0
  112. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_endian.h +128 -0
  113. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_epilogue.h +7 -0
  114. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_flatbuffers.h +58 -0
  115. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_identifier.h +144 -0
  116. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_iov.h +31 -0
  117. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_prologue.h +8 -0
  118. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_refmap.h +144 -0
  119. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_rtconfig.h +160 -0
  120. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_types.h +98 -0
  121. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_verifier.h +243 -0
  122. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/flatcc_portable.h +14 -0
  123. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/paligned_alloc.h +207 -0
  124. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pattributes.h +80 -0
  125. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic.h +83 -0
  126. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_pop.h +20 -0
  127. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_push.h +51 -0
  128. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian.h +201 -0
  129. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian_detect.h +108 -0
  130. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinline.h +19 -0
  131. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinttypes.h +52 -0
  132. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable.h +2 -0
  133. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable_basic.h +25 -0
  134. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstatic_assert.h +67 -0
  135. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdalign.h +164 -0
  136. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdint.h +926 -0
  137. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/punaligned.h +182 -0
  138. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pversion.h +6 -0
  139. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc/portable/pwarnings.h +52 -0
  140. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/flatcc.c +3052 -0
  141. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/nanoarrow.c +3019 -0
  142. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/nanoarrow.h +3354 -0
  143. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/nanoarrow.hpp +344 -0
  144. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.c +29305 -0
  145. snowflake/connector/_internal/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.h +381 -0
  146. snowflake/connector/_internal/nanoarrow_cpp/Logging/logging.cpp +108 -0
  147. snowflake/connector/_internal/nanoarrow_cpp/Logging/logging.hpp +47 -0
  148. snowflake/connector/_internal/nanoarrow_cpp/scripts/.clang-format +8 -0
  149. snowflake/connector/_internal/nanoarrow_cpp/scripts/format.sh +8 -0
  150. snowflake/connector/_internal/protobuf_gen/__init__.py +0 -0
  151. snowflake/connector/_internal/protobuf_gen/database_driver_v1_pb2.py +408 -0
  152. snowflake/connector/_internal/protobuf_gen/database_driver_v1_pb2.pyi +4487 -0
  153. snowflake/connector/_internal/protobuf_gen/database_driver_v1_services.py +2088 -0
  154. snowflake/connector/_internal/protobuf_gen/proto_exception.py +17 -0
  155. snowflake/connector/_internal/result_batch.py +150 -0
  156. snowflake/connector/_internal/snowflake_restful.py +222 -0
  157. snowflake/connector/_internal/snowpark_backcompat_helpers.py +31 -0
  158. snowflake/connector/_internal/sqlstate.py +11 -0
  159. snowflake/connector/_internal/statement_utils.py +207 -0
  160. snowflake/connector/_internal/text_utils.py +112 -0
  161. snowflake/connector/_internal/type_codes.py +139 -0
  162. snowflake/connector/_internal/utils.py +65 -0
  163. snowflake/connector/_internal/write_pandas_operation.py +657 -0
  164. snowflake/connector/aio/README.md +168 -0
  165. snowflake/connector/aio/__init__.py +37 -0
  166. snowflake/connector/aio/connection/__init__.py +17 -0
  167. snowflake/connector/aio/connection/_connection.py +506 -0
  168. snowflake/connector/aio/cursor/__init__.py +35 -0
  169. snowflake/connector/aio/cursor/_base.py +1034 -0
  170. snowflake/connector/aio/cursor/_dict_cursor.py +78 -0
  171. snowflake/connector/aio/cursor/_result_set_wrapper.py +35 -0
  172. snowflake/connector/aio/cursor/_snowflake_cursor.py +72 -0
  173. snowflake/connector/aio/pandas_tools.py +279 -0
  174. snowflake/connector/aio/result_batch.py +165 -0
  175. snowflake/connector/auth/__init__.py +0 -0
  176. snowflake/connector/auth/workload_identity.py +5 -0
  177. snowflake/connector/compat.py +22 -0
  178. snowflake/connector/config_manager.py +392 -0
  179. snowflake/connector/connection/__init__.py +30 -0
  180. snowflake/connector/connection/_connection.py +641 -0
  181. snowflake/connector/connection_config.py +517 -0
  182. snowflake/connector/constants.py +52 -0
  183. snowflake/connector/cursor/__init__.py +37 -0
  184. snowflake/connector/cursor/_base.py +1169 -0
  185. snowflake/connector/cursor/_chunked_download_reader.py +75 -0
  186. snowflake/connector/cursor/_dict_cursor.py +78 -0
  187. snowflake/connector/cursor/_result_set_wrapper.py +35 -0
  188. snowflake/connector/cursor/_snowflake_cursor.py +72 -0
  189. snowflake/connector/description.py +7 -0
  190. snowflake/connector/errors.py +492 -0
  191. snowflake/connector/network.py +71 -0
  192. snowflake/connector/pandas_tools.py +191 -0
  193. snowflake/connector/py.typed +0 -0
  194. snowflake/connector/result_batch.py +216 -0
  195. snowflake/connector/telemetry.py +40 -0
  196. snowflake/connector/time_util.py +11 -0
  197. snowflake/connector/types.py +134 -0
  198. snowflake/connector/util_text.py +3 -0
  199. snowflake/connector/version.py +23 -0
  200. snowflake_connector_python-5.2.0.dist-info/DELVEWHEEL +2 -0
  201. snowflake_connector_python-5.2.0.dist-info/METADATA +190 -0
  202. snowflake_connector_python-5.2.0.dist-info/RECORD +204 -0
  203. snowflake_connector_python-5.2.0.dist-info/WHEEL +4 -0
  204. snowflake_connector_python.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
@@ -0,0 +1,144 @@
1
+ /*
2
+ * The flatcc builder supports storing a pointer to a refmap
3
+ * and wraps some operations to make them work as a dummy
4
+ * even if no refmap has been set. This enables optional
5
+ * DAG preservation possible during clone operations.
6
+ *
7
+ * A refmap maps a source address to a builder reference.
8
+ *
9
+ * This is just a map, but the semantics are important:
10
+ *
11
+ * The map thus preserves identity of the source. It is not a
12
+ * cache because cache eviction would fail to properly track
13
+ * identity.
14
+ *
15
+ * The map is used for memoization during object cloning are and
16
+ * may also be used by user logic doing similar operations.
17
+ * This ensures that identity is preserved so a source object is
18
+ * not duplicated which could lead to either loss of semantic
19
+ * information, or an explosion in size, or both. In some, or
20
+ * even most, cases this concern may not be important, but when
21
+ * it is important, it is important.
22
+ *
23
+ * The source address must not be reused for different content
24
+ * for the lifetime of the map, although the content doest not
25
+ * have to be valid or event exist at that location since source
26
+ * address is just used as a key.
27
+ *
28
+ * The lifetime may be a single clone operation which then
29
+ * tracks child object references as well, or it may be the
30
+ * lifetime of the buffer builder.
31
+ *
32
+ * The map may be flushed explicitly when the source addresses
33
+ * are no longer unique, such as when reusing a memory buffer,
34
+ * and when identity preservation is no longer important.
35
+ * Flushing a map is esentially the same as ending a lifetime.
36
+ *
37
+ * Multiple maps may exist concurrently for example if cloning
38
+ * an object twice into two new objects that should have
39
+ * separate identities. This is especially true and necessary
40
+ * when creating a new nested buffer because the nested buffer
41
+ * cannot share references with the parent. Cloning and object
42
+ * that contains a nested buffer does not require multiple maps
43
+ * because the nested buffer is then opaque.
44
+ */
45
+
46
+ #ifndef FLATCC_REFMAP_H
47
+ #define FLATCC_REFMAP_H
48
+
49
+ #ifdef __cplusplus
50
+ extern "C" {
51
+ #endif
52
+
53
+ #include "flatcc/flatcc_types.h"
54
+
55
+ #ifndef FLATCC_REFMAP_MIN_BUCKETS
56
+ /* 8 buckets gives us 5 useful initial entries with a load factor of 0.7 */
57
+ #define FLATCC_REFMAP_MIN_BUCKETS 8
58
+ #endif
59
+
60
+ #define FLATCC_REFMAP_LOAD_FACTOR 0.7f
61
+
62
+ typedef struct flatcc_refmap flatcc_refmap_t;
63
+ typedef flatbuffers_soffset_t flatcc_refmap_ref_t;
64
+
65
+ static const flatcc_refmap_ref_t flatcc_refmap_not_found = 0;
66
+
67
+ struct flatcc_refmap_item {
68
+ const void* src;
69
+ flatcc_refmap_ref_t ref;
70
+ };
71
+
72
+ struct flatcc_refmap {
73
+ size_t count;
74
+ size_t buckets;
75
+ struct flatcc_refmap_item* table;
76
+ /* Use stack allocation for small maps. */
77
+ struct flatcc_refmap_item min_table[FLATCC_REFMAP_MIN_BUCKETS];
78
+ };
79
+
80
+ /*
81
+ * Fast zero initialization - does not allocate any memory.
82
+ * May be replaced by memset 0, but `init` avoids clearing the
83
+ * stack allocated initial hash table until it is needed.
84
+ */
85
+ static inline int flatcc_refmap_init(flatcc_refmap_t* refmap) {
86
+ refmap->count = 0;
87
+ refmap->buckets = 0;
88
+ refmap->table = 0;
89
+ return 0;
90
+ }
91
+
92
+ /*
93
+ * Removes all items and deallocates memory.
94
+ * Not required unless `insert` or `resize` took place. The map can be
95
+ * reused subsequently without calling `init`.
96
+ */
97
+ void flatcc_refmap_clear(flatcc_refmap_t* refmap);
98
+
99
+ /*
100
+ * Keeps allocated memory as is, but removes all items. The map
101
+ * must intialized first.
102
+ */
103
+ void flatcc_refmap_reset(flatcc_refmap_t* refmap);
104
+
105
+ /*
106
+ * Returns the inserted reference if the `src` pointer was found,
107
+ * without inspecting the content of the `src` pointer.
108
+ *
109
+ * Returns flatcc_refmap_not_found (default 0) if the `src` pointer was
110
+ * not found.
111
+ */
112
+ flatcc_refmap_ref_t flatcc_refmap_find(flatcc_refmap_t* refmap, const void* src);
113
+
114
+ /*
115
+ * Inserts a `src` source pointer and its associated `ref` reference
116
+ * into the refmap without inspecting the `src` pointer content. The
117
+ * `ref` value will be replaced if the the `src` pointer already exists.
118
+ *
119
+ * Inserting null will just return the ref without updating the map.
120
+ *
121
+ * There is no delete operation which simplifies an open
122
+ * addressing hash table, and it isn't needed for this use case.
123
+ *
124
+ * Returns the input ref or not_found on allocation error.
125
+ */
126
+ flatcc_refmap_ref_t flatcc_refmap_insert(flatcc_refmap_t* refmap, const void* src,
127
+ flatcc_refmap_ref_t ref);
128
+
129
+ /*
130
+ * Set the hash table to accommodate at least `count` items while staying
131
+ * within the predefined load factor.
132
+ *
133
+ * Resize is primarily an internal operation, but the user may resize
134
+ * ahead of a large anticipated load, or after a large load to shrink
135
+ * the table using 0 as the `count` argument. The table never shrinks
136
+ * on its own account.
137
+ */
138
+ int flatcc_refmap_resize(flatcc_refmap_t* refmap, size_t count);
139
+
140
+ #ifdef __cplusplus
141
+ }
142
+ #endif
143
+
144
+ #endif /* FLATCC_REFMAP_H */
@@ -0,0 +1,160 @@
1
+ #ifndef FLATCC_RTCONFIG_H
2
+ #define FLATCC_RTCONFIG_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ /* Include portability layer here since all other files depend on it. */
9
+ #ifdef FLATCC_PORTABLE
10
+ #include "flatcc/portable/portable.h"
11
+ #endif
12
+
13
+ /*
14
+ * Fast printing and parsing of double.
15
+ *
16
+ * This requires the grisu3/grisu3_* files to be in the include path,
17
+ * otherwise strod and sprintf will be used (these needed anyway
18
+ * as fallback for cases not supported by grisu3).
19
+ */
20
+ #ifndef FLATCC_USE_GRISU3
21
+ #define FLATCC_USE_GRISU3 1
22
+ #endif
23
+
24
+ /*
25
+ * This requires compiler that has enabled marc=native or similar so
26
+ * __SSE4_2__ flag is defined. Otherwise it will have no effect.
27
+ *
28
+ * While SSE may be used for different purposes, it has (as of this
29
+ * writing) only be used to test the effect on JSON whitespace handling
30
+ * which improved, but not by a lot, assuming 64-bit unligned access is
31
+ * otherwise available:
32
+ *
33
+ * With 8 space indentation, the JSON benchmark handles 308K parse ops/sec
34
+ * while SSE ups that to 333 parse ops/sec or 336 if \r\n is also
35
+ * consumed by SSE. Disabling indentation leaves SSE spacing handling
36
+ * ineffective, and performance reaches 450K parse ops/sec and can
37
+ * improve further to 500+K parse ops/sec if inexact GRISU3 numbers are
38
+ * allowed (they are pretty accurate anyway, just not exact). This
39
+ * feature requires hacking a flag direct in the grisu3 double parsing
40
+ * lib directly and only mentioned for comparison.
41
+ *
42
+ * In conclusion SSE doesn't add a lot to JSON space handling at least.
43
+ *
44
+ * Disabled by default, but can be overriden by build system.
45
+ */
46
+ #ifndef FLATCC_USE_SSE4_2
47
+ #define FLATCC_USE_SSE4_2 0
48
+ #endif
49
+
50
+ /*
51
+ * The verifier only reports yes and no. The following setting
52
+ * enables assertions in debug builds. It must be compiled into
53
+ * the runtime library and is not normally the desired behavior.
54
+ *
55
+ * NOTE: enabling this can break test cases so use with build, not test.
56
+ */
57
+ #if !defined(FLATCC_DEBUG_VERIFY) && !defined(NDEBUG)
58
+ #define FLATCC_DEBUG_VERIFY 0
59
+ #endif
60
+
61
+ #if !defined(FLATCC_TRACE_VERIFY)
62
+ #define FLATCC_TRACE_VERIFY 0
63
+ #endif
64
+
65
+ /*
66
+ * Limit recursion level for tables. Actual level may be deeper
67
+ * when structs are deeply nested - but these are limited by the
68
+ * schema compiler.
69
+ */
70
+ #ifndef FLATCC_JSON_PRINT_MAX_LEVELS
71
+ #define FLATCC_JSON_PRINT_MAX_LEVELS 100
72
+ #endif
73
+
74
+ /* Maximum length of names printed exluding _type suffix. */
75
+ #ifndef FLATCC_JSON_PRINT_NAME_LEN_MAX
76
+ #define FLATCC_JSON_PRINT_NAME_LEN_MAX 100
77
+ #endif
78
+
79
+ /*
80
+ * Print float and double values with C99 hexadecimal floating point
81
+ * notation. This option is not valid JSON but it avoids precision
82
+ * loss, correctly handles NaN, +/-Infinity and is significantly faster
83
+ * to parse and print. Some JSON parsers rely on strtod which does
84
+ * support hexadecimal floating points when C99 compliant.
85
+ */
86
+ #ifndef FLATCC_JSON_PRINT_HEX_FLOAT
87
+ #define FLATCC_JSON_PRINT_HEX_FLOAT 0
88
+ #endif
89
+
90
+ /*
91
+ * Always print multipe enum flags like `color: "Red Green"`
92
+ * even when unquote is selected as an option for single
93
+ * value like `color: Green`. Otherwise multiple values
94
+ * are printed as `color: Red Green`, but this could break
95
+ * some flatbuffer json parser.
96
+ */
97
+ #ifndef FLATCC_JSON_PRINT_ALWAYS_QUOTE_MULTIPLE_FLAGS
98
+ #define FLATCC_JSON_PRINT_ALWAYS_QUOTE_MULTIPLE_FLAGS 1
99
+ #endif
100
+
101
+ /*
102
+ * The general nesting limit may be lower, but for skipping
103
+ * JSON we do not need to - we can set this high as it only
104
+ * costs a single char per level in a stack array.
105
+ */
106
+ #ifndef FLATCC_JSON_PARSE_GENERIC_MAX_NEST
107
+ #define FLATCC_JSON_PARSE_GENERIC_MAX_NEST 512
108
+ #endif
109
+
110
+ /* Store value even if it is default. */
111
+ #ifndef FLATCC_JSON_PARSE_FORCE_DEFAULTS
112
+ #define FLATCC_JSON_PARSE_FORCE_DEFAULTS 0
113
+ #endif
114
+
115
+ #ifndef FLATCC_JSON_PARSE_ALLOW_UNQUOTED
116
+ #define FLATCC_JSON_PARSE_ALLOW_UNQUOTED 1
117
+ #endif
118
+
119
+ /*
120
+ * Multiple enum values are by default not permitted unless
121
+ * quoted like `color: "Red Green" as per Googles flatc JSON
122
+ * parser while a single value like `color: Red` can be
123
+ * unquoted. Enabling this setting will allow `color: Red
124
+ * Green`, but only if FLATCC_JSON_PARSE_ALLOW_UNQUOTED is
125
+ * also enabled.
126
+ */
127
+ #ifndef FLATCC_JSON_PARSE_ALLOW_UNQUOTED_LIST
128
+ #define FLATCC_JSON_PARSE_ALLOW_UNQUOTED_LIST 0
129
+ #endif
130
+
131
+ #ifndef FLATCC_JSON_PARSE_ALLOW_UNKNOWN_FIELD
132
+ #define FLATCC_JSON_PARSE_ALLOW_UNKNOWN_FIELD 1
133
+ #endif
134
+
135
+ #ifndef FLATCC_JSON_PARSE_ALLOW_TRAILING_COMMA
136
+ #define FLATCC_JSON_PARSE_ALLOW_TRAILING_COMMA 1
137
+ #endif
138
+
139
+ /*
140
+ * Just parse to the closing bracket '}' if set.
141
+ * Otherwise parse to end by consuming space and
142
+ * fail if anything but space follows.
143
+ */
144
+ #ifndef FLATCC_PARSE_IGNORE_TRAILING_DATA
145
+ #define FLATCC_PARSE_IGNORE_TRAILING_DATA 0
146
+ #endif
147
+
148
+ /*
149
+ * Optimize to parse a lot of white space, but
150
+ * in most cases it probably slows parsing down.
151
+ */
152
+ #ifndef FLATCC_JSON_PARSE_WIDE_SPACE
153
+ #define FLATCC_JSON_PARSE_WIDE_SPACE 0
154
+ #endif
155
+
156
+ #ifdef __cplusplus
157
+ }
158
+ #endif
159
+
160
+ #endif /* FLATCC_RTCONFIG_H */
@@ -0,0 +1,98 @@
1
+ #ifndef FLATCC_TYPES_H
2
+ #define FLATCC_TYPES_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include <stdlib.h>
9
+
10
+ #ifndef UINT8_MAX
11
+ #include <stdint.h>
12
+ #endif
13
+
14
+ /*
15
+ * This should match generated type declaratios in
16
+ * `flatbuffers_common_reader.h` (might have different name prefix).
17
+ * Read only generated code does not depend on library code,
18
+ * hence the duplication.
19
+ */
20
+ #ifndef flatbuffers_types_defined
21
+ #define flatbuffers_types_defined
22
+
23
+ /*
24
+ * uoffset_t and soffset_t must be same integer type, except for sign.
25
+ * They can be (u)int16_t, (u)int32_t, or (u)int64_t.
26
+ * The default is (u)int32_t.
27
+ *
28
+ * voffset_t is expected to be uint16_t, but can experimentally be
29
+ * compiled from uint8_t up to uint32_t.
30
+ *
31
+ * ID_MAX is the largest value that can index a vtable. The table size
32
+ * is given as voffset value. Each id represents a voffset value index
33
+ * from 0 to max inclusive. Space is required for two header voffset
34
+ * fields and the unaddressible highest index (due to the table size
35
+ * representation). For 16-bit voffsets this yields a max of 2^15 - 4,
36
+ * or (2^16 - 1) / 2 - 3.
37
+ */
38
+
39
+ #define flatbuffers_uoffset_t_defined
40
+ #define flatbuffers_soffset_t_defined
41
+ #define flatbuffers_voffset_t_defined
42
+ #define flatbuffers_utype_t_defined
43
+ #define flatbuffers_bool_t_defined
44
+ #define flatbuffers_thash_t_defined
45
+ #define flatbuffers_fid_t_defined
46
+
47
+ /* uoffset_t is also used for vector and string headers. */
48
+ #define FLATBUFFERS_UOFFSET_MAX UINT32_MAX
49
+ #define FLATBUFFERS_SOFFSET_MAX INT32_MAX
50
+ #define FLATBUFFERS_SOFFSET_MIN INT32_MIN
51
+ #define FLATBUFFERS_VOFFSET_MAX UINT16_MAX
52
+ #define FLATBUFFERS_UTYPE_MAX UINT8_MAX
53
+ /* Well - the max of the underlying type. */
54
+ #define FLATBUFFERS_BOOL_MAX UINT8_MAX
55
+ #define FLATBUFFERS_THASH_MAX UINT32_MAX
56
+
57
+ #define FLATBUFFERS_ID_MAX (FLATBUFFERS_VOFFSET_MAX / sizeof(flatbuffers_voffset_t) - 3)
58
+ /* Vectors of empty structs can yield div by zero, so we must guard against this. */
59
+ #define FLATBUFFERS_COUNT_MAX(elem_size) \
60
+ (FLATBUFFERS_UOFFSET_MAX / ((elem_size) == 0 ? 1 : (elem_size)))
61
+
62
+ #define FLATBUFFERS_UOFFSET_WIDTH 32
63
+ #define FLATBUFFERS_COUNT_WIDTH 32
64
+ #define FLATBUFFERS_SOFFSET_WIDTH 32
65
+ #define FLATBUFFERS_VOFFSET_WIDTH 16
66
+ #define FLATBUFFERS_UTYPE_WIDTH 8
67
+ #define FLATBUFFERS_BOOL_WIDTH 8
68
+ #define FLATBUFFERS_THASH_WIDTH 32
69
+
70
+ #define FLATBUFFERS_TRUE 1
71
+ #define FLATBUFFERS_FALSE 0
72
+
73
+ #define FLATBUFFERS_PROTOCOL_IS_LE 1
74
+ #define FLATBUFFERS_PROTOCOL_IS_BE 0
75
+
76
+ typedef uint32_t flatbuffers_uoffset_t;
77
+ typedef int32_t flatbuffers_soffset_t;
78
+ typedef uint16_t flatbuffers_voffset_t;
79
+ typedef uint8_t flatbuffers_utype_t;
80
+ typedef uint8_t flatbuffers_bool_t;
81
+ typedef uint32_t flatbuffers_thash_t;
82
+ /* Public facing type operations. */
83
+ typedef flatbuffers_utype_t flatbuffers_union_type_t;
84
+
85
+ static const flatbuffers_bool_t flatbuffers_true = FLATBUFFERS_TRUE;
86
+ static const flatbuffers_bool_t flatbuffers_false = FLATBUFFERS_FALSE;
87
+
88
+ #define FLATBUFFERS_IDENTIFIER_SIZE (FLATBUFFERS_THASH_WIDTH / 8)
89
+
90
+ typedef char flatbuffers_fid_t[FLATBUFFERS_IDENTIFIER_SIZE];
91
+
92
+ #endif /* flatbuffers_types_defined */
93
+
94
+ #ifdef __cplusplus
95
+ }
96
+ #endif
97
+
98
+ #endif /* FLATCC_TYPES_H */
@@ -0,0 +1,243 @@
1
+ #ifndef FLATCC_VERIFIER_H
2
+ #define FLATCC_VERIFIER_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ /*
9
+ * Runtime support for verifying flatbuffers.
10
+ *
11
+ * Link with the verifier implementation file.
12
+ *
13
+ * Note:
14
+ *
15
+ * 1) nested buffers will NOT have their identifier verified.
16
+ * The user may do so subsequently. The reason is in part because
17
+ * the information is not readily avaible without generated reader code,
18
+ * in part because the buffer might use a different, but valid,
19
+ * identifier and the user has no chance of specifiying this in the
20
+ * verifier code. The root verifier also doesn't assume a specific id
21
+ * but accepts a user supplied input which may be null.
22
+ *
23
+ * 2) All offsets in a buffer are verified for alignment relative to the
24
+ * buffer start, but the buffer itself is only assumed to aligned to
25
+ * uoffset_t. A reader should therefore ensure buffer alignment separately
26
+ * before reading the buffer. Nested buffers are in fact checked for
27
+ * alignment, but still only relative to the root buffer.
28
+ *
29
+ * 3) The max nesting level includes nested buffer nestings, so the
30
+ * verifier might fail even if the individual buffers are otherwise ok.
31
+ * This is to prevent abuse with lots of nested buffers.
32
+ *
33
+ *
34
+ * IMPORTANT:
35
+ *
36
+ * Even if verifier passes, the buffer may be invalid to access due to
37
+ * lack of alignemnt in memory, but the verifier is safe to call.
38
+ *
39
+ * NOTE: The buffer is not safe to modify after verification because an
40
+ * attacker may craft overlapping data structures such that modification
41
+ * of one field updates another in a way that violates the buffer
42
+ * constraints. This may also be caused by a clever compression scheme.
43
+ *
44
+ * It is likely faster to rewrite the table although this is also
45
+ * dangerous because an attacker (or even normal user) can draft a DAG
46
+ * that explodes when expanded carelesslessly. A safer approach is to
47
+ * hash all object references written and reuse those that match. This
48
+ * will expand references into other objects while bounding expansion
49
+ * and it will be safe to update assuming shared objects are ok to
50
+ * update.
51
+ *
52
+ */
53
+
54
+ #include "flatcc/flatcc_types.h"
55
+
56
+ #define FLATCC_VERIFY_ERROR_MAP(XX) \
57
+ XX(ok, "ok") \
58
+ XX(buffer_header_too_small, "buffer header too small") \
59
+ XX(identifier_mismatch, "identifier mismatch") \
60
+ XX(max_nesting_level_reached, "max nesting level reached") \
61
+ XX(required_field_missing, "required field missing") \
62
+ XX(runtime_buffer_header_not_aligned, "runtime: buffer header not aligned") \
63
+ XX(runtime_buffer_size_too_large, "runtime: buffer size too large") \
64
+ XX(string_not_zero_terminated, "string not zero terminated") \
65
+ XX(string_out_of_range, "string out of range") \
66
+ XX(struct_out_of_range, "struct out of range") \
67
+ XX(struct_size_overflow, "struct size overflow") \
68
+ XX(struct_unaligned, "struct unaligned") \
69
+ XX(table_field_not_aligned, "table field not aligned") \
70
+ XX(table_field_out_of_range, "table field out of range") \
71
+ XX(table_field_size_overflow, "table field size overflow") \
72
+ XX(table_header_out_of_range_or_unaligned, "table header out of range or unaligned") \
73
+ XX(vector_header_out_of_range_or_unaligned, "vector header out of range or unaligned") \
74
+ XX(string_header_out_of_range_or_unaligned, "string header out of range or unaligned") \
75
+ XX(offset_out_of_range, "offset out of range") \
76
+ XX(table_offset_out_of_range_or_unaligned, "table offset out of range or unaligned") \
77
+ XX(table_size_out_of_range, "table size out of range") \
78
+ XX(type_field_absent_from_required_union_field, "type field absent from required union field") \
79
+ XX(type_field_absent_from_required_union_vector_field, \
80
+ "type field absent from required union vector field") \
81
+ XX(union_cannot_have_a_table_without_a_type, "union cannot have a table without a type") \
82
+ XX(union_type_NONE_cannot_have_a_value, "union value field present with type NONE") \
83
+ XX(vector_count_exceeds_representable_vector_size, \
84
+ "vector count exceeds representable vector size") \
85
+ XX(vector_out_of_range, "vector out of range") \
86
+ XX(vtable_header_out_of_range, "vtable header out of range") \
87
+ XX(vtable_header_too_small, "vtable header too small") \
88
+ XX(vtable_offset_out_of_range_or_unaligned, "vtable offset out of range or unaligned") \
89
+ XX(vtable_size_out_of_range_or_unaligned, "vtable size out of range or unaligned") \
90
+ XX(vtable_size_overflow, "vtable size overflow") \
91
+ XX(union_element_absent_without_type_NONE, "union element absent without type NONE") \
92
+ XX(union_element_present_with_type_NONE, "union element present with type NONE") \
93
+ XX(union_vector_length_mismatch, "union type and table vectors have different lengths") \
94
+ XX(union_vector_verification_not_supported, "union vector verification not supported") \
95
+ XX(not_supported, "not supported")
96
+
97
+ enum flatcc_verify_error_no {
98
+ #define XX(no, str) flatcc_verify_error_##no,
99
+ FLATCC_VERIFY_ERROR_MAP(XX)
100
+ #undef XX
101
+ };
102
+
103
+ #define flatcc_verify_ok flatcc_verify_error_ok
104
+
105
+ const char* flatcc_verify_error_string(int err);
106
+
107
+ /*
108
+ * Type specific table verifier function that checks each known field
109
+ * for existence in the vtable and then calls the appropriate verifier
110
+ * function in this library.
111
+ *
112
+ * The table descriptor values have been verified for bounds, overflow,
113
+ * and alignment, but vtable entries after header must be verified
114
+ * for all fields the table verifier function understands.
115
+ *
116
+ * Calls other typespecific verifier functions recursively whenever a
117
+ * table field, union or table vector is encountered.
118
+ */
119
+ typedef struct flatcc_table_verifier_descriptor flatcc_table_verifier_descriptor_t;
120
+ struct flatcc_table_verifier_descriptor {
121
+ /* Pointer to buffer. Not assumed to be aligned beyond uoffset_t. */
122
+ const void* buf;
123
+ /* Buffer size. */
124
+ flatbuffers_uoffset_t end;
125
+ /* Time to live: number nesting levels left before failure. */
126
+ int ttl;
127
+ /* Vtable of current table. */
128
+ const void* vtable;
129
+ /* Table offset relative to buffer start */
130
+ flatbuffers_uoffset_t table;
131
+ /* Table end relative to buffer start as per vtable[1] field. */
132
+ flatbuffers_voffset_t tsize;
133
+ /* Size of vtable in bytes. */
134
+ flatbuffers_voffset_t vsize;
135
+ };
136
+
137
+ typedef int flatcc_table_verifier_f(flatcc_table_verifier_descriptor_t* td);
138
+
139
+ typedef struct flatcc_union_verifier_descriptor flatcc_union_verifier_descriptor_t;
140
+
141
+ struct flatcc_union_verifier_descriptor {
142
+ /* Pointer to buffer. Not assumed to be aligned beyond uoffset_t. */
143
+ const void* buf;
144
+ /* Buffer size. */
145
+ flatbuffers_uoffset_t end;
146
+ /* Time to live: number nesting levels left before failure. */
147
+ int ttl;
148
+ /* Type of union value to be verified */
149
+ flatbuffers_utype_t type;
150
+ /* Offset relative to buffer start to where union value offset is stored. */
151
+ flatbuffers_uoffset_t base;
152
+ /* Offset of union value relative to base. */
153
+ flatbuffers_uoffset_t offset;
154
+ };
155
+
156
+ typedef int flatcc_union_verifier_f(flatcc_union_verifier_descriptor_t* ud);
157
+
158
+ /*
159
+ * The `as_root` functions are normally the only functions called
160
+ * explicitly in this interface.
161
+ *
162
+ * If `fid` is null, the identifier is not checked and is allowed to be entirely absent.
163
+ *
164
+ * The buffer must at least be aligned to uoffset_t on systems that
165
+ * require aligned memory addresses. The buffer pointers alignment is
166
+ * not significant to internal verification of the buffer.
167
+ */
168
+ int flatcc_verify_struct_as_root(const void* buf, size_t bufsiz, const char* fid, size_t size,
169
+ uint16_t align);
170
+
171
+ int flatcc_verify_struct_as_typed_root(const void* buf, size_t bufsiz, flatbuffers_thash_t thash,
172
+ size_t size, uint16_t align);
173
+
174
+ int flatcc_verify_table_as_root(const void* buf, size_t bufsiz, const char* fid,
175
+ flatcc_table_verifier_f* root_tvf);
176
+
177
+ int flatcc_verify_table_as_typed_root(const void* buf, size_t bufsiz, flatbuffers_thash_t thash,
178
+ flatcc_table_verifier_f* root_tvf);
179
+ /*
180
+ * The buffer header is verified by any of the `_as_root` verifiers, but
181
+ * this function may be used as a quick sanity check.
182
+ */
183
+ int flatcc_verify_buffer_header(const void* buf, size_t bufsiz, const char* fid);
184
+
185
+ int flatcc_verify_typed_buffer_header(const void* buf, size_t bufsiz,
186
+ flatbuffers_thash_t type_hash);
187
+
188
+ /*
189
+ * The following functions are typically called by a generated table
190
+ * verifier function.
191
+ */
192
+
193
+ /* Scalar, enum or struct field. */
194
+ int flatcc_verify_field(flatcc_table_verifier_descriptor_t* td, flatbuffers_voffset_t id,
195
+ size_t size, uint16_t align);
196
+ /* Vector of scalars, enums or structs. */
197
+ int flatcc_verify_vector_field(flatcc_table_verifier_descriptor_t* td, flatbuffers_voffset_t id,
198
+ int required, size_t elem_size, uint16_t align, size_t max_count);
199
+ int flatcc_verify_string_field(flatcc_table_verifier_descriptor_t* td, flatbuffers_voffset_t id,
200
+ int required);
201
+ int flatcc_verify_string_vector_field(flatcc_table_verifier_descriptor_t* td,
202
+ flatbuffers_voffset_t id, int required);
203
+ int flatcc_verify_table_field(flatcc_table_verifier_descriptor_t* td, flatbuffers_voffset_t id,
204
+ int required, flatcc_table_verifier_f tvf);
205
+ int flatcc_verify_table_vector_field(flatcc_table_verifier_descriptor_t* td,
206
+ flatbuffers_voffset_t id, int required,
207
+ flatcc_table_verifier_f tvf);
208
+ /* Table verifiers pass 0 as fid. */
209
+ int flatcc_verify_struct_as_nested_root(flatcc_table_verifier_descriptor_t* td,
210
+ flatbuffers_voffset_t id, int required, const char* fid,
211
+ size_t size, uint16_t align);
212
+ int flatcc_verify_table_as_nested_root(flatcc_table_verifier_descriptor_t* td,
213
+ flatbuffers_voffset_t id, int required, const char* fid,
214
+ uint16_t align, flatcc_table_verifier_f tvf);
215
+
216
+ /*
217
+ * A NONE type will not accept a table being present, and a required
218
+ * union will not accept a type field being absent, and an absent type
219
+ * field will not accept a table field being present.
220
+ *
221
+ * If the above checks out and the type is not NONE, the uvf callback
222
+ * is executed. It must test each known table type and silently accept
223
+ * any unknown table type for forward compatibility. A union table
224
+ * value is verified without the required flag because an absent table
225
+ * encodes a typed NULL value while an absent type field encodes a
226
+ * missing union which fails if required.
227
+ */
228
+ int flatcc_verify_union_field(flatcc_table_verifier_descriptor_t* td, flatbuffers_voffset_t id,
229
+ int required, flatcc_union_verifier_f uvf);
230
+
231
+ int flatcc_verify_union_vector_field(flatcc_table_verifier_descriptor_t* td,
232
+ flatbuffers_voffset_t id, int required,
233
+ flatcc_union_verifier_f uvf);
234
+
235
+ int flatcc_verify_union_table(flatcc_union_verifier_descriptor_t* ud, flatcc_table_verifier_f* tvf);
236
+ int flatcc_verify_union_struct(flatcc_union_verifier_descriptor_t* ud, size_t size, uint16_t align);
237
+ int flatcc_verify_union_string(flatcc_union_verifier_descriptor_t* ud);
238
+
239
+ #ifdef __cplusplus
240
+ }
241
+ #endif
242
+
243
+ #endif /* FLATCC_VERIFIER_H */
@@ -0,0 +1,14 @@
1
+ #ifndef FLATCC_PORTABLE_H
2
+ #define FLATCC_PORTABLE_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "flatcc/portable/portable_basic.h"
9
+
10
+ #ifdef __cplusplus
11
+ }
12
+ #endif
13
+
14
+ #endif /* FLATCC_PORTABLE_H */