2 * Copyright (C) 2010 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _DNSPROXYLISTENER_H__
18 #define _DNSPROXYLISTENER_H__
21 #include <sysutils/FrameworkListener.h>
23 #include "NetdCommand.h"
25 class DnsProxyListener : public FrameworkListener {
28 virtual ~DnsProxyListener() {}
31 class GetAddrInfoCmd : public NetdCommand {
34 virtual ~GetAddrInfoCmd() {}
35 int runCommand(SocketClient *c, int argc, char** argv);
38 class GetAddrInfoHandler {
40 // Note: All of host, service, and hints may be NULL
41 GetAddrInfoHandler(SocketClient *c,
44 struct addrinfo* hints)
49 ~GetAddrInfoHandler();
51 static void* threadStart(void* handler);
57 SocketClient* mClient; // ref counted
59 char* mService; // owned
60 struct addrinfo* mHints; // owned
63 /* ------ gethostbyaddr ------*/
64 class GetHostByAddrCmd : public NetdCommand {
67 virtual ~GetHostByAddrCmd() {}
68 int runCommand(SocketClient *c, int argc, char** argv);
71 class GetHostByAddrHandler {
73 GetHostByAddrHandler(SocketClient *c,
79 mAddressLen(addressLen),
80 mAddressFamily(addressFamily) {}
81 ~GetHostByAddrHandler();
83 static void* threadStart(void* handler);
89 SocketClient* mClient; // ref counted
90 void* mAddress; // address to lookup; owned
91 int mAddressLen; // length of address to look up
92 int mAddressFamily; // address family