diff options
author | Alex Williams <alex.williams@ni.com> | 2019-03-15 15:05:45 -0700 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2019-05-21 16:04:42 -0700 |
commit | 36802305b41feff59f0e3c346a595f286979fcab (patch) | |
tree | 37508ded81d42ef9726c9b7dc0047b59acd3c2b8 /host/lib/include | |
parent | feb20b2feef244cbbae59dfaa3378e8e28d6d38e (diff) | |
download | uhd-36802305b41feff59f0e3c346a595f286979fcab.tar.gz uhd-36802305b41feff59f0e3c346a595f286979fcab.tar.bz2 uhd-36802305b41feff59f0e3c346a595f286979fcab.zip |
transport: Make dpdk_simple subclass udp_simple
With the same APIs, this will make it easier to add support for X310.
Diffstat (limited to 'host/lib/include')
-rw-r--r-- | host/lib/include/uhdlib/transport/dpdk_simple.hpp | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/host/lib/include/uhdlib/transport/dpdk_simple.hpp b/host/lib/include/uhdlib/transport/dpdk_simple.hpp index 62728b38d..86abaeff8 100644 --- a/host/lib/include/uhdlib/transport/dpdk_simple.hpp +++ b/host/lib/include/uhdlib/transport/dpdk_simple.hpp @@ -7,15 +7,14 @@ #ifndef INCLUDED_DPDK_SIMPLE_HPP #define INCLUDED_DPDK_SIMPLE_HPP +#include <uhd/transport/udp_simple.hpp> #include <uhdlib/transport/dpdk_common.hpp> namespace uhd { namespace transport { -class dpdk_simple : boost::noncopyable +class dpdk_simple : public udp_simple { public: - typedef boost::shared_ptr<dpdk_simple> sptr; - virtual ~dpdk_simple(void) = 0; /*! @@ -30,7 +29,7 @@ public: * \param addr a string representing the destination address * \param port a string representing the destination port */ - static sptr make_connected(struct uhd_dpdk_ctx &ctx, + static udp_simple::sptr make_connected(struct uhd_dpdk_ctx &ctx, const std::string &addr, const std::string &port); /*! @@ -45,38 +44,26 @@ public: * \param addr a string representing the destination address * \param port a string representing the destination port */ - static sptr make_broadcast(struct uhd_dpdk_ctx &ctx, + static udp_simple::sptr make_broadcast(struct uhd_dpdk_ctx &ctx, const std::string &addr, const std::string &port); /*! - * Request a single send buffer of specified size. - * - * \param buf a pointer to place to write buffer location - * \return the maximum length of the buffer in Bytes - */ - virtual size_t get_tx_buf(void** buf) = 0; - - /*! - * Send and release outstanding buffer - * - * \param number of bytes sent (releases buffer if sent) + * Send a single buffer. + * Blocks until the data is sent. + * \param buff single asio buffer + * \return the number of bytes sent */ - virtual size_t send(size_t length) = 0; + virtual size_t send(const boost::asio::const_buffer& buff) = 0; /*! - * Receive a single packet. - * Buffer provided by transport (must be freed). - * - * \param buf a pointer to place to write buffer location + * Receive into the provided buffer. + * Blocks until data is received or a timeout occurs. + * \param buff a mutable buffer to receive into * \param timeout the timeout in seconds * \return the number of bytes received or zero on timeout */ - virtual size_t recv(void **buf, double timeout = 0.1) = 0; - - /*! - * Return/free receive buffer - */ - virtual void put_rx_buf(void) = 0; + virtual size_t recv( + const boost::asio::mutable_buffer& buff, double timeout = 0.1) = 0; /*! * Get the last IP address as seen by recv(). |