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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 * If bytes_read is 0, causes EOF to be reported to | 72 * If bytes_read is 0, causes EOF to be reported to |
73 * NSS after it reads the last byte from the circular buffer. | 73 * NSS after it reads the last byte from the circular buffer. |
74 * If bytes_read is < 0, it is treated as an NSPR error code. | 74 * If bytes_read is < 0, it is treated as an NSPR error code. |
75 * See nspr/pr/src/md/unix/unix_errors.c for how to | 75 * See nspr/pr/src/md/unix/unix_errors.c for how to |
76 * map from Unix errors to NSPR error codes. | 76 * map from Unix errors to NSPR error codes. |
77 * On EWOULDBLOCK or the equivalent, don't call this function. | 77 * On EWOULDBLOCK or the equivalent, don't call this function. |
78 */ | 78 */ |
79 void memio_PutReadResult(memio_Private *secret, int bytes_read); | 79 void memio_PutReadResult(memio_Private *secret, int bytes_read); |
80 | 80 |
81 /* Ask memio what data it has to send to the network. | 81 /* Ask memio what data it has to send to the network. |
82 * Returns up to two buffers of data by writing the positions and lengths into | 82 * If there was previous a write error, the NSPR error code is returned. |
83 * |buf1|, |len1| and |buf2|, |len2|. | 83 * Otherwise, it returns 0 and provides up to two buffers of data by |
| 84 * writing the positions and lengths into |buf1|, |len1| and |buf2|, |len2|. |
84 */ | 85 */ |
85 void memio_GetWriteParams(memio_Private *secret, | 86 int memio_GetWriteParams(memio_Private *secret, |
86 const char **buf1, unsigned int *len1, | 87 const char **buf1, unsigned int *len1, |
87 const char **buf2, unsigned int *len2); | 88 const char **buf2, unsigned int *len2); |
88 | 89 |
89 /* Tell memio how many bytes were sent to the network. | 90 /* Tell memio how many bytes were sent to the network. |
90 * If bytes_written is < 0, it is treated as an NSPR error code. | 91 * If bytes_written is < 0, it is treated as an NSPR error code. |
91 * See nspr/pr/src/md/unix/unix_errors.c for how to | 92 * See nspr/pr/src/md/unix/unix_errors.c for how to |
92 * map from Unix errors to NSPR error codes. | 93 * map from Unix errors to NSPR error codes. |
93 * On EWOULDBLOCK or the equivalent, don't call this function. | 94 * On EWOULDBLOCK or the equivalent, don't call this function. |
94 */ | 95 */ |
95 void memio_PutWriteResult(memio_Private *secret, int bytes_written); | 96 void memio_PutWriteResult(memio_Private *secret, int bytes_written); |
96 | 97 |
97 #ifdef __cplusplus | 98 #ifdef __cplusplus |
98 } | 99 } |
99 #endif | 100 #endif |
100 | 101 |
101 #endif | 102 #endif |
OLD | NEW |