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
3// found in the LICENSE file.
4
5#ifndef NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_
6#define NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_
7
8#include "net/base/net_log.h"
9#include "net/base/sys_addrinfo.h"
10
11namespace net {
12
13class HostPortPair;
14class IPEndPoint;
15
16// Creates a NetLog callback for socket error events.
17NetLog::ParametersCallback CreateNetLogSocketErrorCallback(int net_error,
18                                                           int os_error);
19
20// Creates a NetLog callback for a HostPortPair.
21// |host_and_port| must remain valid for the lifetime of the returned callback.
22NetLog::ParametersCallback CreateNetLogHostPortPairCallback(
23    const HostPortPair* host_and_port);
24
25// Creates a NetLog callback for an IPEndPoint.
26// |address| must remain valid for the lifetime of the returned callback.
27NetLog::ParametersCallback CreateNetLogIPEndPointCallback(
28    const IPEndPoint* address);
29
30// Creates a NetLog callback for the source sockaddr on connect events.
31// |net_address| must remain valid for the lifetime of the returned callback.
32NetLog::ParametersCallback CreateNetLogSourceAddressCallback(
33    const struct sockaddr* net_address,
34    socklen_t address_len);
35
36}  // namespace net
37
38#endif  // NET_SOCKET_SOCKET_NET_LOG_PARAMS_H_
39