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 data pipes. | 5 // This file contains types/constants and functions specific to data 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_DATA_PIPE_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and | 75 // |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and |
76 // |MojoBeginReadData()|. | 76 // |MojoBeginReadData()|. |
77 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. | 77 // |MOJO_READ_DATA_FLAG_NONE| - No flags; default mode. |
78 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested | 78 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| - Read (or discard) either the requested |
79 // number of elements or none. | 79 // number of elements or none. |
80 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of | 80 // |MOJO_READ_DATA_FLAG_DISCARD| - Discard (up to) the requested number of |
81 // elements. | 81 // elements. |
82 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to | 82 // |MOJO_READ_DATA_FLAG_QUERY| - Query the number of elements available to |
83 // read. For use with |MojoReadData()| only. Mutually exclusive with | 83 // read. For use with |MojoReadData()| only. Mutually exclusive with |
84 // |MOJO_READ_DATA_FLAG_DISCARD| and |MOJO_READ_DATA_FLAG_ALL_OR_NONE| is | 84 // |MOJO_READ_DATA_FLAG_DISCARD|, and |MOJO_READ_DATA_FLAG_ALL_OR_NONE| |
85 // ignored if this flag is set. | 85 // is ignored if this flag is set. |
86 // |MOJO_READ_DATA_FLAG_PEEK| - Read elements without removing them. For use | 86 // |MOJO_READ_DATA_FLAG_PEEK| - Read elements without removing them. For use |
87 // with |MojoReadData()| only. Mutually exclusive with | 87 // with |MojoReadData()| only. Mutually exclusive with |
88 // |MOJO_READ_DATA_FLAG_DISCARD| and |MOJO_READ_DATA_FLAG_QUERY|. | 88 // |MOJO_READ_DATA_FLAG_DISCARD| and |MOJO_READ_DATA_FLAG_QUERY|. |
89 | 89 |
90 typedef uint32_t MojoReadDataFlags; | 90 typedef uint32_t MojoReadDataFlags; |
91 | 91 |
92 #ifdef __cplusplus | 92 #ifdef __cplusplus |
93 const MojoReadDataFlags MOJO_READ_DATA_FLAG_NONE = 0; | 93 const MojoReadDataFlags MOJO_READ_DATA_FLAG_NONE = 0; |
94 const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0; | 94 const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0; |
95 const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD = 1 << 1; | 95 const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD = 1 << 1; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // If |flags| has neither |MOJO_READ_DATA_FLAG_DISCARD| nor | 257 // If |flags| has neither |MOJO_READ_DATA_FLAG_DISCARD| nor |
258 // |MOJO_READ_DATA_FLAG_QUERY| set, this tries to read up to |*num_bytes| (which | 258 // |MOJO_READ_DATA_FLAG_QUERY| set, this tries to read up to |*num_bytes| (which |
259 // must be a multiple of the data pipe's element size) bytes of data to | 259 // must be a multiple of the data pipe's element size) bytes of data to |
260 // |elements| and set |*num_bytes| to the amount actually read. If flags has | 260 // |elements| and set |*num_bytes| to the amount actually read. If flags has |
261 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set, it will either read exactly | 261 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set, it will either read exactly |
262 // |*num_bytes| bytes of data or none. Additionally, if flags has | 262 // |*num_bytes| bytes of data or none. Additionally, if flags has |
263 // |MOJO_READ_DATA_FLAG_PEEK| set, the data read will remain in the pipe and be | 263 // |MOJO_READ_DATA_FLAG_PEEK| set, the data read will remain in the pipe and be |
264 // available to future reads. | 264 // available to future reads. |
265 // | 265 // |
266 // If flags has |MOJO_READ_DATA_FLAG_DISCARD| set, it discards up to | 266 // If flags has |MOJO_READ_DATA_FLAG_DISCARD| set, it discards up to |
267 // |*num_bytes| (which again be a multiple of the element size) bytes of data, | 267 // |*num_bytes| (which again must be a multiple of the element size) bytes of |
268 // setting |*num_bytes| to the amount actually discarded. If flags has | 268 // data, setting |*num_bytes| to the amount actually discarded. If flags has |
269 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE|, it will either discard exactly | 269 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE|, it will either discard exactly |
270 // |*num_bytes| bytes of data or none. In this case, |MOJO_READ_DATA_FLAG_QUERY| | 270 // |*num_bytes| bytes of data or none. In this case, |MOJO_READ_DATA_FLAG_QUERY| |
271 // must not be set, and |elements| is ignored (and should typically be set to | 271 // must not be set, and |elements| is ignored (and should typically be set to |
272 // null). | 272 // null). |
273 // | 273 // |
274 // If flags has |MOJO_READ_DATA_FLAG_QUERY| set, it queries the amount of data | 274 // If flags has |MOJO_READ_DATA_FLAG_QUERY| set, it queries the amount of data |
275 // available, setting |*num_bytes| to the number of bytes available. In this | 275 // available, setting |*num_bytes| to the number of bytes available. In this |
276 // case, |MOJO_READ_DATA_FLAG_DISCARD| must not be set, and | 276 // case, |MOJO_READ_DATA_FLAG_DISCARD| must not be set, and |
277 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| is ignored, as are |elements| and the input | 277 // |MOJO_READ_DATA_FLAG_ALL_OR_NONE| is ignored, as are |elements| and the input |
278 // value of |*num_bytes|. | 278 // value of |*num_bytes|. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // |MojoEndReadData()| has already been called). | 364 // |MojoEndReadData()| has already been called). |
365 MOJO_SYSTEM_EXPORT MojoResult | 365 MOJO_SYSTEM_EXPORT MojoResult |
366 MojoEndReadData(MojoHandle data_pipe_consumer_handle, | 366 MojoEndReadData(MojoHandle data_pipe_consumer_handle, |
367 uint32_t num_bytes_read); | 367 uint32_t num_bytes_read); |
368 | 368 |
369 #ifdef __cplusplus | 369 #ifdef __cplusplus |
370 } // extern "C" | 370 } // extern "C" |
371 #endif | 371 #endif |
372 | 372 |
373 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ | 373 #endif // MOJO_PUBLIC_C_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |