CommandListener.h revision 89c1e975f0c03997808d35c7be10b244c5309f9f
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 "UsbController.h" 29#include "ResolverController.h" 30 31class 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 UsbController *sUsbCtrl; 38 static ResolverController *sResolverCtrl; 39 40public: 41 CommandListener(); 42 virtual ~CommandListener() {} 43 44private: 45 46 static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx); 47 48 class UsbCmd : public NetdCommand { 49 public: 50 UsbCmd(); 51 virtual ~UsbCmd() {} 52 int runCommand(SocketClient *c, int argc, char ** argv); 53 }; 54 55 class SoftapCmd : public NetdCommand { 56 public: 57 SoftapCmd(); 58 virtual ~SoftapCmd() {} 59 int runCommand(SocketClient *c, int argc, char ** argv); 60 }; 61 62 class InterfaceCmd : public NetdCommand { 63 public: 64 InterfaceCmd(); 65 virtual ~InterfaceCmd() {} 66 int runCommand(SocketClient *c, int argc, char ** argv); 67 }; 68 69 class IpFwdCmd : public NetdCommand { 70 public: 71 IpFwdCmd(); 72 virtual ~IpFwdCmd() {} 73 int runCommand(SocketClient *c, int argc, char ** argv); 74 }; 75 76 class TetherCmd : public NetdCommand { 77 public: 78 TetherCmd(); 79 virtual ~TetherCmd() {} 80 int runCommand(SocketClient *c, int argc, char ** argv); 81 }; 82 83 class NatCmd : public NetdCommand { 84 public: 85 NatCmd(); 86 virtual ~NatCmd() {} 87 int runCommand(SocketClient *c, int argc, char ** argv); 88 }; 89 90 class ListTtysCmd : public NetdCommand { 91 public: 92 ListTtysCmd(); 93 virtual ~ListTtysCmd() {} 94 int runCommand(SocketClient *c, int argc, char ** argv); 95 }; 96 97 class PppdCmd : public NetdCommand { 98 public: 99 PppdCmd(); 100 virtual ~PppdCmd() {} 101 int runCommand(SocketClient *c, int argc, char ** argv); 102 }; 103 104 class PanCmd : public NetdCommand { 105 public: 106 PanCmd(); 107 virtual ~PanCmd() {} 108 int runCommand(SocketClient *c, int argc, char ** argv); 109 }; 110 111 class ResolverCmd : public NetdCommand { 112 public: 113 ResolverCmd(); 114 virtual ~ResolverCmd() {} 115 int runCommand(SocketClient *c, int argc, char ** argv); 116 }; 117}; 118 119#endif 120