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_SOCKET_ERROR_PARAMS_H_ | 5 #ifndef NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_ |
6 #define NET_SOCKET_SOCKET_ERROR_PARAMS_H_ | 6 #define NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
| 10 #include "net/base/sys_addrinfo.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 // Extra parameters to attach to the NetLog when we receive a socket error. | 14 class HostPortPair; |
14 class SocketErrorParams : public NetLog::EventParameters { | 15 class IPEndPoint; |
15 public: | |
16 SocketErrorParams(int net_error, int os_error); | |
17 | 16 |
18 virtual base::Value* ToValue() const OVERRIDE; | 17 // Creates a NetLog callback for socket error events. |
| 18 NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error, |
| 19 int os_error); |
19 | 20 |
20 protected: | 21 // Creates a NetLog callback for a HostPortPair. |
21 virtual ~SocketErrorParams(); | 22 // |host_and_port| must remain valid for the lifetime of the returned callback. |
| 23 NetLog::ParametersCallback CreateNetLogHostPortPairCallback( |
| 24 const HostPortPair* host_and_port); |
22 | 25 |
23 private: | 26 // Creates a NetLog callback for an IPEndPoint. |
24 const int net_error_; | 27 // |address| must remain valid for the lifetime of the returned callback. |
25 const int os_error_; | 28 NetLog::ParametersCallback CreateNetLogIPEndPointCallback( |
26 }; | 29 const IPEndPoint* address); |
| 30 |
| 31 // Creates a NetLog callback for the source sockaddr on connect events. |
| 32 // |net_address| must remain valid for the lifetime of the returned callback. |
| 33 NetLog::ParametersCallback CreateNetLogSourceAddressCallback( |
| 34 const struct sockaddr* net_address, |
| 35 socklen_t address_len); |
27 | 36 |
28 } // namespace net | 37 } // namespace net |
29 | 38 |
30 #endif // NET_SOCKET_SOCKET_ERROR_PARAMS_H_ | 39 #endif // NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_ |
OLD | NEW |