IdletimerController.h revision 98f65d32b1530b4da6050e38d52f955710577efb
10031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall/* 20031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * Copyright (C) 2012 The Android Open Source Project 30031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * 40031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * Licensed under the Apache License, Version 2.0 (the "License"); 50031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * you may not use this file except in compliance with the License. 60031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * You may obtain a copy of the License at 70031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * 80031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * http://www.apache.org/licenses/LICENSE-2.0 90031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * 100031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * Unless required by applicable law or agreed to in writing, software 110031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * distributed under the License is distributed on an "AS IS" BASIS, 120031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * See the License for the specific language governing permissions and 140031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall * limitations under the License. 150031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall */ 160031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall#ifndef _IDLETIMER_CONTROLLER_H 170031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall#define _IDLETIMER_CONTROLLER_H 180031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall 190031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrallclass IdletimerController { 200031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrallpublic: 210031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall 220031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall IdletimerController(); 230031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall virtual ~IdletimerController(); 240031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall 250031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall int enableIdletimerControl(); 260031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall int disableIdletimerControl(); 2798f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai int addInterfaceIdletimer(const char *iface, uint32_t timeout, 2898f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai const char *classLabel); 2998f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai int removeInterfaceIdletimer(const char *iface, uint32_t timeout, 3098f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai const char *classLabel); 310031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall bool setupIptablesHooks(); 320031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall 330031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall private: 340031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall enum IptOp { IptOpAdd, IptOpDelete }; 350031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall int setDefaults(); 360031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall int runIpxtablesCmd(const char *cmd); 3798f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai int modifyInterfaceIdletimer(IptOp op, const char *iface, uint32_t timeout, 3898f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai const char *classLabel); 390031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall}; 400031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall 410031cead820149e2fe3ccb3cc2fe05758a3cb5c2JP Abgrall#endif 42