Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium 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_MESSAGE_H_ | |
| 6 #define MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ | |
| 7 | |
| 8 #include <stdbool.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "mojo/public/c/bindings/struct.h" | |
| 12 | |
| 13 #ifdef __cplusplus | |
| 14 extern "C" { | |
| 15 #endif | |
| 16 | |
| 17 // Validates that the buffer started at a (validated) mojo_struct_header with a | |
| 18 // given size contains a valid mojo message header. | |
| 19 bool mojo_validate_message_header(mojo_struct_header_t* header, uint32_t size); | |
|
viettrungluu
2016/02/02 00:48:47
const mojo_struct_header_t*?
|size_t| for size?
jamesr
2016/02/02 00:55:04
Sure (although it's meaningless here)
| |
| 20 | |
|
viettrungluu
2016/02/02 00:48:47
Probably you want suitable pack pragmas, no?
jamesr
2016/02/02 00:55:04
I'm relying on the static assertions to tell me if
| |
| 21 typedef struct mojo_message_header { | |
| 22 mojo_struct_header_t struct_header; | |
| 23 uint32_t name; | |
| 24 uint32_t flags; | |
| 25 } mojo_message_header_t; | |
|
viettrungluu
2016/02/02 00:48:47
Note that POSIX sez that _t names are reserved for
jamesr
2016/02/02 00:55:04
That's super annoying. Is there another naming co
| |
| 26 | |
| 27 typedef struct mojo_message_header_with_request_id { | |
| 28 mojo_message_header_t message_header; | |
| 29 uint64_t request_id; | |
| 30 } mojo_message_header_with_request_id_t; | |
| 31 | |
| 32 #ifdef __cplusplus | |
| 33 } // extern "C" | |
| 34 #endif | |
| 35 | |
| 36 #endif // MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ | |
| OLD | NEW |