[hamradio-commits] [soapyremote] 01/04: New upstream version 0.3.2
Andreas E. Bombe
aeb at moszumanska.debian.org
Thu Dec 8 18:27:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
aeb pushed a commit to branch master
in repository soapyremote.
commit 3f3099ee2f64045128c4c1c6add12aa9fd54bdcc
Author: Andreas Bombe <aeb at debian.org>
Date: Thu Dec 8 14:13:49 2016 +0100
New upstream version 0.3.2
---
CMakeLists.txt | 4 ++++
Changelog.txt | 9 ++++++++
client/Registration.cpp | 9 ++++++--
client/Streaming.cpp | 4 ++--
common/SoapySSDPEndpoint.cpp | 47 ++++++++++++++++++++++++++++++----------
common/SoapySSDPEndpoint.hpp | 23 ++++++++++++--------
debian/changelog | 6 +++++
debian/soapysdr-server.install | 2 ++
debian/soapysdr-server.manpages | 1 +
debian/soapysdr-server.postinst | 12 ++++++++++
debian/soapysdr-server.prerm | 9 ++++++++
server/CMakeLists.txt | 3 +++
server/SoapySDRServer.1 | 47 ++++++++++++++++++++++++++++++++++++++++
system/CMakeLists.txt | 19 ++++++++++++++++
system/SoapySDRServer.service.in | 10 +++++++++
system/SoapySDRServer.sysctl | 4 ++++
16 files changed, 184 insertions(+), 25 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f74ce3c..540b281 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,3 +42,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)
add_subdirectory(common)
add_subdirectory(client)
add_subdirectory(server)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ add_subdirectory(system)
+endif()
diff --git a/Changelog.txt b/Changelog.txt
index 5a58ccf..fdc4051 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,6 +1,15 @@
+Release 0.3.2 (2016-12-04)
+==========================
+
+- Added man page for SoapySDRServer executable
+
Release 0.3.1 (2016-09-01)
==========================
+- Fixed info print for setupStream() - status socket connection
+- Added sysctl config file for increased default network limits
+- Added IP version preferences to SSDP discovery (remote:ipver=4)
+- Added systemd service script for SoapySDRServer
- Update debian files for SoapySDR module ABI format
- Preserve packet+burst boundaries in server readStream() endpoint
diff --git a/client/Registration.cpp b/client/Registration.cpp
index 6e66f6d..aa0dc5f 100644
--- a/client/Registration.cpp
+++ b/client/Registration.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2015 Josh Blum
+// Copyright (c) 2015-2016 Josh Blum
// SPDX-License-Identifier: BSL-1.0
#include "SoapyClient.hpp"
@@ -72,7 +72,12 @@ static std::vector<SoapySDR::Kwargs> findRemote(const SoapySDR::Kwargs &args)
//wait maximum timeout for replies
std::this_thread::sleep_for(std::chrono::microseconds(SOAPY_REMOTE_SOCKET_TIMEOUT_US));
- for (const auto &url : SoapySSDPEndpoint::getInstance()->getServerURLs())
+ //determine IP version preferences
+ int ipVer(4);
+ const auto ipVerIt = args.find("remote:ipver");
+ if (ipVerIt != args.end()) ipVer = std::stoi(ipVerIt->second);
+
+ for (const auto &url : SoapySSDPEndpoint::getInstance()->getServerURLs(ipVer))
{
auto argsWithURL = args;
argsWithURL["remote"] = url;
diff --git a/client/Streaming.cpp b/client/Streaming.cpp
index c143368..2b35bd1 100644
--- a/client/Streaming.cpp
+++ b/client/Streaming.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2015 Josh Blum
+// Copyright (c) 2015-2016 Josh Blum
// SPDX-License-Identifier: BSL-1.0
#include <SoapySDR/Logger.hpp>
@@ -212,7 +212,7 @@ SoapySDR::Stream *SoapyRemoteDevice::setupStream(
delete data;
throw std::runtime_error("SoapyRemote::setupStream("+bindURL+") -- bind FAIL: " + errorMsg);
}
- SoapySDR::logf(SOAPY_SDR_INFO, "Client side status bound to %s", data->streamSock.getsockname().c_str());
+ SoapySDR::logf(SOAPY_SDR_INFO, "Client side status bound to %s", data->statusSock.getsockname().c_str());
const auto statusBindPort = SoapyURL(data->statusSock.getsockname()).getService();
//setup the remote end of the stream
diff --git a/common/SoapySSDPEndpoint.cpp b/common/SoapySSDPEndpoint.cpp
index 4aa4ab4..fd6c55a 100644
--- a/common/SoapySSDPEndpoint.cpp
+++ b/common/SoapySSDPEndpoint.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2015 Josh Blum
+// Copyright (c) 2015-2016 Josh Blum
// SPDX-License-Identifier: BSL-1.0
/*
@@ -17,7 +17,9 @@
#include "SoapyRPCSocket.hpp"
#include <thread>
#include <ctime>
+#include <chrono>
#include <cctype>
+#include <map>
#include <set>
//! IPv4 multi-cast address for SSDP communications
@@ -46,11 +48,14 @@
struct SoapySSDPEndpointData
{
+ int ipVer;
SoapyRPCSocket sock;
std::string groupURL;
std::thread *thread;
std::chrono::high_resolution_clock::time_point lastTimeSearch;
std::chrono::high_resolution_clock::time_point lastTimeNotify;
+ typedef std::map<std::string, std::pair<std::string, std::chrono::high_resolution_clock::time_point>> DiscoveredURLs;
+ DiscoveredURLs usnToURL;
};
static std::string timeNowGMT(void)
@@ -79,8 +84,8 @@ SoapySSDPEndpoint::SoapySSDPEndpoint(void):
done(false)
{
const bool isIPv6Supported = not SoapyRPCSocket(SoapyURL("tcp", "::", "0").toString()).null();
- this->spawnHandler("0.0.0.0", SSDP_MULTICAST_ADDR_IPV4);
- if (isIPv6Supported) this->spawnHandler("::", SSDP_MULTICAST_ADDR_IPV6);
+ this->spawnHandler("0.0.0.0", SSDP_MULTICAST_ADDR_IPV4, 4);
+ if (isIPv6Supported) this->spawnHandler("::", SSDP_MULTICAST_ADDR_IPV6, 6);
}
SoapySSDPEndpoint::~SoapySSDPEndpoint(void)
@@ -116,15 +121,32 @@ void SoapySSDPEndpoint::enablePeriodicNotify(const bool enable)
for (auto &data : handlers) this->sendNotifyHeader(data, NTS_ALIVE);
}
-std::vector<std::string> SoapySSDPEndpoint::getServerURLs(void)
+std::vector<std::string> SoapySSDPEndpoint::getServerURLs(const int ipVer, const bool only)
{
std::lock_guard<std::mutex> lock(mutex);
+
+ //create a single mapping of discovered URLs using the preferences specified
+ SoapySSDPEndpointData::DiscoveredURLs usnPrefToURL;
+ for (auto &data : handlers)
+ {
+ const bool ipVerMatch = data->ipVer == ipVer;
+ //ignore this data set if only is specified and the IP version does not match
+ if (only and not ipVerMatch) continue;
+ for (auto &pair : data->usnToURL)
+ {
+ //ignore this URL if the entry is already present and the IP version does not match
+ if (usnPrefToURL.count(pair.first) != 0 and not ipVerMatch) continue;
+ usnPrefToURL[pair.first] = pair.second;
+ }
+ }
+
+ //copy the filtered URLs into the resulting list
std::vector<std::string> serverURLs;
- for (auto &pair : usnToURL) serverURLs.push_back(pair.second.first);
+ for (auto &pair : usnPrefToURL) serverURLs.push_back(pair.second.first);
return serverURLs;
}
-void SoapySSDPEndpoint::spawnHandler(const std::string &bindAddr, const std::string &groupAddr)
+void SoapySSDPEndpoint::spawnHandler(const std::string &bindAddr, const std::string &groupAddr, const int ipVer)
{
//static list of blacklisted groups
//if we fail to join a group, its blacklisted
@@ -140,6 +162,7 @@ void SoapySSDPEndpoint::spawnHandler(const std::string &bindAddr, const std::str
}
auto data = new SoapySSDPEndpointData();
+ data->ipVer = ipVer;
auto &sock = data->sock;
const auto groupURL = SoapyURL("udp", groupAddr, SSDP_UDP_PORT_NUMBER).toString();
@@ -199,12 +222,12 @@ void SoapySSDPEndpoint::handlerLoop(SoapySSDPEndpointData *data)
const auto triggerExpired = timeNow + std::chrono::seconds(TRIGGER_TIMEOUT_SECONDS);
//remove old cache entries
- auto it = usnToURL.begin();
- while (it != usnToURL.end())
+ auto it = data->usnToURL.begin();
+ while (it != data->usnToURL.end())
{
auto &expires = it->second.second;
if (expires > timeNow) ++it;
- else usnToURL.erase(it++);
+ else data->usnToURL.erase(it++);
}
//check trigger for periodic search
@@ -334,7 +357,7 @@ void SoapySSDPEndpoint::handleNotifyRequest(SoapySSDPEndpointData *data, const S
this->handleRegisterService(data, header, recvAddr);
}
-void SoapySSDPEndpoint::handleRegisterService(SoapySSDPEndpointData *, const SoapyHTTPHeader &header, const std::string &recvAddr)
+void SoapySSDPEndpoint::handleRegisterService(SoapySSDPEndpointData *data, const SoapyHTTPHeader &header, const std::string &recvAddr)
{
//extract usn
const auto usn = header.getField("USN");
@@ -343,7 +366,7 @@ void SoapySSDPEndpoint::handleRegisterService(SoapySSDPEndpointData *, const Soa
//handle byebye from notification packets
if (header.getField("NTS") == NTS_BYEBYE)
{
- usnToURL.erase(usn);
+ data->usnToURL.erase(usn);
return;
}
@@ -355,5 +378,5 @@ void SoapySSDPEndpoint::handleRegisterService(SoapySSDPEndpointData *, const Soa
//register the server
const auto expires = std::chrono::high_resolution_clock::now() + std::chrono::seconds(getCacheDuration(header));
- usnToURL[usn] = std::make_pair(serverURL.toString(), expires);
+ data->usnToURL[usn] = std::make_pair(serverURL.toString(), expires);
}
diff --git a/common/SoapySSDPEndpoint.hpp b/common/SoapySSDPEndpoint.hpp
index 0203111..f600003 100644
--- a/common/SoapySSDPEndpoint.hpp
+++ b/common/SoapySSDPEndpoint.hpp
@@ -1,12 +1,10 @@
-// Copyright (c) 2015-2015 Josh Blum
+// Copyright (c) 2015-2016 Josh Blum
// SPDX-License-Identifier: BSL-1.0
#pragma once
#include "SoapyRPCSocket.hpp"
-#include <map>
#include <string>
#include <csignal> //sig_atomic_t
-#include <chrono>
#include <mutex>
#include <vector>
#include <memory>
@@ -48,8 +46,18 @@ public:
*/
void enablePeriodicNotify(const bool enable);
- //! Get a list of all active server URLs
- std::vector<std::string> getServerURLs(void);
+ /*!
+ * Get a list of all active server URLs.
+ *
+ * The same endpoint can be discovered under both IPv4 and IPv6.
+ * When 'only' is false, the ipVer specifies the IP version preference
+ * when both are discovered but will fallback to the other version.
+ * But when 'only' is true, only addresses of the ipVer type are used.
+ *
+ * \param ipVer the preferred IP version to discover (6 or 4)
+ * \param only true to ignore other discovered IP versions
+ */
+ std::vector<std::string> getServerURLs(const int ipVer = 4, const bool only = false);
private:
SoapySocketSession sess;
@@ -57,9 +65,6 @@ private:
//protection between threads
std::mutex mutex;
- //discovered services
- std::map<std::string, std::pair<std::string, std::chrono::high_resolution_clock::time_point>> usnToURL;
-
//service settings
bool serviceRegistered;
std::string uuid;
@@ -75,7 +80,7 @@ private:
//signal done to the thread
sig_atomic_t done;
- void spawnHandler(const std::string &bindAddr, const std::string &groupAddr);
+ void spawnHandler(const std::string &bindAddr, const std::string &groupAddr, const int ipVer);
void handlerLoop(SoapySSDPEndpointData *data);
void sendHeader(SoapyRPCSocket &sock, const SoapyHTTPHeader &header, const std::string &addr);
void sendSearchHeader(SoapySSDPEndpointData *data);
diff --git a/debian/changelog b/debian/changelog
index c46379c..0f49d24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+soapyremote (0.3.2) unstable; urgency=low
+
+ * Release 0.3.2 (2016-12-04)
+
+ -- Josh Blum <josh at pothosware.com> Sun, 04 Dec 2016 18:14:54 -0800
+
soapyremote (0.3.1) unstable; urgency=low
* Release 0.3.1 (2016-09-01)
diff --git a/debian/soapysdr-server.install b/debian/soapysdr-server.install
index c703cf8..ef04224 100644
--- a/debian/soapysdr-server.install
+++ b/debian/soapysdr-server.install
@@ -1 +1,3 @@
usr/bin/
+usr/lib/systemd/
+usr/lib/sysctl.d/
diff --git a/debian/soapysdr-server.manpages b/debian/soapysdr-server.manpages
new file mode 100644
index 0000000..5bd4606
--- /dev/null
+++ b/debian/soapysdr-server.manpages
@@ -0,0 +1 @@
+server/SoapySDRServer.1
diff --git a/debian/soapysdr-server.postinst b/debian/soapysdr-server.postinst
new file mode 100644
index 0000000..7b86d01
--- /dev/null
+++ b/debian/soapysdr-server.postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "configure" ]; then
+ #Load the new sysctl limits so they are immediately usable.
+ #Otherwise, the limits will be always loaded at boot time.
+ if [ -x "`which sysctl 2>/dev/null`" ]; then
+ sysctl --load /usr/lib/sysctl.d/SoapySDRServer.conf
+ fi
+fi
+
+#DEBHELPER#
diff --git a/debian/soapysdr-server.prerm b/debian/soapysdr-server.prerm
new file mode 100644
index 0000000..8028023
--- /dev/null
+++ b/debian/soapysdr-server.prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "remove" ]; then
+ systemctl stop SoapySDRServer
+ systemctl disable SoapySDRServer
+fi
+
+#DEBHELPER#
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 4ad4bcd..9d98594 100644
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -34,3 +34,6 @@ include_directories(${SoapySDR_INCLUDE_DIRS})
add_executable(SoapySDRServer ${SOAPY_SERVER_SOURCES})
target_link_libraries(SoapySDRServer ${SoapySDR_LIBRARIES} SoapySDRRemoteCommon)
install(TARGETS SoapySDRServer DESTINATION bin)
+
+#install man pages for the application executable
+install(FILES SoapySDRServer.1 DESTINATION share/man/man1)
diff --git a/server/SoapySDRServer.1 b/server/SoapySDRServer.1
new file mode 100644
index 0000000..66cbcb1
--- /dev/null
+++ b/server/SoapySDRServer.1
@@ -0,0 +1,47 @@
+.\" SoapySDRServer.1 - manpage for SoapySDRServer
+.\"
+.\"
+.TH SOAPYSDRSERVER 1 2016\-10\-28 "SoapyRemote 0.3.2"
+.SH NAME
+\fBSoapySDRServer\fR \- provide access to local SoapySDR devices over network
+.\" ----------------------------------------------------------------------------
+.SH SYNOPSIS
+\fBSoapySDRServer\fR [\fIOPTIONS\fR]
+.\" ----------------------------------------------------------------------------
+.SH DESCRIPTION
+SoapySDRServer is a server that exports all locally available SoapySDR devices
+over the network.
+On the other side, a SoapyRemote module for SoapySDR connects to this server and
+provides the server's modules locally.
+.\" ----------------------------------------------------------------------------
+.SH OPTIONS
+.TP
+\fB\-\-bind\fR[=\fIIP\fR[:\fIPORT\fR]]
+Run server.
+If an \fIIP\fR argument is not given, bind to the default port 55132 on all
+local network addresses.
+\fIIP\fR is the IPv4 or IPv6 address to bind to.
+If the either of the special values "0.0.0.0" or "[::]" for \fIIP\fR is given
+it will bind to all local addresses.
+\fIPORT\fR is an optional port number to use instead of the default.
+.TP
+\fB\-\-help\fR
+Display help and exit.
+.\" ----------------------------------------------------------------------------
+.SH HOMEPAGE
+SoapySDRServer is part of the
+.UR https://github.com/pothosware/SoapyRemote/wiki
+SoapyRemote project
+.UE .
+.\" ----------------------------------------------------------------------------
+.SH AUTHORS
+The SoapyRemote client and server were written mostly by
+.MT josh at pothosware.com
+Josh Blum
+.ME
+with additional contributions from Bastille Networks.
+.\"
+.\"This man page was originally written for the Debian project by
+.\".MT aeb at debian.org
+.\"Andreas Bombe
+.\".ME .
diff --git a/system/CMakeLists.txt b/system/CMakeLists.txt
new file mode 100644
index 0000000..707304f
--- /dev/null
+++ b/system/CMakeLists.txt
@@ -0,0 +1,19 @@
+########################################################################
+# SoapySDRServer systemd service
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/SoapySDRServer.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/SoapySDRServer.service
+ at ONLY)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/SoapySDRServer.service
+ DESTINATION lib/systemd/system)
+
+########################################################################
+# Increase the sysctl network limits
+########################################################################
+install(
+ FILES SoapySDRServer.sysctl
+ RENAME SoapySDRServer.conf
+ DESTINATION lib/sysctl.d)
diff --git a/system/SoapySDRServer.service.in b/system/SoapySDRServer.service.in
new file mode 100644
index 0000000..a1dcb02
--- /dev/null
+++ b/system/SoapySDRServer.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=SoapyRemote network server
+
+[Service]
+ExecStart=@CMAKE_INSTALL_PREFIX@/bin/SoapySDRServer --bind
+KillMode=process
+Restart=on-abnormal
+
+[Install]
+WantedBy=multi-user.target
diff --git a/system/SoapySDRServer.sysctl b/system/SoapySDRServer.sysctl
new file mode 100644
index 0000000..2416c2b
--- /dev/null
+++ b/system/SoapySDRServer.sysctl
@@ -0,0 +1,4 @@
+#SoapyRemote: Increase the default socket buffer sizes
+#to fit the default size requested for client and server.
+net.core.rmem_max=104857600
+net.core.wmem_max=104857600
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/soapyremote.git
More information about the pkg-hamradio-commits
mailing list