GNU Radio Manual and C++ API Reference  3.10.3.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/asio.hpp>
16 #include <memory>
17 
18 namespace gr {
19 
20 class basic_block;
21 
22 namespace network {
23 
25 {
26 private:
27  boost::asio::ip::tcp::socket d_socket;
28  std::vector<char> d_buf;
29  basic_block* d_block;
30  bool d_no_delay;
31 
32  tcp_connection(boost::asio::io_service& io_service,
33  int MTU = 10000,
34  bool no_delay = false);
35 
36  void handle_read(const boost::system::error_code& error, size_t bytes_transferred);
37 
38 public:
39  typedef std::shared_ptr<tcp_connection> sptr;
40 
41  static sptr
42  make(boost::asio::io_service& io_service, int MTU = 10000, bool no_delay = false);
43 
44  boost::asio::ip::tcp::socket& socket() { return d_socket; };
45 
47  void send(pmt::pmt_t vector);
48 };
49 
50 } /* namespace network */
51 } /* namespace gr */
52 
53 #endif /* INCLUDED_TCP_CONNECTION_H */
The abstract base class for all signal processing blocks.
Definition: basic_block.h:63
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Definition: tcp_connection.h:25
void start(gr::basic_block *block)
boost::asio::ip::tcp::socket & socket()
Definition: tcp_connection.h:44
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:39
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:83