TOBI Interface A  0.1
/home/breidi/Dropbox/libtia/include/tia-private/newtia/server_impl/fusty_data_server_impl.h
00001 /*
00002     This file is part of the TOBI Interface A (TiA) library.
00003 
00004     Commercial Usage
00005     Licensees holding valid Graz University of Technology Commercial
00006     licenses may use this file in accordance with the Graz University
00007     of Technology Commercial License Agreement provided with the
00008     Software or, alternatively, in accordance with the terms contained in
00009     a written agreement between you and Graz University of Technology.
00010 
00011     --------------------------------------------------
00012 
00013     GNU Lesser General Public License Usage
00014     Alternatively, this file may be used under the terms of the GNU Lesser
00015     General Public License version 3.0 as published by the Free Software
00016     Foundation and appearing in the file lgpl.txt included in the
00017     packaging of this file.  Please review the following information to
00018     ensure the GNU General Public License version 3.0 requirements will be
00019     met: http://www.gnu.org/copyleft/lgpl.html.
00020 
00021     In case of GNU Lesser General Public License Usage ,the TiA library
00022     is distributed in the hope that it will be useful,
00023     but WITHOUT ANY WARRANTY; without even the implied warranty of
00024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025     GNU General Public License for more details.
00026 
00027     You should have received a copy of the GNU Lesser General Public License
00028     along with the TiA library. If not, see <http://www.gnu.org/licenses/>.
00029 
00030     Copyright 2010 Graz University of Technology
00031     Contact: TiA@tobi-project.org
00032 */
00033 
00034 #ifndef FUSTY_DATA_SERVER_IMPL_H
00035 #define FUSTY_DATA_SERVER_IMPL_H
00036 
00037 
00038 #include "../../network/tcp_data_server.h"
00039 #include "../../network/udp_data_server.h"
00040 
00041 #include "../server/data_server.h"
00042 
00043 #include <map>
00044 #include <set>
00045 
00046 namespace tia
00047 {
00048 
00049 //-----------------------------------------------------------------------------
00050 class FustyDataServerImpl : public DataServer
00051 {
00052 public:
00053     FustyDataServerImpl (TCPDataServer& tcp_data_server, UDPDataServer& udp_data_server);
00054 
00055     virtual ~FustyDataServerImpl ();
00056 
00057     virtual Port localPort (ConnectionID connection) const;
00058     virtual std::string getTargetIP () const;
00059 
00060     virtual ConnectionID addConnection (bool udp);
00061 
00062     virtual bool hasConnection (ConnectionID connection) const;
00063 
00064     virtual bool transmitting (ConnectionID connection) const;
00065 
00066     virtual bool removeConnection (ConnectionID connection);
00067 
00068     virtual void startTransmission (ConnectionID connection);
00069 
00070     virtual void stopTransmission (ConnectionID connection);
00071 
00072 private:
00073     TCPDataServer& tcp_data_server_;
00074     UDPDataServer& udp_data_server_;
00075 
00076     std::map<ConnectionID, boost::asio::ip::tcp::endpoint> id_tcp_endpoint_map_;
00077     std::set<ConnectionID> tcp_connections_;
00078     std::set<ConnectionID> udp_connections_;
00079     std::set<ConnectionID> transmitting_;
00080     ConnectionID next_free_connection_id_;
00081 };
00082 
00083 }
00084 
00085 #endif // FUSTY_DATA_SERVER_IMPL_H
 All Data Structures Files Functions Variables Typedefs Enumerations