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..a7b351e089b070261fc60c6bfd3204231b4db086 |
--- /dev/null |
+++ b/mojo/public/c/bindings/struct.h |
@@ -0,0 +1,28 @@ |
+// 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 <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(void* data, uint32_t size); |
viettrungluu
2016/02/02 00:48:47
const void*?
Also, should you use a |size_t| for
|
+ |
+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_ |