diff options
author | Josh Blum <josh@joshknows.com> | 2010-02-22 18:47:05 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-02-22 18:47:05 -0800 |
commit | 6b7c53985c09a8d74e9bfd9c6b37948d458b2c44 (patch) | |
tree | b2a5fda7c44229ba210e95424e813b63c2545f85 /host/lib/transport | |
parent | 5200303517f4941fa60e2db713411f36116634a7 (diff) | |
download | uhd-6b7c53985c09a8d74e9bfd9c6b37948d458b2c44.tar.gz uhd-6b7c53985c09a8d74e9bfd9c6b37948d458b2c44.tar.bz2 uhd-6b7c53985c09a8d74e9bfd9c6b37948d458b2c44.zip |
Work on the io interface for a device (and some implementation work in usrp2).
Modified the udp transport to reflect some of these changes.
Got the fw compiling again, and it will not set data to true for small payloads (configuration ones).
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/udp.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/host/lib/transport/udp.cpp b/host/lib/transport/udp.cpp index af60760a5..fca4dd7d6 100644 --- a/host/lib/transport/udp.cpp +++ b/host/lib/transport/udp.cpp @@ -17,7 +17,6 @@ #include <uhd/transport/udp.hpp> #include <boost/format.hpp> -#include <boost/assign/list_of.hpp> #include <iostream> /*********************************************************************** @@ -30,8 +29,9 @@ public: ~udp_impl(void); //send/recv - void send(const std::vector<boost::asio::const_buffer> &buffs); - void send(const boost::asio::const_buffer &buff); + size_t send(const std::vector<boost::asio::const_buffer> &buffs); + size_t send(const boost::asio::const_buffer &buff); + size_t recv(const boost::asio::mutable_buffer &buff); uhd::shared_iovec recv(void); private: @@ -79,13 +79,17 @@ udp_impl::~udp_impl(void){ delete _socket; } -void udp_impl::send(const std::vector<boost::asio::const_buffer> &buffs){ - _socket->send_to(buffs, _receiver_endpoint); +size_t udp_impl::send(const std::vector<boost::asio::const_buffer> &buffs){ + return _socket->send_to(buffs, _receiver_endpoint); } -void udp_impl::send(const boost::asio::const_buffer &buff){ - std::vector<boost::asio::const_buffer> buffs = boost::assign::list_of(buff); - send(buffs); +size_t udp_impl::send(const boost::asio::const_buffer &buff){ + return _socket->send_to(boost::asio::buffer(buff), _receiver_endpoint); +} + +size_t udp_impl::recv(const boost::asio::mutable_buffer &buff){ + if (_socket->available() == 0) return 0; + return _socket->receive_from(boost::asio::buffer(buff), _sender_endpoint); } uhd::shared_iovec udp_impl::recv(void){ |