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 SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ | 5 #ifndef SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ |
6 #define SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ | 6 #define SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 // ===================================================================== | 257 // ===================================================================== |
258 // Official API ends here. | 258 // Official API ends here. |
259 // ===================================================================== | 259 // ===================================================================== |
260 | 260 |
261 // Definitions below are necessary here only for C++03 compatibility. | 261 // Definitions below are necessary here only for C++03 compatibility. |
262 // Once C++11 is available, they should be moved into bpf_dsl.cc via extern | 262 // Once C++11 is available, they should be moved into bpf_dsl.cc via extern |
263 // templates. | 263 // templates. |
264 namespace internal { | 264 namespace internal { |
265 | 265 |
| 266 // Make argument-dependent lookup work. This is necessary because although |
| 267 // BoolExpr is defined in bpf_dsl, since it's merely a typedef for |
| 268 // scoped_refptr<const internal::BoolExplImpl>, argument-dependent lookup only |
| 269 // searches the "internal" nested namespace. |
| 270 using bpf_dsl::operator!; |
| 271 using bpf_dsl::operator||; |
| 272 using bpf_dsl::operator&&; |
| 273 |
266 // Returns a boolean expression that represents whether system call | 274 // Returns a boolean expression that represents whether system call |
267 // argument |num| of size |size| is equal to |val|, when masked | 275 // argument |num| of size |size| is equal to |val|, when masked |
268 // according to |mask|. Users should use the Arg template class below | 276 // according to |mask|. Users should use the Arg template class below |
269 // instead of using this API directly. | 277 // instead of using this API directly. |
270 SANDBOX_EXPORT BoolExpr | 278 SANDBOX_EXPORT BoolExpr |
271 ArgEq(int num, size_t size, uint64_t mask, uint64_t val); | 279 ArgEq(int num, size_t size, uint64_t mask, uint64_t val); |
272 | 280 |
273 // Returns the default mask for a system call argument of the specified size. | 281 // Returns the default mask for a system call argument of the specified size. |
274 SANDBOX_EXPORT uint64_t DefaultMask(size_t size); | 282 SANDBOX_EXPORT uint64_t DefaultMask(size_t size); |
275 | 283 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 357 |
350 template <typename T> | 358 template <typename T> |
351 ResultExpr Caser<T>::Default(ResultExpr result) const { | 359 ResultExpr Caser<T>::Default(ResultExpr result) const { |
352 return elser_.Else(result); | 360 return elser_.Else(result); |
353 } | 361 } |
354 | 362 |
355 } // namespace bpf_dsl | 363 } // namespace bpf_dsl |
356 } // namespace sandbox | 364 } // namespace sandbox |
357 | 365 |
358 #endif // SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ | 366 #endif // SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ |
OLD | NEW |