xorp

fibconfig_entry_set_click.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/fea/data_plane/fibconfig/fibconfig_entry_set_click.hh,v 1.9 2008/10/02 21:56:57 bms Exp $
00021 
00022 #ifndef __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_SET_CLICK_HH__
00023 #define __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_SET_CLICK_HH__
00024 
00025 #include <xorp_config.h>
00026 #ifdef XORP_USE_CLICK
00027 
00028 
00029 
00030 #include "libxorp/ipv4net.hh"
00031 #include "libxorp/ipv6net.hh"
00032 #include "libxorp/time_slice.hh"
00033 #include "libxorp/timer.hh"
00034 
00035 #include "fea/fibconfig_entry_set.hh"
00036 #include "fea/nexthop_port_mapper.hh"
00037 #include "fea/data_plane/control_socket/click_socket.hh"
00038 
00039 
00040 class FibConfigEntrySetClick : public FibConfigEntrySet,
00041                    public ClickSocket,
00042                    public NexthopPortMapperObserver {
00043 public:
00050     FibConfigEntrySetClick(FeaDataPlaneManager& fea_data_plane_manager);
00051 
00055     virtual ~FibConfigEntrySetClick();
00056 
00063     virtual int start(string& error_msg);
00064 
00071     virtual int stop(string& error_msg);
00072 
00081     virtual int add_entry4(const Fte4& fte);
00082 
00091     virtual int delete_entry4(const Fte4& fte);
00092 
00101     virtual int add_entry6(const Fte6& fte);
00102 
00111     virtual int delete_entry6(const Fte6& fte);
00112 
00118     const map<IPv4Net, Fte4>& fte_table4() const { return _fte_table4; }
00119 
00125     const map<IPv6Net, Fte6>& fte_table6() const { return _fte_table6; }
00126 
00129     virtual int notify_table_id_change(uint32_t new_tbl) { UNUSED(new_tbl); return XORP_OK; }
00130 
00131 private:
00132     virtual void nexthop_port_mapper_event(bool is_mapping_changed);
00133 
00134     int add_entry(const FteX& fte);
00135     int delete_entry(const FteX& fte);
00136 
00137     // Methods related to reinstalling all IPv4 and IPv6 forwarding entries
00138     void start_task_reinstall_all_entries();
00139     void run_task_reinstall_all_entries();
00143     bool reinstall_all_entries4();
00147     bool reinstall_all_entries6();
00148 
00149     ClickSocketReader _cs_reader;
00150 
00151     map<IPv4Net, Fte4>  _fte_table4;
00152     map<IPv6Net, Fte6>  _fte_table6;
00153 
00154     // State related to reinstalling all IPv4 and IPv6 forwarding entries
00155     XorpTimer _reinstall_all_entries_timer;
00156     TimeSlice _reinstall_all_entries_time_slice;
00157     bool _start_reinstalling_fte_table4;
00158     bool _is_reinstalling_fte_table4;
00159     bool _start_reinstalling_fte_table6;
00160     bool _is_reinstalling_fte_table6;
00161     IPv4Net _reinstalling_ipv4net;
00162     IPv6Net _reinstalling_ipv6net;
00163 };
00164 
00165 #endif
00166 #endif // __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_SET_CLICK_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations