コード例 #1
0
ファイル: bw_main.py プロジェクト: moxwose/freeIBS
def init():
    global bw_loader
    from core.bandwidth_limit.bw_loader import BWLoader
    bw_loader=BWLoader()
    bw_loader.loadAll()
    registerInParents()

    global tc
    from core.bandwidth_limit.tc import TC
    tc=TC()

    global mark_id_pool
    from core.bandwidth_limit.idpool import IDPool
    mark_id_pool=IDPool([10000,4294967295],"iptables mark")
    
    global iptables
    from core.bandwidth_limit.iptables import IPTables
    iptables=IPTables()
    
    initTree()

    global manager
    from core.bandwidth_limit.bw_manager import BWManager,UpdateCounters
    manager=BWManager()
    periodic_events.getManager().register(UpdateCounters())    
    
    global actions
    from core.bandwidth_limit.bw_actions import BWActions
    actions=BWActions()
    
    from core.bandwidth_limit.bw_handler import BWHandler
    handlers_manager.getManager().registerHandler(BWHandler())

    applyStatics()
コード例 #2
0
def init():
    global radius_server_started
    if defs.RADIUS_SERVER_ENABLED==0:
        return

    toLog("Initializing IBS Radius Server", LOG_DEBUG)

    stat_main.getStatKeeper().registerStat("auth_packets", "int")
    stat_main.getStatKeeper().registerStat("acct_packets", "int")    

    stat_main.getStatKeeper().registerStat("auth_duplicate_packets", "int")
    stat_main.getStatKeeper().registerStat("acct_duplicate_packets", "int")    

    stat_main.getStatKeeper().registerStat("auth_avg_response_time", "seconds")
    stat_main.getStatKeeper().registerStat("acct_avg_response_time", "seconds")    

    stat_main.getStatKeeper().registerStat("auth_max_response_time", "seconds")
    stat_main.getStatKeeper().registerStat("acct_max_response_time", "seconds")    

    global ibs_dic
    ibs_dic=dictionary.Dictionary("%s/radius_server/dictionary"%defs.IBS_ROOT,
				  "%s/radius_server/dictionary.usr"%defs.IBS_ROOT,
				  "%s/radius_server/dictionary.ser"%defs.IBS_ROOT,
				  "%s/radius_server/dictionary.sip"%defs.IBS_ROOT)

    from radius_server.request_list import RequestList, CleanRequestListPeriodicEvent
    global request_list
    request_list = RequestList()
    periodic_events.getManager().register(CleanRequestListPeriodicEvent())

    startRadiusServer()
    radius_server_started=True
コード例 #3
0
ファイル: ras.py プロジェクト: moxwose/freeIBS
    def _registerEvent(self):
	class GeneralUpdateEvent(periodic_events.PeriodicEvent):
	    def __init__(my_self):
		periodic_events.PeriodicEvent.__init__(my_self,"%s general_update"%self.ras_ip,self.getAttribute("general_update_interval"),[],0)

	    def run(my_self):
		self.generalUpdate()
	
	self.__general_update_event=GeneralUpdateEvent()
	periodic_events.getManager().register(self.__general_update_event)
コード例 #4
0
    def _registerEvent(self):
        class GeneralUpdateEvent(periodic_events.PeriodicEvent):
            def __init__(my_self):
                periodic_events.PeriodicEvent.__init__(
                    my_self, "%s general_update" % self.ras_ip,
                    int(self.getAttribute("general_update_interval")), [], 0)

            def run(my_self):
                self.generalUpdate()

        self.__general_update_event = GeneralUpdateEvent()
        periodic_events.getManager().register(self.__general_update_event)
コード例 #5
0
ファイル: ras.py プロジェクト: moxwose/freeIBS
    def _registerEvent(self):
	GeneralUpdateRas._registerEvent(self)
	
	class UpdateUserListEvent(periodic_events.PeriodicEvent):
	    def __init__(my_self):
		periodic_events.PeriodicEvent.__init__(my_self,"%s update userlist"%self.getRasIP(),self.getAttribute("update_users_interval"),[],0)

	    def run(my_self):
		self.updateUserList()

	if self.getAttribute("online_check"):
	    self.__update_userlist_event=UpdateUserListEvent()
	    periodic_events.getManager().register(self.__update_userlist_event)
