Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: dart/runtime/bin/net/nss_memio.h

Issue 201853003: Update NSS to NSS 3.16 RTM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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.
9
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.
12 // Revision 257452 (this should agree with "nss_rev" in DEPS).
13
6 #ifndef BIN_NET_NSS_MEMIO_H_ 14 #ifndef BIN_NET_NSS_MEMIO_H_
7 #define BIN_NET_NSS_MEMIO_H_ 15 #define BIN_NET_NSS_MEMIO_H_
8 16
9 #include <stddef.h> 17 #include <stddef.h>
10 #include "vm/globals.h" 18 #include "vm/globals.h"
11 19
12 #ifdef __cplusplus 20 #ifdef __cplusplus
13 extern "C" { 21 extern "C" {
14 #endif 22 #endif
15 23
(...skipping 15 matching lines...) Expand all
31 usual to the nspr file descriptor returned by SSL_ImportFD, 39 usual to the nspr file descriptor returned by SSL_ImportFD,
32 your app must shuttle encrypted data between 40 your app must shuttle encrypted data between
33 the real network and memio's network buffers. 41 the real network and memio's network buffers.
34 memio_GetReadParams/memio_PutReadResult 42 memio_GetReadParams/memio_PutReadResult
35 are the hooks you need to pump data into memio's input buffer, 43 are the hooks you need to pump data into memio's input buffer,
36 and memio_GetWriteParams/memio_PutWriteResult 44 and memio_GetWriteParams/memio_PutWriteResult
37 are the hooks you need to pump data out of memio's output buffer. 45 are the hooks you need to pump data out of memio's output buffer.
38 ----------------------------------------------------------------------*/ 46 ----------------------------------------------------------------------*/
39 47
40 /* Create the I/O layer and its two circular buffers. */ 48 /* Create the I/O layer and its two circular buffers. */
41 PRFileDesc *memio_CreateIOLayer(int bufsize); 49 PRFileDesc *memio_CreateIOLayer(int readbufsize, int writebufsize);
42 50
43 /* Must call before trying to make an ssl connection */ 51 /* Must call before trying to make an ssl connection */
44 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername); 52 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername);
45 53
46 /* Return a private pointer needed by the following 54 /* Return a private pointer needed by the following
47 * four functions. (We could have passed a PRFileDesc to 55 * four functions. (We could have passed a PRFileDesc to
48 * them, but that would be slower. Better for the caller 56 * them, but that would be slower. Better for the caller
49 * to grab the pointer once and cache it. 57 * to grab the pointer once and cache it.
50 * This may be a premature optimization.) 58 * This may be a premature optimization.)
51 */ 59 */
52 memio_Private *memio_GetSecret(PRFileDesc *fd); 60 memio_Private *memio_GetSecret(PRFileDesc *fd);
53 61
62 /* Ask memio how many bytes were requested by a higher layer if the
63 * last attempt to read data resulted in PR_WOULD_BLOCK_ERROR, due to the
64 * transport buffer being empty. If the last attempt to read data from the
65 * memio did not result in PR_WOULD_BLOCK_ERROR, returns 0.
66 */
67 int memio_GetReadRequest(memio_Private *secret);
68
54 /* Ask memio where to put bytes from the network, and how many it can handle. 69 /* Ask memio where to put bytes from the network, and how many it can handle.
55 * Returns bytes available to write, or 0 if none available. 70 * Returns bytes available to write, or 0 if none available.
56 * Puts current buffer position into *buf. 71 * Puts current buffer position into *buf.
57 */ 72 */
58 int memio_GetReadParams(memio_Private *secret, uint8_t **buf); 73 int memio_GetReadParams(memio_Private *secret, uint8_t **buf);
59 74
75 /* Ask memio how many bytes are contained in the internal buffer.
76 * Returns bytes available to read, or 0 if none available.
77 */
78 int memio_GetReadableBufferSize(memio_Private *secret);
79
60 /* Tell memio how many bytes were read from the network. 80 /* Tell memio how many bytes were read from the network.
61 * If bytes_read is 0, causes EOF to be reported to 81 * If bytes_read is 0, causes EOF to be reported to
62 * NSS after it reads the last byte from the circular buffer. 82 * NSS after it reads the last byte from the circular buffer.
63 * 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.
64 * 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
65 * map from Unix errors to NSPR error codes. 85 * map from Unix errors to NSPR error codes.
66 * On EWOULDBLOCK or the equivalent, don't call this function. 86 * On EWOULDBLOCK or the equivalent, don't call this function.
67 */ 87 */
68 void memio_PutReadResult(memio_Private *secret, int bytes_read); 88 void memio_PutReadResult(memio_Private *secret, int bytes_read);
69 89
(...skipping 11 matching lines...) Expand all
81 * map from Unix errors to NSPR error codes. 101 * map from Unix errors to NSPR error codes.
82 * On EWOULDBLOCK or the equivalent, don't call this function. 102 * On EWOULDBLOCK or the equivalent, don't call this function.
83 */ 103 */
84 void memio_PutWriteResult(memio_Private *secret, int bytes_written); 104 void memio_PutWriteResult(memio_Private *secret, int bytes_written);
85 105
86 #ifdef __cplusplus 106 #ifdef __cplusplus
87 } 107 }
88 #endif 108 #endif
89 109
90 #endif // BIN_NET_NSS_MEMIO_H_ 110 #endif // BIN_NET_NSS_MEMIO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698