Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Written in NSPR style to also be suitable for adding to the NSS demo suite | 4 // Written in NSPR style to also be suitable for adding to the NSS demo suite |
| 5 | 5 |
| 6 #ifndef __MEMIO_H | 6 #ifndef __MEMIO_H |
| 7 #define __MEMIO_H | 7 #define __MEMIO_H |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername); | 43 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername); |
| 44 | 44 |
| 45 /* Return a private pointer needed by the following | 45 /* Return a private pointer needed by the following |
| 46 * four functions. (We could have passed a PRFileDesc to | 46 * four functions. (We could have passed a PRFileDesc to |
| 47 * them, but that would be slower. Better for the caller | 47 * them, but that would be slower. Better for the caller |
| 48 * to grab the pointer once and cache it. | 48 * to grab the pointer once and cache it. |
| 49 * This may be a premature optimization.) | 49 * This may be a premature optimization.) |
| 50 */ | 50 */ |
| 51 memio_Private *memio_GetSecret(PRFileDesc *fd); | 51 memio_Private *memio_GetSecret(PRFileDesc *fd); |
| 52 | 52 |
| 53 /* Ask memio how many bytes were requested by a higher layer during the last | |
| 54 * read request that could not be satisfied (due to the buffer being empty). | |
| 55 * Returns 0 if there was no unsatisfied read request. | |
| 56 */ | |
| 57 int memio_GetReadRequest(memio_Private *secret); | |
|
wtc
2012/12/20 02:41:22
The specification of this function is not very cle
Ryan Sleevi
2012/12/20 02:55:58
While yes, we only need a bool, I typed it as an i
| |
| 58 | |
| 53 /* Ask memio where to put bytes from the network, and how many it can handle. | 59 /* Ask memio where to put bytes from the network, and how many it can handle. |
| 54 * Returns bytes available to write, or 0 if none available. | 60 * Returns bytes available to write, or 0 if none available. |
| 55 * Puts current buffer position into *buf. | 61 * Puts current buffer position into *buf. |
| 56 */ | 62 */ |
| 57 int memio_GetReadParams(memio_Private *secret, char **buf); | 63 int memio_GetReadParams(memio_Private *secret, char **buf); |
| 58 | 64 |
| 59 /* Tell memio how many bytes were read from the network. | 65 /* Tell memio how many bytes were read from the network. |
| 60 * If bytes_read is 0, causes EOF to be reported to | 66 * If bytes_read is 0, causes EOF to be reported to |
| 61 * NSS after it reads the last byte from the circular buffer. | 67 * NSS after it reads the last byte from the circular buffer. |
| 62 * If bytes_read is < 0, it is treated as an NSPR error code. | 68 * If bytes_read is < 0, it is treated as an NSPR error code. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 80 * map from Unix errors to NSPR error codes. | 86 * map from Unix errors to NSPR error codes. |
| 81 * On EWOULDBLOCK or the equivalent, don't call this function. | 87 * On EWOULDBLOCK or the equivalent, don't call this function. |
| 82 */ | 88 */ |
| 83 void memio_PutWriteResult(memio_Private *secret, int bytes_written); | 89 void memio_PutWriteResult(memio_Private *secret, int bytes_written); |
| 84 | 90 |
| 85 #ifdef __cplusplus | 91 #ifdef __cplusplus |
| 86 } | 92 } |
| 87 #endif | 93 #endif |
| 88 | 94 |
| 89 #endif | 95 #endif |
| OLD | NEW |