コード例 #6
0
    def _registerEvent(self):
        GeneralUpdateRas._registerEvent(self)

        class UpdateUserListEvent(periodic_events.PeriodicEvent):
            def __init__(my_self):
                periodic_events.PeriodicEvent.__init__(
                    my_self, "%s update userlist" % self.getRasIP(),
                    int(self.getAttribute("update_users_interval")), [], 0)

            def run(my_self):
                self.updateUserList()

        if self.getAttribute("online_check"):
            self.__update_userlist_event = UpdateUserListEvent()
            periodic_events.getManager().register(self.__update_userlist_event)
コード例 #7
0
ファイル: user_main.py プロジェクト: moxwose/freeIBS
def init():
    from core.user import user_actions,user_plugin,attribute_manager

    global attr_manager
    attr_manager=attribute_manager.AttributeManager()
    
    global user_loader
    from core.user.user_loader import UserLoader
    user_loader=UserLoader()

    global user_pool
    from core.user.user_pool import UserPool
    user_pool=UserPool()
    
    global user_action_manager
    user_action_manager=user_actions.UserActions()

    global user_plugin_manager
    user_plugin_manager=user_plugin.UserPluginManager()

    global credit_change_log_actions
    from core.user.credit_change_log import CreditChangeLogActions
    credit_change_log_actions=CreditChangeLogActions()

    global connection_log_manager
    from core.user.connection_log import ConnectionLogActions
    connection_log_manager=ConnectionLogActions()

    global add_user_save_actions
    from core.user.add_user_save import AddUserSaveActions,AddUserSaveHandler
    add_user_save_actions=AddUserSaveActions()
    handlers_manager.getManager().registerHandler(AddUserSaveHandler())

    global ras_msg_dispatcher
    from core.user.ras_msg_dispatcher import RasMsgDispatcher
    ras_msg_dispatcher=RasMsgDispatcher()
    
    global online
    from core.user.online import OnlineUsers,OnlineCheckPeriodicEvent
    online=OnlineUsers()
    periodic_events.getManager().register(OnlineCheckPeriodicEvent())
    
    
    plugin_loader.loadPlugins(defs.IBS_CORE+"/user/plugins")

    from core.user.user_handler import UserHandler
    handlers_manager.getManager().registerHandler(UserHandler())
コード例 #8
0
def init():
    global bw_loader
    from core.bandwidth_limit.bw_loader import BWLoader
    bw_loader=BWLoader()
    bw_loader.loadAll()
    registerInParents()

    global tc
    from core.bandwidth_limit.tc import TC
    tc=TC()

    global mark_id_pool
    from core.bandwidth_limit.idpool import IDPool
    mark_id_pool=IDPool([10000,4294967295],"iptables mark")
    
    global iptables
    from core.bandwidth_limit.iptables import IPTables
    iptables=IPTables()
    
    initTree()

    global manager
    from core.bandwidth_limit.bw_manager import BWManager,UpdateCounters
    manager=BWManager()
    periodic_events.getManager().register(UpdateCounters())    
    
    global actions
    from core.bandwidth_limit.bw_actions import BWActions
    actions=BWActions()
    
    from core.bandwidth_limit.bw_handler import BWHandler
    handlers_manager.getManager().registerHandler(BWHandler())

    applyStatics()


    setReCreateTreeSignalHandler()
コード例 #9
0
def init():
    global onlines_loop
    from core.snapshot.onlines_loop import OnlinesLoop
    onlines_loop = OnlinesLoop()

    global realtime_manager
    from core.snapshot.realtime_manager import RealTimeManager
    realtime_manager = RealTimeManager()

    from core.snapshot.realtime_manager import RealTimePeriodicEvent
    periodic_events.getManager().register(RealTimePeriodicEvent())

    plugin_loader.loadPlugins(defs.IBS_CORE + "/snapshot/plugins")

    from core.snapshot.snapshot_handler import SnapShotHandler
    handlers_manager.getManager().registerHandler(SnapShotHandler())

    from core.snapshot.bw_snapshot import BWSnapShotOnlinesLoopClient
    getOnlinesLoop().registerClient(BWSnapShotOnlinesLoopClient())

    from core.snapshot.onlines_snapshot import OnlinesSnapShotOnlinesLoopClient
    getOnlinesLoop().registerClient(OnlinesSnapShotOnlinesLoopClient())

    getOnlinesLoop().doLoop()  #do loop for first time
