aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/transport/udp_simple.hpp3
-rw-r--r--host/include/uhd/transport/vrt_if_packet.hpp7
-rw-r--r--host/include/uhd/types/metadata.hpp5
-rw-r--r--host/include/uhd/utils/CMakeLists.txt1
-rw-r--r--host/include/uhd/utils/assert.hpp31
-rw-r--r--host/include/uhd/utils/assert.ipp52
6 files changed, 72 insertions, 27 deletions
diff --git a/host/include/uhd/transport/udp_simple.hpp b/host/include/uhd/transport/udp_simple.hpp
index 793ec4fd7..98dca02f0 100644
--- a/host/include/uhd/transport/udp_simple.hpp
+++ b/host/include/uhd/transport/udp_simple.hpp
@@ -29,6 +29,9 @@ class UHD_API udp_simple : boost::noncopyable{
public:
typedef boost::shared_ptr<udp_simple> sptr;
+ //! The maximum number of bytes per udp packet.
+ static const size_t mtu = 1500 - 20 - 8; //default ipv4 mtu - ipv4 header - udp header
+
/*!
* Make a new connected udp transport:
* This transport is for sending and receiving
diff --git a/host/include/uhd/transport/vrt_if_packet.hpp b/host/include/uhd/transport/vrt_if_packet.hpp
index ccefe14ea..51bd81bb1 100644
--- a/host/include/uhd/transport/vrt_if_packet.hpp
+++ b/host/include/uhd/transport/vrt_if_packet.hpp
@@ -35,6 +35,13 @@ namespace vrt{
* the operation used (ie the pack or unpack function call).
*/
struct UHD_API if_packet_info_t{
+ //packet type (pack only supports data)
+ enum packet_type_t {
+ PACKET_TYPE_DATA = 0x0,
+ PACKET_TYPE_EXTENSION = 0x1,
+ PACKET_TYPE_CONTEXT = 0x2
+ } packet_type;
+
//size fields
size_t num_payload_words32; //required in pack, derived in unpack
size_t num_header_words32; //derived in pack, derived in unpack
diff --git a/host/include/uhd/types/metadata.hpp b/host/include/uhd/types/metadata.hpp
index f4c962ff7..6712e2594 100644
--- a/host/include/uhd/types/metadata.hpp
+++ b/host/include/uhd/types/metadata.hpp
@@ -52,10 +52,9 @@ namespace uhd{
* Burst flags:
* Start of burst will be true for the first packet in the chain.
* End of burst will be true for the last packet in the chain.
- * --Not currently used in any known device implementation.--
*/
- //bool start_of_burst;
- //bool end_of_burst;
+ bool start_of_burst;
+ bool end_of_burst;
/*!
* Error conditions (TODO):
diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt
index 36f86054a..d484788b2 100644
--- a/host/include/uhd/utils/CMakeLists.txt
+++ b/host/include/uhd/utils/CMakeLists.txt
@@ -18,6 +18,7 @@
INSTALL(FILES
algorithm.hpp
assert.hpp
+ assert.ipp
byteswap.hpp
byteswap.ipp
exception.hpp
diff --git a/host/include/uhd/utils/assert.hpp b/host/include/uhd/utils/assert.hpp
index 2f0ed4ff1..7f7b71cfb 100644
--- a/host/include/uhd/utils/assert.hpp
+++ b/host/include/uhd/utils/assert.hpp
@@ -20,10 +20,6 @@
#include <uhd/config.hpp>
#include <uhd/utils/exception.hpp>
-#include <uhd/utils/algorithm.hpp>
-#include <boost/format.hpp>
-#include <boost/foreach.hpp>
-#include <boost/lexical_cast.hpp>
#include <stdexcept>
#include <string>
@@ -35,8 +31,9 @@ namespace uhd{
};
//! Throw an assert error with throw-site information
- #define UHD_ASSERT_THROW(_x) if (not (_x)) \
- throw uhd::assert_error(UHD_THROW_SITE_INFO("assertion failed: " + std::string(#_x)))
+ #define UHD_ASSERT_THROW(_x) if (not (_x)) throw uhd::assert_error( \
+ UHD_THROW_SITE_INFO("assertion failed: " + std::string(#_x)) \
+ ); else void(0)
/*!
* Check that an element is found in a container.
@@ -46,31 +43,17 @@ namespace uhd{
*
* \param range a list of possible settings
* \param value an element that may be in the list
- * \param what a description of what is being set
+ * \param what a description of what the value is
* \throw assertion_error when elem not in list
*/
template<typename T, typename Range> void assert_has(
const Range &range,
const T &value,
const std::string &what = "unknown"
- ){
- if (std::has(range, value)) return;
- std::string possible_values = "";
- size_t i = 0;
- BOOST_FOREACH(const T &v, range){
- if (i++ > 0) possible_values += ", ";
- possible_values += boost::lexical_cast<std::string>(v);
- }
- throw uhd::assert_error(str(boost::format(
- "assertion failed:\n"
- " %s is not a valid %s.\n"
- " possible values are: [%s].\n"
- )
- % boost::lexical_cast<std::string>(value)
- % what % possible_values
- ));
- }
+ );
}//namespace uhd
+#include <uhd/utils/assert.ipp>
+
#endif /* INCLUDED_UHD_UTILS_ASSERT_HPP */
diff --git a/host/include/uhd/utils/assert.ipp b/host/include/uhd/utils/assert.ipp
new file mode 100644
index 000000000..6a8b3e417
--- /dev/null
+++ b/host/include/uhd/utils/assert.ipp
@@ -0,0 +1,52 @@
+//
+// 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_UHD_UTILS_ASSERT_IPP
+#define INCLUDED_UHD_UTILS_ASSERT_IPP
+
+#include <uhd/utils/algorithm.hpp>
+#include <boost/format.hpp>
+#include <boost/foreach.hpp>
+#include <boost/lexical_cast.hpp>
+
+namespace uhd{
+
+ template<typename T, typename Range> UHD_INLINE void assert_has(
+ const Range &range,
+ const T &value,
+ const std::string &what
+ ){
+ if (std::has(range, value)) return;
+ std::string possible_values = "";
+ size_t i = 0;
+ BOOST_FOREACH(const T &v, range){
+ if (i++ > 0) possible_values += ", ";
+ possible_values += boost::lexical_cast<std::string>(v);
+ }
+ throw uhd::assert_error(str(boost::format(
+ "assertion failed:\n"
+ " %s is not a valid %s.\n"
+ " possible values are: [%s].\n"
+ )
+ % boost::lexical_cast<std::string>(value)
+ % what % possible_values
+ ));
+ }
+
+}//namespace uhd
+
+#endif /* INCLUDED_UHD_UTILS_ASSERT_IPP */