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