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 // This file contains types/constants and functions specific to message pipes. | 5 // This file contains types/constants and functions specific to message pipes. |
6 // | 6 // |
7 // Note: This header should be compilable as C. | 7 // Note: This header should be compilable as C. |
8 | 8 |
9 #ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // |MOJO_READ_MESSAGE_FLAG_NONE| - No flags; default mode. | 47 // |MOJO_READ_MESSAGE_FLAG_NONE| - No flags; default mode. |
48 // |MOJO_READ_MESSAGE_FLAG_MAY_DISCARD| - If the message is unable to be read | 48 // |MOJO_READ_MESSAGE_FLAG_MAY_DISCARD| - If the message is unable to be read |
49 // for whatever reason (e.g., the caller-supplied buffer is too small), | 49 // for whatever reason (e.g., the caller-supplied buffer is too small), |
50 // discard the message (i.e., simply dequeue it). | 50 // discard the message (i.e., simply dequeue it). |
51 | 51 |
52 typedef uint32_t MojoReadMessageFlags; | 52 typedef uint32_t MojoReadMessageFlags; |
53 | 53 |
54 #define MOJO_READ_MESSAGE_FLAG_NONE ((MojoReadMessageFlags)0) | 54 #define MOJO_READ_MESSAGE_FLAG_NONE ((MojoReadMessageFlags)0) |
55 #define MOJO_READ_MESSAGE_FLAG_MAY_DISCARD ((MojoReadMessageFlags)1 << 0) | 55 #define MOJO_READ_MESSAGE_FLAG_MAY_DISCARD ((MojoReadMessageFlags)1 << 0) |
56 | 56 |
57 #ifdef __cplusplus | 57 MOJO_BEGIN_EXTERN_C |
58 extern "C" { | |
59 #endif | |
60 | 58 |
61 // Creates a message pipe, which is a bidirectional communication channel for | 59 // Creates a message pipe, which is a bidirectional communication channel for |
62 // framed data (i.e., messages). Messages can contain plain data and/or Mojo | 60 // framed data (i.e., messages). Messages can contain plain data and/or Mojo |
63 // handles. | 61 // handles. |
64 // | 62 // |
65 // |options| may be set to null for a message pipe with the default options. | 63 // |options| may be set to null for a message pipe with the default options. |
66 // | 64 // |
67 // On success, |*message_pipe_handle0| and |*message_pipe_handle1| are set to | 65 // On success, |*message_pipe_handle0| and |*message_pipe_handle1| are set to |
68 // handles for the two endpoints (ports) for the message pipe. | 66 // handles for the two endpoints (ports) for the message pipe. |
69 // | 67 // |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // | 142 // |
145 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should | 143 // TODO(vtl): Reconsider the |MOJO_RESULT_RESOURCE_EXHAUSTED| error code; should |
146 // distinguish this from the hitting-system-limits case. | 144 // distinguish this from the hitting-system-limits case. |
147 MojoResult MojoReadMessage(MojoHandle message_pipe_handle, | 145 MojoResult MojoReadMessage(MojoHandle message_pipe_handle, |
148 void* bytes, // Optional out. | 146 void* bytes, // Optional out. |
149 uint32_t* num_bytes, // Optional in/out. | 147 uint32_t* num_bytes, // Optional in/out. |
150 MojoHandle* handles, // Optional out. | 148 MojoHandle* handles, // Optional out. |
151 uint32_t* num_handles, // Optional in/out. | 149 uint32_t* num_handles, // Optional in/out. |
152 MojoReadMessageFlags flags); | 150 MojoReadMessageFlags flags); |
153 | 151 |
154 #ifdef __cplusplus | 152 MOJO_END_EXTERN_C |
155 } // extern "C" | |
156 #endif | |
157 | 153 |
158 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ | 154 #endif // MOJO_PUBLIC_C_SYSTEM_MESSAGE_PIPE_H_ |
OLD | NEW |