CommandListener.h revision 8e46896b4c4be5deaef651a12b17314f63ae9070
1d18304287dbabc7835be771400b85d4ae8b63de6San Mehat/* 2d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Copyright (C) 2008 The Android Open Source Project 3d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * 4d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Licensed under the Apache License, Version 2.0 (the "License"); 5d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * you may not use this file except in compliance with the License. 6d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * You may obtain a copy of the License at 7d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * 8d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * http://www.apache.org/licenses/LICENSE-2.0 9d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * 10d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Unless required by applicable law or agreed to in writing, software 11d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * distributed under the License is distributed on an "AS IS" BASIS, 12d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * See the License for the specific language governing permissions and 14d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * limitations under the License. 15d18304287dbabc7835be771400b85d4ae8b63de6San Mehat */ 16d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 17d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#ifndef _COMMANDLISTENER_H__ 18d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#define _COMMANDLISTENER_H__ 19d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 20d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#include <sysutils/FrameworkListener.h> 219ff78fb7da7158f5bd7c86d89a842691820259cfSan Mehat 22d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#include "NetdCommand.h" 239d10b341a0ba46f108cb96e46691197d778cbc06San Mehat#include "TetherController.h" 249ff78fb7da7158f5bd7c86d89a842691820259cfSan Mehat#include "NatController.h" 25d5573d34c8fac49e16b20cf144486125bf940086San Mehat#include "PppController.h" 261bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat#include "PanController.h" 275af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt#include "SoftapController.h" 283e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt#include "UsbController.h" 29d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 30d18304287dbabc7835be771400b85d4ae8b63de6San Mehatclass CommandListener : public FrameworkListener { 319d10b341a0ba46f108cb96e46691197d778cbc06San Mehat static TetherController *sTetherCtrl; 329ff78fb7da7158f5bd7c86d89a842691820259cfSan Mehat static NatController *sNatCtrl; 33d5573d34c8fac49e16b20cf144486125bf940086San Mehat static PppController *sPppCtrl; 341bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat static PanController *sPanCtrl; 355af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt static SoftapController *sSoftapCtrl; 363e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt static UsbController *sUsbCtrl; 379d10b341a0ba46f108cb96e46691197d778cbc06San Mehat 38d18304287dbabc7835be771400b85d4ae8b63de6San Mehatpublic: 39d18304287dbabc7835be771400b85d4ae8b63de6San Mehat CommandListener(); 40d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~CommandListener() {} 41d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 42d18304287dbabc7835be771400b85d4ae8b63de6San Mehatprivate: 43d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 448e46896b4c4be5deaef651a12b17314f63ae9070San Mehat static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx); 458e46896b4c4be5deaef651a12b17314f63ae9070San Mehat 463e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt class UsbCmd : public NetdCommand { 473e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt public: 483e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt UsbCmd(); 493e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt virtual ~UsbCmd() {} 503e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt int runCommand(SocketClient *c, int argc, char ** argv); 513e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt }; 523e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt 535af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt class SoftapCmd : public NetdCommand { 545af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt public: 555af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt SoftapCmd(); 565af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt virtual ~SoftapCmd() {} 575af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int runCommand(SocketClient *c, int argc, char ** argv); 585af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt }; 595af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 605c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat class InterfaceCmd : public NetdCommand { 61d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 625c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat InterfaceCmd(); 635c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat virtual ~InterfaceCmd() {} 64d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 65d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 66d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 67d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class IpFwdCmd : public NetdCommand { 68d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 69d18304287dbabc7835be771400b85d4ae8b63de6San Mehat IpFwdCmd(); 70d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~IpFwdCmd() {} 71d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 72d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 73d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 74d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class TetherCmd : public NetdCommand { 75d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 76d18304287dbabc7835be771400b85d4ae8b63de6San Mehat TetherCmd(); 77d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~TetherCmd() {} 78d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 79d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 80d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 81d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class NatCmd : public NetdCommand { 82d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 83d18304287dbabc7835be771400b85d4ae8b63de6San Mehat NatCmd(); 84d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~NatCmd() {} 85d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 86d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 87d5573d34c8fac49e16b20cf144486125bf940086San Mehat 88d5573d34c8fac49e16b20cf144486125bf940086San Mehat class ListTtysCmd : public NetdCommand { 89d5573d34c8fac49e16b20cf144486125bf940086San Mehat public: 90d5573d34c8fac49e16b20cf144486125bf940086San Mehat ListTtysCmd(); 91d5573d34c8fac49e16b20cf144486125bf940086San Mehat virtual ~ListTtysCmd() {} 92d5573d34c8fac49e16b20cf144486125bf940086San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 93d5573d34c8fac49e16b20cf144486125bf940086San Mehat }; 94d5573d34c8fac49e16b20cf144486125bf940086San Mehat 95d5573d34c8fac49e16b20cf144486125bf940086San Mehat class PppdCmd : public NetdCommand { 96d5573d34c8fac49e16b20cf144486125bf940086San Mehat public: 97d5573d34c8fac49e16b20cf144486125bf940086San Mehat PppdCmd(); 98d5573d34c8fac49e16b20cf144486125bf940086San Mehat virtual ~PppdCmd() {} 99d5573d34c8fac49e16b20cf144486125bf940086San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 100d5573d34c8fac49e16b20cf144486125bf940086San Mehat }; 1011bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat 1021bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat class PanCmd : public NetdCommand { 1031bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat public: 1041bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat PanCmd(); 1051bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat virtual ~PanCmd() {} 1061bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 1071bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat }; 108d18304287dbabc7835be771400b85d4ae8b63de6San Mehat}; 109d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 110d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#endif 111