GNU Radio Manual and C++ API Reference  3.10.0.0
The Free & Open Software Radio Ecosystem
tcp_connection.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_TCP_CONNECTION_H
12 #define INCLUDED_TCP_CONNECTION_H
13 
14 #include <pmt/pmt.h>
15 #include <boost/array.hpp>
16 #include <boost/asio.hpp>
17 #include <memory>
18 
19 namespace gr {
20 
21 class basic_block;
22 
23 namespace network {
24 
26 {
27 private:
28  boost::asio::ip::tcp::socket d_socket;
29  std::vector<char> d_buf;
30  basic_block* d_block;
31  bool d_no_delay;
32 
33  tcp_connection(boost::asio::io_service& io_service,
34  int MTU = 10000,
35  bool no_delay = false);
36 
37  void handle_read(const boost::system::error_code& error, size_t bytes_transferred);
38 
39 public:
40  typedef std::shared_ptr<tcp_connection> sptr;
41 
42  static sptr
43  make(boost::asio::io_service& io_service, int MTU = 10000, bool no_delay = false);
44 
45  boost::asio::ip::tcp::socket& socket() { return d_socket; };
46 
48  void send(pmt::pmt_t vector);
49 };
50 
51 } /* namespace network */
52 } /* namespace gr */
53 
54 #endif /* INCLUDED_TCP_CONNECTION_H */
The abstract base class for all signal processing blocks.
Definition: basic_block.h:44
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Definition: tcp_connection.h:26
void start(gr::basic_block *block)
boost::asio::ip::tcp::socket & socket()
Definition: tcp_connection.h:45
static sptr make(boost::asio::io_service &io_service, int MTU=10000, bool no_delay=false)
void send(pmt::pmt_t vector)
std::shared_ptr< tcp_connection > sptr
Definition: tcp_connection.h:40
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:84