xorp

io_ip_dummy.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2007-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/io/io_ip_dummy.hh,v 1.6 2008/10/11 04:20:19 pavlin Exp $
00021 
00022 #ifndef __FEA_DATA_PLANE_IO_IO_IP_DUMMY_HH__
00023 #define __FEA_DATA_PLANE_IO_IO_IP_DUMMY_HH__
00024 
00025 //
00026 // I/O IP raw communication support.
00027 //
00028 // The mechanism is Dummy (for testing purpose).
00029 //
00030 
00031 
00032 
00033 #include "libxorp/xorpfd.hh"
00034 
00035 #include "fea/io_ip.hh"
00036 #include "fea/io_ip_manager.hh"
00037 
00038 
00045 class IoIpDummy : public IoIp {
00046 public:
00057     IoIpDummy(FeaDataPlaneManager& fea_data_plane_manager,
00058            const IfTree& iftree, int family, uint8_t ip_protocol);
00059 
00063     virtual ~IoIpDummy();
00064 
00071     int     start(string& error_msg);
00072 
00079     int     stop(string& error_msg);
00080 
00089     int     set_multicast_ttl(int ttl, string& error_msg);
00090 
00102     int     enable_multicast_loopback(bool is_enabled, string& error_msg);
00103 
00114     int     set_default_multicast_interface(const string& if_name,
00115                         const string& vif_name,
00116                         string& error_msg);
00117 
00127     int     join_multicast_group(const string& if_name,
00128                      const string& vif_name,
00129                      const IPvX& group,
00130                      string& error_msg);
00131     
00141     int     leave_multicast_group(const string& if_name,
00142                       const string& vif_name,
00143                       const IPvX& group,
00144                       string& error_msg);
00145 
00172     int     send_packet(const string&   if_name,
00173                 const string&   vif_name,
00174                 const IPvX&     src_address,
00175                 const IPvX&     dst_address,
00176                 int32_t     ip_ttl,
00177                 int32_t     ip_tos,
00178                 bool        ip_router_alert,
00179                 bool        ip_internet_control,
00180                 const vector<uint8_t>& ext_headers_type,
00181                 const vector<vector<uint8_t> >& ext_headers_payload,
00182                 const vector<uint8_t>& payload,
00183                 string&     error_msg);
00184 
00191     XorpFd* mcast_protocol_fd_in() {
00192     return (&_dummy_protocol_fd_in);
00193     }
00194 
00195 private:
00196     // Private state
00197     XorpFd  _dummy_protocol_fd_in;  // Dummy protocol file descriptor
00198     uint8_t _multicast_ttl;     // Default multicast TTL
00199     bool    _multicast_loopback;    // True if mcast loopback is enabled
00200     string  _default_multicast_interface;
00201     string  _default_multicast_vif;
00202 
00203     set<IoIpComm::JoinedMulticastGroup> _joined_groups_table;
00204 };
00205 
00206 #endif // __FEA_DATA_PLANE_IO_IO_IP_DUMMY_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations