aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/transport/adapter.hpp
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-08-09 11:18:35 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:38 -0800
commit01284980b1d7227f1c11496d2be939bb4b23adb1 (patch)
tree3bf21c2ece1296640a8854ea229960e5c937ebdd /host/lib/include/uhdlib/transport/adapter.hpp
parentaf5b2b5e778ead57b0fe9e72561227f1ebbbfc42 (diff)
downloaduhd-01284980b1d7227f1c11496d2be939bb4b23adb1.tar.gz
uhd-01284980b1d7227f1c11496d2be939bb4b23adb1.tar.bz2
uhd-01284980b1d7227f1c11496d2be939bb4b23adb1.zip
transport: Add modeling of physical adapters
Now link instances must have the ability to report the corresponding physical adapter that is used for the local side of the link. This information can be used to help identify when multiple links share the same adapter.
Diffstat (limited to 'host/lib/include/uhdlib/transport/adapter.hpp')
-rw-r--r--host/lib/include/uhdlib/transport/adapter.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/transport/adapter.hpp b/host/lib/include/uhdlib/transport/adapter.hpp
new file mode 100644
index 000000000..3d6d49575
--- /dev/null
+++ b/host/lib/include/uhdlib/transport/adapter.hpp
@@ -0,0 +1,33 @@
+//
+// Copyright 2019 Ettus Research, a National Instruments Brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_UHDLIB_TRANSPORT_ADAPTER_HPP
+#define INCLUDED_UHDLIB_TRANSPORT_ADAPTER_HPP
+
+#include <uhdlib/transport/adapter_info.hpp>
+#include <uhdlib/transport/udp_boost_asio_link.hpp>
+
+namespace uhd { namespace transport {
+
+class adapter_ctx : uhd::noncopyable
+{
+public:
+ UHD_SINGLETON_FCN(adapter_ctx, get);
+
+ ~adapter_ctx() = default;
+
+ adapter_id_t register_adapter(adapter_info& info);
+
+private:
+ adapter_ctx() = default;
+
+ std::mutex _mutex;
+ std::unordered_map<std::string, adapter_id_t> _id_map;
+};
+
+}} // namespace uhd::transport
+
+#endif /* INCLUDED_UHDLIB_TRANSPORT_ADAPTER_HPP */