xorp

main_rtrmgr.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, Version 2, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 // $XORP: xorp/rtrmgr/main_rtrmgr.hh,v 1.19 2008/10/30 23:50:16 pavlin Exp $
00021 
00022 #ifndef __RTRMGR_MAIN_RTRMGR_HH__
00023 #define __RTRMGR_MAIN_RTRMGR_HH__
00024 
00025 
00026 
00027 
00028 #include "libxorp/ipv4.hh"
00029 #include "generic_module_manager.hh"
00030 
00031 
00032 class MasterConfigTree;
00033 class XrlRtrmgrInterface;
00034 
00035 class Rtrmgr {
00036 public:
00037     Rtrmgr(const string& module_dir,
00038        const string& command_dir,
00039        const string& template_dir,
00040        const string& xrl_targets_dir,
00041        const string& config_file,
00042        const list<IPv4>& bind_addrs,
00043        uint16_t bind_port,
00044        bool do_exec,
00045        bool do_restart,
00046        bool verbose,
00047        int32_t quit_time,
00048        bool daemon_mode);
00049     ~Rtrmgr();
00050 
00051     int run();
00052     bool ready() const;
00053     void module_status_changed(const string& module_name,
00054                    GenericModule::ModuleStatus status);
00055     void daemonize();
00056     bool verbose() const { return _verbose; }
00057 
00058 private:
00059     string  _module_dir;
00060     string  _command_dir;
00061     string  _template_dir;
00062     string  _xrl_targets_dir;        // Only used by DEBUG_XRLDB.
00063     string  _config_file;
00064     list<IPv4>  _bind_addrs;
00065     uint16_t    _bind_port;
00066 
00067     bool    _do_exec;
00068     bool    _do_restart;
00069     bool    _verbose;       // Set to true if output is verbose
00070     int32_t _quit_time;
00071     bool    _daemon_mode;
00072 
00073     bool    _ready;
00074     MasterConfigTree* _mct;
00075     XrlRtrmgrInterface* _xrt;
00076 };
00077 
00078 #endif // __RTRMGR_MAIN_RTRMGR_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations