OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // and size (i.e., the |num_bytes| field of the header is sufficient for storing | 43 // and size (i.e., the |num_bytes| field of the header is sufficient for storing |
44 // the header itself). Besides, it checks that the memory range | 44 // the header itself). Besides, it checks that the memory range |
45 // [data, data + num_bytes) is not marked as occupied by other objects in | 45 // [data, data + num_bytes) is not marked as occupied by other objects in |
46 // |validation_context|. On success, the memory range is marked as occupied. | 46 // |validation_context|. On success, the memory range is marked as occupied. |
47 // Note: Does not verify |version| or that |num_bytes| is correct for the | 47 // Note: Does not verify |version| or that |num_bytes| is correct for the |
48 // claimed version. | 48 // claimed version. |
49 bool ValidateStructHeaderAndClaimMemory(const void* data, | 49 bool ValidateStructHeaderAndClaimMemory(const void* data, |
50 ValidationContext* validation_context); | 50 ValidationContext* validation_context); |
51 | 51 |
52 // Validates that |data| contains a valid union header, in terms of alignment | 52 // Validates that |data| contains a valid union header, in terms of alignment |
53 // and size. If not inlined, it checks that the memory range | 53 // and size. It checks that the memory range [data, data + kUnionDataSize) is |
54 // [data, data + num_bytes) is not marked as occupied by other objects in | 54 // not marked as occupied by other objects in |validation_context|. On success, |
55 // |validation_context|. On success, the memory range is marked as occupied. | 55 // the memory range is marked as occupied. |
56 bool ValidateUnionHeaderAndClaimMemory(const void* data, | 56 bool ValidateNonInlinedUnionHeaderAndClaimMemory( |
57 bool inlined, | 57 const void* data, |
58 ValidationContext* validation_context); | 58 ValidationContext* validation_context); |
59 | 59 |
60 // Validates that the message is a request which doesn't expect a response. | 60 // Validates that the message is a request which doesn't expect a response. |
61 bool ValidateMessageIsRequestWithoutResponse( | 61 bool ValidateMessageIsRequestWithoutResponse( |
62 const Message* message, | 62 const Message* message, |
63 ValidationContext* validation_context); | 63 ValidationContext* validation_context); |
64 | 64 |
65 // Validates that the message is a request expecting a response. | 65 // Validates that the message is a request expecting a response. |
66 bool ValidateMessageIsRequestExpectingResponse( | 66 bool ValidateMessageIsRequestExpectingResponse( |
67 const Message* message, | 67 const Message* message, |
68 ValidationContext* validation_context); | 68 ValidationContext* validation_context); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ValidationContext* validation_context); | 169 ValidationContext* validation_context); |
170 bool ValidateHandleOrInterface(const Interface_Data& input, | 170 bool ValidateHandleOrInterface(const Interface_Data& input, |
171 ValidationContext* validation_context); | 171 ValidationContext* validation_context); |
172 bool ValidateHandleOrInterface(const Handle_Data& input, | 172 bool ValidateHandleOrInterface(const Handle_Data& input, |
173 ValidationContext* validation_context); | 173 ValidationContext* validation_context); |
174 | 174 |
175 } // namespace internal | 175 } // namespace internal |
176 } // namespace mojo | 176 } // namespace mojo |
177 | 177 |
178 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ | 178 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_UTIL_H_ |
OLD | NEW |