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

Side by Side Diff: mojo/public/c/bindings/struct.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_STRUCT_H_
6 #define MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
7
8 #include <stdbool.h>
9 #include <stdint.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 // Validates that a given buffer has a mojo struct header and that the size of
16 // the struct in the header matches the size of the buffer.
17 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
18
19 typedef struct struct_header {
20 uint32_t num_bytes;
21 uint32_t version;
22 } mojo_struct_header_t;
23
24 #ifdef __cplusplus
25 } // extern "C"
26 #endif
27
28 #endif // MOJO_PUBLIC_C_BINDINGS_STRUCT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698