コード例 #10
0
ファイル: user_main.py プロジェクト: sankopay/IBSng
def init():
    global user_audit_log_manager
    from core.user.user_audit_log import UserAuditLog
    user_audit_log_manager = UserAuditLog()

    from core.user import user_actions, user_plugin, attribute_manager
    global attr_manager
    attr_manager = attribute_manager.AttributeManager()

    global user_loader
    from core.user.user_loader import UserLoader
    user_loader = UserLoader()

    global user_pool
    from core.user.user_pool import UserPool
    user_pool = UserPool()

    global mail_actions
    from core.user.mail_actions import MailActions
    mail_actions = MailActions()

    global user_action_manager
    user_action_manager = user_actions.UserActions()

    global user_plugin_manager
    user_plugin_manager = user_plugin.UserPluginManager()

    global credit_change_log_actions
    from core.user.credit_change_log import CreditChangeLogActions
    credit_change_log_actions = CreditChangeLogActions()

    global connection_log_manager
    from core.user.connection_log import ConnectionLogActions
    connection_log_manager = ConnectionLogActions()

    global add_user_save_actions
    from core.user.add_user_save import AddUserSaveActions, AddUserSaveHandler
    add_user_save_actions = AddUserSaveActions()
    handlers_manager.getManager().registerHandler(AddUserSaveHandler())

    global ras_msg_dispatcher
    from core.user.ras_msg_dispatcher import RasMsgDispatcher
    ras_msg_dispatcher = RasMsgDispatcher()

    global online
    from core.user.online import OnlineUsers, OnlineCheckPeriodicEvent
    online = OnlineUsers()
    periodic_events.getManager().register(OnlineCheckPeriodicEvent())

    global user_server_auth
    from core.user.server_auth import UserServerAuth
    user_server_auth = UserServerAuth()

    global dialer_errors
    from core.user.dialer_errors import DialerErrors
    dialer_errors = DialerErrors()

    global voip_errors
    from core.user.voip_errors import VoIPErrors
    voip_errors = VoIPErrors()

    global ip_map
    from core.user.ip_map import IPMap
    ip_map = IPMap()

    global user_plugin_modules
    user_plugin_modules = plugin_loader.loadPlugins(defs.IBS_CORE +
                                                    "/user/plugins")

    from core.user.user_handler import UserHandler
    handlers_manager.getManager().registerHandler(UserHandler())
コード例 #11
0
 def _delEvent(self):
     periodic_events.getManager().unRegister(self.__general_update_event)
コード例 #12
0
ファイル: ras.py プロジェクト: moxwose/freeIBS
    def _delEvent(self):
	periodic_events.getManager().unRegister(self.__general_update_event)
コード例 #13
0
def postInit():
    from core.event import periodic_events
    from core.threadpool.twrapper_checker import TWrapperChecker
    periodic_events.getManager().register(TWrapperChecker())
コード例 #14
0
ファイル: db_check.py プロジェクト: sankopay/IBSng
def init():
    db_pool_check = DBPoolCheck('dbcheck', defs.DB_POOL_CHECK_INTERVAL, [], 1)
    periodic_events.getManager().register(db_pool_check)
コード例 #15
0
ファイル: plan.py プロジェクト: sankopay/IBSng
 def __removeLoginRetry(self):
     periodic_events.getManager().unRegister(self.plan_login_retry)
コード例 #16
0
ファイル: plan.py プロジェクト: sankopay/IBSng
 def __initLoginRetry(self):
     self.plan_login_retry = PLanLoginRetry(self)
     periodic_events.getManager().register(self.plan_login_retry)
コード例 #17
0
ファイル: ras.py プロジェクト: moxwose/freeIBS
    def _delEvent(self):
	GeneralUpdateRas._delEvent(self)
	if self.getAttribute("online_check"):
	    periodic_events.getManager().unRegister(self.__update_userlist_event)
	    
コード例 #18
0
 def _delEvent(self):
     GeneralUpdateRas._delEvent(self)
     if self.getAttribute("online_check"):
         periodic_events.getManager().unRegister(
             self.__update_userlist_event)
コード例 #19
0
ファイル: plan.py プロジェクト: moxwose/freeIBS
    def __removeLoginRetry(self):
	periodic_events.getManager().unRegister(self.plan_login_retry)
コード例 #20
0
ファイル: plan.py プロジェクト: moxwose/freeIBS
    def __initLoginRetry(self):
	self.plan_login_retry=PLanLoginRetry(self)
	periodic_events.getManager().register(self.plan_login_retry)
コード例 #21
0
from core.event import periodic_events
i=0
for evt in periodic_events.getManager().events:
    print i,evt
    i+=1
コード例 #22
0
ファイル: db_check.py プロジェクト: moxwose/freeIBS
def init():
    db_pool_check=DBPoolCheck('dbcheck',defs.DB_POOL_CHECK_INTERVAL,[],1)
    periodic_events.getManager().register(db_pool_check)