xorp

master_conf_tree_node.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/master_conf_tree_node.hh,v 1.24 2008/10/02 21:58:23 bms Exp $
00021 
00022 #ifndef __RTRMGR_MASTER_CONF_TREE_NODE_HH__
00023 #define __RTRMGR_MASTER_CONF_TREE_NODE_HH__
00024 
00025 #include "libxorp/xorp.h"
00026 
00027 
00028 
00029 
00030 
00031 
00032 #include "conf_tree_node.hh"
00033 #include "task.hh"
00034 
00035 
00036 class MasterConfigTreeNode : public ConfigTreeNode {
00037 public:
00038     MasterConfigTreeNode(bool verbose);
00039     MasterConfigTreeNode(const MasterConfigTreeNode& ctn);
00040     MasterConfigTreeNode(const string& node_name, const string& path, 
00041              const TemplateTreeNode* ttn, 
00042              MasterConfigTreeNode* parent,
00043              const ConfigNodeId& node_id,
00044              uid_t user_id, bool verbose);
00045 
00046     virtual ConfigTreeNode* create_node(const string& segment, 
00047                     const string& path,
00048                     const TemplateTreeNode* ttn, 
00049                     ConfigTreeNode* parent_node, 
00050                     const ConfigNodeId& node_id,
00051                     uid_t user_id,
00052                     uint32_t clientid,
00053                     bool verbose);
00054     virtual ConfigTreeNode* create_node(const ConfigTreeNode& ctn);
00055     void command_status_callback(const Command* cmd, bool success);
00056 
00057     void find_changed_modules(set<string>& changed_modules) const;
00058     void find_active_modules(set<string>& active_modules) const;
00059     void find_all_modules(set<string>& all_modules) const;
00060 
00061     void initialize_commit();
00062     bool children_changed();
00063     bool commit_changes(TaskManager& task_manager, bool do_commit,
00064             int depth, int last_depth, string& error_msg,
00065             bool& needs_activate, bool& needs_update);
00066     bool check_commit_status(string& error_msg) const;
00067     void finalize_commit();
00068 
00069 
00070 protected:
00071 
00072     int _actions_pending;   // Needed to track how many response callbacks
00073                 // callbacks we expect during a commit
00074     bool _actions_succeeded;    // Did any action fail during the commit?
00075     const Command* _cmd_that_failed;
00076 
00077 private:
00078 };
00079 
00080 #endif // __RTRMGR_MASTER_CONF_TREE_NODE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations