1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 6 #define MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 7 8 #include <stdbool.h> 9 #include <stddef.h> 10 #include <stdint.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 // Validates that a given buffer has a mojo struct header and that the size of 17 // the struct in the header matches the size of the buffer. 18 bool mojo_validate_struct_header(const void* data, size_t size); 19 20 typedef struct struct_header { 21 uint32_t num_bytes; 22 uint32_t version; 23 } mojo_struct_header_t; 24 25 #ifdef __cplusplus 26 } // extern "C" 27 #endif 28 29 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_ 30