USRP Hardware Driver and USRP Manual  Version: 3.15.0.HEAD-0-gaea0e2de
UHD and USRP Manual
muxed_zero_copy_if.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2016 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 // Copyright 2019 Ettus Research, a National Instruments Brand
5 //
6 // SPDX-License-Identifier: GPL-3.0-or-later
7 //
8 
9 #ifndef INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP
10 #define INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP
11 
12 #include <uhd/config.hpp>
14 #include <stdint.h>
15 #include <boost/function.hpp>
17 
18 namespace uhd { namespace transport {
19 
30 {
31 public:
32  typedef boost::shared_ptr<muxed_zero_copy_if> sptr;
33 
44  typedef boost::function<uint32_t(void* buff, size_t size)> stream_classifier_fn;
45 
47  virtual ~muxed_zero_copy_if() {}
48 
50  virtual zero_copy_if::sptr make_stream(const uint32_t stream_num) = 0;
51 
53  virtual void remove_stream(const uint32_t stream_num) = 0;
54 
56  virtual size_t get_num_dropped_frames() const = 0;
57 
59  //
60  // \param classify_fn See also stream_classifier_fn.
61  // \param max_streams Max number of streams that can be muxed/demuxed
62  // \param recv_timeout_s This is a timeout that is used in the receiver thread
63  // when fetching the next packet. Its specific effect
64  // depends on the type of the underlying transport.
65  // A longer timeout means the thread can block on
66  // outstanding I/O for longer. A lower value will
67  // increase CPU utilization.
68  static sptr make(zero_copy_if::sptr base_xport,
69  stream_classifier_fn classify_fn,
70  size_t max_streams,
71  const double recv_timeout_s = 0.0);
72 };
73 
74 }} // namespace uhd::transport
75 
76 #endif /* INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP */
Definition: muxed_zero_copy_if.hpp:29
boost::noncopyable noncopyable
Definition: noncopyable.hpp:46
boost::shared_ptr< zero_copy_if > sptr
Definition: zero_copy.hpp:169
virtual ~muxed_zero_copy_if()
virtual dtor
Definition: muxed_zero_copy_if.hpp:47
Definition: build_info.hpp:13
boost::function< uint32_t(void *buff, size_t size)> stream_classifier_fn
Definition: muxed_zero_copy_if.hpp:44
virtual size_t get_num_dropped_frames() const =0
Get number of frames dropped due to unregistered streams.
static sptr make(zero_copy_if::sptr base_xport, stream_classifier_fn classify_fn, size_t max_streams, const double recv_timeout_s=0.0)
Make a new demuxer from a transport and parameters.
virtual zero_copy_if::sptr make_stream(const uint32_t stream_num)=0
Make a virtual transport for the specified stream number.
boost::shared_ptr< muxed_zero_copy_if > sptr
Definition: muxed_zero_copy_if.hpp:32
virtual void remove_stream(const uint32_t stream_num)=0
Unregister the stream number. All packets destined to the stream will be dropped. ...