summaryrefslogtreecommitdiff
path: root/lib/nanopb/pb_common.h
diff options
context:
space:
mode:
authorAditya Naik2020-06-24 10:53:58 -0400
committerAditya Naik2020-06-24 10:53:58 -0400
commitda3f69722aa088a4530095d94a6d206c1ce06e03 (patch)
tree823f7899a2d59af38ac3472e9e2e092abd4b47a9 /lib/nanopb/pb_common.h
parent7897fd742ffc4afb82faa5fc8f3a39b12b8c667b (diff)
parent0915882d1ee834d2cc7c8d4ca9bcdb7495dbe1a1 (diff)
Master mergerefactor
Diffstat (limited to 'lib/nanopb/pb_common.h')
-rw-r--r--lib/nanopb/pb_common.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/nanopb/pb_common.h b/lib/nanopb/pb_common.h
new file mode 100644
index 0000000..47fa2c9
--- /dev/null
+++ b/lib/nanopb/pb_common.h
@@ -0,0 +1,45 @@
+/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
+ * These functions are rarely needed by applications directly.
+ */
+
+#ifndef PB_COMMON_H_INCLUDED
+#define PB_COMMON_H_INCLUDED
+
+#include "pb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Initialize the field iterator structure to beginning.
+ * Returns false if the message type is empty. */
+bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message);
+
+/* Get a field iterator for extension field. */
+bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension);
+
+/* Same as pb_field_iter_begin(), but for const message pointer.
+ * Note that the pointers in pb_field_iter_t will be non-const but shouldn't
+ * be written to when using these functions. */
+bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message);
+bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension);
+
+/* Advance the iterator to the next field.
+ * Returns false when the iterator wraps back to the first field. */
+bool pb_field_iter_next(pb_field_iter_t *iter);
+
+/* Advance the iterator until it points at a field with the given tag.
+ * Returns false if no such field exists. */
+bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
+
+#ifdef PB_VALIDATE_UTF8
+/* Validate UTF-8 text string */
+bool pb_validate_utf8(const char *s);
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
+