| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_C_BINDINGS_MESSAGE_H_ | 5 #ifndef MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ |
| 6 #define MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ | 6 #define MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "mojo/public/c/bindings/struct.h" | 10 #include "mojo/public/c/bindings/struct.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Which message is it? | 43 // Which message is it? |
| 44 uint32_t ordinal; | 44 uint32_t ordinal; |
| 45 // Described by the MOJOM_MESSAGE_* flags defined above. | 45 // Described by the MOJOM_MESSAGE_* flags defined above. |
| 46 uint32_t flags; | 46 uint32_t flags; |
| 47 uint64_t request_id; | 47 uint64_t request_id; |
| 48 }; | 48 }; |
| 49 MOJO_STATIC_ASSERT(sizeof(struct MojomMessageWithRequestId) == 24, | 49 MOJO_STATIC_ASSERT(sizeof(struct MojomMessageWithRequestId) == 24, |
| 50 "MojomMessageWithRequestId must be 24 bytes"); | 50 "MojomMessageWithRequestId must be 24 bytes"); |
| 51 | 51 |
| 52 // Validates that |in_buf| is a valid mojom message. This does not validate the | 52 // Validates that |in_buf| is a valid mojom message. This does not validate the |
| 53 // contents of the message's body, only the message header. | 53 // contents of the message's body, only the message header. This function does |
| 54 // not validate whether a message should be a kind of request. |
| 54 // |in_buf|: can be a MojomMessage or a MojomMessageWithRequestId. | 55 // |in_buf|: can be a MojomMessage or a MojomMessageWithRequestId. |
| 55 // |in_buf_size|: number of bytes in |in_buf|. | 56 // |in_buf_size|: number of bytes in |in_buf|. |
| 56 MojomValidationResult MojomMessage_ValidateHeader(const void* in_buf, | 57 MojomValidationResult MojomMessage_ValidateHeader(const void* in_buf, |
| 57 uint32_t in_buf_size); | 58 uint32_t in_buf_size); |
| 58 | 59 |
| 60 // Validates that the given message is a request expecting a response. Assumes |
| 61 // that the message is already validated by MojomMessage_ValidateHeader(). |
| 62 MojomValidationResult MojomMessage_ValidateRequestExpectingResponse( |
| 63 const void* in_buf); |
| 64 |
| 65 // Validates that the given message is a request which isn't expecting a |
| 66 // response. Assumes that the message is already validated by |
| 67 // MojomMessage_ValidateHeader(). |
| 68 MojomValidationResult MojomMessage_ValidateRequestWithoutResponse( |
| 69 const void* in_buf); |
| 70 |
| 71 // Validates that the given message is a response. Assumes taht the message is |
| 72 // already validated by MojomMessage_ValidateHeader(). |
| 73 MojomValidationResult MojomMessage_ValidateResponse(const void* in_buf); |
| 74 |
| 59 MOJO_END_EXTERN_C | 75 MOJO_END_EXTERN_C |
| 60 | 76 |
| 61 #endif // MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ | 77 #endif // MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ |
| OLD | NEW |