summaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-23 16:27:49 -0800
committerJosh Blum <josh@joshknows.com>2010-02-23 16:27:49 -0800
commit8050fda48d69f46788672a9ceaccd8d82500ac05 (patch)
tree98ba17ea9bd041040da1ec9f0cf85dae014cb1c0 /host/lib/transport
parent6b7c53985c09a8d74e9bfd9c6b37948d458b2c44 (diff)
downloaduhd-8050fda48d69f46788672a9ceaccd8d82500ac05.tar.gz
uhd-8050fda48d69f46788672a9ceaccd8d82500ac05.tar.bz2
uhd-8050fda48d69f46788672a9ceaccd8d82500ac05.zip
Added IF data io handing within the usrp2 impl.
It packs and unpacks vrt headers/metadata. NOT YET TESTED IN ANY WAY...
Diffstat (limited to 'host/lib/transport')
-rw-r--r--host/lib/transport/udp.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/host/lib/transport/udp.cpp b/host/lib/transport/udp.cpp
index fca4dd7d6..878f71410 100644
--- a/host/lib/transport/udp.cpp
+++ b/host/lib/transport/udp.cpp
@@ -31,8 +31,8 @@ public:
//send/recv
size_t send(const std::vector<boost::asio::const_buffer> &buffs);
size_t send(const boost::asio::const_buffer &buff);
+ size_t recv(const std::vector<boost::asio::mutable_buffer> &buffs);
size_t recv(const boost::asio::mutable_buffer &buff);
- uhd::shared_iovec recv(void);
private:
boost::asio::ip::udp::socket *_socket;
@@ -87,20 +87,12 @@ 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){
+size_t udp_impl::recv(const std::vector<boost::asio::mutable_buffer> &buffs){
if (_socket->available() == 0) return 0;
- return _socket->receive_from(boost::asio::buffer(buff), _sender_endpoint);
+ return _socket->receive_from(buffs, _sender_endpoint);
}
-uhd::shared_iovec udp_impl::recv(void){
- //allocate a buffer for the number of bytes available (could be zero)
- uhd::shared_iovec iov(_socket->available());
- //call recv only if data is available
- if (iov.len != 0){
- _socket->receive_from(
- boost::asio::buffer(iov.base, iov.len),
- _sender_endpoint
- );
- }
- return iov;
+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);
}