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

Side by Side Diff: mojo/public/cpp/bindings/lib/message_validation.h

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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 2015 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_CPP_BINDINGS_LIB_MESSAGE_VALIDATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_VALIDATION_H_
7
8 #include <string>
9
10 #include "mojo/public/cpp/bindings/lib/bounds_checker.h"
11 #include "mojo/public/cpp/bindings/lib/validation_errors.h"
12 #include "mojo/public/cpp/bindings/message.h"
13
14 namespace mojo {
15 namespace internal {
16
17 // Validates that the message is a request which doesn't expect a response.
18 ValidationError ValidateMessageIsRequestWithoutResponse(const Message* message,
19 std::string* err);
20 // Validates that the message is a request expecting a response.
21 ValidationError ValidateMessageIsRequestExpectingResponse(
22 const Message* message,
23 std::string* err);
24 // Validates that the message is a response.
25 ValidationError ValidateMessageIsResponse(const Message* message,
26 std::string* err);
27
28 // Validates that the message payload is a valid struct of type ParamsType.
29 template <typename ParamsType>
30 ValidationError ValidateMessagePayload(const Message* message,
31 std::string* err) {
32 BoundsChecker bounds_checker(message->payload(), message->payload_num_bytes(),
33 message->handles()->size());
34 return ParamsType::Validate(message->payload(), &bounds_checker, err);
35 }
36
37 } // namespace internal
38 } // namespace mojo
39
40 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_VALIDATION_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/message_internal.h ('k') | mojo/public/cpp/bindings/lib/message_validation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698