|
xorp
|
00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- 00002 // vim:set sts=4 ts=8: 00003 00004 // Copyright (c) 2001-2011 XORP, Inc and Others 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License, Version 2, June 00008 // 1991 as published by the Free Software Foundation. Redistribution 00009 // and/or modification of this program under the terms of any other 00010 // version of the GNU General Public License is not permitted. 00011 // 00012 // This program is distributed in the hope that it will be useful, but 00013 // WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details, 00015 // see the GNU General Public License, Version 2, a copy of which can be 00016 // found in the XORP LICENSE.gpl file. 00017 // 00018 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; 00019 // http://xorp.net 00020 00021 00022 #ifndef __RTRMGR_XORPSH_BASE_HH__ 00023 #define __RTRMGR_XORPSH_BASE_HH__ 00024 00025 00026 class EventLoop; 00027 class OpCommandList; 00028 class SlaveConfigTree; 00029 class TemplateTree; 00030 00039 class XorpShellBase { 00040 public: 00041 typedef XorpCallback1<void, const XrlError&>::RefPtr GENERIC_CALLBACK; 00042 typedef XorpCallback2<void, bool, string>::RefPtr CallBack; 00043 typedef XorpCallback2<void, const XrlError&, 00044 const XrlAtomList*>::RefPtr GET_USERS_CALLBACK; 00045 typedef XorpCallback2<void, const XrlError&, 00046 const uint32_t*>::RefPtr PID_CALLBACK; 00047 typedef XorpCallback3<void, const XrlError&, const bool*, 00048 const uint32_t*>::RefPtr LOCK_CALLBACK; 00049 00050 virtual ~XorpShellBase() {} 00051 00052 00053 enum Mode { 00054 MODE_AUTHENTICATING, 00055 MODE_INITIALIZING, 00056 MODE_IDLE, 00057 MODE_COMMITTING, 00058 MODE_LOADING, 00059 MODE_SAVING, 00060 MODE_SHUTDOWN 00061 }; 00062 00063 virtual EventLoop& eventloop() = 0; 00064 00065 virtual OpCommandList* op_cmd_list() = 0; 00066 00067 virtual SlaveConfigTree* config_tree() = 0; 00068 00069 virtual TemplateTree* template_tree() = 0; 00070 00071 virtual uint32_t clientid() const = 0; 00072 00073 virtual uint32_t rtrmgr_pid() const = 0; 00074 00075 virtual bool commit_changes(const string& deltas, const string& deletions, 00076 GENERIC_CALLBACK cb, CallBack final_cb) = 0; 00077 00078 virtual bool enter_config_mode(bool exclusive, GENERIC_CALLBACK cb) = 0; 00079 00080 virtual bool get_config_users(GET_USERS_CALLBACK cb) = 0; 00081 00082 virtual bool get_rtrmgr_pid(PID_CALLBACK cb) = 0; 00083 00084 virtual bool leave_config_mode(GENERIC_CALLBACK cb) = 0; 00085 00086 virtual bool load_from_file(const string& filename, GENERIC_CALLBACK cb, 00087 CallBack final_cb) = 0; 00088 00089 virtual bool lock_config(LOCK_CALLBACK cb) = 0; 00090 00091 virtual bool save_to_file(const string& filename, GENERIC_CALLBACK cb, 00092 CallBack final_cb) = 0; 00093 00094 virtual void set_mode(Mode mode) = 0; 00095 00096 virtual bool unlock_config(GENERIC_CALLBACK cb) = 0; 00097 }; 00098 00099 #endif // __RTRMGR_XORPSH_BASE_HH__