xorp

slave_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/slave_conf_tree_node.hh,v 1.28 2008/10/02 21:58:24 bms Exp $
00021 
00022 #ifndef __RTRMGR_SLAVE_CONF_TREE_NODE_HH__
00023 #define __RTRMGR_SLAVE_CONF_TREE_NODE_HH__
00024 
00025 #include "libxorp/xorp.h"
00026 
00027 
00028 
00029 
00030 
00031 
00032 #include "conf_tree_node.hh"
00033 #include "xorp_client.hh"
00034 
00035 
00036 class Command;
00037 class CommandTree;
00038 class RouterCLI;
00039 class TemplateTreeNode;
00040 
00041 class SlaveConfigTreeNode : public ConfigTreeNode {
00042 public:
00043     SlaveConfigTreeNode(bool verbose);
00044     SlaveConfigTreeNode(const string& node_name, const string& path,
00045             const TemplateTreeNode* ttn,
00046             SlaveConfigTreeNode* parent,
00047             const ConfigNodeId& node_id,
00048             uid_t user_id,
00049             uint32_t clientid,
00050             bool verbose);
00051 
00052     virtual ConfigTreeNode* create_node(const string& segment, 
00053                     const string& path,
00054                     const TemplateTreeNode* ttn,
00055                     ConfigTreeNode* parent_node,
00056                     const ConfigNodeId& node_id,
00057                     uid_t user_id, 
00058                     uint32_t clientid,
00059                     bool verbose);
00060     virtual ConfigTreeNode* create_node(const ConfigTreeNode& ctn);
00061 
00062     void create_command_tree(CommandTree& cmd_tree,
00063                  const list<string>& commands,
00064                  bool include_intermediate_nodes,
00065                  bool include_children_templates,
00066                  bool include_leaf_value_nodes,
00067                  bool include_read_only_nodes,
00068                  bool include_permanent_nodes,
00069                  bool include_user_hidden_nodes) const;
00070 
00071     int get_deltas(const SlaveConfigTreeNode& master_node);
00072     int get_deletions(const SlaveConfigTreeNode& master_node);
00073 
00074     // adaptors so we don't need to cast elsewhere
00075     SlaveConfigTreeNode* parent() { return (SlaveConfigTreeNode*)_parent; }
00076 
00077     void finalize_commit();
00078 
00079 protected:
00080     bool build_command_tree(CommandTree& cmdtree, 
00081                 const list<string>& commands, 
00082                 int depth,
00083                 bool include_intermediate_nodes,
00084                 bool include_children_templates,
00085                 bool include_leaf_value_nodes,
00086                 bool include_read_only_nodes,
00087                 bool include_permanent_nodes,
00088                 bool include_user_hidden_nodes) const;
00089 
00090 private:
00091     //
00092     // XXX: don't add any storage here, SlaveConfigTreeNode needs to be the
00093     // same size as ConfigTreeNode.
00094     //
00095 };
00096 
00097 #endif // __RTRMGR_SLAVE_CONF_TREE_NODE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations