2 * Copyright (C) 2008 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 _COMMANDLISTENER_H__
18 #define _COMMANDLISTENER_H__
20 #include <sysutils/FrameworkListener.h>
22 #include "NetdCommand.h"
23 #include "TetherController.h"
24 #include "NatController.h"
25 #include "PppController.h"
26 #include "PanController.h"
27 #include "SoftapController.h"
28 #include "BandwidthController.h"
29 #include "ResolverController.h"
31 class CommandListener : public FrameworkListener {
32 static TetherController *sTetherCtrl;
33 static NatController *sNatCtrl;
34 static PppController *sPppCtrl;
35 static PanController *sPanCtrl;
36 static SoftapController *sSoftapCtrl;
37 static BandwidthController *sBandwidthCtrl;
38 static ResolverController *sResolverCtrl;
42 virtual ~CommandListener() {}
46 static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx);
48 class SoftapCmd : public NetdCommand {
51 virtual ~SoftapCmd() {}
52 int runCommand(SocketClient *c, int argc, char ** argv);
55 class InterfaceCmd : public NetdCommand {
58 virtual ~InterfaceCmd() {}
59 int runCommand(SocketClient *c, int argc, char ** argv);
62 class IpFwdCmd : public NetdCommand {
65 virtual ~IpFwdCmd() {}
66 int runCommand(SocketClient *c, int argc, char ** argv);
69 class TetherCmd : public NetdCommand {
72 virtual ~TetherCmd() {}
73 int runCommand(SocketClient *c, int argc, char ** argv);
76 class NatCmd : public NetdCommand {
80 int runCommand(SocketClient *c, int argc, char ** argv);
83 class ListTtysCmd : public NetdCommand {
86 virtual ~ListTtysCmd() {}
87 int runCommand(SocketClient *c, int argc, char ** argv);
90 class PppdCmd : public NetdCommand {
94 int runCommand(SocketClient *c, int argc, char ** argv);
97 class PanCmd : public NetdCommand {
101 int runCommand(SocketClient *c, int argc, char ** argv);
104 class BandwidthControlCmd : public NetdCommand {
106 BandwidthControlCmd();
107 virtual ~BandwidthControlCmd() {}
108 int runCommand(SocketClient *c, int argc, char ** argv);
111 class ResolverCmd : public NetdCommand {
114 virtual ~ResolverCmd() {}
115 int runCommand(SocketClient *c, int argc, char ** argv);