diff --git a/include/certstore.h b/include/certstore.h index 6a608efbabd76102e2e4ab1683fdc92c0648ef0c..06b5dc1ae290bc51c0c9ffa6189f1069dec9bd76 100644 --- a/include/certstore.h +++ b/include/certstore.h @@ -40,7 +40,7 @@ class Logger; } } -namespace jami { +namespace dhtnet { using Logger = dht::log::Logger; namespace tls { diff --git a/include/connectionmanager.h b/include/connectionmanager.h index 5d2db509ce9747959025d080b2124b791c2ece98..38cd9635bf65a76a7a72be7b5f41669ce62299c1 100644 --- a/include/connectionmanager.h +++ b/include/connectionmanager.h @@ -30,7 +30,7 @@ #include <vector> #include <string> -namespace jami { +namespace dhtnet { class ChannelSocket; class ConnectionManager; @@ -253,7 +253,7 @@ struct ConnectionManager::Config * UPnP IGD controller and the mutex to access it */ bool upnpEnabled; - std::shared_ptr<jami::upnp::Controller> upnpCtrl; + std::shared_ptr<dhtnet::upnp::Controller> upnpCtrl; std::shared_ptr<dht::log::Logger> logger; diff --git a/include/diffie-hellman.h b/include/diffie-hellman.h index e7f8429d01143307039c33eb114d2d294232e93f..56fc06422250039208f76dc54ddee52646e94abe 100644 --- a/include/diffie-hellman.h +++ b/include/diffie-hellman.h @@ -28,7 +28,7 @@ #include <cstdint> #include <string> -namespace jami { +namespace dhtnet { namespace tls { class DhParams diff --git a/include/fileutils.h b/include/fileutils.h index 6264af6c083003a99223cd43cdb950297b7bd432..c2dcdc9f1f9b76602703a4cc9450251345e6543f 100644 --- a/include/fileutils.h +++ b/include/fileutils.h @@ -39,7 +39,7 @@ #define DIR_SEPARATOR_STR_ESC "//*" // Escaped directory separator string #endif -namespace jami { +namespace dhtnet { namespace fileutils { /** diff --git a/include/generic_io.h b/include/generic_io.h index cd8d0e9fbd8d1dfa46b40f7bfd0102ac451ff637..db0ce33c7863434bdee18fa18eaa30744f960e95 100644 --- a/include/generic_io.h +++ b/include/generic_io.h @@ -29,7 +29,7 @@ using ssize_t = SSIZE_T; #endif -namespace jami { +namespace dhtnet { template<typename T> class GenericSocket diff --git a/include/ice_options.h b/include/ice_options.h index e7aee6d1cd5fa478f53fee6018bb0a7d7a55be05..1bdc760148132fee1a43b6f7b43b163e2e0b2b0d 100644 --- a/include/ice_options.h +++ b/include/ice_options.h @@ -6,7 +6,7 @@ #include "ip_utils.h" -namespace jami { +namespace dhtnet { namespace upnp { class UPnPContext; diff --git a/include/ice_transport.h b/include/ice_transport.h index 2615939b149516c0d53e024df3406d3f7459e4de..8fc447d0f96a2bdf48553ad4f9e21ada7908e3f5 100644 --- a/include/ice_transport.h +++ b/include/ice_transport.h @@ -38,7 +38,7 @@ class Logger; } } -namespace jami { +namespace dhtnet { using Logger = dht::log::Logger; diff --git a/include/ip_utils.h b/include/ip_utils.h index c720aa1d789ef8376d4401d66c891d97696d0299..f37e80a29bb8f8e48c044c06511578ad4934d9a1 100644 --- a/include/ip_utils.h +++ b/include/ip_utils.h @@ -59,7 +59,7 @@ extern "C" { #define INVALID_SOCKET (-1) -namespace jami { +namespace dhtnet { /** * Binary representation of an IP address. diff --git a/include/multiplexed_socket.h b/include/multiplexed_socket.h index 9e254bb61372b077ca226e9e1897d364c8a2b8a0..23c1ba12a6b8453172c57e158875d16d7c24b106 100644 --- a/include/multiplexed_socket.h +++ b/include/multiplexed_socket.h @@ -34,7 +34,7 @@ class Logger; } } -namespace jami { +namespace dhtnet { using Logger = dht::log::Logger; class IceTransport; @@ -358,4 +358,4 @@ private: } // namespace jami -MSGPACK_ADD_ENUM(jami::ChannelRequestState); +MSGPACK_ADD_ENUM(dhtnet::ChannelRequestState); diff --git a/include/string_utils.h b/include/string_utils.h index 75661a298448d5eac8f8e6b631a72cc125b5d0a9..5d7e2ebf0121bdf8a8d89afd5c9d9e2eef3aa0aa 100644 --- a/include/string_utils.h +++ b/include/string_utils.h @@ -34,7 +34,7 @@ #include <WTypes.h> #endif -namespace jami { +namespace dhtnet { constexpr static const char TRUE_STR[] = "true"; constexpr static const char FALSE_STR[] = "false"; @@ -183,12 +183,12 @@ namespace std { inline string operator+(const string& s, const string_view& sv) { - return jami::concat(s, sv); + return dhtnet::concat(s, sv); } inline string operator+(const string_view& sv, const string& s) { - return jami::concat(sv, s); + return dhtnet::concat(sv, s); } using svmatch = match_results<string_view::const_iterator>; using svsub_match = sub_match<string_view::const_iterator>; diff --git a/include/tls_session.h b/include/tls_session.h index 4a4b994d5d9af613f477b87030f4db25d03783e8..19db4fc47675be45b75f2dc467ecc384e18aa312 100644 --- a/include/tls_session.h +++ b/include/tls_session.h @@ -46,7 +46,7 @@ struct PrivateKey; } // namespace crypto } // namespace dht -namespace jami { +namespace dhtnet { namespace tls { enum class TlsSessionState { diff --git a/include/upnp/mapping.h b/include/upnp/mapping.h index a781022d5c07cbed4943ffb925fb91ebed07e565..ebcbdaa6b090b65faf4853dced6ca65a9c67340b 100644 --- a/include/upnp/mapping.h +++ b/include/upnp/mapping.h @@ -30,7 +30,7 @@ #include <mutex> #include <memory> -namespace jami { +namespace dhtnet { namespace upnp { using sys_clock = std::chrono::system_clock; diff --git a/include/upnp/upnp_context.h b/include/upnp/upnp_context.h index b9a5d266e8615497480b4a1b4b689adf839cabf7..57b45d6f679d20a6c48825f7f1129e8fb1177f50 100644 --- a/include/upnp/upnp_context.h +++ b/include/upnp/upnp_context.h @@ -56,11 +56,11 @@ using random_device = dht::crypto::random_device; using IgdFoundCallback = std::function<void()>; -namespace jami { +namespace dhtnet { class IpAddr; } -namespace jami { +namespace dhtnet { namespace upnp { class UPnPProtocol; diff --git a/include/upnp/upnp_control.h b/include/upnp/upnp_control.h index e68cada394950dcebb6462308439f98e4b679862..c9949b4a1f4379f032f76ff2cdec4005648d10ae 100644 --- a/include/upnp/upnp_control.h +++ b/include/upnp/upnp_control.h @@ -28,11 +28,11 @@ #include <memory> #include <chrono> -namespace jami { +namespace dhtnet { class IpAddr; } -namespace jami { +namespace dhtnet { namespace upnp { class UPnPContext; diff --git a/include/upnp/upnp_thread_util.h b/include/upnp/upnp_thread_util.h index 6bc5271339a0cdff9061cf154f5f6f36b3b6a9b8..564a6ebd23912722d031fed7e207c74dc53078a5 100644 --- a/include/upnp/upnp_thread_util.h +++ b/include/upnp/upnp_thread_util.h @@ -13,7 +13,7 @@ /*JAMI_ERR() << "The calling thread " << getCurrentThread() \ << " is not the expected thread: " << threadId_;*/ -namespace jami { +namespace dhtnet { namespace upnp { class UpnpThreadUtil diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp index f60b7d2e0087cc95e6d933d1f70fbafab758c64e..87fcae297ac2de30916fd08512e848d1ac84fbb3 100644 --- a/src/connectionmanager.cpp +++ b/src/connectionmanager.cpp @@ -37,12 +37,12 @@ #include <charconv> #include <fstream> -namespace jami { +namespace dhtnet { static constexpr std::chrono::seconds DHT_MSG_TIMEOUT {30}; static constexpr uint64_t ID_MAX_VAL = 9007199254740992; using ValueIdDist = std::uniform_int_distribution<dht::Value::Id>; -using CallbackId = std::pair<jami::DeviceId, dht::Value::Id>; +using CallbackId = std::pair<dhtnet::DeviceId, dht::Value::Id>; struct ConnectionInfo { diff --git a/src/fileutils.cpp b/src/fileutils.cpp index f3633eddb459730162495679db8084d4b258244c..10679636b4d767b121cd6a78f3ae73bbaad9a108 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -83,7 +83,7 @@ #define PIDFILE ".ring.pid" #define ERASE_BLOCK 4096 -namespace jami { +namespace dhtnet { namespace fileutils { // returns true if directory exists @@ -169,10 +169,10 @@ isFile(const std::string& path, bool resolveSymlink) #ifdef _WIN32 if (resolveSymlink) { struct _stat64i32 s; - if (_wstat(jami::to_wstring(path).c_str(), &s) == 0) + if (_wstat(dhtnet::to_wstring(path).c_str(), &s) == 0) return S_ISREG(s.st_mode); } else { - DWORD attr = GetFileAttributes(jami::to_wstring(path).c_str()); + DWORD attr = GetFileAttributes(dhtnet::to_wstring(path).c_str()); if ((attr != INVALID_FILE_ATTRIBUTES) && !(attr & FILE_ATTRIBUTE_DIRECTORY) && !(attr & FILE_ATTRIBUTE_REPARSE_POINT)) return true; @@ -226,7 +226,7 @@ isSymLink(const std::string& path) if (lstat(path.c_str(), &s) == 0) return S_ISLNK(s.st_mode); #elif !defined(_MSC_VER) - DWORD attr = GetFileAttributes(jami::to_wstring(path).c_str()); + DWORD attr = GetFileAttributes(dhtnet::to_wstring(path).c_str()); if (attr & FILE_ATTRIBUTE_REPARSE_POINT) return true; #endif @@ -251,13 +251,13 @@ writeTime(const std::string& path) ext_params.dwSecurityQosFlags = SECURITY_ANONYMOUS; ext_params.lpSecurityAttributes = nullptr; ext_params.hTemplateFile = nullptr; - HANDLE h = CreateFile2(jami::to_wstring(path).c_str(), + HANDLE h = CreateFile2(dhtnet::to_wstring(path).c_str(), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &ext_params); #elif _WIN32 - HANDLE h = CreateFileW(jami::to_wstring(path).c_str(), + HANDLE h = CreateFileW(dhtnet::to_wstring(path).c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, @@ -571,14 +571,14 @@ recursive_mkdir(const std::string& path, mode_t mode) #ifndef _WIN32 if (mkdir(path.data(), mode) != 0) { #else - if (_wmkdir(jami::to_wstring(path.data()).c_str()) != 0) { + if (_wmkdir(dhtnet::to_wstring(path.data()).c_str()) != 0) { #endif if (errno == ENOENT) { recursive_mkdir(path.substr(0, path.find_last_of(DIR_SEPARATOR_CH)), mode); #ifndef _WIN32 if (mkdir(path.data(), mode) != 0) { #else - if (_wmkdir(jami::to_wstring(path.data()).c_str()) != 0) { + if (_wmkdir(dhtnet::to_wstring(path.data()).c_str()) != 0) { #endif //JAMI_ERR("Could not create directory."); return false; @@ -712,7 +712,7 @@ remove(const std::string& path, bool erase) #ifdef _WIN32 // use Win32 api since std::remove will not unlink directory in use if (isDirectory(path)) - return !RemoveDirectory(jami::to_wstring(path).c_str()); + return !RemoveDirectory(dhtnet::to_wstring(path).c_str()); #endif return std::remove(path.c_str()); @@ -737,7 +737,7 @@ void openStream(std::ifstream& file, const std::string& path, std::ios_base::openmode mode) { #ifdef _WIN32 - file.open(jami::to_wstring(path), mode); + file.open(dhtnet::to_wstring(path), mode); #else file.open(path, mode); #endif @@ -747,7 +747,7 @@ void openStream(std::ofstream& file, const std::string& path, std::ios_base::openmode mode) { #ifdef _WIN32 - file.open(jami::to_wstring(path), mode); + file.open(dhtnet::to_wstring(path), mode); #else file.open(path, mode); #endif @@ -757,7 +757,7 @@ std::ifstream ifstream(const std::string& path, std::ios_base::openmode mode) { #ifdef _WIN32 - return std::ifstream(jami::to_wstring(path), mode); + return std::ifstream(dhtnet::to_wstring(path), mode); #else return std::ifstream(path, mode); #endif @@ -767,7 +767,7 @@ std::ofstream ofstream(const std::string& path, std::ios_base::openmode mode) { #ifdef _WIN32 - return std::ofstream(jami::to_wstring(path), mode); + return std::ofstream(dhtnet::to_wstring(path), mode); #else return std::ofstream(path, mode); #endif @@ -845,7 +845,7 @@ int accessFile(const std::string& file, int mode) { #ifdef _WIN32 - return _waccess(jami::to_wstring(file).c_str(), mode); + return _waccess(dhtnet::to_wstring(file).c_str(), mode); #else return access(file.c_str(), mode); #endif diff --git a/src/ice_socket.h b/src/ice_socket.h index 795185de0ae8fc70634a7f1d5dc5b2bc2e16802d..5692a7cec10ba3edb85954b663613bc1dcb013f7 100644 --- a/src/ice_socket.h +++ b/src/ice_socket.h @@ -29,7 +29,7 @@ using ssize_t = SSIZE_T; #endif -namespace jami { +namespace dhtnet { class IceTransport; using IceRecvCb = std::function<ssize_t(unsigned char* buf, size_t len)>; diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp index 1271649eb7b5a7d402d859d9ac5b31179bcb9d79..b47353be4013eaf8cfaaf0cb33f6c1ca961df578 100644 --- a/src/ice_transport.cpp +++ b/src/ice_transport.cpp @@ -61,7 +61,7 @@ throw std::runtime_error("Invalid component ID " + (std::to_string(compId))); \ } while (0) -namespace jami { +namespace dhtnet { static constexpr unsigned STUN_MAX_PACKET_SIZE {8192}; static constexpr uint16_t IPV6_HEADER_SIZE = 40; ///< Size in bytes of IPV6 packet header @@ -1766,7 +1766,7 @@ IceTransport::parseIceCandidates(std::string_view sdp_msg) ICESDP res; int nr = 0; - for (std::string_view line; jami::getline(sdp_msg, line); nr++) { + for (std::string_view line; dhtnet::getline(sdp_msg, line); nr++) { if (nr == 0) { res.rem_ufrag = line; } else if (nr == 1) { diff --git a/src/ice_transport_factory.h b/src/ice_transport_factory.h index 97a219466ae7cc8d02534107e5273fdfa0fbe2c5..0292192e78ce6875b233035d0c608e6bdded98eb 100644 --- a/src/ice_transport_factory.h +++ b/src/ice_transport_factory.h @@ -31,7 +31,7 @@ #include <memory> #include <vector> -namespace jami { +namespace dhtnet { class IceTransportFactory { diff --git a/src/ip_utils.cpp b/src/ip_utils.cpp index 0b2ded500c4750b766f4666e2a11bbce49b2bed7..2d8f098ae032593f9e79e4aa2a0b9b68b6a7c8cc 100644 --- a/src/ip_utils.cpp +++ b/src/ip_utils.cpp @@ -50,7 +50,7 @@ WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pA #endif #endif -namespace jami { +namespace dhtnet { std::string_view sip_strerror(pj_status_t code) diff --git a/src/multiplexed_socket.cpp b/src/multiplexed_socket.cpp index dd6c298354e41560f262f1115a7e6a8b0b05bbec..faf680e695b0df4545b7064547add0715405881c 100644 --- a/src/multiplexed_socket.cpp +++ b/src/multiplexed_socket.cpp @@ -51,7 +51,7 @@ struct VersionMsg MSGPACK_DEFINE_MAP(v) }; -namespace jami { +namespace dhtnet { using clock = std::chrono::steady_clock; using time_point = clock::time_point; diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 0b4ede53c06b0a329677556cb98d1df3f332c90b..8b6b8a98ad1a81f39507359767061588b5214046 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -49,7 +49,7 @@ static constexpr int ICE_COMP_ID_SIP_TRANSPORT {1}; -namespace jami { +namespace dhtnet { int init_crt(gnutls_session_t session, dht::crypto::Certificate& crt) diff --git a/src/peer_connection.h b/src/peer_connection.h index 3798f0c395b7594a6175638f4c4dbb788d4040f2..484562a6486823efccd6303f14be127dd7a25fab 100644 --- a/src/peer_connection.h +++ b/src/peer_connection.h @@ -43,7 +43,7 @@ struct Certificate; } // namespace crypto } // namespace dht -namespace jami { +namespace dhtnet { namespace tls { class DhParams; } diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp index acaa07d57b96604b9b262ae8e6ac3c007024a190..f9876ef2390e8cddd3eab28293884d4bcffd589d 100644 --- a/src/security/certstore.cpp +++ b/src/security/certstore.cpp @@ -33,7 +33,7 @@ #include <sstream> #include <fmt/format.h> -namespace jami { +namespace dhtnet { namespace tls { CertificateStore::CertificateStore(const std::string& path, std::shared_ptr<Logger> logger) @@ -290,7 +290,7 @@ CertificateStore::pinCertificatePath(const std::string& path, if (logger_) logger_->d("CertificateStore: loaded %zu certificates from %s.", certs.size(), path.c_str()); if (cb) cb(ids); - //emitSignal<libjami::ConfigurationSignal::CertificatePathPinned>(path, ids); + //emitSignal<libdhtnet::ConfigurationSignal::CertificatePathPinned>(path, ids); }); } @@ -363,7 +363,7 @@ CertificateStore::pinCertificate(const std::shared_ptr<crypto::Certificate>& cer } } //for (const auto& id : ids) - // emitSignal<libjami::ConfigurationSignal::CertificatePinned>(id); + // emitSignal<libdhtnet::ConfigurationSignal::CertificatePinned>(id); return ids; } @@ -471,9 +471,9 @@ CertificateStore::pinOcspResponse(const dht::crypto::Certificate& cert) TrustStore::PermissionStatus TrustStore::statusFromStr(const char* str) { - if (!std::strcmp(str, libjami::Certificate::Status::ALLOWED)) + if (!std::strcmp(str, libdhtnet::Certificate::Status::ALLOWED)) return PermissionStatus::ALLOWED; - if (!std::strcmp(str, libjami::Certificate::Status::BANNED)) + if (!std::strcmp(str, libdhtnet::Certificate::Status::BANNED)) return PermissionStatus::BANNED; return PermissionStatus::UNDEFINED; } @@ -483,19 +483,19 @@ TrustStore::statusToStr(TrustStore::PermissionStatus s) { switch (s) { case PermissionStatus::ALLOWED: - return libjami::Certificate::Status::ALLOWED; + return libdhtnet::Certificate::Status::ALLOWED; case PermissionStatus::BANNED: - return libjami::Certificate::Status::BANNED; + return libdhtnet::Certificate::Status::BANNED; case PermissionStatus::UNDEFINED: default: - return libjami::Certificate::Status::UNDEFINED; + return libdhtnet::Certificate::Status::UNDEFINED; } } TrustStatus trustStatusFromStr(const char* str) { - if (!std::strcmp(str, libjami::Certificate::TrustStatus::TRUSTED)) + if (!std::strcmp(str, libdhtnet::Certificate::TrustStatus::TRUSTED)) return TrustStatus::TRUSTED; return TrustStatus::UNTRUSTED; } @@ -505,10 +505,10 @@ statusToStr(TrustStatus s) { switch (s) { case TrustStatus::TRUSTED: - return libjami::Certificate::TrustStatus::TRUSTED; + return libdhtnet::Certificate::TrustStatus::TRUSTED; case TrustStatus::UNTRUSTED: default: - return libjami::Certificate::TrustStatus::UNTRUSTED; + return libdhtnet::Certificate::TrustStatus::UNTRUSTED; } } diff --git a/src/security/diffie-hellman.cpp b/src/security/diffie-hellman.cpp index dfe1d75fdf0bfb791f2261fe928ee7946c3dbfbc..450a7a0c55c3030c073327c183678ca030e34556 100644 --- a/src/security/diffie-hellman.cpp +++ b/src/security/diffie-hellman.cpp @@ -25,7 +25,7 @@ #include <chrono> #include <ciso646> -namespace jami { +namespace dhtnet { namespace tls { DhParams::DhParams(const std::vector<uint8_t>& data) diff --git a/src/security/security_const.h b/src/security/security_const.h index fb9541ba9c7ae46223db770c988ceec8eee3f740..0160e36b8e4156623aa1c5e01afdc576406a6871 100644 --- a/src/security/security_const.h +++ b/src/security/security_const.h @@ -19,7 +19,7 @@ */ #pragma once -namespace libjami { +namespace libdhtnet { namespace Certificate { @@ -118,4 +118,4 @@ constexpr static char TLS_PEER_CA_[] = "TLS_PEER_CA_"; constexpr static char TLS_CIPHER[] = "TLS_CIPHER"; } // namespace TlsTransport -} // namespace libjami +} // namespace libdhtnet diff --git a/src/security/threadloop.cpp b/src/security/threadloop.cpp index 88db725d241942625c7ff99dbf82bd065a41235b..5db493e70dd8b777d115f68fb7c5184b68737084 100644 --- a/src/security/threadloop.cpp +++ b/src/security/threadloop.cpp @@ -22,7 +22,7 @@ #include <ciso646> // fix windows compiler bug -namespace jami { +namespace dhtnet { void ThreadLoop::mainloop(std::thread::id& tid, diff --git a/src/security/threadloop.h b/src/security/threadloop.h index 8a7a0c6c2cd9cca9b4dda2f414717a28629e9b42..de4e475bf9802c743d516df2ac0087ec3cda4135 100644 --- a/src/security/threadloop.h +++ b/src/security/threadloop.h @@ -30,7 +30,7 @@ #include <opendht/logger.h> -namespace jami { +namespace dhtnet { struct ThreadLoopException : public std::runtime_error { diff --git a/src/security/tls_session.cpp b/src/security/tls_session.cpp index e84d277e6d16f28b3be0af869507a66a4474068d..94078a3e64475837af071c88d99a7f4f798c15ca 100644 --- a/src/security/tls_session.cpp +++ b/src/security/tls_session.cpp @@ -47,7 +47,7 @@ #include <cstdlib> #include <unistd.h> -namespace jami { +namespace dhtnet { namespace tls { static constexpr const char* DTLS_CERT_PRIORITY_STRING { diff --git a/src/sip_utils.h b/src/sip_utils.h index 6460b70943034fc861f6addd11c437ca1592256a..453344e87879f64ab8a7eb674ef1c29b62060b1a 100644 --- a/src/sip_utils.h +++ b/src/sip_utils.h @@ -33,7 +33,7 @@ #include <pjsip/sip_endpoint.h> #include <pjsip/sip_dialog.h> -namespace jami { +namespace dhtnet { namespace sip_utils { using namespace std::literals; diff --git a/src/string_utils.cpp b/src/string_utils.cpp index 934ff23500b863e84e891574e8bb31576a2bfacb..3ab43593a034682b7babbd9a382c2ec7b2b99dac 100644 --- a/src/string_utils.cpp +++ b/src/string_utils.cpp @@ -40,7 +40,7 @@ #include <ciso646> // fix windows compiler bug -namespace jami { +namespace dhtnet { #ifdef _WIN32 std::wstring diff --git a/src/transport/peer_channel.h b/src/transport/peer_channel.h index 5f25123b93d6c823cf4cbc6936338da82c70f8e3..a2a910f9ab1086cabe37bbfe01c670079376c828 100644 --- a/src/transport/peer_channel.h +++ b/src/transport/peer_channel.h @@ -23,7 +23,7 @@ #include <deque> #include <algorithm> -namespace jami { +namespace dhtnet { class PeerChannel { diff --git a/src/upnp/protocol/igd.cpp b/src/upnp/protocol/igd.cpp index 862e9083b1269635d21948d3a9e89c89156adf2b..e816fb896b91308d4268bb10689e3cdd1fb3c590 100644 --- a/src/upnp/protocol/igd.cpp +++ b/src/upnp/protocol/igd.cpp @@ -23,7 +23,7 @@ #include "igd.h" //#include "logger.h" -namespace jami { +namespace dhtnet { namespace upnp { IGD::IGD(NatProtocolType proto) diff --git a/src/upnp/protocol/igd.h b/src/upnp/protocol/igd.h index 4ed9ed31028f20a0863630749b491070ba2c3121..7e1d21128a30095ed15a15ff82f1369e052dc72d 100644 --- a/src/upnp/protocol/igd.h +++ b/src/upnp/protocol/igd.h @@ -30,7 +30,7 @@ typedef uint16_t in_port_t; #endif -namespace jami { +namespace dhtnet { namespace upnp { enum class NatProtocolType { UNKNOWN, PUPNP, NAT_PMP }; diff --git a/src/upnp/protocol/mapping.cpp b/src/upnp/protocol/mapping.cpp index bb09441df1f09d6f1e6f7d9717bc679c1075691d..9b285e9f12626073db8b09f1cf45840e2f7febc0 100644 --- a/src/upnp/protocol/mapping.cpp +++ b/src/upnp/protocol/mapping.cpp @@ -24,7 +24,7 @@ // #include "logger.h" #include "igd.h" -namespace jami { +namespace dhtnet { namespace upnp { Mapping::Mapping(PortType type, uint16_t portExternal, uint16_t portInternal, bool available) diff --git a/src/upnp/protocol/natpmp/nat_pmp.cpp b/src/upnp/protocol/natpmp/nat_pmp.cpp index 68dfee0aac748d54d383ed6c8b2a53f5cfcbfbef..8f04a19838691944de038dc4ac9af1d0933e78bd 100644 --- a/src/upnp/protocol/natpmp/nat_pmp.cpp +++ b/src/upnp/protocol/natpmp/nat_pmp.cpp @@ -23,7 +23,7 @@ #if HAVE_LIBNATPMP -namespace jami { +namespace dhtnet { namespace upnp { NatPmp::NatPmp() diff --git a/src/upnp/protocol/natpmp/nat_pmp.h b/src/upnp/protocol/natpmp/nat_pmp.h index 68fd28b14bf90900f00c4281dda9ea6063224c72..1ecf90ebd360777306790745c965521d395f9282 100644 --- a/src/upnp/protocol/natpmp/nat_pmp.h +++ b/src/upnp/protocol/natpmp/nat_pmp.h @@ -37,11 +37,11 @@ #include <atomic> #include <thread> -namespace jami { +namespace dhtnet { class IpAddr; } -namespace jami { +namespace dhtnet { namespace upnp { // Requested lifetime in seconds. The actual lifetime might be different. diff --git a/src/upnp/protocol/natpmp/pmp_igd.cpp b/src/upnp/protocol/natpmp/pmp_igd.cpp index ac8b698b755d629f8a9e1825557261776e3b43f5..41f25dd88cfa9134d00b01131e6ab1f528b667e1 100644 --- a/src/upnp/protocol/natpmp/pmp_igd.cpp +++ b/src/upnp/protocol/natpmp/pmp_igd.cpp @@ -24,7 +24,7 @@ #include <algorithm> -namespace jami { +namespace dhtnet { namespace upnp { PMPIGD::PMPIGD() diff --git a/src/upnp/protocol/natpmp/pmp_igd.h b/src/upnp/protocol/natpmp/pmp_igd.h index a70e7ee707e413b303d44e9e4ccd1b7209aa1b41..b6274624409a1e1ff2dfc6d160b2381b20184eaf 100644 --- a/src/upnp/protocol/natpmp/pmp_igd.h +++ b/src/upnp/protocol/natpmp/pmp_igd.h @@ -31,7 +31,7 @@ #include <chrono> #include <functional> -namespace jami { +namespace dhtnet { namespace upnp { class PMPIGD : public IGD diff --git a/src/upnp/protocol/pupnp/pupnp.cpp b/src/upnp/protocol/pupnp/pupnp.cpp index 6ea556332f30a90706427254b6f16caaeb1dd5d7..4df86211e5ff11861fff8aa1ce4cdba0fbf1e1f4 100644 --- a/src/upnp/protocol/pupnp/pupnp.cpp +++ b/src/upnp/protocol/pupnp/pupnp.cpp @@ -26,7 +26,7 @@ #include <opendht/thread_pool.h> #include <opendht/http.h> -namespace jami { +namespace dhtnet { namespace upnp { // Action identifiers. diff --git a/src/upnp/protocol/pupnp/pupnp.h b/src/upnp/protocol/pupnp/pupnp.h index a77f30ff672262326b2aec934193a7aebb7494c8..7c5939c63bbc37990c12a621ddcb28efcdcc1740 100644 --- a/src/upnp/protocol/pupnp/pupnp.h +++ b/src/upnp/protocol/pupnp/pupnp.h @@ -53,11 +53,11 @@ #include <memory> #include <future> -namespace jami { +namespace dhtnet { class IpAddr; } -namespace jami { +namespace dhtnet { namespace upnp { class PUPnP : public UPnPProtocol diff --git a/src/upnp/protocol/pupnp/upnp_igd.cpp b/src/upnp/protocol/pupnp/upnp_igd.cpp index 2f8a33241e76a7e5037aa589ff3a2a6383895bba..18be2d4ac7b1dde4d5172872692f0ca1e6d76f8c 100644 --- a/src/upnp/protocol/pupnp/upnp_igd.cpp +++ b/src/upnp/protocol/pupnp/upnp_igd.cpp @@ -22,7 +22,7 @@ #include "upnp_igd.h" -namespace jami { +namespace dhtnet { namespace upnp { UPnPIGD::UPnPIGD(std::string&& UDN, diff --git a/src/upnp/protocol/pupnp/upnp_igd.h b/src/upnp/protocol/pupnp/upnp_igd.h index 2ad213ba4caa90270fb2b570bc60b5985533931c..da6b40037416e0eb9a8323ac6eeea0e22f13a40a 100644 --- a/src/upnp/protocol/pupnp/upnp_igd.h +++ b/src/upnp/protocol/pupnp/upnp_igd.h @@ -32,7 +32,7 @@ #include <chrono> #include <functional> -namespace jami { +namespace dhtnet { namespace upnp { class UPnPIGD : public IGD diff --git a/src/upnp/protocol/upnp_protocol.h b/src/upnp/protocol/upnp_protocol.h index 048f385b866a096b5c36021676af5ab83c4a5155..9ab83395f7e6f717008eeac5d7003998d0d2c564 100644 --- a/src/upnp/protocol/upnp_protocol.h +++ b/src/upnp/protocol/upnp_protocol.h @@ -32,7 +32,7 @@ #include <condition_variable> #include <list> -namespace jami { +namespace dhtnet { namespace upnp { // UPnP device descriptions. diff --git a/src/upnp/upnp_context.cpp b/src/upnp/upnp_context.cpp index a36e56f9788133fdf44748d70619a1ddf807975e..35fdb50b26873a6ca8889d9c8e56809a4d39518a 100644 --- a/src/upnp/upnp_context.cpp +++ b/src/upnp/upnp_context.cpp @@ -26,7 +26,7 @@ #include <asio/steady_timer.hpp> #include <fmt/std.h> -namespace jami { +namespace dhtnet { namespace upnp { constexpr static auto MAP_UPDATE_INTERVAL = std::chrono::seconds(30); diff --git a/src/upnp/upnp_control.cpp b/src/upnp/upnp_control.cpp index bba37d31bfff9dfa3b90078c6affdcaa0fd3ba53..2c7f07afda8a7a64ebdda6ebf38b1c2111fe38df 100644 --- a/src/upnp/upnp_control.cpp +++ b/src/upnp/upnp_control.cpp @@ -23,7 +23,7 @@ #include "upnp/upnp_control.h" #include "upnp/upnp_context.h" -namespace jami { +namespace dhtnet { namespace upnp { Controller::Controller(const std::shared_ptr<UPnPContext>& ctx) diff --git a/tests/certstore.cpp b/tests/certstore.cpp index 7d6b75ff79d5f53d3001d9558854c4c5695c20f1..43967c68e0905ca081f83b31bf8862871f587c37 100644 --- a/tests/certstore.cpp +++ b/tests/certstore.cpp @@ -25,7 +25,7 @@ #include "test_runner.h" #include "certstore.h" -namespace jami { +namespace dhtnet { namespace test { class CertStoreTest : public CppUnit::TestFixture @@ -85,26 +85,26 @@ CertStoreTest::trustStoreTest() // Test certificate status auto certAllowed = aliceAccount->accountManager()->getCertificatesByStatus( - jami::tls::TrustStore::PermissionStatus::ALLOWED); + dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT( std::find_if(certAllowed.begin(), certAllowed.end(), [&](auto v) { return v == id; }) == certAllowed.end()); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(id) - == jami::tls::TrustStore::PermissionStatus::UNDEFINED); - aliceAccount->setCertificateStatus(ca.second, jami::tls::TrustStore::PermissionStatus::ALLOWED); + == dhtnet::tls::TrustStore::PermissionStatus::UNDEFINED); + aliceAccount->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); certAllowed = aliceAccount->accountManager()->getCertificatesByStatus( - jami::tls::TrustStore::PermissionStatus::ALLOWED); + dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT( std::find_if(certAllowed.begin(), certAllowed.end(), [&](auto v) { return v == id; }) != certAllowed.end()); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(id) - == jami::tls::TrustStore::PermissionStatus::ALLOWED); - aliceAccount->setCertificateStatus(ca.second, jami::tls::TrustStore::PermissionStatus::UNDEFINED); + == dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); + aliceAccount->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::UNDEFINED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(id) - == jami::tls::TrustStore::PermissionStatus::UNDEFINED); - aliceAccount->setCertificateStatus(ca.second, jami::tls::TrustStore::PermissionStatus::ALLOWED); + == dhtnet::tls::TrustStore::PermissionStatus::UNDEFINED); + aliceAccount->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(id) - == jami::tls::TrustStore::PermissionStatus::ALLOWED); + == dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); // Test getPinnedCertificates pinned = aliceAccount->certStore().getPinnedCertificates(); @@ -126,44 +126,44 @@ CertStoreTest::trustStoreTest() CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*device.second)); // Ban device - aliceAccount->setCertificateStatus(device.second, jami::tls::TrustStore::PermissionStatus::BANNED); + aliceAccount->setCertificateStatus(device.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(device.second->getId().toString()) - == jami::tls::TrustStore::PermissionStatus::BANNED); + == dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(id) - == jami::tls::TrustStore::PermissionStatus::ALLOWED); + == dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*ca.second)); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*account.second)); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*device.second)); // Ban account - aliceAccount->setCertificateStatus(account.second, jami::tls::TrustStore::PermissionStatus::BANNED); + aliceAccount->setCertificateStatus(account.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(account.second->getId().toString()) - == jami::tls::TrustStore::PermissionStatus::BANNED); + == dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*ca.second)); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*account.second)); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*device2.second)); // Unban account aliceAccount->setCertificateStatus(account.second, - jami::tls::TrustStore::PermissionStatus::ALLOWED); + dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(account.second->getId().toString()) - == jami::tls::TrustStore::PermissionStatus::ALLOWED); + == dhtnet::tls::TrustStore::PermissionStatus::ALLOWED); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*ca.second)); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*account.second)); CPPUNIT_ASSERT(aliceAccount->accountManager()->isAllowed(*device2.second)); // Ban CA - aliceAccount->setCertificateStatus(ca.second, jami::tls::TrustStore::PermissionStatus::BANNED); + aliceAccount->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(ca.second->getId().toString()) - == jami::tls::TrustStore::PermissionStatus::BANNED); + == dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*ca.second)); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*account.second)); CPPUNIT_ASSERT(not aliceAccount->accountManager()->isAllowed(*device2.second)); - aliceAccount->setCertificateStatus(ca.second, jami::tls::TrustStore::PermissionStatus::BANNED); + aliceAccount->setCertificateStatus(ca.second, dhtnet::tls::TrustStore::PermissionStatus::BANNED); CPPUNIT_ASSERT(aliceAccount->accountManager()->getCertificateStatus(ca.second->getId().toString()) - == jami::tls::TrustStore::PermissionStatus::BANNED); + == dhtnet::tls::TrustStore::PermissionStatus::BANNED); // Test unpin aliceAccount->certStore().unpinCertificate(id); @@ -172,11 +172,11 @@ CertStoreTest::trustStoreTest() == pinned.end()); // Test statusToStr - CPPUNIT_ASSERT(strcmp(jami::tls::statusToStr(jami::tls::TrustStatus::TRUSTED), - libjami::Certificate::TrustStatus::TRUSTED) + CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::TRUSTED), + libdhtnet::Certificate::TrustStatus::TRUSTED) == 0); - CPPUNIT_ASSERT(strcmp(jami::tls::statusToStr(jami::tls::TrustStatus::UNTRUSTED), - libjami::Certificate::TrustStatus::UNTRUSTED) + CPPUNIT_ASSERT(strcmp(dhtnet::tls::statusToStr(dhtnet::tls::TrustStatus::UNTRUSTED), + libdhtnet::Certificate::TrustStatus::UNTRUSTED) == 0);*/ } @@ -206,4 +206,4 @@ CertStoreTest::getCertificateWithSplitted() } // namespace test } // namespace jami -JAMI_TEST_RUNNER(jami::test::CertStoreTest::name()); +JAMI_TEST_RUNNER(dhtnet::test::CertStoreTest::name()); diff --git a/tests/connectionManager.cpp b/tests/connectionManager.cpp index 504f49f608e26c8edb63a1c23510a72a1ca04ba4..90321f84121fc397e318282ca899f4fa50c8277a 100644 --- a/tests/connectionManager.cpp +++ b/tests/connectionManager.cpp @@ -28,7 +28,7 @@ using namespace std::literals::chrono_literals; -namespace jami { +namespace dhtnet { namespace test { class ConnectionManagerTest : public CppUnit::TestFixture @@ -1274,4 +1274,4 @@ ConnectionManagerTest::testShutdownWhileNegotiating() } // namespace test } // namespace jami -JAMI_TEST_RUNNER(jami::test::ConnectionManagerTest::name()) +JAMI_TEST_RUNNER(dhtnet::test::ConnectionManagerTest::name()) diff --git a/tests/testFileutils.cpp b/tests/testFileutils.cpp index ba95e33d938aef1093037fe9192346b4afbbafda..34ca646de174d23109eb77d5ca83e456d354087b 100644 --- a/tests/testFileutils.cpp +++ b/tests/testFileutils.cpp @@ -29,7 +29,7 @@ #include <cstdlib> #include <unistd.h> -namespace jami { namespace fileutils { namespace test { +namespace dhtnet { namespace fileutils { namespace test { class FileutilsTest : public CppUnit::TestFixture { public: @@ -150,7 +150,7 @@ FileutilsTest::testIsDirectoryWritable() CPPUNIT_ASSERT(removeAll(NON_EXISTANT_PATH_BASE) == 0); } -}}} // namespace jami::test::fileutils +}}} // namespace dhtnet::test::fileutils -JAMI_TEST_RUNNER(jami::fileutils::test::FileutilsTest::name()); +JAMI_TEST_RUNNER(dhtnet::fileutils::test::FileutilsTest::name()); diff --git a/tests/testString_utils.cpp b/tests/testString_utils.cpp index ba4b163c237fd4eccb38170fd367751246b8cbe5..60c136379d1445f1a0330325bca36e05fdb5d437 100644 --- a/tests/testString_utils.cpp +++ b/tests/testString_utils.cpp @@ -29,7 +29,7 @@ using namespace std::literals; -namespace jami { +namespace dhtnet { namespace test { class StringUtilsTest : public CppUnit::TestFixture @@ -89,10 +89,10 @@ void StringUtilsTest::to_number_test() { // test with int - CPPUNIT_ASSERT(jami::stoi(PI_42) == INT); + CPPUNIT_ASSERT(dhtnet::stoi(PI_42) == INT); // test with double - CPPUNIT_ASSERT(jami::stod(PI_DOUBLE) == DOUBLE); + CPPUNIT_ASSERT(dhtnet::stod(PI_DOUBLE) == DOUBLE); } void @@ -111,7 +111,7 @@ StringUtilsTest::split_string_test() std::string_view line; split_string_result.clear(); - while (jami::getline(data, line, '*')) { + while (dhtnet::getline(data, line, '*')) { split_string_result.emplace_back(line); } CPPUNIT_ASSERT(split_string_result.size() == 2); @@ -122,4 +122,4 @@ StringUtilsTest::split_string_test() } // namespace test } // namespace jami -JAMI_TEST_RUNNER(jami::test::StringUtilsTest::name()); +JAMI_TEST_RUNNER(dhtnet::test::StringUtilsTest::name());