Index: mojo/public/c/bindings/struct.h |
diff --git a/mojo/public/c/bindings/struct.h b/mojo/public/c/bindings/struct.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bdc893ef05acd11bbfca6efee4e4704b8e15e512 |
--- /dev/null |
+++ b/mojo/public/c/bindings/struct.h |
@@ -0,0 +1,29 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ |
+#define MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ |
+ |
+#include <stdbool.h> |
+#include <stddef.h> |
+#include <stdint.h> |
+ |
+#ifdef __cplusplus |
+extern "C" { |
+#endif |
+ |
+// Validates that a given buffer has a mojo struct header and that the size of |
+// the struct in the header matches the size of the buffer. |
+bool mojo_validate_struct_header(const void* data, size_t size); |
+ |
+typedef struct struct_header { |
+ uint32_t num_bytes; |
+ uint32_t version; |
+} mojo_struct_header_t; |
+ |
+#ifdef __cplusplus |
+} // extern "C" |
+#endif |
+ |
+#endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ |