CommandListener.h revision 5c1b8af16dbbc20c89aaca2f93e725e12b16d055
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 28class CommandListener : public FrameworkListener { 29 static TetherController *sTetherCtrl; 30 static NatController *sNatCtrl; 31 static PppController *sPppCtrl; 32 static PanController *sPanCtrl; 33 34public: 35 CommandListener(); 36 virtual ~CommandListener() {} 37 38private: 39 40 class InterfaceCmd : public NetdCommand { 41 public: 42 InterfaceCmd(); 43 virtual ~InterfaceCmd() {} 44 int runCommand(SocketClient *c, int argc, char ** argv); 45 }; 46 47 class IpFwdCmd : public NetdCommand { 48 public: 49 IpFwdCmd(); 50 virtual ~IpFwdCmd() {} 51 int runCommand(SocketClient *c, int argc, char ** argv); 52 }; 53 54 class TetherCmd : public NetdCommand { 55 public: 56 TetherCmd(); 57 virtual ~TetherCmd() {} 58 int runCommand(SocketClient *c, int argc, char ** argv); 59 }; 60 61 class NatCmd : public NetdCommand { 62 public: 63 NatCmd(); 64 virtual ~NatCmd() {} 65 int runCommand(SocketClient *c, int argc, char ** argv); 66 }; 67 68 class ListTtysCmd : public NetdCommand { 69 public: 70 ListTtysCmd(); 71 virtual ~ListTtysCmd() {} 72 int runCommand(SocketClient *c, int argc, char ** argv); 73 }; 74 75 class PppdCmd : public NetdCommand { 76 public: 77 PppdCmd(); 78 virtual ~PppdCmd() {} 79 int runCommand(SocketClient *c, int argc, char ** argv); 80 }; 81 82 class PanCmd : public NetdCommand { 83 public: 84 PanCmd(); 85 virtual ~PanCmd() {} 86 int runCommand(SocketClient *c, int argc, char ** argv); 87 }; 88}; 89 90#endif 91