Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: mojo/public/c/bindings/message.h

Issue 1654373002: C types and utilities to validate and access struct and message headers (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698