diff options
author | Josh Blum <josh@joshknows.com> | 2010-06-01 12:23:20 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-06-01 12:23:20 -0700 |
commit | bb1eef8cade6e39532919918ce1168c3e62a54df (patch) | |
tree | 4b8b68cf6a4e464ad82e6cbfa1a48a4a841cd6cc /host/lib/transport/vrt_packet_handler_state.hpp | |
parent | 8c0759df03520f010203fdeb3979f82fc41b72f7 (diff) | |
download | uhd-bb1eef8cade6e39532919918ce1168c3e62a54df.tar.gz uhd-bb1eef8cade6e39532919918ce1168c3e62a54df.tar.bz2 uhd-bb1eef8cade6e39532919918ce1168c3e62a54df.zip |
Moved the packet handler state stuff into a separate header (so we dont pull in all the includes).
Use callback for getting buffers rather than zc interface pointer so its more modular.
Diffstat (limited to 'host/lib/transport/vrt_packet_handler_state.hpp')
-rw-r--r-- | host/lib/transport/vrt_packet_handler_state.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/host/lib/transport/vrt_packet_handler_state.hpp b/host/lib/transport/vrt_packet_handler_state.hpp new file mode 100644 index 000000000..2320a3b8e --- /dev/null +++ b/host/lib/transport/vrt_packet_handler_state.hpp @@ -0,0 +1,56 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_LIBUHD_TRANSPORT_VRT_PACKET_HANDLER_STATE_HPP +#define INCLUDED_LIBUHD_TRANSPORT_VRT_PACKET_HANDLER_STATE_HPP + +#include <uhd/config.hpp> +#include <uhd/transport/zero_copy.hpp> +#include <boost/asio/buffer.hpp> + +namespace vrt_packet_handler{ + + struct recv_state{ + //init the expected seq number + size_t next_packet_seq; + + //state variables to handle fragments + uhd::transport::managed_recv_buffer::sptr managed_buff; + boost::asio::const_buffer copy_buff; + size_t fragment_offset_in_samps; + + recv_state(void){ + //first expected seq is zero + next_packet_seq = 0; + + //initially empty copy buffer + copy_buff = boost::asio::buffer("", 0); + } + }; + + struct send_state{ + //init the expected seq number + size_t next_packet_seq; + + send_state(void){ + next_packet_seq = 0; + } + }; + +} //namespace vrt_packet_handler + +#endif /* INCLUDED_LIBUHD_TRANSPORT_VRT_PACKET_HANDLER_STATE_HPP */ |