transport: use /run/nfd.sock on Linux
refs #5039 Change-Id: Ia81115676427db1ebdf4d72d9aadf2e34e2f0ae6
This commit is contained in:
1 parent
2349e28c6d
commit
52a803cb9d
5 files changed
+19
-22
No files matched your search
+4
-1
@@ -6,7 +6,10 @@
|
|||||||
; tcp://192.0.2.1
|
; tcp://192.0.2.1
|
||||||
; tcp4://example.com:6363
|
; tcp4://example.com:6363
|
||||||
;
|
;
|
||||||
transport=unix:///var/run/nfd.sock
|
; The default value of this field is platform-dependent, being unix:///run/nfd.sock on Linux and
|
||||||
|
; unix:///var/run/nfd.sock on other platforms.
|
||||||
|
;
|
||||||
|
;transport=unix:///var/run/nfd.sock
|
||||||
|
|
||||||
; "pib" determines which Public Info Base (PIB) should used by default in applications.
|
; "pib" determines which Public Info Base (PIB) should used by default in applications.
|
||||||
; If "pib" is not specified, a platform-dependent default will be used.
|
; If "pib" is not specified, a platform-dependent default will be used.
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ NFD
|
|||||||
---
|
---
|
||||||
|
|
||||||
transport
|
transport
|
||||||
FaceUri for default connection toward local NDN forwarder. Only ``unix`` and ``tcp4`` FaceUris
|
FaceUri for default connection toward local NDN forwarder. Only ``unix``, ``tcp``, ``tcp4``, and
|
||||||
can be specified here.
|
``tcp6`` FaceUris can be specified here.
|
||||||
|
|
||||||
By default, ``unix:///var/run/nfd.sock`` is used.
|
By default, ``unix:///run/nfd.sock`` is used on Linux and ``unix:///var/run/nfd.sock`` is used on
|
||||||
|
other platforms.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This value can be overridden using the ``NDN_CLIENT_TRANSPORT`` environment variable.
|
This value can be overridden using the ``NDN_CLIENT_TRANSPORT`` environment variable.
|
||||||
|
|||||||
@@ -100,9 +100,6 @@ Face::Face(shared_ptr<Transport> transport, boost::asio::io_service& ioService,
|
|||||||
shared_ptr<Transport>
|
shared_ptr<Transport>
|
||||||
Face::makeDefaultTransport()
|
Face::makeDefaultTransport()
|
||||||
{
|
{
|
||||||
// transport=unix:///var/run/nfd.sock
|
|
||||||
// transport=tcp://localhost:6363
|
|
||||||
|
|
||||||
std::string transportUri;
|
std::string transportUri;
|
||||||
|
|
||||||
const char* transportEnviron = getenv("NDN_CLIENT_TRANSPORT");
|
const char* transportEnviron = getenv("NDN_CLIENT_TRANSPORT");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2019 Regents of the University of California.
|
* Copyright (c) 2013-2020 Regents of the University of California.
|
||||||
*
|
*
|
||||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||||
*
|
*
|
||||||
@@ -42,7 +42,11 @@ std::string
|
|||||||
UnixTransport::getSocketNameFromUri(const std::string& uriString)
|
UnixTransport::getSocketNameFromUri(const std::string& uriString)
|
||||||
{
|
{
|
||||||
// Assume the default nfd.sock location.
|
// Assume the default nfd.sock location.
|
||||||
|
#ifdef __linux__
|
||||||
|
std::string path = "/run/nfd.sock";
|
||||||
|
#else
|
||||||
std::string path = "/var/run/nfd.sock";
|
std::string path = "/var/run/nfd.sock";
|
||||||
|
#endif // __linux__
|
||||||
|
|
||||||
if (uriString.empty()) {
|
if (uriString.empty()) {
|
||||||
return path;
|
return path;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2018 Regents of the University of California.
|
* Copyright (c) 2013-2020 Regents of the University of California.
|
||||||
*
|
*
|
||||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||||
*
|
*
|
||||||
@@ -32,27 +32,19 @@ BOOST_FIXTURE_TEST_SUITE(TestUnixTransport, TransportFixture)
|
|||||||
|
|
||||||
using ndn::Transport;
|
using ndn::Transport;
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameOk)
|
BOOST_AUTO_TEST_CASE(GetSocketNameFromUri)
|
||||||
{
|
{
|
||||||
BOOST_CHECK_EQUAL(UnixTransport::getSocketNameFromUri("unix:///tmp/test/nfd.sock"), "/tmp/test/nfd.sock");
|
BOOST_CHECK_EQUAL(UnixTransport::getSocketNameFromUri("unix:///tmp/test/nfd.sock"), "/tmp/test/nfd.sock");
|
||||||
}
|
#ifdef __linux__
|
||||||
|
BOOST_CHECK_EQUAL(UnixTransport::getSocketNameFromUri(""), "/run/nfd.sock");
|
||||||
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameOkOmittedSocketOmittedProtocol)
|
#else
|
||||||
{
|
|
||||||
BOOST_CHECK_EQUAL(UnixTransport::getSocketNameFromUri(""), "/var/run/nfd.sock");
|
BOOST_CHECK_EQUAL(UnixTransport::getSocketNameFromUri(""), "/var/run/nfd.sock");
|
||||||
}
|
#endif // __linux__
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameBadWrongTransport)
|
|
||||||
{
|
|
||||||
BOOST_CHECK_EXCEPTION(UnixTransport::getSocketNameFromUri("tcp://"),
|
BOOST_CHECK_EXCEPTION(UnixTransport::getSocketNameFromUri("tcp://"),
|
||||||
Transport::Error,
|
Transport::Error,
|
||||||
[] (const Transport::Error& error) {
|
[] (const Transport::Error& error) {
|
||||||
return error.what() == "Cannot create UnixTransport from \"tcp\" URI"s;
|
return error.what() == "Cannot create UnixTransport from \"tcp\" URI"s;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(GetDefaultSocketNameBadMalformedUri)
|
|
||||||
{
|
|
||||||
BOOST_CHECK_EXCEPTION(UnixTransport::getSocketNameFromUri("unix"),
|
BOOST_CHECK_EXCEPTION(UnixTransport::getSocketNameFromUri("unix"),
|
||||||
Transport::Error,
|
Transport::Error,
|
||||||
[] (const Transport::Error& error) {
|
[] (const Transport::Error& error) {
|
||||||
|
|||||||
Reference in new issue
Block a user