xorp

io_tcpudp_dummy.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2007-2009 XORP, Inc.
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_tcpudp_dummy.hh,v 1.11 2008/10/11 04:20:19 pavlin Exp $
00021 
00022 #ifndef __FEA_DATA_PLANE_IO_IO_TCPUDP_DUMMY_HH__
00023 #define __FEA_DATA_PLANE_IO_IO_TCPUDP_DUMMY_HH__
00024 
00025 //
00026 // I/O TCP/UDP communication support.
00027 //
00028 // The mechanism is Dummy (for testing purpose).
00029 //
00030 
00031 #include "fea/io_tcpudp.hh"
00032 
00033 
00037 class IoTcpUdpDummy : public IoTcpUdp {
00038 public:
00049     IoTcpUdpDummy(FeaDataPlaneManager& fea_data_plane_manager,
00050           const IfTree& iftree, int family, bool is_tcp);
00051 
00055     virtual ~IoTcpUdpDummy();
00056 
00063     int     start(string& error_msg);
00064 
00071     int     stop(string& error_msg);
00072 
00079     int tcp_open(string& error_msg);
00080 
00087     int udp_open(string& error_msg);
00088 
00097     int tcp_open_and_bind(const IPvX& local_addr, uint16_t local_port,
00098               string& error_msg);
00099 
00108     int udp_open_and_bind(const IPvX& local_addr, uint16_t local_port, const string& local_dev,
00109               int reuse, string& error_msg);
00110 
00122     int udp_open_bind_join(const IPvX& local_addr, uint16_t local_port,
00123                const IPvX& mcast_addr, uint8_t ttl, bool reuse,
00124                string& error_msg);
00125 
00136     int tcp_open_bind_connect(const IPvX& local_addr, uint16_t local_port,
00137                   const IPvX& remote_addr, uint16_t remote_port,
00138                   string& error_msg);
00139 
00150     int udp_open_bind_connect(const IPvX& local_addr, uint16_t local_port,
00151                   const IPvX& remote_addr, uint16_t remote_port,
00152                   string& error_msg);
00153 
00168     int udp_open_bind_broadcast(const string& ifname, const string& vifname,
00169                     uint16_t local_port, uint16_t remote_port,
00170                     bool reuse, bool limited, bool connected,
00171                     string& error_msg);
00172 
00181     int bind(const IPvX& local_addr, uint16_t local_port, string& error_msg);
00182 
00191     int udp_join_group(const IPvX& mcast_addr, const IPvX& join_if_addr,
00192                string& error_msg);
00193 
00202     int udp_leave_group(const IPvX& mcast_addr, const IPvX& leave_if_addr,
00203             string& error_msg);
00204 
00211     int close(string& error_msg);
00212 
00223     int tcp_listen(uint32_t backlog, string& error_msg);
00224 
00231     int udp_enable_recv(string& error_msg);
00232 
00240     int send(const vector<uint8_t>& data, string& error_msg);
00241 
00254     int send_to(const IPvX& remote_addr, uint16_t remote_port,
00255         const vector<uint8_t>& data, string& error_msg);
00256 
00266     int send_from_multicast_if(const IPvX& group_addr, uint16_t group_port,
00267                    const IPvX& ifaddr, const vector<uint8_t>& data,
00268                    string& error_msg);
00269 
00287     int set_socket_option(const string& optname, uint32_t optval,
00288               string& error_msg);
00289 
00298     int set_socket_option(const string& optname, const string& optval,
00299               string& error_msg);
00300 
00309     int accept_connection(bool is_accepted, string& error_msg);
00310 
00311 private:
00312 };
00313 
00314 #endif // __FEA_DATA_PLANE_IO_IO_TCPUDP_DUMMY_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations