blob: 93e9ecd4aae6b195c5e15ddd46099c9b58eb1078 [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
Ben Chanbbdef5f2012-04-23 13:58:15 -07009namespace {
10base::LazyInstance<Ares> g_ares = LAZY_INSTANCE_INITIALIZER;
11} // namespace
Paul Stewartc2350ee2011-10-19 12:28:40 -070012
13Ares::Ares() { }
14
15Ares::~Ares() { }
16
17Ares* Ares::GetInstance() {
18 return g_ares.Pointer();
19}
20
21void Ares::Destroy(ares_channel channel) {
22 ares_destroy(channel);
23}
24
25void Ares::GetHostByName(ares_channel channel,
26 const char *hostname,
27 int family,
28 ares_host_callback callback,
29 void *arg) {
30 ares_gethostbyname(channel, hostname, family, callback, arg);
31}
32
33int Ares::GetSock(ares_channel channel,
34 ares_socket_t *socks,
35 int numsocks) {
36 return ares_getsock(channel, socks, numsocks);
37}
38
39int Ares::InitOptions(ares_channel *channelptr,
40 struct ares_options *options,
41 int optmask) {
42 return ares_init_options(channelptr, options, optmask);
43}
44
45
46void Ares::ProcessFd(ares_channel channel,
47 ares_socket_t read_fd,
48 ares_socket_t write_fd) {
49 return ares_process_fd(channel, read_fd, write_fd);
50}
51
52void Ares::SetLocalDev(ares_channel channel, const char *local_dev_name) {
53 ares_set_local_dev(channel, local_dev_name);
54}
55
56struct timeval *Ares::Timeout(ares_channel channel,
57 struct timeval *maxtv,
58 struct timeval *tv) {
59 return ares_timeout(channel, maxtv, tv);
60}
61
62} // namespace shill