OSDN Git Service

Merge "Replace custom logwrapper implementation with liblogwrap"
[android-x86/system-netd.git] / CommandListener.h
index 05e990e..e8d92a8 100644 (file)
 #include "TetherController.h"
 #include "NatController.h"
 #include "PppController.h"
-#include "PanController.h"
 #include "SoftapController.h"
 #include "BandwidthController.h"
+#include "IdletimerController.h"
+#include "InterfaceController.h"
 #include "ResolverController.h"
+#include "SecondaryTableController.h"
+#include "FirewallController.h"
+#include "ClatdController.h"
 
 class CommandListener : public FrameworkListener {
     static TetherController *sTetherCtrl;
     static NatController *sNatCtrl;
     static PppController *sPppCtrl;
-    static PanController *sPanCtrl;
     static SoftapController *sSoftapCtrl;
     static BandwidthController *sBandwidthCtrl;
+    static IdletimerController *sIdletimerCtrl;
+    static InterfaceController *sInterfaceCtrl;
     static ResolverController *sResolverCtrl;
+    static SecondaryTableController *sSecondaryTableCtrl;
+    static FirewallController *sFirewallCtrl;
+    static ClatdController *sClatdCtrl;
 
 public:
     CommandListener();
@@ -43,6 +51,8 @@ public:
 
 private:
 
+    static int writeFile(const char *path, const char *value, int size);
+
     static int readInterfaceCounters(const char *iface, unsigned long *rx, unsigned long *tx);
 
     class SoftapCmd : public NetdCommand {
@@ -94,17 +104,21 @@ private:
         int runCommand(SocketClient *c, int argc, char ** argv);
     };
 
-    class PanCmd : public NetdCommand {
+    class BandwidthControlCmd : public NetdCommand {
     public:
-        PanCmd();
-        virtual ~PanCmd() {}
+        BandwidthControlCmd();
+        virtual ~BandwidthControlCmd() {}
         int runCommand(SocketClient *c, int argc, char ** argv);
+    protected:
+        void sendGenericOkFail(SocketClient *cli, int cond);
+        void sendGenericOpFailed(SocketClient *cli, const char *errMsg);
+        void sendGenericSyntaxError(SocketClient *cli, const char *usageMsg);
     };
 
-    class BandwidthControlCmd : public NetdCommand {
+    class IdletimerControlCmd : public NetdCommand {
     public:
-        BandwidthControlCmd();
-        virtual ~BandwidthControlCmd() {}
+        IdletimerControlCmd();
+        virtual ~IdletimerControlCmd() {}
         int runCommand(SocketClient *c, int argc, char ** argv);
     };
 
@@ -114,6 +128,23 @@ private:
         virtual ~ResolverCmd() {}
         int runCommand(SocketClient *c, int argc, char ** argv);
     };
+
+    class FirewallCmd: public NetdCommand {
+    public:
+        FirewallCmd();
+        virtual ~FirewallCmd() {}
+        int runCommand(SocketClient *c, int argc, char ** argv);
+    protected:
+        int sendGenericOkFail(SocketClient *cli, int cond);
+        static FirewallRule parseRule(const char* arg);
+    };
+
+    class ClatdCmd : public NetdCommand {
+    public:
+        ClatdCmd();
+        virtual ~ClatdCmd() {}
+        int runCommand(SocketClient *c, int argc, char ** argv);
+    };
 };
 
 #endif