GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
udp_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 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_NETWORK_UDP_SINK_H
12 #define INCLUDED_NETWORK_UDP_SINK_H
13 
14 #include <gnuradio/network/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace network {
19 
20 /*!
21  * \brief This block provides a UDP Sink block that can send
22  * data over UDP streams to a specified host.
23  * \ingroup networking_tools
24  *
25  * \details
26  * This block provides a UDP sink that supports sending data over
27  * a UDP stream to external applications. A number of header formats
28  * are supported including None (raw stream), and other header formats
29  * that allow for sequence numbers to be tracked. This feature allows
30  * the recipient to be aware of any frames dropped in transit or by
31  * its receiving stack. The UDP packet size can also be adjusted
32  * to support jumbo frames. For most networks, 1472 is the correct
33  * UDP data packet size that optimizes network transmission. Adjusting
34  * this value without a full understanding of the network implications
35  * can create additional network fragmentation and inefficient packet
36  * usage so should be avoided. For networks and endpoints supporting
37  * jumbo frames of 9000, 8972 would be the appropriate size
38  * (9000 - 28 header bytes). If send NULL packet as EOF is set, when
39  * the flowgraph terminates, an empty UDP packet is sent. This can
40  * be used on the receiving side to be aware that no more data may
41  * be received from the sending application. When pairing with the
42  * GNU Radio UDP source block, this isn't necessary and the source
43  * block can simply be set to source zero's when an incoming network
44  * data stream is not present in order to continue returning data
45  * from the work function. This block also supports IPv4 and IPv6
46  * addresses and is automatically determined from the address
47  * provided.
48  */
49 class NETWORK_API udp_sink : virtual public gr::sync_block
50 {
51 public:
52  typedef std::shared_ptr<udp_sink> sptr;
53 
54  /*!
55  * Build a udp_sink block.
56  */
57  static sptr make(size_t itemsize,
58  size_t veclen,
59  const std::string& host,
60  int port,
61  int header_type,
62  int payloadsize,
63  bool send_eof);
64 };
65 
66 } // namespace network
67 } // namespace gr
68 
69 #endif /* INCLUDED_NETWORK_UDP_SINK_H */
This block provides a UDP Sink block that can send data over UDP streams to a specified host.
Definition: udp_sink.h:50
static sptr make(size_t itemsize, size_t veclen, const std::string &host, int port, int header_type, int payloadsize, bool send_eof)
std::shared_ptr< udp_sink > sptr
Definition: udp_sink.h:52
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define NETWORK_API
Definition: gr-network/include/gnuradio/network/api.h:19
GR_RUNTIME_API size_t itemsize(types::vector_type type)
GNU Radio logging wrapper.
Definition: basic_block.h:29