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__
20 #include <sysutils/FrameworkListener.h>
22 #include "NetdCommand.h"
23 #include "NetworkController.h"
25 class DnsProxyListener : public FrameworkListener {
27 DnsProxyListener(const NetworkController* controller);
28 virtual ~DnsProxyListener() {}
31 const NetworkController *mNetCtrl;
32 class GetAddrInfoCmd : public NetdCommand {
34 GetAddrInfoCmd(const NetworkController* controller);
35 virtual ~GetAddrInfoCmd() {}
36 int runCommand(SocketClient *c, int argc, char** argv);
38 const NetworkController* mNetCtrl;
41 class GetAddrInfoHandler {
43 // Note: All of host, service, and hints may be NULL
44 GetAddrInfoHandler(SocketClient *c,
47 struct addrinfo* hints,
49 ~GetAddrInfoHandler();
51 static void* threadStart(void* handler);
56 SocketClient* mClient; // ref counted
58 char* mService; // owned
59 struct addrinfo* mHints; // owned
63 /* ------ gethostbyname ------*/
64 class GetHostByNameCmd : public NetdCommand {
66 GetHostByNameCmd(const NetworkController* controller);
67 virtual ~GetHostByNameCmd() {}
68 int runCommand(SocketClient *c, int argc, char** argv);
70 const NetworkController* mNetCtrl;
73 class GetHostByNameHandler {
75 GetHostByNameHandler(SocketClient *c,
79 ~GetHostByNameHandler();
80 static void* threadStart(void* handler);
84 SocketClient* mClient; //ref counted
90 /* ------ gethostbyaddr ------*/
91 class GetHostByAddrCmd : public NetdCommand {
93 GetHostByAddrCmd(const NetworkController* controller);
94 virtual ~GetHostByAddrCmd() {}
95 int runCommand(SocketClient *c, int argc, char** argv);
97 const NetworkController* mNetCtrl;
100 class GetHostByAddrHandler {
102 GetHostByAddrHandler(SocketClient *c,
107 ~GetHostByAddrHandler();
109 static void* threadStart(void* handler);
114 SocketClient* mClient; // ref counted
115 void* mAddress; // address to lookup; owned
116 int mAddressLen; // length of address to look up
117 int mAddressFamily; // address family