| 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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 6 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 7 // for details. All rights reserved. Use of this source code is governed by a | 7 // for details. All rights reserved. Use of this source code is governed by a |
| 8 // BSD-style license that can be found in the LICENSE file. | 8 // BSD-style license that can be found in the LICENSE file. |
| 9 | 9 |
| 10 // This file is a modified copy of Chromium's src/net/base/nss_memio.h. | 10 // This file is a modified copy of Chromium's src/net/base/nss_memio.h. |
| 11 // char* has been changed to uint8_t* everywhere, and C++ casts are used. | 11 // char* has been changed to uint8_t* everywhere, and C++ casts are used. |
| 12 // Revision 257452 (this should agree with "nss_rev" in DEPS). | 12 // Revision 291806 (this should agree with "nss_rev" in DEPS). |
| 13 | 13 |
| 14 #ifndef BIN_NET_NSS_MEMIO_H_ | 14 #ifndef BIN_NET_NSS_MEMIO_H_ |
| 15 #define BIN_NET_NSS_MEMIO_H_ | 15 #define BIN_NET_NSS_MEMIO_H_ |
| 16 | 16 |
| 17 #include <stddef.h> | 17 #include <stddef.h> |
| 18 #include "vm/globals.h" | 18 #include "vm/globals.h" |
| 19 | 19 |
| 20 #ifdef __cplusplus | 20 #ifdef __cplusplus |
| 21 extern "C" { | 21 extern "C" { |
| 22 #endif | 22 #endif |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 * If bytes_read is 0, causes EOF to be reported to | 81 * If bytes_read is 0, causes EOF to be reported to |
| 82 * NSS after it reads the last byte from the circular buffer. | 82 * NSS after it reads the last byte from the circular buffer. |
| 83 * If bytes_read is < 0, it is treated as an NSPR error code. | 83 * If bytes_read is < 0, it is treated as an NSPR error code. |
| 84 * See nspr/pr/src/md/unix/unix_errors.c for how to | 84 * See nspr/pr/src/md/unix/unix_errors.c for how to |
| 85 * map from Unix errors to NSPR error codes. | 85 * map from Unix errors to NSPR error codes. |
| 86 * On EWOULDBLOCK or the equivalent, don't call this function. | 86 * On EWOULDBLOCK or the equivalent, don't call this function. |
| 87 */ | 87 */ |
| 88 void memio_PutReadResult(memio_Private *secret, int bytes_read); | 88 void memio_PutReadResult(memio_Private *secret, int bytes_read); |
| 89 | 89 |
| 90 /* Ask memio what data it has to send to the network. | 90 /* Ask memio what data it has to send to the network. |
| 91 * Returns up to two buffers of data by writing the positions and lengths into | 91 * If there was previous a write error, the NSPR error code is returned. |
| 92 * |buf1|, |len1| and |buf2|, |len2|. | 92 * Otherwise, it returns 0 and provides up to two buffers of data by |
| 93 * writing the positions and lengths into |buf1|, |len1| and |buf2|, |len2|. |
| 93 */ | 94 */ |
| 94 void memio_GetWriteParams(memio_Private *secret, | 95 int memio_GetWriteParams(memio_Private *secret, |
| 95 const uint8_t **buf1, unsigned int *len1, | 96 const uint8_t **buf1, unsigned int *len1, |
| 96 const uint8_t **buf2, unsigned int *len2); | 97 const uint8_t **buf2, unsigned int *len2); |
| 97 | 98 |
| 98 /* Tell memio how many bytes were sent to the network. | 99 /* Tell memio how many bytes were sent to the network. |
| 99 * If bytes_written is < 0, it is treated as an NSPR error code. | 100 * If bytes_written is < 0, it is treated as an NSPR error code. |
| 100 * See nspr/pr/src/md/unix/unix_errors.c for how to | 101 * See nspr/pr/src/md/unix/unix_errors.c for how to |
| 101 * map from Unix errors to NSPR error codes. | 102 * map from Unix errors to NSPR error codes. |
| 102 * On EWOULDBLOCK or the equivalent, don't call this function. | 103 * On EWOULDBLOCK or the equivalent, don't call this function. |
| 103 */ | 104 */ |
| 104 void memio_PutWriteResult(memio_Private *secret, int bytes_written); | 105 void memio_PutWriteResult(memio_Private *secret, int bytes_written); |
| 105 | 106 |
| 106 #ifdef __cplusplus | 107 #ifdef __cplusplus |
| 107 } | 108 } |
| 108 #endif | 109 #endif |
| 109 | 110 |
| 110 #endif // BIN_NET_NSS_MEMIO_H_ | 111 #endif // BIN_NET_NSS_MEMIO_H_ |
| OLD | NEW |