OLD | NEW |
(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 #include "mojo/public/cpp/bindings/lib/message_validation.h" |
| 6 |
| 7 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| 8 #include "mojo/public/cpp/bindings/message.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace internal { |
| 12 |
| 13 bool ValidateMessageIsRequestWithoutResponse(const Message* message) { |
| 14 if (message->has_flag(kMessageIsResponse) || |
| 15 message->has_flag(kMessageExpectsResponse)) { |
| 16 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS); |
| 17 return false; |
| 18 } |
| 19 return true; |
| 20 } |
| 21 |
| 22 bool ValidateMessageIsRequestExpectingResponse(const Message* message) { |
| 23 if (message->has_flag(kMessageIsResponse) || |
| 24 !message->has_flag(kMessageExpectsResponse)) { |
| 25 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS); |
| 26 return false; |
| 27 } |
| 28 return true; |
| 29 } |
| 30 |
| 31 bool ValidateMessageIsResponse(const Message* message) { |
| 32 if (message->has_flag(kMessageExpectsResponse) || |
| 33 !message->has_flag(kMessageIsResponse)) { |
| 34 ReportValidationError(VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS); |
| 35 return false; |
| 36 } |
| 37 return true; |
| 38 } |
| 39 |
| 40 } // namespace internal |
| 41 } // namespace mojo |
OLD | NEW |