xorp

ifconfig_set_netlink_socket.hh

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 // $XORP: xorp/fea/data_plane/ifconfig/ifconfig_set_netlink_socket.hh,v 1.14 2008/12/18 02:06:57 abittau Exp $
00022 
00023 #ifndef __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_NETLINK_SOCKET_HH__
00024 #define __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_NETLINK_SOCKET_HH__
00025 
00026 #include <xorp_config.h>
00027 
00028 #ifdef HAVE_NETLINK_SOCKETS
00029 
00030 #include "fea/ifconfig_set.hh"
00031 #include "fea/data_plane/control_socket/netlink_socket.hh"
00032 
00033 
00034 class IfConfigSetNetlinkSocket : public IfConfigSet,
00035                  public NetlinkSocket {
00036 public:
00043     IfConfigSetNetlinkSocket(FeaDataPlaneManager& fea_data_plane_manager);
00044 
00048     virtual ~IfConfigSetNetlinkSocket();
00049 
00056     virtual int start(string& error_msg);
00057 
00064     virtual int stop(string& error_msg);
00065 
00066 private:
00074     virtual bool is_discard_emulated(const IfTreeInterface& i) const;
00075 
00083     virtual bool is_unreachable_emulated(const IfTreeInterface& i) const;
00084 
00091     virtual int config_begin(string& error_msg);
00092 
00099     virtual int config_end(string& error_msg);
00100 
00111     virtual int config_interface_begin(const IfTreeInterface* pulled_ifp,
00112                        IfTreeInterface& config_iface,
00113                        string& error_msg);
00114 
00125     virtual int config_interface_end(const IfTreeInterface* pulled_ifp,
00126                      const IfTreeInterface& config_iface,
00127                      string& error_msg);
00128 
00143     virtual int config_vif_begin(const IfTreeInterface* pulled_ifp,
00144                  const IfTreeVif* pulled_vifp,
00145                  const IfTreeInterface& config_iface,
00146                  const IfTreeVif& config_vif,
00147                  string& error_msg);
00148 
00163     virtual int config_vif_end(const IfTreeInterface* pulled_ifp,
00164                    const IfTreeVif* pulled_vifp,
00165                    const IfTreeInterface& config_iface,
00166                    const IfTreeVif& config_vif,
00167                    string& error_msg);
00168 
00190     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00191                    const IfTreeVif* pulled_vifp,
00192                    const IfTreeAddr4* pulled_addrp,
00193                    const IfTreeInterface& config_iface,
00194                    const IfTreeVif& config_vif,
00195                    const IfTreeAddr4& config_addr,
00196                    string& error_msg);
00197 
00216     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00217                       const IfTreeVif* pulled_vifp,
00218                       const IfTreeAddr4* pulled_addrp,
00219                       const IfTreeInterface& config_iface,
00220                       const IfTreeVif& config_vif,
00221                       const IfTreeAddr4& config_addr,
00222                       string& error_msg);
00223 
00245     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00246                    const IfTreeVif* pulled_vifp,
00247                    const IfTreeAddr6* pulled_addrp,
00248                    const IfTreeInterface& config_iface,
00249                    const IfTreeVif& config_vif,
00250                    const IfTreeAddr6& config_addr,
00251                    string& error_msg);
00252 
00271     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00272                       const IfTreeVif* pulled_vifp,
00273                       const IfTreeAddr6* pulled_addrp,
00274                       const IfTreeInterface& config_iface,
00275                       const IfTreeVif& config_vif,
00276                       const IfTreeAddr6& config_addr,
00277                       string& error_msg);
00278 
00290     int set_interface_status(const string& ifname,
00291                  uint32_t if_index,
00292                  uint32_t interface_flags,
00293                  bool is_enabled,
00294                  string& error_msg);
00295 
00302     void wait_interface_status(const IfTreeInterface* ifp, bool is_enabled);
00303 
00313     int set_interface_mac_address(const string& ifname, uint32_t if_index,
00314                   const Mac& mac, string& error_msg);
00315 
00325     int set_interface_mtu(const string& ifname, uint32_t if_index,
00326               uint32_t mtu, string& error_msg);
00327 
00345     int add_addr(const string& ifname, const string& vifname,
00346          uint32_t if_index, const IPvX& addr, uint32_t prefix_len,
00347          bool is_broadcast, const IPvX& broadcast_addr,
00348          bool is_point_to_point, const IPvX& endpoint_addr,
00349          string& error_msg);
00350 
00362     int delete_addr(const string& ifname, const string& vifname,
00363             uint32_t if_index, const IPvX& addr, uint32_t prefix_len,
00364             string& error_msg);
00365 
00366     NetlinkSocketReader _ns_reader;
00367 };
00368 
00369 #endif
00370 #endif // __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_NETLINK_SOCKET_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations