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

Side by Side Diff: net/base/nss_memio.h

Issue 1589001: memio_SetPeerName implicitly assumes that struct sockaddr is the same as... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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
« no previous file with comments | « no previous file | net/base/nss_memio.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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
11 #ifdef __cplusplus 11 #ifdef __cplusplus
12 extern "C" { 12 extern "C" {
13 #endif 13 #endif
14 14
15 #include "prio.h" 15 #include "prio.h"
16 16
17 struct sockaddr;
18
19 /* Opaque structure. Really just a more typesafe alias for PRFilePrivate. */ 17 /* Opaque structure. Really just a more typesafe alias for PRFilePrivate. */
20 struct memio_Private; 18 struct memio_Private;
21 typedef struct memio_Private memio_Private; 19 typedef struct memio_Private memio_Private;
22 20
23 /*---------------------------------------------------------------------- 21 /*----------------------------------------------------------------------
24 NSPR I/O layer that terminates in a pair of circular buffers 22 NSPR I/O layer that terminates in a pair of circular buffers
25 rather than talking to the real network. 23 rather than talking to the real network.
26 To use this with NSS: 24 To use this with NSS:
27 1) call memio_CreateIOLayer to create a fake NSPR socket 25 1) call memio_CreateIOLayer to create a fake NSPR socket
28 2) call SSL_ImportFD to ssl-ify the socket 26 2) call SSL_ImportFD to ssl-ify the socket
29 3) Do your own networking calls to set up a TCP connection 27 3) Do your own networking calls to set up a TCP connection
30 4) call memio_SetPeerName to tell NSS about the other end of the connection 28 4) call memio_SetPeerName to tell NSS about the other end of the connection
31 5) While at the same time doing plaintext nonblocking NSPR I/O as 29 5) While at the same time doing plaintext nonblocking NSPR I/O as
32 usual to the nspr file descriptor returned by SSL_ImportFD, 30 usual to the nspr file descriptor returned by SSL_ImportFD,
33 your app must shuttle encrypted data between 31 your app must shuttle encrypted data between
34 the real network and memio's network buffers. 32 the real network and memio's network buffers.
35 memio_GetReadParams/memio_PutReadResult 33 memio_GetReadParams/memio_PutReadResult
36 are the hooks you need to pump data into memio's input buffer, 34 are the hooks you need to pump data into memio's input buffer,
37 and memio_GetWriteParams/memio_PutWriteResult 35 and memio_GetWriteParams/memio_PutWriteResult
38 are the hooks you need to pump data out of memio's output buffer. 36 are the hooks you need to pump data out of memio's output buffer.
39 ----------------------------------------------------------------------*/ 37 ----------------------------------------------------------------------*/
40 38
41 /* Create the I/O layer and its two circular buffers. */ 39 /* Create the I/O layer and its two circular buffers. */
42 PRFileDesc *memio_CreateIOLayer(int bufsize); 40 PRFileDesc *memio_CreateIOLayer(int bufsize);
43 41
44 /* Must call before trying to make an ssl connection */ 42 /* Must call before trying to make an ssl connection */
45 void memio_SetPeerName(PRFileDesc *fd, const struct sockaddr *peername, 43 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername);
46 size_t peername_len);
47 44
48 /* Return a private pointer needed by the following 45 /* Return a private pointer needed by the following
49 * four functions. (We could have passed a PRFileDesc to 46 * four functions. (We could have passed a PRFileDesc to
50 * them, but that would be slower. Better for the caller 47 * them, but that would be slower. Better for the caller
51 * to grab the pointer once and cache it. 48 * to grab the pointer once and cache it.
52 * This may be a premature optimization.) 49 * This may be a premature optimization.)
53 */ 50 */
54 memio_Private *memio_GetSecret(PRFileDesc *fd); 51 memio_Private *memio_GetSecret(PRFileDesc *fd);
55 52
56 /* Ask memio where to put bytes from the network, and how many it can handle. 53 /* Ask memio where to put bytes from the network, and how many it can handle.
(...skipping 25 matching lines...) Expand all
82 * On EWOULDBLOCK or the equivalent, don't call this function. 79 * On EWOULDBLOCK or the equivalent, don't call this function.
83 */ 80 */
84 void memio_PutWriteResult(memio_Private *secret, int bytes_written); 81 void memio_PutWriteResult(memio_Private *secret, int bytes_written);
85 82
86 83
87 #ifdef __cplusplus 84 #ifdef __cplusplus
88 } 85 }
89 #endif 86 #endif
90 87
91 #endif 88 #endif
OLDNEW
« no previous file with comments | « no previous file | net/base/nss_memio.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698