CommandListener.h revision 786d1122d6a0a7b4bf16fdafe3b710759acc5094
1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17#ifndef _COMMANDLISTENER_H__ 18#define _COMMANDLISTENER_H__ 19 20#include <sysutils/FrameworkListener.h> 21 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 30class CommandListener : public FrameworkListener { 31 static TetherController *sTetherCtrl; 32 static NatController *sNatCtrl; 33 static PppController *sPppCtrl; 34 static PanController *sPanCtrl; 35 static SoftapController *sSoftapCtrl; 36 static BandwidthController *sBandwidthCtrl; 37 38public: 39 CommandListener(); 40 virtual ~CommandListener() {} 41 42private: 43 44 static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx); 45 46 class SoftapCmd : public NetdCommand { 47 public: 48 SoftapCmd(); 49 virtual ~SoftapCmd() {} 50 int runCommand(SocketClient *c, int argc, char ** argv); 51 }; 52 53 class InterfaceCmd : public NetdCommand { 54 public: 55 InterfaceCmd(); 56 virtual ~InterfaceCmd() {} 57 int runCommand(SocketClient *c, int argc, char ** argv); 58 }; 59 60 class IpFwdCmd : public NetdCommand { 61 public: 62 IpFwdCmd(); 63 virtual ~IpFwdCmd() {} 64 int runCommand(SocketClient *c, int argc, char ** argv); 65 }; 66 67 class TetherCmd : public NetdCommand { 68 public: 69 TetherCmd(); 70 virtual ~TetherCmd() {} 71 int runCommand(SocketClient *c, int argc, char ** argv); 72 }; 73 74 class NatCmd : public NetdCommand { 75 public: 76 NatCmd(); 77 virtual ~NatCmd() {} 78 int runCommand(SocketClient *c, int argc, char ** argv); 79 }; 80 81 class ListTtysCmd : public NetdCommand { 82 public: 83 ListTtysCmd(); 84 virtual ~ListTtysCmd() {} 85 int runCommand(SocketClient *c, int argc, char ** argv); 86 }; 87 88 class PppdCmd : public NetdCommand { 89 public: 90 PppdCmd(); 91 virtual ~PppdCmd() {} 92 int runCommand(SocketClient *c, int argc, char ** argv); 93 }; 94 95 class PanCmd : public NetdCommand { 96 public: 97 PanCmd(); 98 virtual ~PanCmd() {} 99 int runCommand(SocketClient *c, int argc, char ** argv); 100 }; 101 102 class BandwidthControlCmd : public NetdCommand { 103 public: 104 BandwidthControlCmd(); 105 virtual ~BandwidthControlCmd() {} 106 int runCommand(SocketClient *c, int argc, char ** argv); 107 }; 108}; 109 110#endif 111