OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTEXT_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "mojo/public/cpp/bindings/bindings_export.h" |
14 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 15 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
15 | 16 |
16 static const int kMaxRecursionDepth = 100; | 17 static const int kMaxRecursionDepth = 100; |
17 | 18 |
18 namespace mojo { | 19 namespace mojo { |
19 | 20 |
20 class Message; | 21 class Message; |
21 | 22 |
22 namespace internal { | 23 namespace internal { |
23 | 24 |
24 // ValidationContext is used when validating object sizes, pointers and handle | 25 // ValidationContext is used when validating object sizes, pointers and handle |
25 // indices in the payload of incoming messages. | 26 // indices in the payload of incoming messages. |
26 class ValidationContext { | 27 class MOJO_CPP_BINDINGS_EXPORT ValidationContext { |
27 public: | 28 public: |
28 // [data, data + data_num_bytes) specifies the initial valid memory range. | 29 // [data, data + data_num_bytes) specifies the initial valid memory range. |
29 // [0, num_handles) specifies the initial valid range of handle indices. | 30 // [0, num_handles) specifies the initial valid range of handle indices. |
30 // | 31 // |
31 // If provided, |message| and |description| provide additional information | 32 // If provided, |message| and |description| provide additional information |
32 // to use when reporting validation errors. In addition if |message| is | 33 // to use when reporting validation errors. In addition if |message| is |
33 // provided, the MojoNotifyBadMessage API will be used to notify the system of | 34 // provided, the MojoNotifyBadMessage API will be used to notify the system of |
34 // such errors. | 35 // such errors. |
35 ValidationContext(const void* data, | 36 ValidationContext(const void* data, |
36 size_t data_num_bytes, | 37 size_t data_num_bytes, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 int stack_depth_; | 131 int stack_depth_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(ValidationContext); | 133 DISALLOW_COPY_AND_ASSIGN(ValidationContext); |
133 }; | 134 }; |
134 | 135 |
135 } // namespace internal | 136 } // namespace internal |
136 } // namespace mojo | 137 } // namespace mojo |
137 | 138 |
138 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ | 139 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
OLD | NEW |