Chromium Code Reviews| Index: mojo/public/c/bindings/message.h |
| diff --git a/mojo/public/c/bindings/message.h b/mojo/public/c/bindings/message.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f9eb4467a2110de2cc4277afb727fb88240929f5 |
| --- /dev/null |
| +++ b/mojo/public/c/bindings/message.h |
| @@ -0,0 +1,36 @@ |
| +// 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_MESSAGE_H_ |
| +#define MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ |
| + |
| +#include <stdbool.h> |
| +#include <stdint.h> |
| + |
| +#include "mojo/public/c/bindings/struct.h" |
| + |
| +#ifdef __cplusplus |
| +extern "C" { |
| +#endif |
| + |
| +// Validates that the buffer started at a (validated) mojo_struct_header with a |
| +// given size contains a valid mojo message header. |
| +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)
|
| + |
|
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
|
| +typedef struct mojo_message_header { |
| + mojo_struct_header_t struct_header; |
| + uint32_t name; |
| + uint32_t flags; |
| +} 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
|
| + |
| +typedef struct mojo_message_header_with_request_id { |
| + mojo_message_header_t message_header; |
| + uint64_t request_id; |
| +} mojo_message_header_with_request_id_t; |
| + |
| +#ifdef __cplusplus |
| +} // extern "C" |
| +#endif |
| + |
| +#endif // MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ |