CommandListener.h revision 89c1e975f0c03997808d35c7be10b244c5309f9f
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" 2989c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk#include "ResolverController.h" 30d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 31d18304287dbabc7835be771400b85d4ae8b63de6San Mehatclass CommandListener : public FrameworkListener { 329d10b341a0ba46f108cb96e46691197d778cbc06San Mehat static TetherController *sTetherCtrl; 339ff78fb7da7158f5bd7c86d89a842691820259cfSan Mehat static NatController *sNatCtrl; 34d5573d34c8fac49e16b20cf144486125bf940086San Mehat static PppController *sPppCtrl; 351bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat static PanController *sPanCtrl; 365af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt static SoftapController *sSoftapCtrl; 373e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt static UsbController *sUsbCtrl; 3889c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk static ResolverController *sResolverCtrl; 399d10b341a0ba46f108cb96e46691197d778cbc06San Mehat 40d18304287dbabc7835be771400b85d4ae8b63de6San Mehatpublic: 41d18304287dbabc7835be771400b85d4ae8b63de6San Mehat CommandListener(); 42d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~CommandListener() {} 43d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 44d18304287dbabc7835be771400b85d4ae8b63de6San Mehatprivate: 45d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 468e46896b4c4be5deaef651a12b17314f63ae9070San Mehat static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx); 478e46896b4c4be5deaef651a12b17314f63ae9070San Mehat 483e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt class UsbCmd : public NetdCommand { 493e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt public: 503e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt UsbCmd(); 513e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt virtual ~UsbCmd() {} 523e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt int runCommand(SocketClient *c, int argc, char ** argv); 533e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt }; 543e6ba3ce1abda6071d5b01f53ca6039bb7b5e2d3Robert Greenwalt 555af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt class SoftapCmd : public NetdCommand { 565af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt public: 575af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt SoftapCmd(); 585af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt virtual ~SoftapCmd() {} 595af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt int runCommand(SocketClient *c, int argc, char ** argv); 605af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt }; 615af38c360587ca2eef0badf6137ccf018f8cd4aaDmitry Shmidt 625c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat class InterfaceCmd : public NetdCommand { 63d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 645c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat InterfaceCmd(); 655c1b8af16dbbc20c89aaca2f93e725e12b16d055San Mehat virtual ~InterfaceCmd() {} 66d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 67d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 68d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 69d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class IpFwdCmd : public NetdCommand { 70d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 71d18304287dbabc7835be771400b85d4ae8b63de6San Mehat IpFwdCmd(); 72d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~IpFwdCmd() {} 73d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 74d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 75d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 76d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class TetherCmd : public NetdCommand { 77d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 78d18304287dbabc7835be771400b85d4ae8b63de6San Mehat TetherCmd(); 79d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~TetherCmd() {} 80d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 81d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 82d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 83d18304287dbabc7835be771400b85d4ae8b63de6San Mehat class NatCmd : public NetdCommand { 84d18304287dbabc7835be771400b85d4ae8b63de6San Mehat public: 85d18304287dbabc7835be771400b85d4ae8b63de6San Mehat NatCmd(); 86d18304287dbabc7835be771400b85d4ae8b63de6San Mehat virtual ~NatCmd() {} 87d18304287dbabc7835be771400b85d4ae8b63de6San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 88d18304287dbabc7835be771400b85d4ae8b63de6San Mehat }; 89d5573d34c8fac49e16b20cf144486125bf940086San Mehat 90d5573d34c8fac49e16b20cf144486125bf940086San Mehat class ListTtysCmd : public NetdCommand { 91d5573d34c8fac49e16b20cf144486125bf940086San Mehat public: 92d5573d34c8fac49e16b20cf144486125bf940086San Mehat ListTtysCmd(); 93d5573d34c8fac49e16b20cf144486125bf940086San Mehat virtual ~ListTtysCmd() {} 94d5573d34c8fac49e16b20cf144486125bf940086San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 95d5573d34c8fac49e16b20cf144486125bf940086San Mehat }; 96d5573d34c8fac49e16b20cf144486125bf940086San Mehat 97d5573d34c8fac49e16b20cf144486125bf940086San Mehat class PppdCmd : public NetdCommand { 98d5573d34c8fac49e16b20cf144486125bf940086San Mehat public: 99d5573d34c8fac49e16b20cf144486125bf940086San Mehat PppdCmd(); 100d5573d34c8fac49e16b20cf144486125bf940086San Mehat virtual ~PppdCmd() {} 101d5573d34c8fac49e16b20cf144486125bf940086San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 102d5573d34c8fac49e16b20cf144486125bf940086San Mehat }; 1031bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat 1041bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat class PanCmd : public NetdCommand { 1051bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat public: 1061bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat PanCmd(); 1071bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat virtual ~PanCmd() {} 1081bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat int runCommand(SocketClient *c, int argc, char ** argv); 1091bdac9e98c1ef37ba568b6cf23bfbc09cfe6bf15San Mehat }; 11089c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk 11189c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk class ResolverCmd : public NetdCommand { 11289c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk public: 11389c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk ResolverCmd(); 11489c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk virtual ~ResolverCmd() {} 11589c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk int runCommand(SocketClient *c, int argc, char ** argv); 11689c1e975f0c03997808d35c7be10b244c5309f9fMattias Falk }; 117d18304287dbabc7835be771400b85d4ae8b63de6San Mehat}; 118d18304287dbabc7835be771400b85d4ae8b63de6San Mehat 119d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#endif 120