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"
24 class DnsProxyListener : public FrameworkListener {
27 virtual ~DnsProxyListener() {}
30 class GetAddrInfoCmd : public NetdCommand {
33 virtual ~GetAddrInfoCmd() {}
34 int runCommand(SocketClient *c, int argc, char** argv);
37 class GetAddrInfoHandler {
39 // Note: All of host, service, and hints may be NULL
40 GetAddrInfoHandler(SocketClient *c,
43 struct addrinfo* hints)
48 ~GetAddrInfoHandler();
50 static void* threadStart(void* handler);
55 SocketClient* mClient; // ref counted
57 char* mService; // owned
58 struct addrinfo* mHints; // owned
61 /* ------ gethostbyaddr ------*/
62 class GetHostByAddrCmd : public NetdCommand {
65 virtual ~GetHostByAddrCmd() {}
66 int runCommand(SocketClient *c, int argc, char** argv);
69 class GetHostByAddrHandler {
71 GetHostByAddrHandler(SocketClient *c,
77 mAddressLen(addressLen),
78 mAddressFamily(addressFamily) {}
79 ~GetHostByAddrHandler();
81 static void* threadStart(void* handler);
86 SocketClient* mClient; // ref counted
87 void* mAddress; // address to lookup; owned
88 int mAddressLen; // length of address to look up
89 int mAddressFamily; // address family