USRP Hardware Driver and USRP Manual  Version: 20250528.0.gitc354764c.el9
UHD and USRP Manual
udp_simple.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010,2014 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <uhd/types/serial.hpp>
13 #include <boost/asio/buffer.hpp>
14 #include <cstddef>
15 #include <memory>
16 #include <string>
17 
18 namespace uhd { namespace transport {
19 
21 {
22 public:
23  typedef std::shared_ptr<udp_simple> sptr;
24 
25  virtual ~udp_simple(void) = 0;
26 
28  static const size_t mtu = 1500 - 20 - 8; // default ipv4 mtu - ipv4 header - udp
29  // header
30 
44  static sptr make_connected(const std::string& addr, const std::string& port);
45 
58  static sptr make_broadcast(const std::string& addr, const std::string& port);
59 
66 
73  virtual size_t send(const boost::asio::const_buffer& buff) = 0;
74 
82  virtual size_t recv(
83  const boost::asio::mutable_buffer& buff, double timeout = 0.1) = 0;
84 
89  virtual std::string get_recv_addr(void) = 0;
90 
94  virtual std::string get_send_addr(void) = 0;
95 };
96 
97 }} // namespace uhd::transport
Definition: udp_simple.hpp:21
std::shared_ptr< udp_simple > sptr
Definition: udp_simple.hpp:23
static sptr make_broadcast(const std::string &addr, const std::string &port)
static uart_iface::sptr make_uart(sptr udp)
static sptr make_connected(const std::string &addr, const std::string &port)
virtual ~udp_simple(void)=0
virtual size_t recv(const boost::asio::mutable_buffer &buff, double timeout=0.1)=0
virtual std::string get_send_addr(void)=0
virtual size_t send(const boost::asio::const_buffer &buff)=0
virtual std::string get_recv_addr(void)=0
std::shared_ptr< uart_iface > sptr
Definition: serial.hpp:172
#define UHD_API
Definition: config.h:87
Definition: build_info.hpp:12
boost::noncopyable noncopyable
Definition: noncopyable.hpp:45