GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
udp_source.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_SOURCE_H
12 #define INCLUDED_NETWORK_UDP_SOURCE_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 source block that starts a
22  * listener on the specified port and waits for inbound UDP packets.
23  * \ingroup networking_tools
24  *
25  * \details
26  * This block provides a UDP source that supports receiving data over
27  * a UDP stream from 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 flowgraph to be aware of any frames dropped in transit or by
31  * its receiving stack. However, this needs to be appropriately
32  * paired with the sending application (it needs to send the same
33  * header). The UDP packet size can also be adjusted
34  * to support jumbo frames. For most networks, 1472 is the correct
35  * UDP data packet size that optimizes network transmission. Adjusting
36  * this value without a full understanding of the network implications
37  * can create additional network fragmentation and inefficient packet
38  * usage so should be avoided. For networks and endpoints supporting
39  * jumbo frames of 9000, 8972 would be the appropriate size
40  * (9000 - 28 header bytes). This block does support IPv4 only or
41  * dual stack IPv4/IPv6 listening as an endpoint with an enable
42  * IPv6 option that can be set on the block properties page. It can
43  * also be set to source zeros (no signal) in the event no data
44  * is being received.
45  */
46 class NETWORK_API udp_source : virtual public gr::sync_block
47 {
48 public:
49  typedef std::shared_ptr<udp_source> sptr;
50 
51  /*!
52  * Build a udp_source block.
53  */
54  static sptr make(size_t itemsize,
55  size_t vecLen,
56  int port,
57  int header_type,
58  int payloadsize,
59  bool notify_missed,
60  bool source_zeros,
61  bool ipv6);
62 };
63 
64 } // namespace network
65 } // namespace gr
66 
67 #endif /* INCLUDED_NETWORK_UDP_SOURCE_H */
This block provides a UDP source block that starts a listener on the specified port and waits for inb...
Definition: udp_source.h:47
std::shared_ptr< udp_source > sptr
Definition: udp_source.h:49
static sptr make(size_t itemsize, size_t vecLen, int port, int header_type, int payloadsize, bool notify_missed, bool source_zeros, bool ipv6)
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