xorp

ifconfig_set_ioctl.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/ifconfig/ifconfig_set_ioctl.hh,v 1.13 2008/10/02 21:57:07 bms Exp $
00021 
00022 #ifndef __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_IOCTL_HH__
00023 #define __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_IOCTL_HH__
00024 
00025 #include <xorp_config.h>
00026 #if defined(HAVE_IOCTL_SIOCGIFCONF) && !defined(HAVE_NETLINK_SOCKETS)
00027 
00028 #include "fea/ifconfig_set.hh"
00029 
00030 
00031 class IfConfigSetIoctl : public IfConfigSet {
00032 public:
00039     IfConfigSetIoctl(FeaDataPlaneManager& fea_data_plane_manager);
00040 
00044     virtual ~IfConfigSetIoctl();
00045 
00052     virtual int start(string& error_msg);
00053     
00060     virtual int stop(string& error_msg);
00061 
00062 private:
00070     virtual bool is_discard_emulated(const IfTreeInterface& i) const;
00071 
00079     virtual bool is_unreachable_emulated(const IfTreeInterface& i) const;
00080 
00087     virtual int config_begin(string& error_msg);
00088 
00095     virtual int config_end(string& error_msg);
00096 
00107     virtual int config_interface_begin(const IfTreeInterface* pulled_ifp,
00108                        IfTreeInterface& config_iface,
00109                        string& error_msg);
00110 
00121     virtual int config_interface_end(const IfTreeInterface* pulled_ifp,
00122                      const IfTreeInterface& config_iface,
00123                      string& error_msg);
00124 
00139     virtual int config_vif_begin(const IfTreeInterface* pulled_ifp,
00140                  const IfTreeVif* pulled_vifp,
00141                  const IfTreeInterface& config_iface,
00142                  const IfTreeVif& config_vif,
00143                  string& error_msg);
00144 
00159     virtual int config_vif_end(const IfTreeInterface* pulled_ifp,
00160                    const IfTreeVif* pulled_vifp,
00161                    const IfTreeInterface& config_iface,
00162                    const IfTreeVif& config_vif,
00163                    string& error_msg);
00164 
00186     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00187                    const IfTreeVif* pulled_vifp,
00188                    const IfTreeAddr4* pulled_addrp,
00189                    const IfTreeInterface& config_iface,
00190                    const IfTreeVif& config_vif,
00191                    const IfTreeAddr4& config_addr,
00192                    string& error_msg);
00193 
00212     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00213                       const IfTreeVif* pulled_vifp,
00214                       const IfTreeAddr4* pulled_addrp,
00215                       const IfTreeInterface& config_iface,
00216                       const IfTreeVif& config_vif,
00217                       const IfTreeAddr4& config_addr,
00218                       string& error_msg);
00219 
00241     virtual int config_add_address(const IfTreeInterface* pulled_ifp,
00242                    const IfTreeVif* pulled_vifp,
00243                    const IfTreeAddr6* pulled_addrp,
00244                    const IfTreeInterface& config_iface,
00245                    const IfTreeVif& config_vif,
00246                    const IfTreeAddr6& config_addr,
00247                    string& error_msg);
00248 
00267     virtual int config_delete_address(const IfTreeInterface* pulled_ifp,
00268                       const IfTreeVif* pulled_vifp,
00269                       const IfTreeAddr6* pulled_addrp,
00270                       const IfTreeInterface& config_iface,
00271                       const IfTreeVif& config_vif,
00272                       const IfTreeAddr6& config_addr,
00273                       string& error_msg);
00274 
00286     int set_interface_status(const string& ifname, uint32_t if_index,
00287                  uint32_t interface_flags, bool is_enabled,
00288                  string& error_msg);
00289 
00298     int set_interface_mac_address(const string& ifname, const Mac& mac,
00299                   string& error_msg);
00300 
00309     int set_interface_mtu(const string& ifname, uint32_t mtu,
00310               string& error_msg);
00311 
00329     int add_addr(const string& ifname, const string& vifname,
00330          uint32_t if_index, const IPv4& addr, uint32_t prefix_len,
00331          bool is_broadcast, const IPv4& broadcast_addr,
00332          bool is_point_to_point, const IPv4& endpoint_addr,
00333          string& error_msg);
00334 
00346     int delete_addr(const string& ifname, const string& vifname,
00347             uint32_t if_index, const IPv4& addr, uint32_t prefix_len,
00348             string& error_msg);
00349 
00364     int add_addr(const string& ifname, const string& vifname,
00365          uint32_t if_index, const IPv6& addr, uint32_t prefix_len,
00366          bool is_point_to_point, const IPv6& endpoint_addr,
00367          string& error_msg);
00368 
00380     int delete_addr(const string& ifname, const string& vifname,
00381             uint32_t if_index, const IPv6& addr, uint32_t prefix_len,
00382             string& error_msg);
00383 
00384     int _s4;
00385     int _s6;
00386 };
00387 
00388 #endif
00389 #endif // __FEA_DATA_PLANE_IFCONFIG_IFCONFIG_SET_IOCTL_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations