GNU Radio 3.6.0 C++ API
blob_to_socket.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011-2012 Free Software Foundation, Inc.
00003  * 
00004  * This file is part of GNU Radio
00005  * 
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  * 
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_GR_EXTRAS_BLOB_TO_SOCKET_H
00023 #define INCLUDED_GR_EXTRAS_BLOB_TO_SOCKET_H
00024 
00025 #include <gnuradio/extras/api.h>
00026 #include <gr_sync_block.h>
00027 
00028 namespace gnuradio{ namespace extras{
00029 
00030 class GR_EXTRAS_API blob_to_socket : virtual public gr_sync_block{
00031 public:
00032     typedef boost::shared_ptr<blob_to_socket> sptr;
00033 
00034     /*!
00035      * \brief Make a socket to message blob block
00036      *
00037      * The UDP socket will be connected to the server address and port.
00038      * The TCP socket will be connected to the server address and port.
00039      * The remote server socket should be activated before this block.
00040      *
00041      * This block reads incoming messages from the queue,
00042      * and sends the blob contents into a UDP socket.
00043      * Non-blob message values will be ignored by the block.
00044      * An empty blob (length 0 bytes) tells the work to exit.
00045      *
00046      * \param proto the protocol "UDP" or "TCP"
00047      * \param addr the resolvable server address of the UDP socket
00048      * \param port the resolvable server port of the UDP socket
00049      * \return a new blob to socket block
00050      */
00051     static sptr make(
00052         const std::string &proto, const std::string &addr, const std::string &port
00053     );
00054 };
00055 
00056 }}
00057 
00058 #endif /* INCLUDED_GR_EXTRAS_BLOB_TO_SOCKET_H */