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_VALIDATION_H_ | |
6 #define MOJO_PUBLIC_C_BINDINGS_VALIDATION_H_ | |
7 | |
8 #include <mojo/macros.h> | |
9 #include <stdint.h> | |
10 | |
11 MOJO_BEGIN_EXTERN_C | |
12 | |
13 // One of MOJOM_VALIDATION_* codes; See below. | |
14 typedef uint32_t MojomValidationResult; | |
15 | |
16 // No error; successful validation. | |
17 #define MOJOM_VALIDATION_ERROR_NONE ((MojomValidationResult)0) | |
18 // An object (struct or array) is not 8-byte aligned. | |
19 #define MOJOM_VALIDATION_MISALIGNED_OBJECT ((MojomValidationResult)1) | |
20 // An object is not contained inside the message data, or it overlaps other | |
21 // objects. | |
22 #define MOJOM_VALIDATION_ILLEGAL_MEMORY_RANGE ((MojomValidationResult)2) | |
23 // A struct header doesn't make sense, for example: | |
24 // - |num_bytes| is smaller than the size of the struct header. | |
25 // - |num_bytes| and |version| don't match. | |
26 #define MOJOM_VALIDATION_UNEXPECTED_STRUCT_HEADER ((MojomValidationResult)3) | |
27 // An array header doesn't make sense, for example: | |
28 // - |num_bytes| is smaller than the size of the header plus the size required | |
29 // to store |num_elements| elements. | |
30 // - For fixed-size arrays, |num_elements| is different than the specified | |
31 // size. | |
32 #define MOJOM_VALIDATION_UNEXPECTED_ARRAY_HEADER ((MojomValidationResult)4) | |
33 // An encoded handle is illegal. | |
34 #define MOJOM_VALIDATION_ILLEGAL_HANDLE ((MojomValidationResult)5) | |
35 // A non-nullable handle field is set to invalid handle. | |
36 #define MOJOM_VALIDATION_UNEXPECTED_INVALID_HANDLE ((MojomValidationResult)6) | |
37 // An encoded pointer is illegal. | |
38 #define MOJOM_VALIDATION_ILLEGAL_POINTER ((MojomValidationResult)7) | |
39 // A non-nullable pointer field is set to null. | |
40 #define MOJOM_VALIDATION_UNEXPECTED_NULL_POINTER ((MojomValidationResult)8) | |
41 // |flags| in the message header is invalid. The flags are either | |
42 // inconsistent with one another, inconsistent with other parts of the | |
43 // message, or unexpected for the message receiver. For example the | |
44 // receiver is expecting a request message but the flags indicate that | |
45 // the message is a response message. | |
46 #define MOJOM_VALIDATION_MESSAGE_HEADER_INVALID_FLAGS ((MojomValidationResult)9) | |
47 // |flags| in the message header indicates that a request ID is required but | |
48 // there isn't one. | |
49 #define MOJOM_VALIDATION_MESSAGE_HEADER_MISSING_REQUEST_ID \ | |
50 ((MojomValidationResult)10) | |
51 // The |name| field in a message header contains an unexpected value. | |
52 #define MOJOM_VALIDATION_MESSAGE_HEADER_UNKNOWN_METHOD \ | |
53 ((MojomValidationResult)11) | |
54 // Two parallel arrays which are supposed to represent a map have different | |
55 // lengths. | |
56 #define MOJOM_VALIDATION_DIFFERENT_SIZED_ARRAYS_IN_MAP \ | |
57 ((MojomValidationResult)12) | |
58 // A non-nullable union is set to null. (Has size 0) | |
59 #define MOJOM_VALIDATION_UNEXPECTED_NULL_UNION ((MojomValidationResult)13) | |
60 | |
61 MOJO_END_EXTERN_C | |
62 | |
63 #endif // MOJO_PUBLIC_C_BINDINGS_VALIDATION_H_ | |
OLD | NEW |