blob: cdede2c72228f2c2d23a2fe15f37f9fd958254b6 [file] [log] [blame]
Paul Stewartc2350ee2011-10-19 12:28:40 -07001// Copyright (c) 2011 The Chromium OS 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#include "shill/shill_ares.h"
6
7namespace shill {
8
9static base::LazyInstance<Ares> g_ares(base::LINKER_INITIALIZED);
10
11Ares::Ares() { }
12
13Ares::~Ares() { }
14
15Ares* Ares::GetInstance() {
16 return g_ares.Pointer();
17}
18
19void Ares::Destroy(ares_channel channel) {
20 ares_destroy(channel);
21}
22
23void Ares::GetHostByName(ares_channel channel,
24 const char *hostname,
25 int family,
26 ares_host_callback callback,
27 void *arg) {
28 ares_gethostbyname(channel, hostname, family, callback, arg);
29}
30
31int Ares::GetSock(ares_channel channel,
32 ares_socket_t *socks,
33 int numsocks) {
34 return ares_getsock(channel, socks, numsocks);
35}
36
37int Ares::InitOptions(ares_channel *channelptr,
38 struct ares_options *options,
39 int optmask) {
40 return ares_init_options(channelptr, options, optmask);
41}
42
43
44void Ares::ProcessFd(ares_channel channel,
45 ares_socket_t read_fd,
46 ares_socket_t write_fd) {
47 return ares_process_fd(channel, read_fd, write_fd);
48}
49
50void Ares::SetLocalDev(ares_channel channel, const char *local_dev_name) {
51 ares_set_local_dev(channel, local_dev_name);
52}
53
54struct timeval *Ares::Timeout(ares_channel channel,
55 struct timeval *maxtv,
56 struct timeval *tv) {
57 return ares_timeout(channel, maxtv, tv);
58}
59
60} // namespace shill