OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #ifndef NET_SOCKET_STREAM_SOCKET_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_H_ |
6 #define NET_SOCKET_STREAM_SOCKET_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
11 #include "net/socket/next_proto.h" | 11 #include "net/socket/next_proto.h" |
12 #include "net/socket/socket.h" | 12 #include "net/socket/socket.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class AddressList; | 16 class AddressList; |
17 class IPEndPoint; | 17 class IPEndPoint; |
18 class SSLInfo; | |
18 | 19 |
19 class NET_EXPORT_PRIVATE StreamSocket : public Socket { | 20 class NET_EXPORT_PRIVATE StreamSocket : public Socket { |
20 public: | 21 public: |
21 virtual ~StreamSocket() {} | 22 virtual ~StreamSocket() {} |
22 | 23 |
23 // Called to establish a connection. Returns OK if the connection could be | 24 // Called to establish a connection. Returns OK if the connection could be |
24 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the | 25 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the |
25 // given callback will run asynchronously when the connection is established | 26 // given callback will run asynchronously when the connection is established |
26 // or when an error occurs. The result is some other error code if the | 27 // or when an error occurs. The result is some other error code if the |
27 // connection could not be established. | 28 // connection could not be established. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // Returns true if the underlying transport socket is using TCP FastOpen. | 81 // Returns true if the underlying transport socket is using TCP FastOpen. |
81 // TCP FastOpen is an experiment with sending data in the TCP SYN packet. | 82 // TCP FastOpen is an experiment with sending data in the TCP SYN packet. |
82 virtual bool UsingTCPFastOpen() const = 0; | 83 virtual bool UsingTCPFastOpen() const = 0; |
83 | 84 |
84 // Returns the number of bytes successfully read from this socket. | 85 // Returns the number of bytes successfully read from this socket. |
85 virtual int64 NumBytesRead() const = 0; | 86 virtual int64 NumBytesRead() const = 0; |
86 | 87 |
87 // Returns the connection setup time of this socket. | 88 // Returns the connection setup time of this socket. |
88 virtual base::TimeDelta GetConnectTimeMicros() const = 0; | 89 virtual base::TimeDelta GetConnectTimeMicros() const = 0; |
89 | 90 |
91 // Returns true if NPN was negotiated during the connection of this socket. | |
92 virtual bool WasNpnNegotiated() const = 0; | |
Ryan Sleevi
2012/07/11 22:50:43
How is this different than GetNegotiatedProtocol?
Ryan Hamilton
2012/07/11 23:37:25
I believe there is a distinction, though perhaps i
| |
93 | |
90 // Returns the protocol negotiated via NPN for this socket, or | 94 // Returns the protocol negotiated via NPN for this socket, or |
91 // kProtoUnknown will be returned if NPN is not applicable. | 95 // kProtoUnknown will be returned if NPN is not applicable. |
92 virtual NextProto GetNegotiatedProtocol() const = 0; | 96 virtual NextProto GetNegotiatedProtocol() const = 0; |
93 | 97 |
98 // Gets the SSL connection information of the socket. Returns false if | |
99 // SSL was not used by this socket. | |
100 virtual bool GetSSLInfo(SSLInfo* ssl_info) const = 0; | |
101 | |
94 protected: | 102 protected: |
95 // The following class is only used to gather statistics about the history of | 103 // The following class is only used to gather statistics about the history of |
96 // a socket. It is only instantiated and used in basic sockets, such as | 104 // a socket. It is only instantiated and used in basic sockets, such as |
97 // TCPClientSocket* instances. Other classes that are derived from | 105 // TCPClientSocket* instances. Other classes that are derived from |
98 // StreamSocket should forward any potential settings to their underlying | 106 // StreamSocket should forward any potential settings to their underlying |
99 // transport sockets. | 107 // transport sockets. |
100 class UseHistory { | 108 class UseHistory { |
101 public: | 109 public: |
102 UseHistory(); | 110 UseHistory(); |
103 ~UseHistory(); | 111 ~UseHistory(); |
(...skipping 26 matching lines...) Expand all Loading... | |
130 // identify the motivation. | 138 // identify the motivation. |
131 bool omnibox_speculation_; | 139 bool omnibox_speculation_; |
132 bool subresource_speculation_; | 140 bool subresource_speculation_; |
133 DISALLOW_COPY_AND_ASSIGN(UseHistory); | 141 DISALLOW_COPY_AND_ASSIGN(UseHistory); |
134 }; | 142 }; |
135 }; | 143 }; |
136 | 144 |
137 } // namespace net | 145 } // namespace net |
138 | 146 |
139 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 147 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
OLD | NEW |